|
|
@@ -1,55 +1,92 @@
|
|
1
|
1
|
<template>
|
|
2
|
2
|
<div class="content flex space-x-4">
|
|
3
|
3
|
<div class="flex-1 basis-1/2 flex items-center justify-center">
|
|
4
|
|
-
|
|
5
|
4
|
<div
|
|
6
|
|
- class="w-[50%] h-[50%] min-w-[450px] min-h-[450px] pl-120px font-size-34px border-rd-[12px]">
|
|
7
|
|
- <img alt="" class="w-[400px] h-50px" src="@/assets/system/logo.png"/>
|
|
|
5
|
+ class="w-[50%] h-[50%] min-w-[450px] min-h-[450px] pl-120px font-size-34px border-rd-[12px]"
|
|
|
6
|
+ >
|
|
|
7
|
+ <img alt="" class="w-[400px] h-50px" src="@/assets/system/logo.png" />
|
|
8
|
8
|
</div>
|
|
9
|
9
|
</div>
|
|
10
|
10
|
<div class="flex-1 basis-1/2 flex items-center justify-center">
|
|
11
|
|
- <div
|
|
12
|
|
- class="w-[50%] min-w-[450px] pl-40px pr-40px font-size-34px bg-[#fff] border-rd-[12px]">
|
|
|
11
|
+ <div class="w-[50%] min-w-[450px] pl-40px pr-40px font-size-34px bg-[#fff] border-rd-[12px]">
|
|
13
|
12
|
<div
|
|
14
|
|
- class="w-full lh-130px h-[25%] "
|
|
15
|
|
- style="font-family: 'SourceHanSansCN-Medium', '思源黑体' ,'黑体',serif">
|
|
|
13
|
+ class="w-full lh-130px h-[25%]"
|
|
|
14
|
+ style="font-family: 'SourceHanSansCN-Medium', '思源黑体', '黑体', serif"
|
|
|
15
|
+ >
|
|
16
|
16
|
欢迎登录
|
|
17
|
17
|
</div>
|
|
18
|
18
|
<el-form>
|
|
19
|
19
|
<el-row>
|
|
20
|
|
- <el-col :span="24" class="mb-30px">
|
|
|
20
|
+ <el-col :span="24" class="mb-30px" v-if="isQuick">
|
|
|
21
|
+ <el-form-item class="mb-0" label="">
|
|
|
22
|
+ <el-select
|
|
|
23
|
+ v-model="selectValue"
|
|
|
24
|
+ filterable
|
|
|
25
|
+ placeholder="请选择登录账号"
|
|
|
26
|
+ class="h-50px"
|
|
|
27
|
+ @change="handlerChange"
|
|
|
28
|
+ @visible-change="handlerVisibleChange"
|
|
|
29
|
+ >
|
|
|
30
|
+ <template #prefix>
|
|
|
31
|
+ <Icon icon="ep:user-filled" />
|
|
|
32
|
+ </template>
|
|
|
33
|
+ <el-option
|
|
|
34
|
+ v-for="item in options"
|
|
|
35
|
+ :key="item.value"
|
|
|
36
|
+ :label="item.label"
|
|
|
37
|
+ :value="item.value"
|
|
|
38
|
+ />
|
|
|
39
|
+ </el-select>
|
|
|
40
|
+ </el-form-item>
|
|
|
41
|
+ </el-col>
|
|
|
42
|
+ <el-col :span="24" class="mb-30px" v-if="!isQuick">
|
|
21
|
43
|
<el-form-item class="mb-0" label="">
|
|
22
|
44
|
<el-input
|
|
23
|
|
- v-model="loginData.loginForm.username" class="h-50px"
|
|
24
|
|
- placeholder="请输入登录账号">
|
|
|
45
|
+ v-model="loginData.loginForm.username"
|
|
|
46
|
+ class="h-50px"
|
|
|
47
|
+ placeholder="请输入登录账号"
|
|
|
48
|
+ >
|
|
25
|
49
|
<template #prefix>
|
|
26
|
|
-
|
|
27
|
|
- <Icon icon="ep:user-filled"/>
|
|
|
50
|
+ <Icon icon="ep:user-filled" />
|
|
28
|
51
|
</template>
|
|
29
|
52
|
</el-input>
|
|
30
|
53
|
</el-form-item>
|
|
31
|
54
|
</el-col>
|
|
32
|
|
- <el-col :span="24" class="0px">
|
|
|
55
|
+ <el-col :span="24" class="0px" v-if="!isQuick">
|
|
33
|
56
|
<el-form-item class="mb-0" label="">
|
|
34
|
57
|
<el-input
|
|
35
|
58
|
v-model="loginData.loginForm.password"
|
|
36
|
59
|
class="h-50px"
|
|
37
|
|
- placeholder="请输入登录密码" show-password
|
|
38
|
|
- type="password">
|
|
|
60
|
+ placeholder="请输入登录密码"
|
|
|
61
|
+ show-password
|
|
|
62
|
+ type="password"
|
|
|
63
|
+ >
|
|
39
|
64
|
<template #prefix>
|
|
40
|
|
- <Icon icon="ep:lock"/>
|
|
|
65
|
+ <Icon icon="ep:lock" />
|
|
41
|
66
|
</template>
|
|
42
|
67
|
</el-input>
|
|
43
|
68
|
</el-form-item>
|
|
44
|
69
|
</el-col>
|
|
45
|
70
|
<el-col :span="24" class="mt-10px">
|
|
46
|
71
|
<div class="float-left font-size-16px color-[#6B6E73]">忘记密码?</div>
|
|
47
|
|
- <div class="float-right font-size-16px color-[#295FBA]">注册</div>
|
|
|
72
|
+ <!-- <div class="float-right font-size-16px color-[#295FBA]">注册</div> -->
|
|
|
73
|
+ <div
|
|
|
74
|
+ class="float-right font-size-16px color-[#295FBA]"
|
|
|
75
|
+ @click="handClick"
|
|
|
76
|
+ v-if="!isQuick"
|
|
|
77
|
+ >
|
|
|
78
|
+ 快速登录
|
|
|
79
|
+ </div>
|
|
|
80
|
+ <div class="float-right font-size-16px color-[#295FBA]" @click="handBack" v-else>
|
|
|
81
|
+ 取消快速登录
|
|
|
82
|
+ </div>
|
|
48
|
83
|
</el-col>
|
|
49
|
84
|
<el-col :span="24" class="mt-45px">
|
|
50
|
85
|
<el-button
|
|
51
|
|
- class="w-full h-50px! font-size-22px! font-700 " type="primary"
|
|
52
|
|
- @click="getCode">
|
|
|
86
|
+ class="w-full h-50px! font-size-22px! font-700"
|
|
|
87
|
+ type="primary"
|
|
|
88
|
+ @click="getCode"
|
|
|
89
|
+ >
|
|
53
|
90
|
登 录
|
|
54
|
91
|
</el-button>
|
|
55
|
92
|
</el-col>
|
|
|
@@ -71,22 +108,21 @@
|
|
71
|
108
|
</div>
|
|
72
|
109
|
</template>
|
|
73
|
110
|
<script lang="ts" setup>
|
|
74
|
|
-import {ElLoading} from 'element-plus'
|
|
75
|
|
-import type {RouteLocationNormalizedLoaded} from 'vue-router'
|
|
76
|
|
-import {useIcon} from '@/hooks/web/useIcon'
|
|
|
111
|
+import { ElLoading } from 'element-plus'
|
|
|
112
|
+import type { RouteLocationNormalizedLoaded } from 'vue-router'
|
|
|
113
|
+import { useIcon } from '@/hooks/web/useIcon'
|
|
77
|
114
|
import * as authUtil from '@/utils/auth'
|
|
78
|
|
-import {usePermissionStore} from '@/store/modules/permission'
|
|
|
115
|
+import { usePermissionStore } from '@/store/modules/permission'
|
|
79
|
116
|
import * as LoginApi from '@/api/login'
|
|
80
|
|
-import {LoginStateEnum, useLoginState} from './components/useLogin'
|
|
81
|
|
-
|
|
|
117
|
+import { LoginStateEnum, useLoginState } from './components/useLogin'
|
|
82
|
118
|
|
|
83
|
|
-defineOptions({name: 'LoginForm'})
|
|
|
119
|
+defineOptions({ name: 'LoginForm' })
|
|
84
|
120
|
|
|
85
|
|
-const {t} = useI18n()
|
|
|
121
|
+const { t } = useI18n()
|
|
86
|
122
|
const message = useMessage()
|
|
87
|
|
-const iconHouse = useIcon({icon: 'ep:house'})
|
|
88
|
|
-const {getLoginState} = useLoginState()
|
|
89
|
|
-const {currentRoute, push} = useRouter()
|
|
|
123
|
+const iconHouse = useIcon({ icon: 'ep:house' })
|
|
|
124
|
+const { getLoginState } = useLoginState()
|
|
|
125
|
+const { currentRoute, push } = useRouter()
|
|
90
|
126
|
const permissionStore = usePermissionStore()
|
|
91
|
127
|
const redirect = ref<string>('')
|
|
92
|
128
|
const loginLoading = ref(false)
|
|
|
@@ -110,6 +146,25 @@ const loginData = reactive({
|
|
110
|
146
|
rememberMe: true // 默认记录我。如果不需要,可手动修改
|
|
111
|
147
|
}
|
|
112
|
148
|
})
|
|
|
149
|
+
|
|
|
150
|
+const options = ref([
|
|
|
151
|
+ {
|
|
|
152
|
+ value: 'admin123',
|
|
|
153
|
+ label: 'admin'
|
|
|
154
|
+ },
|
|
|
155
|
+ {
|
|
|
156
|
+ value: '111111',
|
|
|
157
|
+ label: 'test111'
|
|
|
158
|
+ },
|
|
|
159
|
+ {
|
|
|
160
|
+ value: '222222',
|
|
|
161
|
+ label: 'test222'
|
|
|
162
|
+ }
|
|
|
163
|
+])
|
|
|
164
|
+const isQuick = ref(false)
|
|
|
165
|
+const selectValue = ref('')
|
|
|
166
|
+const selectLabel = ref('')
|
|
|
167
|
+
|
|
113
|
168
|
// 获取验证码
|
|
114
|
169
|
const getCode = async () => {
|
|
115
|
170
|
// 情况一,未开启:则直接登录
|
|
|
@@ -149,7 +204,7 @@ const loading = ref() // ElLoading.service 返回的实例
|
|
149
|
204
|
const handleLogin = async (params: any) => {
|
|
150
|
205
|
loginLoading.value = true
|
|
151
|
206
|
try {
|
|
152
|
|
- const loginDataLoginForm = {...loginData.loginForm}
|
|
|
207
|
+ const loginDataLoginForm = { ...loginData.loginForm }
|
|
153
|
208
|
loginDataLoginForm.captchaVerification = params.captchaVerification
|
|
154
|
209
|
const res = await LoginApi.login(loginDataLoginForm)
|
|
155
|
210
|
console.log(1113)
|
|
|
@@ -173,18 +228,39 @@ const handleLogin = async (params: any) => {
|
|
173
|
228
|
redirect.value = '/'
|
|
174
|
229
|
}
|
|
175
|
230
|
|
|
176
|
|
-
|
|
177
|
231
|
// 判断是否为SSO登录
|
|
178
|
232
|
if (redirect.value.indexOf('sso') !== -1) {
|
|
179
|
233
|
window.location.href = window.location.href.replace('/login?redirect=', '')
|
|
180
|
234
|
} else {
|
|
181
|
|
- await push({path: redirect.value || permissionStore.addRouters[0].path})
|
|
|
235
|
+ await push({ path: redirect.value || permissionStore.addRouters[0].path })
|
|
182
|
236
|
}
|
|
183
|
237
|
} finally {
|
|
184
|
238
|
loginLoading.value = false
|
|
185
|
239
|
loading.value.close()
|
|
186
|
240
|
}
|
|
187
|
241
|
}
|
|
|
242
|
+// 快速登录
|
|
|
243
|
+const handClick = () => {
|
|
|
244
|
+ isQuick.value = true
|
|
|
245
|
+}
|
|
|
246
|
+// 取消快速登录
|
|
|
247
|
+const handBack = () => {
|
|
|
248
|
+ isQuick.value = false
|
|
|
249
|
+}
|
|
|
250
|
+// 选择登录账号
|
|
|
251
|
+const handlerChange = (data: any) => {
|
|
|
252
|
+ selectLabel.value = options.value.filter((item) => item.value == data)[0].label
|
|
|
253
|
+ loginData.loginForm.username = selectLabel.value
|
|
|
254
|
+ loginData.loginForm.password = selectValue.value
|
|
|
255
|
+ isQuick.value = false
|
|
|
256
|
+}
|
|
|
257
|
+// 取消选择
|
|
|
258
|
+const handlerVisibleChange = (data: any) => {
|
|
|
259
|
+ console.log(data, 'handlerVisibleChange-===')
|
|
|
260
|
+ if (!data) {
|
|
|
261
|
+ isQuick.value = false
|
|
|
262
|
+ }
|
|
|
263
|
+}
|
|
188
|
264
|
|
|
189
|
265
|
watch(
|
|
190
|
266
|
() => currentRoute.value,
|
|
|
@@ -205,12 +281,18 @@ onMounted(() => {
|
|
205
|
281
|
.content {
|
|
206
|
282
|
width: 100vw;
|
|
207
|
283
|
height: 100vh;
|
|
208
|
|
- background: url("@/assets/system/login-bg.jpg") no-repeat;
|
|
|
284
|
+ background: url('@/assets/system/login-bg.jpg') no-repeat;
|
|
209
|
285
|
background-size: 100% 100%;
|
|
210
|
286
|
}
|
|
211
|
287
|
|
|
212
|
288
|
:deep(.el-form-item) {
|
|
213
|
289
|
margin-bottom: 0;
|
|
214
|
290
|
}
|
|
|
291
|
+.float-right {
|
|
|
292
|
+ cursor: pointer;
|
|
|
293
|
+}
|
|
|
294
|
+:deep(.el-select__selection) {
|
|
|
295
|
+ height: 42px;
|
|
|
296
|
+}
|
|
215
|
297
|
</style>
|
|
216
|
298
|
|