|
@@ -1,6 +1,11 @@
|
1
|
1
|
<template>
|
2
|
2
|
<div class="login">
|
3
|
|
- <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
|
|
3
|
+ <el-form
|
|
4
|
+ ref="loginForm"
|
|
5
|
+ :model="loginForm"
|
|
6
|
+ :rules="loginRules"
|
|
7
|
+ class="login-form"
|
|
8
|
+ >
|
4
|
9
|
<h3 class="title">智汇口腔医院管理系统</h3>
|
5
|
10
|
<el-form-item prop="username">
|
6
|
11
|
<el-input
|
|
@@ -9,7 +14,11 @@
|
9
|
14
|
auto-complete="off"
|
10
|
15
|
placeholder="账号"
|
11
|
16
|
>
|
12
|
|
- <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
|
17
|
+ <svg-icon
|
|
18
|
+ slot="prefix"
|
|
19
|
+ icon-class="user"
|
|
20
|
+ class="el-input__icon input-icon"
|
|
21
|
+ />
|
13
|
22
|
</el-input>
|
14
|
23
|
</el-form-item>
|
15
|
24
|
<el-form-item prop="password">
|
|
@@ -20,7 +29,11 @@
|
20
|
29
|
placeholder="密码"
|
21
|
30
|
@keyup.enter.native="handleLogin"
|
22
|
31
|
>
|
23
|
|
- <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
|
32
|
+ <svg-icon
|
|
33
|
+ slot="prefix"
|
|
34
|
+ icon-class="password"
|
|
35
|
+ class="el-input__icon input-icon"
|
|
36
|
+ />
|
24
|
37
|
</el-input>
|
25
|
38
|
</el-form-item>
|
26
|
39
|
<el-form-item prop="code" v-if="captchaEnabled">
|
|
@@ -31,63 +44,93 @@
|
31
|
44
|
style="width: 63%"
|
32
|
45
|
@keyup.enter.native="handleLogin"
|
33
|
46
|
>
|
34
|
|
- <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
|
|
47
|
+ <svg-icon
|
|
48
|
+ slot="prefix"
|
|
49
|
+ icon-class="validCode"
|
|
50
|
+ class="el-input__icon input-icon"
|
|
51
|
+ />
|
35
|
52
|
</el-input>
|
36
|
53
|
<div class="login-code">
|
37
|
|
- <img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
|
54
|
+ <img :src="codeUrl" @click="getCode" class="login-code-img" />
|
38
|
55
|
</div>
|
39
|
56
|
</el-form-item>
|
40
|
57
|
<!-- <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox> -->
|
41
|
|
- <el-form-item style="width:100%;">
|
|
58
|
+ <el-form-item style="width: 100%">
|
42
|
59
|
<el-button
|
43
|
60
|
:loading="loading"
|
44
|
61
|
size="medium"
|
45
|
62
|
type="primary"
|
46
|
|
- style="width:100%;"
|
|
63
|
+ style="width: 100%"
|
47
|
64
|
@click.native.prevent="handleLogin"
|
48
|
65
|
>
|
49
|
66
|
<span v-if="!loading">登 录</span>
|
50
|
67
|
<span v-else>登 录 中...</span>
|
51
|
68
|
</el-button>
|
52
|
|
- <div style="float: right;" v-if="register">
|
53
|
|
- <router-link class="link-type" :to="'/register'">立即注册</router-link>
|
|
69
|
+ <div style="float: right" v-if="register">
|
|
70
|
+ <router-link class="link-type" :to="'/register'"
|
|
71
|
+ >立即注册</router-link
|
|
72
|
+ >
|
54
|
73
|
</div>
|
55
|
74
|
</el-form-item>
|
|
75
|
+ <div style="text-align: right">
|
|
76
|
+ <el-popover placement="bottom" width="270px" trigger="click">
|
|
77
|
+ <div style="display: flex;">
|
|
78
|
+ <div style="display: flex;flex-direction: column;align-items: center;">
|
|
79
|
+ <img src="@/assets/images/视慧口腔.png" style="width: 100px;height: 100px;">
|
|
80
|
+ <p>视慧口腔</p>
|
|
81
|
+ </div>
|
|
82
|
+ <div style="display: flex;flex-direction: column;align-items: center;margin-left: 20px;">
|
|
83
|
+ <img src="@/assets/images/口腔医院.png" style="width: 100px;height: 100px;">
|
|
84
|
+ <p>口腔医院</p>
|
|
85
|
+ </div>
|
|
86
|
+ </div>
|
|
87
|
+ <span style="color: #897d7d; cursor: pointer" slot="reference"
|
|
88
|
+ >App下载</span
|
|
89
|
+ >
|
|
90
|
+ </el-popover>
|
|
91
|
+ </div>
|
56
|
92
|
</el-form>
|
57
|
93
|
<!-- 底部 -->
|
58
|
94
|
<div class="el-login-footer">
|
59
|
|
- <span style="font-size: 15px;font-weight: 700;">
|
60
|
|
- 使用推荐:谷歌浏览器 <a href="https://www.google.cn/chrome/" style="color: #f00;" target="_blank">(点此下载)</a> 推荐屏幕分辨率1920 * 1080
|
|
95
|
+ <span style="font-size: 15px; font-weight: 700">
|
|
96
|
+ 使用推荐:谷歌浏览器
|
|
97
|
+ <a
|
|
98
|
+ href="https://www.google.cn/chrome/"
|
|
99
|
+ style="color: #f00"
|
|
100
|
+ target="_blank"
|
|
101
|
+ >(点此下载)</a
|
|
102
|
+ >
|
|
103
|
+ 推荐屏幕分辨率1920 * 1080
|
61
|
104
|
</span>
|
62
|
105
|
</div>
|
63
|
106
|
</div>
|
64
|
107
|
</template>
|
65
|
108
|
|
66
|
109
|
<script>
|
67
|
|
-import { getCodeImg } from "@/api/login";
|
68
|
|
-import Cookies from "js-cookie";
|
|
110
|
+import { getCodeImg } from '@/api/login'
|
|
111
|
+import Cookies from 'js-cookie'
|
69
|
112
|
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
70
|
113
|
|
71
|
114
|
export default {
|
72
|
|
- name: "Login",
|
|
115
|
+ name: 'Login',
|
73
|
116
|
data() {
|
74
|
117
|
return {
|
75
|
|
- codeUrl: "",
|
|
118
|
+ codeUrl: '',
|
76
|
119
|
loginForm: {
|
77
|
|
- username: "",
|
78
|
|
- password: "",
|
|
120
|
+ username: '',
|
|
121
|
+ password: '',
|
79
|
122
|
rememberMe: false,
|
80
|
|
- code: "",
|
81
|
|
- uuid: ""
|
|
123
|
+ code: '',
|
|
124
|
+ uuid: ''
|
82
|
125
|
},
|
83
|
126
|
loginRules: {
|
84
|
127
|
username: [
|
85
|
|
- { required: true, trigger: "blur", message: "请输入您的账号" }
|
|
128
|
+ { required: true, trigger: 'blur', message: '请输入您的账号' }
|
86
|
129
|
],
|
87
|
130
|
password: [
|
88
|
|
- { required: true, trigger: "blur", message: "请输入您的密码" }
|
|
131
|
+ { required: true, trigger: 'blur', message: '请输入您的密码' }
|
89
|
132
|
],
|
90
|
|
- code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
|
133
|
+ code: [{ required: true, trigger: 'change', message: '请输入验证码' }]
|
91
|
134
|
},
|
92
|
135
|
loading: false,
|
93
|
136
|
// 验证码开关
|
|
@@ -95,66 +138,75 @@ export default {
|
95
|
138
|
// 注册开关
|
96
|
139
|
register: false,
|
97
|
140
|
redirect: undefined
|
98
|
|
- };
|
|
141
|
+ }
|
99
|
142
|
},
|
100
|
143
|
watch: {
|
101
|
144
|
$route: {
|
102
|
|
- handler: function(route) {
|
103
|
|
- this.redirect = route.query && route.query.redirect;
|
|
145
|
+ handler: function (route) {
|
|
146
|
+ this.redirect = route.query && route.query.redirect
|
104
|
147
|
},
|
105
|
148
|
immediate: true
|
106
|
149
|
}
|
107
|
150
|
},
|
108
|
151
|
created() {
|
109
|
|
- this.getCode();
|
110
|
|
- this.getCookie();
|
|
152
|
+ this.getCode()
|
|
153
|
+ this.getCookie()
|
111
|
154
|
},
|
112
|
155
|
methods: {
|
113
|
156
|
getCode() {
|
114
|
|
- getCodeImg().then(res => {
|
115
|
|
- this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
|
|
157
|
+ getCodeImg().then((res) => {
|
|
158
|
+ this.captchaEnabled =
|
|
159
|
+ res.captchaEnabled === undefined ? true : res.captchaEnabled
|
116
|
160
|
if (this.captchaEnabled) {
|
117
|
|
- this.codeUrl = "data:image/gif;base64," + res.img;
|
118
|
|
- this.loginForm.uuid = res.uuid;
|
|
161
|
+ this.codeUrl = 'data:image/gif;base64,' + res.img
|
|
162
|
+ this.loginForm.uuid = res.uuid
|
119
|
163
|
}
|
120
|
|
- });
|
|
164
|
+ })
|
121
|
165
|
},
|
122
|
166
|
getCookie() {
|
123
|
|
- const username = Cookies.get("username");
|
124
|
|
- const password = Cookies.get("password");
|
|
167
|
+ const username = Cookies.get('username')
|
|
168
|
+ const password = Cookies.get('password')
|
125
|
169
|
const rememberMe = Cookies.get('rememberMe')
|
126
|
170
|
this.loginForm = {
|
127
|
171
|
username: username === undefined ? this.loginForm.username : username,
|
128
|
|
- password: password === undefined ? this.loginForm.password : decrypt(password),
|
|
172
|
+ password:
|
|
173
|
+ password === undefined ? this.loginForm.password : decrypt(password),
|
129
|
174
|
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
130
|
|
- };
|
|
175
|
+ }
|
131
|
176
|
},
|
132
|
177
|
handleLogin() {
|
133
|
|
- this.$refs.loginForm.validate(valid => {
|
|
178
|
+ this.$refs.loginForm.validate((valid) => {
|
134
|
179
|
if (valid) {
|
135
|
|
- this.loading = true;
|
|
180
|
+ this.loading = true
|
136
|
181
|
if (this.loginForm.rememberMe) {
|
137
|
|
- Cookies.set("username", this.loginForm.username, { expires: 30 });
|
138
|
|
- Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
|
139
|
|
- Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
|
|
182
|
+ Cookies.set('username', this.loginForm.username, { expires: 30 })
|
|
183
|
+ Cookies.set('password', encrypt(this.loginForm.password), {
|
|
184
|
+ expires: 30
|
|
185
|
+ })
|
|
186
|
+ Cookies.set('rememberMe', this.loginForm.rememberMe, {
|
|
187
|
+ expires: 30
|
|
188
|
+ })
|
140
|
189
|
} else {
|
141
|
|
- Cookies.remove("username");
|
142
|
|
- Cookies.remove("password");
|
143
|
|
- Cookies.remove('rememberMe');
|
|
190
|
+ Cookies.remove('username')
|
|
191
|
+ Cookies.remove('password')
|
|
192
|
+ Cookies.remove('rememberMe')
|
144
|
193
|
}
|
145
|
|
- this.$store.dispatch("Login", this.loginForm).then(() => {
|
146
|
|
- this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
147
|
|
- }).catch(() => {
|
148
|
|
- this.loading = false;
|
149
|
|
- if (this.captchaEnabled) {
|
150
|
|
- this.getCode();
|
151
|
|
- }
|
152
|
|
- });
|
|
194
|
+ this.$store
|
|
195
|
+ .dispatch('Login', this.loginForm)
|
|
196
|
+ .then(() => {
|
|
197
|
+ this.$router.push({ path: this.redirect || '/' }).catch(() => {})
|
|
198
|
+ })
|
|
199
|
+ .catch(() => {
|
|
200
|
+ this.loading = false
|
|
201
|
+ if (this.captchaEnabled) {
|
|
202
|
+ this.getCode()
|
|
203
|
+ }
|
|
204
|
+ })
|
153
|
205
|
}
|
154
|
|
- });
|
|
206
|
+ })
|
155
|
207
|
}
|
156
|
208
|
}
|
157
|
|
-};
|
|
209
|
+}
|
158
|
210
|
</script>
|
159
|
211
|
|
160
|
212
|
<style rel="stylesheet/scss" lang="scss">
|
|
@@ -163,7 +215,7 @@ export default {
|
163
|
215
|
justify-content: center;
|
164
|
216
|
align-items: center;
|
165
|
217
|
height: 100%;
|
166
|
|
- background-image: url("https://p0.itc.cn/q_70/images01/20230524/6b270ac81ed14eba8b32184ef268358f.jpeg");
|
|
218
|
+ background-image: url('https://p0.itc.cn/q_70/images01/20230524/6b270ac81ed14eba8b32184ef268358f.jpeg');
|
167
|
219
|
background-size: cover;
|
168
|
220
|
}
|
169
|
221
|
|