基础insert和update自动填充用户信息时增加判断
This commit is contained in:
parent
b6a3a5df35
commit
a0183414a9
|
|
@ -1,11 +1,13 @@
|
|||
package com.ruoyi.cms.controller;
|
||||
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import com.ruoyi.exam.domain.ExamPractice;
|
||||
import com.ruoyi.exam.domain.ExamUserErrorQuestion;
|
||||
import com.ruoyi.exam.domain.ExamUserErrorQuestionVO;
|
||||
import com.ruoyi.exam.service.IExamPracticeService;
|
||||
import com.ruoyi.exam.service.IExamUserErrorQuestionService;
|
||||
import com.ruoyi.framework.jwt.JwtUtil;
|
||||
import com.ruoyi.framework.web.util.ServletUtils;
|
||||
import com.ruoyi.framework.web.util.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysUser;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
|
|
@ -15,6 +17,7 @@ import com.ruoyi.train.course.domain.TrainCourseVO;
|
|||
import com.ruoyi.train.course.service.ITrainCourseCategoryService;
|
||||
import com.ruoyi.train.course.service.ITrainCourseSectionService;
|
||||
import com.ruoyi.train.course.service.ITrainCourseService;
|
||||
import org.apache.shiro.web.servlet.SimpleCookie;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -24,6 +27,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -52,7 +56,11 @@ public class CmsUserController {
|
|||
return prefix + "/user/login";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/user/out")
|
||||
public String out(ModelMap map) {
|
||||
ShiroUtils.logout();
|
||||
return "redirect:"+prefix+"/index";
|
||||
}
|
||||
|
||||
@RequestMapping("/user/reg.html")
|
||||
public String reg(ModelMap map) {
|
||||
|
|
|
|||
|
|
@ -179,9 +179,15 @@
|
|||
<div class="price">
|
||||
<span class="price-info"><span th:text="'¥'+${trainCourse.price}"></span></span>
|
||||
</div>
|
||||
<div class="button" th:if="${trainCourse.price>0}">
|
||||
<div class="button" th:if="${trainCourse.price>0 && !courseAuth}">
|
||||
<input type="button" onclick="shop()" class="hb-ui-btn" value="立刻购买">
|
||||
<em>有效期:<span id="shixian" th:text="${courseDays}"></span>(天)</em>
|
||||
</div>
|
||||
<div class="button" th:if="${trainCourse.price==0||courseAuth}">
|
||||
<input type="button" onclick="goStudy()" class="hb-ui-btn" value="加入学习">
|
||||
<em>有效期:
|
||||
<span id="shixian" th:if="${trainCourse.price==0}" th:text="'永久'"></span>
|
||||
<span id="shixian" th:if="${trainCourse.price>0}" th:text="${courseDays}"></span>
|
||||
(天)</em>
|
||||
</div>
|
||||
<div class="remark" th:text="${trainCourse.description}">
|
||||
|
||||
|
|
@ -203,8 +209,8 @@
|
|||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">
|
||||
<ul >
|
||||
<li th:each="sections:${trainCourseSections}" >
|
||||
<a th:if="${courseAuth}" th:href="@{'/web/course/courseSections.html/'+${sections.id}}">
|
||||
<li th:if="trainCourseSections" th:each="sections,obj:${trainCourseSections}" >
|
||||
<a th:if="${courseAuth}" th:id="'section'+${obj.index+1}" th:href="@{'/web/course/courseSections.html/'+${sections.id}}">
|
||||
<span th:text="${sections.name}"> </span>
|
||||
</a>
|
||||
<a th:if="!${courseAuth}" onclick="shop()">
|
||||
|
|
@ -239,11 +245,12 @@
|
|||
<script type="text/javascript">
|
||||
layui.use(['element','layer'], function(){
|
||||
var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
|
||||
|
||||
|
||||
});
|
||||
function goStudy() {
|
||||
$("#section1").click();
|
||||
}
|
||||
function shop() {
|
||||
var userId="[[${user.userId}]]";
|
||||
var userId="[[${user?.userId}]]";
|
||||
if(userId){
|
||||
var data={
|
||||
"body":"[[${trainCourse.name}]]",
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@
|
|||
<dd><a th:href="@{/web/user/home.html}"><i class="layui-icon" style="margin-left: 2px; font-size: 22px;"></i>我的主页</a></dd>
|
||||
<dd><a th:href="@{/web/user/errorquestion.html}"><i class="layui-icon" style="margin-left: 2px; font-size: 22px;"></i>我的错题本</a></dd>
|
||||
<dd><a th:href="@{/web/user/collect.html}"><i class="layui-icon" style="margin-left: 2px; font-size: 22px;"></i>我的收藏</a></dd>
|
||||
<dd><a href="" style="text-align: center;">退出</a></dd>
|
||||
<dd><a th:href="@{/web/user/out}" style="text-align: center;">退出</a></dd>
|
||||
</dl>
|
||||
</li>
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -58,7 +58,9 @@ public class OnlineSessionFilter extends AccessControlFilter
|
|||
{
|
||||
onlineSession.setUserId(user.getUserId());
|
||||
onlineSession.setLoginName(user.getLoginName());
|
||||
onlineSession.setDeptName(user.getDept().getDeptName());
|
||||
if (null != user.getDept()) {
|
||||
onlineSession.setDeptName(user.getDept().getDeptName());
|
||||
}
|
||||
onlineSession.markAttributeChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue