goupan
2024-04-03 5506e9a45e717ffcb67ec313b5a4e8206d9b3a39
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package cn.stylefeng.roses.kernel.system.integration.modular.system.index.controller;
 
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
import cn.stylefeng.roses.kernel.rule.enums.ResBizTypeEnum;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.system.integration.modular.system.index.service.IndexService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
 
import javax.annotation.Resource;
 
/**
 * 首页相关的界面渲染
 *
 * @author fengshuonan
 * @date 2020/12/27 16:23
 */
@Controller
@ApiResource(name = "首页相关的界面渲染", resBizType = ResBizTypeEnum.SYSTEM)
public class IndexViewController {
 
    @Resource
    private IndexService indexService;
 
    /**
     * 首页界面
     *
     * @author fengshuonan
     * @date 2020/12/13 17:19
     */
    @GetResource(name = "首页界面", path = "/", requiredLogin = false, requiredPermission = false, viewFlag = true)
    public String indexView(Model model) {
 
        // 当前用户已经登录,跳转到首页
        if (LoginContext.me().hasLogin()) {
            model.addAllAttributes(indexService.createIndexRenderAttributes());
            return "/index.html";
        }
 
        // 当前用户没有登录,跳转到登录页面
        return "/login.html";
    }
 
    /**
     * 个人中心界面
     *
     * @author fengshuonan
     * @date 2020/12/29 21:53
     */
    @GetResource(name = "个人中心界面", path = "/view/personal", requiredPermission = false)
    public String personal(Model model) {
        model.addAllAttributes(indexService.createPersonInfoRenderAttributes());
        return "/modular/system/index/personal_info.html";
    }
 
    /**
     * 锁屏界面
     *
     * @author fengshuonan
     * @date 2020/12/29 21:34
     */
    @GetResource(name = "锁屏界面", path = "/view/lock", requiredPermission = false)
    public String lock() {
        return "/modular/system/index/lock_screen.html";
    }
 
    /**
     * 主题切换界面
     *
     * @author fengshuonan
     * @date 2020/12/29 21:42
     */
    @GetResource(name = "主题切换界面", path = "/view/theme", requiredPermission = false)
    public String theme() {
        return "/modular/system/index/theme.html";
    }
 
    /**
     * 修改密码界面
     *
     * @author fengshuonan
     * @date 2020/12/29 21:42
     */
    @GetResource(name = "修改密码界面", path = "/view/changePassword", requiredPermission = false)
    public String changePassword() {
        return "/modular/system/index/change_password.html";
    }
 
}