chengkun
2025-08-29 a370f8c298c691b18f713d4db19919162fbd3299
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!DOCTYPE HTML>
<html>
 
<head>
    <title>账号登录</title>
    <link rel="shortcut icon" href="/favicon.ico">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" href="/static/admin/login/login.css?x=1">
    <include file="common:element-plus">
</head>
 
<body>
    <div class="loginbg"></div>
    <input type="hidden" id="backurl" value="{$SERVER.HTTP_REFERER|default=''}">
    <div id="login_app" class="login-bg">
        <div class="login-register">
            <div class="register-form">
                <div class="text-center font-size-20 mb30">
                    <div class="mt45">
                        <img src="/static/admin/login/logo-m.png" style="width: 200px;" />
                    </div>
                    <p class="mt10">总管理后台登录</p>
                </div>
                <br />
                <el-form :model="form" label-width="auto" style="max-width: 600px" @keydown.enter="login">
                    <el-form-item>
                        <el-input v-model="userdata.username" placeholder="请输入账号" size="large" prefix-icon="user"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-input v-model="userdata.password" type="password" placeholder="请输入密码" size="large" prefix-icon="lock"></el-input>
                    </el-form-item>
                    <br />
                    <el-button type="primary" @click="login" size="large" class="btn_block">登录</el-button>
                </el-form>
            </div>
        </div>
    </div>
 
    <script>
        var backurl = $('#backurl').val();
        const { ElMessage } = ElementPlus;
        const App = {
            data() {
                return {
                    userdata: {
                        username: '',
                        password: '',
                        backurl: backurl,
                    },
                };
            },
            mounted() { },
            created() { },
            methods: {
                login() {
                    let that = this;
                    if (that.userdata.username == '') {
                        ElMessage({
                            message: "请输入账号",
                            type: 'error',
                            plain: true,
                            duration: 2000,
                        });
                        return;
                    }
                    if (that.userdata.password == '') {
                        ElMessage({
                            message: "请输入密码",
                            type: 'error',
                            plain: true,
                            duration: 2000,
                        });
                        return;
                    }
                    let url = "/admin/login/login.html"
                    postRequest(url, that.userdata).then(res => {
                        if (res.data.code == 200) {
                            that.$message({
                                message: res.data.message,
                                type: 'success',
                                plain: true,
                                duration: 500,
                                onClose: function () {
                                    document.location = res.data.url;
                                },
                            })
                            // 
                        }
                        else {
                            that.$message({
                                message: res.data.message,
                                type: 'error',
                                plain: true,
                                duration: 3000,
                            })
                        }
                    });
                },
            }
        };
        const app = Vue.createApp(App);
        for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
            app.component(key, component)
        }
        app.use(ElementPlus, {
            locale: ElementPlusLocaleZhCn,
        });
        app.mount("#login_app");
    </script>
</body>
 
</html>