Quellcode durchsuchen

Merge remote-tracking branch 'origin/master'

JX.Li vor 3 Monaten
Ursprung
Commit
f2bcb59daf

+ 18 - 11
src/main/java/com/sooka/module/web/cms/IndexController.java

@@ -95,7 +95,7 @@ public class IndexController {
 
     /*网站首页*/
     @GetMapping
-    public ModelAndView index(@RequestParam(value = "keyword",required = false) String keyword, HttpServletRequest request){
+    public ModelAndView index(@RequestParam(value = "keyword",required = false) String keyword){
         String domain = ControllerUtil.getDomain();
         log.debug("通过域名访问网站首页[{}]",domain);
         TCmsSite site = siteService.findByDomain(domain);
@@ -105,13 +105,7 @@ public class IndexController {
         if(!StrUtil.isBlank(keyword)) {
             return new ModelAndView( "forward:/"+sitePrefix+"/search");
         }
-        ModelAndView modelAndView = new ModelAndView( "forward:/"+sitePrefix+"/"+site.getSiteId());
-        if (request.getSession().getAttribute(LOGIN_USER) == null) {
-            modelAndView.addObject("btnId", "login");
-        } else {
-            modelAndView.addObject("btnId", "exit");
-        }
-        return modelAndView;
+        return new ModelAndView( "forward:/"+sitePrefix+"/"+site.getSiteId());
     }
 
     @GetMapping("/login")
@@ -124,7 +118,7 @@ public class IndexController {
     @GetMapping("/exit")
     public ModelAndView exit(HttpServletRequest request){
         request.getSession().removeAttribute(LOGIN_USER);
-        return index(null, request);
+        return index(null);
     }
 
     @GetMapping("/register")
@@ -180,7 +174,7 @@ public class IndexController {
      */
     @GetMapping("/${system.site.prefix}/{siteId}")
     public String index(@PathVariable("siteId") Integer siteId,
-                        Model model){
+                        Model model,HttpServletRequest request){
         log.debug("通过站点Id访问网站首页[{}]",siteId);
         SimpleDateFormat formatYear = new SimpleDateFormat("yyyy");
         SimpleDateFormat format = new SimpleDateFormat("yyyy-M-d");
@@ -213,6 +207,11 @@ public class IndexController {
         model.addAttribute("description",site.getDescription());
         model.addAttribute("site",site);
         model.addAttribute("xwdtList",xwdtList);
+        if (request.getSession().getAttribute(LOGIN_USER) == null) {
+            model.addAttribute("btnId", "login");
+        } else {
+            model.addAttribute("btnId", "exit");
+        }
         if(StrUtil.isBlank(site.getTemplate())) {
             return view(CmsConst.INDEX_TPL);
         }
@@ -223,23 +222,31 @@ public class IndexController {
     @GetMapping("/${system.site.prefix}/{siteId}/{categoryId}")
     public String category(@PathVariable("siteId") Integer siteId,
                            @PathVariable("categoryId") Long categoryId,
-                           Model model){
+                           Model model, HttpServletRequest request){
         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);
         }
         PageInfo page = contentService.page(1,siteId,category.getCategoryId());
         model.addAttribute("title",category.getCategoryName());
+
         model.addAttribute("keyword",site.getKeyword());
         model.addAttribute("description",site.getDescription());
         model.addAttribute("site",site);
         model.addAttribute("category",category);
         model.addAttribute("page",page);
+
+
         if(StrUtil.isBlank(site.getTemplate())) {
             return view(category.getIndexTpl());
         }

+ 5 - 1
src/main/resources/static/js/register/login.js

@@ -4,7 +4,11 @@ $(function () {
     $('#login').click(function () {
         show_loading();
         // ajax提交表单,#login_form为表单的ID。如:$('#login_form').ajaxSubmit(function(data)
-        $.post("/login", {username: "test", password: "123456", "verifyCode": $("#j_captcha").val()}, function (data) {
+        $.post("/login", {
+            "username": $("#username").val(),
+            "password": $("#password").val(),
+            "verifyCode": $("#j_captcha").val()
+        }, function (data) {
             var obj = eval(data);
             if (obj.success) {
                 show_msg(obj.message, "/");

+ 18 - 0
src/main/resources/static/www/tuiyijunren/images/basic.css

@@ -74,6 +74,16 @@ width: 330px;
 	margin-bottom: 20px;
 	border-radius: 8px;
 }
+.dl_con .dl_form input[type="password"]{
+	width: 96%;
+	background: none;
+	border: 1px solid #dbd4d1;
+	padding: 0px 2% ;
+	height: 60px;
+	line-height: 60px;
+	margin-bottom: 20px;
+	border-radius: 8px;
+}
 .dl_con .dl_form p input[type="text"]{
 	width: 50%;
 	margin-right: 20px;
@@ -96,6 +106,14 @@ width: 330px;
 	outline: 0px;
 	border: 1px solid #05731d;
 }
+.dl_con .dl_form input[type="password"]::placeholder {
+	color: #7e7e7e;
+	font-size: 20px;
+}
+.dl_con .dl_form input[type="password"]:focus{
+	outline: 0px;
+	border: 1px solid #05731d;
+}
 
 .dl_con .dl_form p label {
 	color: #595959;

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

@@ -195,7 +195,7 @@
             <span>-见效快&nbsp;&nbsp;成本低&nbsp;&nbsp;灵活性高-</span>
         </div>
         <div class="dpsg_list">
-            <#cms_content_list siteId="${site.siteId}" categoryId="1225" orderBy="2" isHot="0" hasChild="0" isRecommend="0" size="3" titleLen="30" var="bean">
+            <#cms_content_list siteId="${site.siteId}" categoryId="1245" orderBy="2" isHot="0" hasChild="0" isRecommend="0" size="3" titleLen="30" var="bean">
                 <a class="dpsg_list_div clearfix" aos="fade-up" href="${bean.url!}">
                     <img src="${bean.thumb!}" alt="${bean.title!}"/>
                     <div class="text">

+ 26 - 10
src/main/resources/templates/www/tuiyijunren/list-dpsg.html

@@ -4,25 +4,41 @@
 <!--中间内容开始-->
 <script>
 	function renderPost(post_str,id) {
-		console.log(post_str)
-		// let html = "<h4>";
 		let arr = post_str.replace(/ /g,"").replace(/,/g," | ");
-		// html += arr + "</h4>"
-		/*for (let i = 0; i < arr.length; i++) {
-			html += +arr[i]+" | ";
-		}*/
-
-		// console.log(html);
-		// return html;
 		$("#"+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>
 <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">
-				<a id="${bean.categoryId}" href="${frontPath}/${site.siteId}/${bean.categoryId}.html">${bean.categoryName}</a>
+			<script>showState("${bean.categoryName}", ${showState}, "${site.siteId}", "${bean.categoryId}", "${frontPath}/${site.siteId}/${bean.categoryId}.html")</script>
 			</#cms_category_list>
 		</div>
 	</div>

+ 32 - 1
src/main/resources/templates/www/tuiyijunren/list-jyxx.html

@@ -1,13 +1,44 @@
 <!--头部开始-->
 @includeFileTemplate("/www/tuiyijunren/include/header.html"){}
 <!--头部结束-->
+<style>
+    .yincang{
+        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>
 <!--中间内容开始-->
 <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">
-				<a id="${bean.categoryId}" href="${frontPath}/${site.siteId}/${bean.categoryId}.html">${bean.categoryName}</a>
+				<script>showState("${bean.categoryName}", ${showState}, "${site.siteId}", "${bean.categoryId}", "${frontPath}/${site.siteId}/${bean.categoryId}.html")</script>
 			</#cms_category_list>
 		</div>
 	</div>

+ 39 - 41
src/main/resources/templates/www/tuiyijunren/login.html

@@ -1,51 +1,49 @@
 <!doctype html>
 <html>
 <head>
-<meta charset="utf-8">
-<title>退伍军人就业创业综合服务平台</title>
-<link href="${resPath}/tuiyijunren/images/base.css" rel="stylesheet"/>
-<link href="${resPath}/tuiyijunren/images/basic.css" rel="stylesheet"/>
-<script type="text/javascript" language="javascript" src="${resPath}/tuiyijunren/images/jquery-1.7.2.min.js"></script>
-<script src="${ctxPath}/static/js/register/login.js"></script>
-<script src="${ctxPath}/static/js/login/login_tooltips.js"></script>
+    <meta charset="utf-8">
+    <title>退伍军人就业创业综合服务平台</title>
+    <link href="${resPath}/tuiyijunren/images/base.css" rel="stylesheet"/>
+    <link href="${resPath}/tuiyijunren/images/basic.css" rel="stylesheet"/>
+    <script type="text/javascript" language="javascript"
+            src="${resPath}/tuiyijunren/images/jquery-1.7.2.min.js"></script>
+    <script src="${ctxPath}/static/js/register/login.js"></script>
+    <script src="${ctxPath}/static/js/login/login_tooltips.js"></script>
 </head>
 
 <body class="dl_body">
-	<div class="dl_con">
-		<div class="text">
-			<h1>吉林省退役军人<br>就业创业综合服务平台</h1>
-			<span>退伍不褪色&nbsp;&nbsp;&nbsp;忠诚永记心</span>
-		</div>
-		<div class="dl_form">
-			<input type="text" placeholder="账号:手机号/邮箱/昵称"/>
-			<input type="text" placeholder="密码:请输入您的密码"/>
-			<p>
-				<input type="text" class="form-control" id="j_captcha" name="verifyCode" placeholder="验证码"
-					   aria-describedby="sizing-addon-password">
-				<span class="input-group-addon code" id="basic-addon-code">
-                        <img id="captcha_img" src="${ctxPath}/verify" onclick="changeCode();" alt="点击更换"
-							 title="点击更换" class="m">
-				</span>
-				<!--<input type="text" placeholder="请输入验证码"/>
-				<img src="" style="background: #7B7B7B"/>-->
-			</p>
-			<p>
-				<label>
-					<input type="checkbox"/>记住密码
-				</label>
-				<label>
-					<input type="checkbox"/>记住我
-				</label>
-			</p>
-			
-			<input id="login" type="button" value="登录"/>
-			<a>忘记密码?</a>
-		</div>
-	</div>
+<div class="dl_con">
+    <div class="text">
+        <h1>吉林省退役军人<br>就业创业综合服务平台</h1>
+        <span>退伍不褪色&nbsp;&nbsp;&nbsp;忠诚永记心</span>
+    </div>
+    <div class="dl_form">
+        <input id="username" type="text" placeholder="账号:请输入您的账号"/>
+        <input id="password" type="password" placeholder="密码:请输入您的密码"/>
+        <p>
+            <input type="text" class="form-control" id="j_captcha" name="verifyCode" placeholder="请输入验证码"
+                   aria-describedby="sizing-addon-password">
+            <span class="input-group-addon code" id="basic-addon-code">
+                <img id="captcha_img" src="${ctxPath}/verify" onclick="changeCode();" alt="点击更换"
+                     title="点击更换" class="m" style="background: #7B7B7B"/>
+            </span>
+        </p>
+        <!--<p>
+            <label>
+                <input type="checkbox"/>记住密码
+            </label>
+            <label>
+                <input type="checkbox"/>记住我
+            </label>
+        </p>-->
+        <input id="login" type="button" value="登录"/>
+        <!--<a>忘记密码?</a>-->
+    </div>
+</div>
 </body>
 <script type="text/javascript">
-	function changeCode() {
-		$("#captcha_img").attr("src", "${ctxPath}/verify?t=" + (new Date().getTime()));
-	}
+    function changeCode() {
+        $("#captcha_img").attr("src", "${ctxPath}/verify?t=" + (new Date().getTime()));
+    }
 </script>
 </html>