Explorar o código

答卷验证码优化

KeYuan %!s(int64=8) %!d(string=hai) anos
pai
achega
545b9649b7

+ 1 - 2
src/main/java/com/key/common/utils/ToHtmlServlet.java

@@ -29,13 +29,12 @@ public class ToHtmlServlet extends HttpServlet {
 		String url=request.getParameter("url");
 		String filePath=request.getParameter("filePath");
 		String fileName=request.getParameter("fileName");
-		System.out.println(url+":"+filePath+":"+fileName);
+//		System.out.println(url+":"+filePath+":"+fileName);
 		//url = "/design/my-survey-design!previewDev.action?surveyId=402880ea4675ac62014675ac7b3a0000";
 		// 这是生成的html文件名,如index.htm
 		filePath = filePath.replace("/", File.separator);
 		filePath = filePath.replace("\\", File.separator);
 		String fileRealPath = sc.getRealPath("/") +File.separator+ filePath;
-		System.out.println(fileRealPath);
 		RequestDispatcher rd = sc.getRequestDispatcher(url);
 		final ByteArrayOutputStream os = new ByteArrayOutputStream();
 

+ 4 - 0
src/main/java/com/key/dwsurvey/action/MySurveyAction.java

@@ -41,6 +41,10 @@ public class MySurveyAction extends CrudActionSupport<SurveyDirectory, String>{
 	@Override
 	public String list() throws Exception {
 		HttpServletRequest request=Struts2Utils.getRequest();
+		String surveyState = request.getParameter("surveyState");
+		if(surveyState==null||"".equals(surveyState)){
+			entity.setSurveyState(null);
+		}
 	    page=surveyDirectoryManager.findByUser(page,entity);
 	    return SUCCESS;
 	}

+ 25 - 3
src/main/webapp/WEB-INF/page/content/diaowen-design/answer-survey-mobile.jsp

@@ -251,7 +251,18 @@ $(document).ready(function(){
 									 		<span class="quTitleNum">${i.count }、</span>
 											<span class="quTitleText">${en.quTitle}</span>
 									 	</label>
-								     	<input id="qu_${en.quType }_${en.id }" type="text" name="qu_${en.quType }_${en.id }" class="fillblankInput" >
+
+										 <%--<input id="qu_${en.quType }_${en.id }" type="text" name="qu_${en.quType }_${en.id }" class="fillblankInput" >--%>
+
+										 <c:choose>
+											 <c:when test="${en.answerInputRow > 1 }">
+												 <textarea name="qu_${en.quType }_${en.id }" rows="${en.answerInputRow }" class="inputSytle_2 fillblankInput" ></textarea>
+											 </c:when>
+											 <c:otherwise>
+												 <input type="text" name="qu_${en.quType }_${en.id }" class="inputSytle_1 fillblankInput" >
+											 </c:otherwise>
+										 </c:choose>
+
 									 </div>
 								</div>
 							</div>
@@ -778,7 +789,7 @@ $(document).ready(function(){
 											<p class="valid-msg fail" style="display: none;"><i>●</i><span class="msg_content">验证码错误,请重新输入</span></p>
 										</div>
 									</div>
-									
+									<div class="errorItem" style="display: none;"><label for="" class="error">验证码错误,请重新输入!</label></div>
 									<%-- 验证码:<input type="text" size="8" name="jcaptchaInput">
 									&nbsp;<img id="jcaptchaImg" alt="点击刷新" src="${ctx }/jcaptcha.action"  align="top">
 									&nbsp;点击图片刷新 --%>
@@ -808,7 +819,7 @@ $(document).ready(function(){
   </div>
 
   <div data-role="footer">
-  	<h3><a href="${ctx }/index-m.jsp" style="text-decoration: none;" rel="external">调问网</a> 提供支持</h3>
+  	<h3><a href="http://diaowen.net/index-m.jsp" style="text-decoration: none;" rel="external">调问网</a> 提供支持</h3>
   </div>
 </div>
 
@@ -956,6 +967,17 @@ $(document).ready(function(){
 		if(firstError!=null){
 			$(window).scrollTop(firstError.offset().top);
 		}
+
+		if($("#jcaptchaImgBody").is(":visible")){
+			var jcaptchaInput = $("input[name='jcaptchaInput']").val();
+			if(jcaptchaInput===""){
+				$("#jcaptchaImgBody .errorItem").show();
+				result = false;
+			}else{
+				$("#jcaptchaImgBody .errorItem").hide();
+			}
+		}
+
 		return result;
 	}
 	

+ 12 - 2
src/main/webapp/WEB-INF/page/content/diaowen-design/answer-survey.jsp

@@ -379,6 +379,16 @@ $(document).ready(function(){
 		if(firstError!=null){
 			$(window).scrollTop(firstError.offset().top);
 		}
+		//
+		if($("#jcaptchaImgBody").is(":visible")){
+			var jcaptchaInput = $("input[name='jcaptchaInput']").val();
+			if(jcaptchaInput===""){
+				$("#jcaptchaImgBody .errorItem").show();
+				result = false;
+			}else{
+				$("#jcaptchaImgBody .errorItem").hide();
+			}
+		}
 		return result;
 	}
 	
@@ -1819,7 +1829,7 @@ label.error{
 											<p class="valid-msg fail" style="display: none;"><i>●</i><span class="msg_content">验证码错误,请重新输入</span></p>
 										</div>
 									</div>
-									
+									<div class="errorItem" style="display: none;"><label for="" class="error">验证码错误,请重新输入!</label></div>
 									<%-- 验证码:<input type="text" size="8" name="jcaptchaInput">
 									&nbsp;<img id="jcaptchaImg" alt="点击刷新" src="${ctx }/jcaptcha.action"  align="top">
 									&nbsp;点击图片刷新 --%>
@@ -1856,7 +1866,7 @@ label.error{
 </div>
 
 <div class="footer-copyright" style="color: gray;">
-		 <a href="http://www.diaowen.net" style="text-decoration: none;color: rgb(53, 117, 136);">调问网</a> 提供支持
+	<a href="http://www.diaowen.net" style="text-decoration: none;color: rgb(53, 117, 136);">调问网</a> 提供支持
 </div>
 		
 <div id="fixedMsg" style="position: fixed;top: 0px;width: 100%;padding: 10px;text-align: center;font-size: 18px;letter-spacing: 4px;line-height: 56px;background-color: #111;background-color: rgba(17,17,17,0.5);color: #fff;color: rgba(255,255,255,0.5);z-index: 200;display: none;"></div>