Browse Source

Merge remote-tracking branch 'origin/master'

lchao 6 months ago
parent
commit
a7f135c337

+ 14 - 27
src/main/java/com/sooka/module/web/cms/CertificateAuthController.java

@@ -1,17 +1,14 @@
 package com.sooka.module.web.cms;
 
 import com.github.pagehelper.PageInfo;
-import com.sooka.common.annotation.FormToken;
 import com.sooka.common.utils.ControllerUtil;
 import com.sooka.common.utils.JsonUtil;
 import com.sooka.common.utils.StrUtil;
 import com.sooka.module.web.cms.service.ContentService;
 import com.sooka.mybatis.model.TCmsContent;
 import com.sooka.mybatis.model.TCmsSite;
-import com.sooka.mybatis.model.TCmsUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
@@ -21,8 +18,6 @@ import javax.servlet.http.HttpServletRequest;
 import java.util.HashMap;
 import java.util.Map;
 
-import static com.sooka.common.constant.CmsConst.LOGIN_USER;
-
 @Controller
 @RequestMapping("/cms/certificate")
 public class CertificateAuthController {
@@ -31,40 +26,32 @@ public class CertificateAuthController {
     private ContentService contentService;
 
     @RequestMapping("/query")
-    public ModelAndView certificateAuth(HttpServletRequest request,
-            @RequestParam(value = "username",required = false) String username,
-            @RequestParam(value = "telephone",required = false) String telephone,
-            @RequestParam(value = "certificateType",required = false) String certificateType,
-            @RequestParam(value = "siteId", required=false) String siteId,
-            @RequestParam(value = "number",defaultValue = "1") Integer pageNumber){
-        ModelAndView modelAndView=new ModelAndView("www/tuiyijunren/list-zslb");
-        Map<String,Object>map=new HashMap<>();
-        map.put("title",username);
+    public ModelAndView certificateAuth(
+            @RequestParam(value = "username", required = false) String username,
+            @RequestParam(value = "telephone", required = false) String telephone,
+            @RequestParam(value = "certificateType", required = false) String certificateType,
+            @RequestParam(value = "siteId", required = false) String siteId,
+            @RequestParam(value = "number", defaultValue = "1") Integer pageNumber) {
+        ModelAndView modelAndView = new ModelAndView("www/tuiyijunren/list-zslb");
+        Map<String, Object> map = new HashMap<>();
+        map.put("title", username);
         map.put("telephone", telephone);
         map.put("siteId", siteId);
-        map.put("categoryId",certificateType);
+        map.put("categoryId", certificateType);
         PageInfo<TCmsContent> tCmsContentPageInfo = contentService.certificateQuery(pageNumber, map);
         TCmsSite site = new TCmsSite();
         site.setSiteId(Integer.parseInt(siteId));
 
-        TCmsUser user = (TCmsUser) request.getSession().getAttribute(LOGIN_USER);
-        if (user == null) {
-            modelAndView.addObject("btnId", "login");
-        } else {
-            modelAndView.addObject("btnId", "exit");
-            modelAndView.addObject("nickname", user.getNickname());
-        }
-
-        modelAndView.addObject("model",tCmsContentPageInfo);
-        modelAndView.addObject("siteId",siteId);
-        modelAndView.addObject("site",site);
+        modelAndView.addObject("model", tCmsContentPageInfo);
+        modelAndView.addObject("siteId", siteId);
+        modelAndView.addObject("site", site);
         modelAndView.addObject("categoryId", certificateType);
         return modelAndView;
     }
 
     @RequestMapping("/auth")
     @ResponseBody
-    public Map<String, Object> certificateAuth(HttpServletRequest request, @RequestParam(value = "verifyCode",required = false) String verifyCode) {
+    public Map<String, Object> certificateAuth(HttpServletRequest request, @RequestParam(value = "verifyCode", required = false) String verifyCode) {
         System.out.println("verifyCode = " + verifyCode);
         if (StrUtil.isBlank(verifyCode) || !ControllerUtil.validate(verifyCode, request)) {
             return JsonUtil.toMAP(false, "验证码输入错误");

+ 2 - 23
src/main/java/com/sooka/module/web/cms/IndexController.java

@@ -2,7 +2,6 @@ package com.sooka.module.web.cms;
 
 import com.github.pagehelper.PageInfo;
 import com.google.common.collect.Maps;
-import com.sooka.ServletInitializer;
 import com.sooka.common.constant.CmsConst;
 import com.sooka.common.exception.CmsException;
 import com.sooka.common.utils.*;
@@ -20,7 +19,6 @@ import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
-import tk.mybatis.mapper.util.StringUtil;
 
 import javax.servlet.http.HttpServletRequest;
 import java.io.*;
@@ -174,7 +172,7 @@ public class IndexController {
      */
     @GetMapping("/${system.site.prefix}/{siteId}")
     public String index(@PathVariable("siteId") Integer siteId,
-                        Model model,HttpServletRequest request){
+                        Model model){
         log.debug("通过站点Id访问网站首页[{}]",siteId);
         SimpleDateFormat formatYear = new SimpleDateFormat("yyyy");
         SimpleDateFormat format = new SimpleDateFormat("yyyy-M-d");
@@ -207,13 +205,6 @@ public class IndexController {
         model.addAttribute("description",site.getDescription());
         model.addAttribute("site",site);
         model.addAttribute("xwdtList",xwdtList);
-        TCmsUser user = (TCmsUser) request.getSession().getAttribute(LOGIN_USER);
-        if (user == null) {
-            model.addAttribute("btnId", "login");
-        } else {
-            model.addAttribute("btnId", "exit");
-            model.addAttribute("nickname", user.getNickname());
-        }
         if(StrUtil.isBlank(site.getTemplate())) {
             return view(CmsConst.INDEX_TPL);
         }
@@ -224,18 +215,13 @@ public class IndexController {
     @GetMapping("/${system.site.prefix}/{siteId}/{categoryId}")
     public String category(@PathVariable("siteId") Integer siteId,
                            @PathVariable("categoryId") Long categoryId,
-                           Model model, HttpServletRequest request){
+                           Model model){
         log.debug("栏目");
         TCmsSite site = siteService.findById(siteId);
         if(CmsUtil.isNullOrEmpty(site)) {
             throw new CmsException(CmsConst.SITE_NOT_FOUND);
         }
         TCmsCategory category = categoryService.findById(categoryId);
-        if (request.getSession().getAttribute(LOGIN_USER) == null) {
-            model.addAttribute("showState", false);
-        } else {
-            model.addAttribute("showState", true);
-        }
         if(CmsUtil.isNullOrEmpty(category)) {
             throw new CmsException(CmsConst.CATEGORY_NOT_FOUND);
         }
@@ -247,13 +233,6 @@ public class IndexController {
         model.addAttribute("site",site);
         model.addAttribute("category",category);
         model.addAttribute("page",page);
-        TCmsUser user = (TCmsUser) request.getSession().getAttribute(LOGIN_USER);
-        if (user == null) {
-            model.addAttribute("btnId", "login");
-        } else {
-            model.addAttribute("btnId", "exit");
-            model.addAttribute("nickname", user.getNickname());
-        }
         if(StrUtil.isBlank(site.getTemplate())) {
             return view(category.getIndexTpl());
         }

+ 17 - 0
src/main/java/com/sooka/module/web/cms/LoginController.java

@@ -12,8 +12,11 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
 import java.util.Map;
 
+import static com.sooka.common.constant.CmsConst.LOGIN_USER;
+
 /**
  * Description:用户管理
  *
@@ -41,4 +44,18 @@ public class LoginController {
     public String register(@Validated TCmsUser user) {
         return userService.insert(user);
     }
+
+    @PostMapping("/getInfo")
+    @ResponseBody
+    public Map<String, Object> getInfo(HttpServletRequest request) {
+        Map<String, Object> resultMap = new HashMap<>();
+        TCmsUser user = (TCmsUser) request.getSession().getAttribute(LOGIN_USER);
+        if (user == null) {
+            resultMap.put("status", false);
+        } else {
+            resultMap.put("status", true);
+            resultMap.put("nickname", user.getNickname());
+        }
+        return resultMap;
+    }
 }

+ 13 - 0
src/main/resources/static/js/register/header-index.js

@@ -0,0 +1,13 @@
+// JavaScript Document
+var showState = false;
+$(function () {
+    $.post("/getInfo", function (data) {
+        var obj = eval(data);
+        showState = obj.status;
+        if (showState) {
+            $("#exit").prepend(obj.nickname).show();
+        } else {
+            $("#login").show();
+        }
+    });
+});

+ 23 - 0
src/main/resources/static/js/register/jyxx.js

@@ -0,0 +1,23 @@
+function showStateFunc(categoryName, state, id, aId, href){
+    //state == true  为已经登录
+    var html = $("#"+id);
+    if(state){
+        console.log("用户已经登陆")
+        var link = $("<a>", {
+            href: href, // 设置链接的href属性
+            text: categoryName, // 设置链接的文本
+            id: aId // 可选:添加一个ID
+        });
+        html.append(link);
+    }else{
+        console.log("用户未登录")
+        if("招聘信息" !== categoryName && "优质岗位" !== categoryName){
+            var link = $("<a>", {
+                href: href, // 设置链接的href属性
+                text: categoryName, // 设置链接的文本
+                id: aId // 可选:添加一个ID
+            });
+            html.append(link);
+        }
+    }
+}

+ 6 - 2
src/main/resources/static/js/register/login.js

@@ -11,7 +11,7 @@ $(function () {
         }, function (data) {
             var obj = eval(data);
             if (obj.success) {
-                show_msg(obj.message, "/");
+                show_msg(obj.message, "/tuiyijunren/4");
             } else {
                 show_err_msg(obj.message);
                 setTimeout(function () {
@@ -20,4 +20,8 @@ $(function () {
             }
         }, "json");
     });
-});
+});
+
+function changeCode() {
+    $("#captcha_img").attr("src", "${ctxPath}/verify?t=" + (new Date().getTime()));
+}

+ 1 - 3
src/main/resources/templates/www/tuiyijunren/include/header-index.html

@@ -12,6 +12,7 @@
     <script src="${resPath}/tuiyijunren/images/dist/aos.js"></script>
     <script src="${resPath}/tuiyijunren/images/ft-carousel.min.js" type="text/javascript"></script>
     <script src="${resPath}/tuiyijunren/images/jquery.carouFredSel-6.0.4-packed.js" type="text/javascript"></script>
+    <script src="${ctxPath}/static/js/register/header-index.js"></script>
 </head>
 
 <body>
@@ -52,6 +53,3 @@
     </div>
 </div>
 <!--导航结束-->
-<script type="text/javascript">
-        $(${btnId}).show();
-</script>

+ 17 - 1
src/main/resources/templates/www/tuiyijunren/include/header.html

@@ -47,7 +47,6 @@
     </div>
 </div>
 <script>
-    $(${btnId}).show();
     let ids = [
         [], // 网站首页
         [1217], // 最新动态
@@ -79,4 +78,21 @@
         }
     }
 </script>
+<script>
+    var showState = false;
+    $.ajax({
+        url: "/getInfo",
+        type: "post",
+        async: false,
+        success: function (data) {
+            var obj = eval(data);
+            showState = obj.status;
+            if (showState) {
+                $("#exit").prepend(obj.nickname).show();
+            } else {
+                $("#login").show();
+            }
+        }
+    });
+</script>
 <!--导航结束-->

+ 2 - 25
src/main/resources/templates/www/tuiyijunren/list-dpsg.html

@@ -7,38 +7,15 @@
 		let arr = post_str.replace(/ /g,"").replace(/,/g," | ");
 		$("#"+id).html(arr);
 	}
-
-	function showState(categoryName, state, id, aId, href){
-		//state == true  为已经登录
-		var html = $("#"+id);
-		if(state){
-			console.log("用户已经登陆")
-			var link = $("<a>", {
-				href: href, // 设置链接的href属性
-				text: categoryName, // 设置链接的文本
-				id: aId // 可选:添加一个ID
-			});
-			html.append(link);
-		}else{
-			console.log("用户未登录")
-			if("招聘信息" !== categoryName && "优质岗位" !== categoryName){
-				var link = $("<a>", {
-					href: href, // 设置链接的href属性
-					text: categoryName, // 设置链接的文本
-					id: aId // 可选:添加一个ID
-				});
-				html.append(link);
-			}
-		}
-	}
 </script>
+<script src="${ctxPath}/static/js/register/jyxx.js"></script>
 <div class="er_content clearfix">
 	<div class="er_left fl">
 		<div class="er_nav">
 			<h4>就业信息</h4>
 			<span id="${site.siteId}"></span>
 			<#cms_category_list  siteId="${site.siteId}" categoryId="1218" isNav="0" var="bean">
-			<script>showState("${bean.categoryName}", ${showState}, "${site.siteId}", "${bean.categoryId}", "${frontPath}/${site.siteId}/${bean.categoryId}.html")</script>
+			<script>showStateFunc("${bean.categoryName}", showState, "${site.siteId}", "${bean.categoryId}", "${frontPath}/${site.siteId}/${bean.categoryId}.html")</script>
 			</#cms_category_list>
 		</div>
 	</div>

+ 2 - 26
src/main/resources/templates/www/tuiyijunren/list-jyxx.html

@@ -6,31 +6,7 @@
         display: none;
     }
 </style>
-<script>
-	function showState(categoryName, state, id, aId, href){
-		//state == true  为已经登录
-		var html = $("#"+id);
-        if(state){
-            console.log("用户已经登陆")
-            var link = $("<a>", {
-                href: href, // 设置链接的href属性
-                text: categoryName, // 设置链接的文本
-                id: aId // 可选:添加一个ID
-            });
-            html.append(link);
-        }else{
-            console.log("用户未登录")
-            if("招聘信息" !== categoryName && "优质岗位" !== categoryName){
-                var link = $("<a>", {
-                    href: href, // 设置链接的href属性
-                    text: categoryName, // 设置链接的文本
-                    id: aId // 可选:添加一个ID
-                });
-                html.append(link);
-            }
-        }
-	}
-</script>
+<script src="${ctxPath}/static/js/register/jyxx.js"></script>
 <!--中间内容开始-->
 <div class="er_content clearfix">
 	<div class="er_left fl">
@@ -38,7 +14,7 @@
 			<h4>就业信息</h4>
 			<span id="${site.siteId}"></span>
 			<#cms_category_list  siteId="${site.siteId}" categoryId="1218" isNav="0" var="bean">
-				<script>showState("${bean.categoryName}", ${showState}, "${site.siteId}", "${bean.categoryId}", "${frontPath}/${site.siteId}/${bean.categoryId}.html")</script>
+				<script>showStateFunc("${bean.categoryName}", showState, "${site.siteId}", "${bean.categoryId}", "${frontPath}/${site.siteId}/${bean.categoryId}.html")</script>
 			</#cms_category_list>
 		</div>
 	</div>

+ 3 - 24
src/main/resources/templates/www/tuiyijunren/list-yzgw.html

@@ -28,37 +28,16 @@
     function renderExperienceAndEducation(experienceAndEducation) {
         return "&nbsp;&nbsp"+experienceAndEducation.replaceAll("/","&nbsp;&nbsp;");
     }
-    function showState(categoryName, state, id, aId, href){
-        //state == true  为已经登录
-        var html = $("#"+id);
-        if(state){
-            console.log("用户已经登陆")
-            var link = $("<a>", {
-                href: href, // 设置链接的href属性
-                text: categoryName, // 设置链接的文本
-                id: aId // 可选:添加一个ID
-            });
-            html.append(link);
-        }else{
-            console.log("用户未登录")
-            if("招聘信息" !== categoryName && "优质岗位" !== categoryName){
-                var link = $("<a>", {
-                    href: href, // 设置链接的href属性
-                    text: categoryName, // 设置链接的文本
-                    id: aId // 可选:添加一个ID
-                });
-                html.append(link);
-            }
-        }
-    }
+
 </script>
+<script src="${ctxPath}/static/js/register/jyxx.js"></script>
 <div class="er_content clearfix">
     <div class="er_left fl">
         <div class="er_nav">
             <h4>就业信息</h4>
             <span id="${site.siteId}"></span>
             <#cms_category_list  siteId="${site.siteId}" categoryId="1223" isNav="0" var="bean">
-                <script>showState("${bean.categoryName}", ${showState}, "${site.siteId}", "${bean.categoryId}", "${frontPath}/${site.siteId}/${bean.categoryId}.html")</script>
+                <script>showStateFunc("${bean.categoryName}", showState, "${site.siteId}", "${bean.categoryId}", "${frontPath}/${site.siteId}/${bean.categoryId}.html")</script>
             </#cms_category_list>
         </div>
     </div>

+ 2 - 3
src/main/resources/templates/www/tuiyijunren/list-zsrz.html

@@ -20,9 +20,8 @@
                     <div><p>证书类别</p>:</div>
                     <select id="certificateType" name="certificateType" class="sel">
                         <option value="0">请选择证书类别</option>
-                        <option value="1248">证书类别A</option>
-                        <option value="1249">证书类别B</option>
-                        <option value="1250">证书类别C</option>
+                        <option value="1248">创业导师证书</option>
+                        <option value="1249">培训合格证书</option>
                     </select>
                 </li>
                 <li>

+ 0 - 5
src/main/resources/templates/www/tuiyijunren/login.html

@@ -41,9 +41,4 @@
     </div>
 </div>
 </body>
-<script type="text/javascript">
-    function changeCode() {
-        $("#captcha_img").attr("src", "${ctxPath}/verify?t=" + (new Date().getTime()));
-    }
-</script>
 </html>