Browse Source

登录

gzb
guozhongbo 9 months ago
parent
commit
c95c605cee

+ 12149
- 27
package-lock.json
File diff suppressed because it is too large
View File


+ 1
- 3
public/config.js View File

@@ -3,10 +3,9 @@ window._config = window.isTest
3 3
   ? {
4 4
       // 测试环境
5 5
       webUrl: "https://xhbitest.xhkjedu.com/",
6
-      baseUrl: "https://xhbiapitest.xhkjedu.com/",
6
+      baseUrl: "http://49.4.26.249:8331/",
7 7
       baseImageUrl: "https://xhbifiletest.xhkjedu.com/",
8 8
       showImageUrl: "https://xhbistatictest.xhkjedu.com/",
9
-      useMicroservice: true, // 是否使用微服务
10 9
       axiosApiTimeout: 60, // 接口超时时间 单位秒
11 10
       axiosFileTimeout: 120, // 上传文件超时时间 单位秒
12 11
       // 开发者
@@ -22,7 +21,6 @@ window._config = window.isTest
22 21
       baseUrl: "https://xhbiapi.xhkjedu.com/",
23 22
       baseImageUrl: "https://xhbifile.xhkjedu.com/",
24 23
       showImageUrl: "https://xhbistatic.xhkjedu.com/",
25
-      useMicroservice: true, // 是否使用微服务
26 24
       axiosApiTimeout: 20, // 接口超时时间 单位秒
27 25
       axiosFileTimeout: 30, // 上传文件超时时间 单位秒
28 26
       // 开发者

+ 10
- 0
src/api/admin.js View File

@@ -0,0 +1,10 @@
1
+import { admin_url } from "@/utils/httpRequest";
2
+
3
+/**
4
+ * 1.0.1管理员--账号登录
5
+ */
6
+export const admin_login = (data) => admin_url("admin/login", data);
7
+/**
8
+ * 1.0.4管理员--生成图片验证码
9
+ */
10
+export const img_code = (data) => admin_url("admin/img_code", data);

+ 6
- 0
src/api/appgroup.js View File

@@ -0,0 +1,6 @@
1
+import { appgroup_url } from "@/utils/httpRequest";
2
+
3
+/**
4
+ * 1.0.1管理员--账号登录
5
+ */
6
+export const admin_login = (data) => appgroup_url("admin/login", data);

+ 6
- 0
src/api/region.js View File

@@ -0,0 +1,6 @@
1
+import { region_url } from "@/utils/httpRequest";
2
+
3
+/**
4
+ * 1.0.1管理员--账号登录
5
+ */
6
+export const admin_login = (data) => region_url("admin/login", data);

+ 0
- 279
src/api/system.js View File

@@ -1,279 +0,0 @@
1
-import { ssystem_url } from "@/utils/httpRequest";
2
-
3
-/**
4
- * 用户登录
5
- */
6
-export const login_login = (data) => ssystem_url("login/login", data);
7
-/**
8
- * 用户退出/断开连接
9
- */
10
-export const login_out = (data) => ssystem_url("login/out", data);
11
-/**
12
- *1.2.6分组--用户列表(分享用)
13
- */
14
-export const group_list_gu = (data) => ssystem_url("group/list_gu", data);
15
-/**
16
- * 1.3.1角色--选择列表(分享用)
17
- */
18
-export const role_list_sel = (data) => ssystem_url("role/list_sel", data);
19
-/**
20
- * 4.1.2参数--保存
21
- */
22
-export const dict_add_dict = (data) => ssystem_url("dict/add_dict", data);
23
-/**
24
- * 4.1.3参数--详情
25
- */
26
-export const dict_detail = (data) => ssystem_url("dict/detail", data);
27
-/**
28
- * 4.1.3.2参数--属性
29
- */
30
-export const dict_property = (data) => ssystem_url("dict/property", data);
31
-/**
32
- * 4.1.3.3参数--更新
33
- */
34
-export const dict_edit = (data) => ssystem_url("dict/edit", data);
35
-/**
36
- * 4.1.2.2参数--保存参数详情
37
- */
38
-export const dict_add_detail = (data) => ssystem_url("dict/add_detail", data);
39
-/**
40
- * 4.1.1参数--列表
41
- */
42
-export const dict_list_sel = (data) => ssystem_url("dict/list_sel", data);
43
-/**
44
- * 4.1.4参数--数据列表
45
- */
46
-export const dict_list_data = (data) => ssystem_url("dict/list_data", data);
47
-/**
48
- * 4.1.6参数--分页列表
49
- */
50
-export const dict_list = (data) => ssystem_url("dict/list", data);
51
-/**
52
- * 4.1.7参数--删除
53
- */
54
-export const dict_delete = (data) => ssystem_url("dict/delete", data);
55
-/**
56
- * 4.1.8参数--移动
57
- */
58
-export const dict_move = (data) => ssystem_url("dict/move", data);
59
-/**
60
- * 4.2.3地区--根据名称获取编码
61
- */
62
-export const areazone_get_code = (data) =>
63
-  ssystem_url("areazone/get_code", data);
64
-/**
65
- * 1.1.1用户--列表
66
- */
67
-export const user_list = (data) => ssystem_url("user/list", data);
68
-/**
69
- * 1.1.2用户--添加
70
- */
71
-export const user_add = (data) => ssystem_url("user/add", data);
72
-/**
73
- * 1.1.3用户--更新
74
- */
75
-export const user_edit = (data) => ssystem_url("user/edit", data);
76
-/**
77
- * 1.1.3.2用户--改头像
78
- */
79
-export const user_edit_userpic = (data) =>
80
-  ssystem_url("user/edit_userpic", data);
81
-/**
82
- * 1.1.4用户--删除
83
- */
84
-export const user_delete = (data) => ssystem_url("user/delete", data);
85
-/**
86
- * 1.1.5用户--移除分组
87
- */
88
-export const user_remove_group = (data) =>
89
-  ssystem_url("user/remove_group", data);
90
-/**
91
- * 1.1.5.2用户--分组列表
92
- */
93
-export const user_list_group = (data) => ssystem_url("user/list_group", data);
94
-/**
95
- * 1.1.6.2用户--角色列表
96
- */
97
-export const user_list_role = (data) => ssystem_url("user/list_role", data);
98
-/**
99
- * 1.1.7用户--修改手机号
100
- */
101
-export const user_edit_phone = (data) => ssystem_url("user/edit_phone", data);
102
-/**
103
- * 1.1.8用户--修改密码
104
- */
105
-export const user_edit_pwd = (data) => ssystem_url("user/edit_pwd", data);
106
-/**
107
- * 1.1.9用户--获取验证码
108
- */
109
-export const user_get_code = (data) => ssystem_url("user/get_code", data);
110
-/**
111
- * 1.1.10用户--功能菜单
112
- */
113
-export const power_list_user = (data) => ssystem_url("power/list_user", data);
114
-/**
115
- * 1.2.1分组--列表
116
- */
117
-export const group_list = (data) => ssystem_url("group/list", data);
118
-/**
119
- * 1.2.2分组--添加
120
- */
121
-export const group_add = (data) => ssystem_url("group/add", data);
122
-/**
123
- * 1.2.3分组--更新
124
- */
125
-export const group_edit = (data) => ssystem_url("group/edit", data);
126
-/**
127
- * 1.2.4分组--删除
128
- */
129
-export const group_delete = (data) => ssystem_url("group/delete", data);
130
-/**
131
- * 1.3.1角色--列表
132
- */
133
-export const role_list = (data) => ssystem_url("role/list", data);
134
-/**
135
- * 1.3.2角色--添加
136
- */
137
-export const role_add = (data) => ssystem_url("role/add", data);
138
-/**
139
- * 1.3.2.2角色--添加角色分组用户
140
- */
141
-export const role_add_group_user = (data) =>
142
-  ssystem_url("role/add_group_user", data);
143
-/**
144
- * 1.3.2.3角色--获取角色分组用户
145
- */
146
-export const role_list_gu = (data) => ssystem_url("role/list_gu", data);
147
-/**
148
- * 1.3.2.4角色--角色分组用户选择列表
149
- */
150
-export const role_list_gu_sel = (data) => ssystem_url("role/list_gu_sel", data);
151
-/**
152
- * 1.3.2.5角色--权限选择列表
153
- */
154
-export const power_list_sel = (data) => ssystem_url("power/list_sel", data);
155
-/**
156
- * 1.3.2.6角色--角色权限列表
157
- */
158
-export const role_list_power = (data) => ssystem_url("role/list_power", data);
159
-/**
160
- * 1.3.2.7角色--保存角色权限
161
- */
162
-export const role_add_power = (data) => ssystem_url("role/add_power", data);
163
-/**
164
- * 1.3.2.9 角色--角色资源保存
165
- */
166
-export const roletree_add = (data) => ssystem_url("roletree/add", data);
167
-/**
168
- * 1.3.2.10 角色--角色资源
169
- */
170
-export const roletree_list_role = (data) =>
171
-  ssystem_url("roletree/list_role", data);
172
-/**
173
- * 1.3.3角色--更新
174
- */
175
-export const role_edit = (data) => ssystem_url("role/edit", data);
176
-/**
177
- * 1.3.4角色--删除
178
- */
179
-export const role_delete = (data) => ssystem_url("role/delete", data);
180
-/**
181
- * 1.3.5角色--添加分组
182
- */
183
-export const role_add_group = (data) => ssystem_url("role/add_group", data);
184
-/**
185
- * 1.3.6角色--添加用户
186
- */
187
-export const role_add_user = (data) => ssystem_url("role/add_user", data);
188
-/**
189
- * 1.4.0会话--列表
190
- */
191
-export const user_session_list = (data) =>
192
-  ssystem_url("user_session/list", data);
193
-/**
194
- * 1.4.1会话--单独断开
195
- */
196
-export const user_login_out = (data) => ssystem_url("login/out", data);
197
-/**
198
- * 1.4.2会话--批量断开
199
- */
200
-export const user_session_batch_out = (data) =>
201
-  ssystem_url("user_session/batch_out", data);
202
-/**
203
- * 1.4.3用户--校验用户登录状态
204
- */
205
-export const user_check_login = (data) => ssystem_url("user/check_login", data);
206
-/**
207
- * 1.4.4消息推送--列表
208
- */
209
-export const notice_list = (data) => ssystem_url("notice/list", data);
210
-/**
211
- * 1.4.5消息推送--发送
212
- */
213
-export const notice_send = (data) => ssystem_url("notice/send", data);
214
-/**
215
- * 1.4.6消息推送--删除
216
- */
217
-export const notice_delete = (data) => ssystem_url("notice/delete", data);
218
-/**
219
- * 1.4.7消息推送--置顶
220
- */
221
-export const notice_toped = (data) => ssystem_url("notice/toped", data);
222
-/**
223
- * 1.4.8消息推送--取消置顶
224
- */
225
-export const notice_untoped = (data) => ssystem_url("notice/untoped", data);
226
-/**
227
- * 1.4.9消息推送--批量删除
228
- */
229
-export const notice_deletebatch = (data) =>
230
-  ssystem_url("notice/deletebatch", data);
231
-/**
232
- * 1.4.9消息推送--新增
233
- */
234
-export const notice_add = (data) => ssystem_url("notice/add", data);
235
-/**
236
- * 1.4.10消息推送--编辑
237
- */
238
-export const notice_edit = (data) => ssystem_url("notice/edit", data);
239
-/**
240
- * 1.4.11消息推送--详情
241
- */
242
-export const notice_detail = (data) => ssystem_url("notice/detail", data);
243
-/**
244
- * 1.4.12消息推送--用户列表
245
- */
246
-export const notice_list_user = (data) => ssystem_url("notice/list_user", data);
247
-/**
248
- * 1.4.13消息推送--用户详情
249
- */
250
-export const notice_detail_user = (data) =>
251
-  ssystem_url("notice/detail_user", data);
252
-/**
253
- * 9.1.1 脱敏规则--列表
254
- */
255
-export const tm_list = (data) => ssystem_url("tm/list", data);
256
-/**
257
- * 9.1.2 脱敏规则--添加
258
- */
259
-export const tm_add = (data) => ssystem_url("tm/add", data);
260
-/**
261
- * 9.1.3 脱敏规则--修改
262
- */
263
-export const tm_edit = (data) => ssystem_url("tm/edit", data);
264
-/**
265
- * 9.1.4 脱敏规则--删除
266
- */
267
-export const tm_delete = (data) => ssystem_url("tm/delete", data);
268
-/**
269
- * 9.1.5 脱敏规则--详情
270
- */
271
-export const tm_detail = (data) => ssystem_url("tm/detail", data);
272
-/**
273
- * 9.1.6 脱敏规则--移动
274
- */
275
-export const tm_move = (data) => ssystem_url("tm/move", data);
276
-/**
277
- * 9.1.7 脱敏规则--属性
278
- */
279
-export const tm_attr = (data) => ssystem_url("tm/attr", data);

BIN
src/assets/img/login/bj.png View File


+ 2
- 0
src/assets/img/login/close.svg View File

@@ -0,0 +1,2 @@
1
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1651715334338" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6028" width="600" height="600" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css">@font-face { font-family: feedback-iconfont; src: url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff2?t=1630033759944") format("woff2"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff?t=1630033759944") format("woff"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.ttf?t=1630033759944") format("truetype"); }
2
+</style></defs><path d="M512.022187 546.417778c-184.177778 0-368.071111-55.921778-499.114667-167.537778a37.575111 37.575111 0 0 1-3.498667-53.162667 37.944889 37.944889 0 0 1 53.418667-3.470222c231.082667 198.826667 668.302222 198.826667 898.389333 0a37.944889 37.944889 0 0 1 53.418667 3.470222c13.767111 15.644444 12.231111 39.452444-3.498667 53.191111C880.093298 490.496 696.199964 546.417778 512.022187 546.417778z m-136.760889 164.522666a30.833778 30.833778 0 0 1-6.741334 0c-10.325333-1.422222-19.626667-7.111111-25.543111-15.644444-5.944889-8.561778-7.964444-19.228444-5.632-29.354667l24.945778-146.631111a37.973333 37.973333 0 0 1 43.918222-30.805333 37.831111 37.831111 0 0 1 30.947556 43.747555l-24.945778 146.602667a37.376 37.376 0 0 1-36.949333 32.085333z m561.009778-74.581333c-9.955556 0-19.512889-4.039111-26.453334-11.178667l-123.022222-124.245333a37.176889 37.176889 0 0 1 16.042667-64.455111 37.546667 37.546667 0 0 1 37.091555 12.259556l123.050667 124.245333c14.592 14.563556 14.592 38.144 0 52.707555-7.224889 6.826667-16.782222 10.638222-26.737778 10.666667z m-848.497778 0a38.997333 38.997333 0 0 1-24.945778-10.666667 37.176889 37.176889 0 0 1 0-52.707555l123.022222-124.245333a37.518222 37.518222 0 0 1 67.470222 14.136888 37.205333 37.205333 0 0 1-15.815111 38.058667l-123.022222 124.245333a37.006222 37.006222 0 0 1-26.709333 11.178667z m562.744889 74.581333a37.376 37.376 0 0 1-36.693334-30.833777l-24.945777-146.631111a37.176889 37.176889 0 0 1 9.756444-38.826667 37.546667 37.546667 0 0 1 39.424-7.68c13.539556 5.319111 22.755556 17.92 23.694222 32.341333l24.945778 146.631111c1.820444 9.728-0.341333 19.768889-6.030222 27.904-5.688889 8.135111-14.364444 13.653333-24.177778 15.36a30.805333 30.805333 0 0 1-5.973333 1.706667z" p-id="6029" fill="#999999"></path></svg>

BIN
src/assets/img/login/code.png View File


BIN
src/assets/img/login/logo.png View File


+ 2
- 0
src/assets/img/login/open.svg View File

@@ -0,0 +1,2 @@
1
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1651715361431" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6231" xmlns:xlink="http://www.w3.org/1999/xlink" width="600" height="600"><defs><style type="text/css">@font-face { font-family: feedback-iconfont; src: url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff2?t=1630033759944") format("woff2"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff?t=1630033759944") format("woff"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.ttf?t=1630033759944") format("truetype"); }
2
+</style></defs><path d="M1018.737778 480.711111s-4.266667-12.8-8.533334-17.066667l-21.333333-42.666666c-21.333333-34.133333-51.2-76.8-93.866667-123.733334C813.937778 207.644444 685.937778 113.777778 511.004444 113.777778s-302.933333 93.866667-384 183.466666c-42.666667 46.933333-72.533333 89.6-93.866666 123.733334-8.533333 17.066667-17.066667 29.866667-21.333334 42.666666-4.266667 4.266667-8.533333 17.066667-8.533333 17.066667-4.266667 12.8-4.266667 25.6 0 34.133333 0 0 4.266667 12.8 8.533333 17.066667l21.333334 42.666667c21.333333 34.133333 51.2 76.8 93.866666 123.733333 81.066667 89.6 209.066667 183.466667 384 183.466667s302.933333-93.866667 384-183.466667c42.666667-46.933333 72.533333-89.6 93.866667-123.733333 8.533333-17.066667 17.066667-29.866667 21.333333-42.666667 4.266667-4.266667 8.533333-17.066667 8.533334-17.066667 4.266667-12.8 4.266667-21.333333 0-34.133333z m-102.4 46.933333c-17.066667 29.866667-46.933333 72.533333-81.066667 110.933334-76.8 81.066667-183.466667 157.866667-324.266667 157.866666s-247.466667-76.8-324.266666-157.866666c-38.4-38.4-64-81.066667-81.066667-110.933334-8.533333-12.8-12.8-21.333333-17.066667-29.866666 4.266667-8.533333 8.533333-17.066667 17.066667-29.866667 21.333333-29.866667 46.933333-72.533333 81.066667-110.933333C263.537778 275.911111 370.204444 199.111111 511.004444 199.111111s247.466667 76.8 324.266667 157.866667c38.4 38.4 64 81.066667 81.066667 110.933333 8.533333 12.8 12.8 21.333333 17.066666 29.866667-4.266667 8.533333-12.8 17.066667-17.066666 29.866666z" p-id="6232" fill="#999999"></path><path d="M511.004444 344.177778c-76.8 0-145.066667 68.266667-145.066666 153.6 0 85.333333 68.266667 153.6 145.066666 153.6 76.8 0 145.066667-68.266667 145.066667-153.6 0-85.333333-68.266667-153.6-145.066667-153.6z m-230.4 153.6c0-128 102.4-238.933333 230.4-238.933334s230.4 110.933333 230.4 238.933334-102.4 238.933333-230.4 238.933333-230.4-110.933333-230.4-238.933333z" p-id="6233" fill="#999999"></path></svg>

BIN
src/assets/img/login/pw.png View File


BIN
src/assets/img/login/user.png View File


+ 10
- 36
src/utils/httpRequest.js View File

@@ -101,64 +101,38 @@ http.interceptors.response.use(
101 101
   }
102 102
 );
103 103
 /**
104
- * @param {*} prefix 微服务前缀
105 104
  * @param {*} url 不带前缀的url
106 105
  * @param {*} data 传参
107 106
  * @returns Promise
108 107
  */
109
-const setRequest = ({ prefix, url, data }) =>
108
+const setRequest = ({ url, data }) =>
110 109
   http({
111
-    url: `${window._config.baseUrl}${
112
-      window._config.useMicroservice ? prefix : ""
113
-    }${url}`,
110
+    url: `${window._config.baseUrl}${url}`,
114 111
     method: "post",
115 112
     data: data || {}
116 113
   });
117 114
 /**
118
- * 微服务前缀 sdatasource/
119 115
  * @param {*} url 不带前缀的url
120 116
  * @param {*} data 传参
121 117
  * @returns Promise
122 118
  */
123
-export const sdatasource_url = (url, data) =>
119
+//管理员
120
+export const admin_url = (url, data) =>
124 121
   setRequest({
125
-    prefix: "sdatasource/",
126 122
     url,
127 123
     data
128 124
   });
129
-/**
130
- * 微服务前缀 ssystem/
131
- * @param {*} url 不带前缀的url
132
- * @param {*} data 传参
133
- * @returns Promise
134
- */
135
-export const ssystem_url = (url, data) =>
136
-  setRequest({
137
-    prefix: "ssystem/",
138
-    url,
139
-    data
140
-  });
141
-/**
142
- * 微服务前缀 sdataintegration/
143
- * @param {*} url 不带前缀的url
144
- * @param {*} data 传参
145
- * @returns Promise
146
- */
147
-export const sdataintegration_url = (url, data) =>
125
+
126
+//区域
127
+export const region_url = (url, data) =>
148 128
   setRequest({
149
-    prefix: "sdataintegration/",
150 129
     url,
151 130
     data
152 131
   });
153
-/**
154
- * 微服务前缀 sanalysis/
155
- * @param {*} url 不带前缀的url
156
- * @param {*} data 传参
157
- * @returns Promise
158
- */
159
-export const sanalysis_url = (url, data) =>
132
+
133
+//应用
134
+export const appgroup_url = (url, data) =>
160 135
   setRequest({
161
-    prefix: "sanalysis/",
162 136
     url,
163 137
     data
164 138
   });

+ 470
- 4
src/views/login/login.vue View File

@@ -1,14 +1,480 @@
1 1
 <template>
2
-  <div></div>
2
+  <div class="wrap">
3
+    <div class="logo">
4
+      <img class="logo_img" src="../../assets/img/login/logo.png" />
5
+      <span class="logo_title">星火云鸽管控平台</span>
6
+    </div>
7
+    <div class="loginInner">
8
+      <div class="welcome">欢迎登录</div>
9
+      <!--      <div class="login_type">-->
10
+      <!--        <div @click="usertype = 1" :class="[usertype == 1 ? 'active' : '']">-->
11
+      <!--          账号登录-->
12
+      <!--        </div>-->
13
+      <!--        <div @click="usertype = 2" :class="[usertype == 2 ? 'active' : '']">-->
14
+      <!--          验证码登录-->
15
+      <!--        </div>-->
16
+      <!--      </div>-->
17
+      <Form ref="loginForm" :model="loginForm" :rules="formRules">
18
+        <FormItem prop="loginname">
19
+          <img class="img" src="../../assets/img/login/user.png" alt="" />
20
+          <Input
21
+            v-model="loginForm.loginname"
22
+            clearable
23
+            @keyup.enter.native="login_by_username('loginForm')"
24
+            placeholder="请输入账号"
25
+          />
26
+        </FormItem>
27
+        <FormItem prop="loginpwd">
28
+          <img class="img" src="../../assets/img/login/pw.png" alt="" />
29
+          <Input
30
+            type="password"
31
+            class="show_input"
32
+            oncopy="return false"
33
+            onpaste="return false"
34
+            oncut="return false"
35
+            v-model="loginForm.loginpwd"
36
+            @keyup.enter.native="login_by_username('loginForm')"
37
+            placeholder="请输入密码"
38
+          />
39
+          <div class="pwd">
40
+            <img
41
+              v-if="show_pw"
42
+              @click="togglePw"
43
+              src="../../assets/img/login/open.svg"
44
+              alt=""
45
+            />
46
+            <img
47
+              v-else
48
+              @click="togglePw"
49
+              src="../../assets/img/login/close.svg"
50
+              alt=""
51
+            />
52
+          </div>
53
+        </FormItem>
54
+        <FormItem prop="msgcode" class="changecode">
55
+          <img class="img" src="../../assets/img/login/code.png" alt="" />
56
+          <Input
57
+            v-model="loginForm.msgcode"
58
+            class="input"
59
+            @keyup.enter.native="login_by_username('loginForm')"
60
+            v-noFill
61
+            readonly
62
+            placeholder="请输入验证码"
63
+          />
64
+          <img
65
+            v-if="code_info.base64Str"
66
+            class="code_img"
67
+            :src="code_info.base64Str"
68
+            @click="getCodeImg()"
69
+            title="点击刷新验证码"
70
+          />
71
+          <span class="emit_code" v-else @click="getCodeImg()">获取验证码</span>
72
+        </FormItem>
73
+        <FormItem class="btn_bottom">
74
+          <Checkbox v-model="pwd">记住密码</Checkbox>
75
+        </FormItem>
76
+      </Form>
77
+      <Button
78
+        :loading="wait_flag"
79
+        type="primary"
80
+        @click.enter="login_by_username('loginForm')"
81
+        >登&nbsp;录</Button
82
+      >
83
+    </div>
84
+  </div>
3 85
 </template>
4 86
 
5 87
 <script>
88
+import { img_code } from "@/api/admin";
89
+
90
+const Base64 = require("js-base64").Base64;
6 91
 export default {
7 92
   data() {
8
-    return {};
93
+    // 手机号验证
94
+    const phoneCheck = async (rule, value, callback) => {
95
+      var filter = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
96
+      this.isemit = false;
97
+      if (!value) {
98
+        return callback(new Error("手机号码不能为空"));
99
+      }
100
+      let blnTest = filter.test(value);
101
+      if (!blnTest) {
102
+        return callback(new Error("手机号码格式不正确"));
103
+      } else {
104
+        this.isemit = true;
105
+      }
106
+    };
107
+    return {
108
+      code_info: {
109
+        base64Str: "",
110
+        msgcode: ""
111
+      },
112
+      usertype: 1,
113
+      time1: null,
114
+      isemit: false,
115
+      userInfo: {},
116
+      wait_flag: false,
117
+      loginForm: {
118
+        loginname: "",
119
+        loginpwd: "",
120
+        msgcode: "",
121
+        phone: ""
122
+      },
123
+      formRules: {
124
+        loginname: [
125
+          { required: true, message: "账号不能为空", trigger: "blur" },
126
+          {
127
+            min: 4,
128
+            max: 18,
129
+            message: "账号长度为4~18个字符"
130
+          }
131
+        ],
132
+        loginpwd: [
133
+          { required: true, message: "密码不能为空", trigger: "blur" },
134
+          {
135
+            min: 6,
136
+            max: 16,
137
+            message: "密码长度为6~16个字符"
138
+          }
139
+        ],
140
+        phone: [{ required: true, validator: phoneCheck, trigger: "blur" }],
141
+        msgcode: [
142
+          { required: true, message: "短信验证码不能为空", trigger: "blur" }
143
+        ]
144
+      },
145
+      pwd: false,
146
+      show_pw: false,
147
+      time: 0
148
+    };
149
+  },
150
+  directives: {
151
+    // 防止input输入框自动填充
152
+    noFill: {
153
+      inserted: (el) => {
154
+        let inputEl = el.getElementsByTagName("input")[0];
155
+        if (inputEl) {
156
+          inputEl.addEventListener("focus", () => {
157
+            inputEl.removeAttribute("readonly");
158
+          });
159
+          inputEl.addEventListener("blur", () => {
160
+            inputEl.setAttribute("readonly", "readonly");
161
+          });
162
+        }
163
+      }
164
+    }
165
+  },
166
+  created() {
167
+    // this.$removeEncodeStorage("userInfo");
168
+    // 在页面加载时从cookie获取登录信息
169
+    let loginname = this.getCookie("loginname");
170
+    let loginpwd = Base64.decode(this.getCookie("loginpwd"));
171
+    // 如果存在赋值给表单,并且将记住密码勾选
172
+    if (loginname) {
173
+      this.loginForm.loginname = loginname;
174
+      this.loginForm.loginpwd = loginpwd;
175
+      this.pwd = true;
176
+    }
177
+  },
178
+  watch: {
179
+    time() {
180
+      if (this.time == 0) {
181
+        if (this.time1) {
182
+          clearInterval(this.time1);
183
+        }
184
+      }
185
+    }
186
+  },
187
+  mounted() {
188
+    window.addEventListener("copy", this.inputHandle);
189
+    window.addEventListener("paste", this.inputHandle);
190
+    window.addEventListener("cut", this.inputHandle);
191
+  },
192
+  beforeDestroy() {
193
+    window.removeEventListener("copy", this.inputHandle);
194
+    window.removeEventListener("paste", this.inputHandle);
195
+    window.removeEventListener("cut", this.inputHandle);
196
+    clearInterval(this.time1);
9 197
   },
10
-  methods: {}
198
+  methods: {
199
+    //获取验证码
200
+    getCodeImg() {
201
+      if (!this.loginForm.loginname) {
202
+        this.$Message.error("请输入账号");
203
+        return;
204
+      }
205
+      img_code({
206
+        loginname: this.loginForm.loginname
207
+      }).then((data) => {
208
+        console.log(data);
209
+        if (data.code === 0) {
210
+          this.code_info = data.obj;
211
+        } else {
212
+          this.$Message.error(data.msg);
213
+        }
214
+      });
215
+    },
216
+    inputHandle() {
217
+      let edit = document.querySelector(".show_input");
218
+      edit.oncopy = function () {
219
+        return false;
220
+      };
221
+      edit.onpaste = function () {
222
+        return false;
223
+      };
224
+      edit.oncut = function () {
225
+        return false;
226
+      };
227
+    },
228
+    //切换眼睛
229
+    togglePw() {
230
+      this.show_pw = !this.show_pw;
231
+      let input = document.querySelector(".show_input input");
232
+      if (this.show_pw) {
233
+        input.setAttribute("type", "text");
234
+      } else {
235
+        input.setAttribute("type", "password");
236
+      }
237
+    },
238
+    //登录
239
+    login_by_username(name) {
240
+      let that = this;
241
+      this.$refs[name].validate((valid) => {
242
+        if (valid) {
243
+          if (
244
+            this.loginForm.msgcode.toLowerCase() !==
245
+            this.code_info.msgcode.toLowerCase()
246
+          ) {
247
+            this.$Message.error("验证码不正确");
248
+            return;
249
+          }
250
+          this.wait_flag = true;
251
+        }
252
+      });
253
+    },
254
+    // 记住密码功能
255
+    set_userInfo() {
256
+      if (this.pwd) {
257
+        this.setCookie("loginname", this.loginForm.loginname, 86400);
258
+        this.setCookie("usertype", this.loginForm.usertype, 86400);
259
+        // base64加密密码
260
+        let loginpwd = Base64.encode(this.loginForm.loginpwd);
261
+        this.setCookie("loginpwd", loginpwd, 86400);
262
+      } else {
263
+        this.setCookie("loginname", "");
264
+        this.setCookie("loginpwd", "");
265
+      }
266
+    },
267
+    //验证码登录
268
+    go_type() {},
269
+    //忘记密码
270
+    tousecrt() {},
271
+    // 获取cookie
272
+    getCookie: function (key) {
273
+      if (document.cookie.length > 0) {
274
+        var start = document.cookie.indexOf(key + "=");
275
+        if (start !== -1) {
276
+          start = start + key.length + 1;
277
+          var end = document.cookie.indexOf(";", start);
278
+          if (end === -1) end = document.cookie.length;
279
+          return unescape(document.cookie.substring(start, end));
280
+        }
281
+      }
282
+      return "";
283
+    },
284
+    // 保存cookie
285
+    setCookie: function (cName, value, expiredays) {
286
+      var exdate = new Date();
287
+      exdate.setDate(exdate.getDate() + expiredays);
288
+      document.cookie =
289
+        cName +
290
+        "=" +
291
+        decodeURIComponent(value) +
292
+        (expiredays == null ? "" : ";expires=" + exdate.toGMTString());
293
+    }
294
+  }
11 295
 };
12 296
 </script>
13 297
 
14
-<style lang="less" scoped></style>
298
+<style lang="less" scoped>
299
+.wrap {
300
+  height: 100%;
301
+  background: url("../../assets/img/login/bj.png") no-repeat;
302
+  background-size: 100% 100%;
303
+  position: relative;
304
+  .logo {
305
+    position: absolute;
306
+    top: 70px;
307
+    left: 60px;
308
+    width: 300px;
309
+    height: 50px;
310
+    display: flex;
311
+    align-items: center;
312
+    .logo_img {
313
+      width: 45px;
314
+      height: 45px;
315
+      margin-right: 10px;
316
+    }
317
+    .logo_title {
318
+      color: #414354;
319
+      font-size: 20px;
320
+      font-weight: 700;
321
+      font-family: "HarmonyOSSansSC";
322
+    }
323
+  }
324
+  .loginInner {
325
+    width: 400px;
326
+    height: 440px;
327
+    padding: 40px;
328
+    border-radius: 20px;
329
+    opacity: 0.88;
330
+    background: #ffffff;
331
+    box-shadow: 0 0 18px 0 #deeaffe0;
332
+    position: absolute;
333
+    right: 160px;
334
+    bottom: 160px;
335
+    .welcome {
336
+      height: 30px;
337
+      color: #000000;
338
+      font-size: 24px;
339
+      font-family: "AlibabaPuHuiTi";
340
+      text-align: center;
341
+    }
342
+    .login_type {
343
+      height: 40px;
344
+      display: flex;
345
+      justify-content: center;
346
+      align-items: center;
347
+      margin-bottom: 10px;
348
+      div {
349
+        color: #7c8db5;
350
+        font-size: 16px;
351
+        font-family: "SourceHanSansCN";
352
+        cursor: pointer;
353
+        &:first-of-type {
354
+          margin-right: 20px;
355
+        }
356
+      }
357
+      .active {
358
+        color: #253a70;
359
+        position: relative;
360
+        &::after {
361
+          display: block;
362
+          content: "";
363
+          height: 2px;
364
+          width: 30px;
365
+          background-color: #339dff;
366
+          position: absolute;
367
+          top: 24px;
368
+          left: 30%;
369
+        }
370
+      }
371
+    }
372
+    /deep/ .ivu-form {
373
+      .ivu-form-item {
374
+        .ivu-form-item-content {
375
+          position: relative;
376
+          .img {
377
+            position: absolute;
378
+            z-index: 33;
379
+            width: 16px;
380
+            height: 16px;
381
+            top: 12px;
382
+            left: 15px;
383
+          }
384
+          .ivu-input-wrapper {
385
+            width: 100%;
386
+            // height: 47px;
387
+            input {
388
+              &:-moz-placeholder {
389
+                color: #999 !important;
390
+              }
391
+            }
392
+            .ivu-input {
393
+              height: 40px;
394
+              padding-left: 40px;
395
+            }
396
+            .ivu-input-icon {
397
+              line-height: 50px;
398
+            }
399
+            .ivu-input-icon-clear {
400
+              line-height: 50px;
401
+            }
402
+            // padding-left: 20px;
403
+          }
404
+          .ivu-checkbox-wrapper {
405
+            span {
406
+              font-size: 15px;
407
+              font-family: "Microsoft YaHei";
408
+              font-weight: 400;
409
+              color: rgba(136, 136, 136, 1);
410
+              line-height: 17px;
411
+            }
412
+          }
413
+          .pwd {
414
+            position: absolute;
415
+            z-index: 33;
416
+            width: 16px;
417
+            height: 16px;
418
+            top: 12px;
419
+            right: 15px;
420
+          }
421
+          .pwd img {
422
+            width: 16px;
423
+            height: 16px;
424
+            vertical-align: top;
425
+            cursor: pointer;
426
+          }
427
+        }
428
+      }
429
+      .btn_bottom {
430
+        height: 32px;
431
+        .ivu-form-item-content {
432
+          display: flex;
433
+          justify-content: space-between;
434
+          a {
435
+            //color: @theme_color;
436
+          }
437
+        }
438
+      }
439
+    }
440
+    /deep/ .ivu-btn {
441
+      width: 100%;
442
+      height: 40px;
443
+      span {
444
+        font-size: 18px;
445
+        font-family: "Microsoft YaHei";
446
+        font-weight: 400;
447
+        color: rgba(255, 255, 255, 1);
448
+      }
449
+    }
450
+    .changecode {
451
+      display: flex;
452
+      /deep/ .ivu-form-item-content {
453
+        width: 100%;
454
+        .input {
455
+          width: calc(100% - 120px) !important;
456
+          margin-right: 10px;
457
+        }
458
+        .emit_code {
459
+          display: inline-block;
460
+          width: 110px;
461
+          line-height: 40px;
462
+          height: 40px;
463
+          text-align: center;
464
+          border: 1px solid #339dff;
465
+          border-radius: 6px;
466
+          cursor: pointer;
467
+          color: #339dff;
468
+          vertical-align: bottom;
469
+        }
470
+        .code_img {
471
+          width: 110px;
472
+          height: 40px;
473
+          cursor: pointer;
474
+          vertical-align: bottom;
475
+        }
476
+      }
477
+    }
478
+  }
479
+}
480
+</style>

Loading…
Cancel
Save