|
@@ -44,263 +44,263 @@
|
44
|
44
|
</div>
|
45
|
45
|
</template>
|
46
|
46
|
<script setup>
|
47
|
|
-import LoginInput from './LoginInput.vue'
|
|
47
|
+ import LoginInput from './LoginInput.vue'
|
48
|
48
|
|
49
|
|
-const showPWD = ref(false)
|
50
|
|
-import loginApi from '@/api/auth/loginApi'
|
51
|
|
-import PhoneLoginForm from './phoneLoginForm.vue'
|
52
|
|
-import ThreeLogin from './threeLogin.vue'
|
53
|
|
-import smCrypto from '@/utils/smCrypto'
|
54
|
|
-import { required } from '@/utils/formRules'
|
55
|
|
-import { afterLogin } from './util'
|
56
|
|
-import configData from '@/config'
|
57
|
|
-import configApi from '@/api/dev/configApi'
|
58
|
|
-import tool from '@/utils/tool'
|
59
|
|
-import { message } from 'ant-design-vue'
|
|
49
|
+ const showPWD = ref(false)
|
|
50
|
+ import loginApi from '@/api/auth/loginApi'
|
|
51
|
+ import PhoneLoginForm from './phoneLoginForm.vue'
|
|
52
|
+ import ThreeLogin from './threeLogin.vue'
|
|
53
|
+ import smCrypto from '@/utils/smCrypto'
|
|
54
|
+ import { required } from '@/utils/formRules'
|
|
55
|
+ import { afterLogin } from './util'
|
|
56
|
+ import configData from '@/config'
|
|
57
|
+ import configApi from '@/api/dev/configApi'
|
|
58
|
+ import tool from '@/utils/tool'
|
|
59
|
+ import { message } from 'ant-design-vue'
|
60
|
60
|
|
61
|
|
-import { globalStore, iframeStore, keepAliveStore, viewTagsStore, enumMaplistStore } from '@/store'
|
62
|
|
-const { proxy } = getCurrentInstance()
|
|
61
|
+ import { globalStore, iframeStore, keepAliveStore, viewTagsStore, enumMaplistStore } from '@/store'
|
|
62
|
+ const { proxy } = getCurrentInstance()
|
63
|
63
|
|
64
|
|
-const activeKey = ref('userAccount')
|
65
|
|
-const captchaOpen = ref(configData.SYS_BASE_CONFIG.SNOWY_SYS_DEFAULT_CAPTCHA_OPEN)
|
66
|
|
-const validCodeBase64 = ref('')
|
67
|
|
-const loading = ref(false)
|
|
64
|
+ const activeKey = ref('userAccount')
|
|
65
|
+ const captchaOpen = ref(configData.SYS_BASE_CONFIG.SNOWY_SYS_DEFAULT_CAPTCHA_OPEN)
|
|
66
|
+ const validCodeBase64 = ref('')
|
|
67
|
+ const loading = ref(false)
|
68
|
68
|
|
69
|
|
-const ruleForm = reactive({
|
70
|
|
- // account: 'superAdmin',
|
71
|
|
- // password: '123456',
|
72
|
|
- account: '',
|
73
|
|
- password: '',
|
74
|
|
- validCode: '',
|
75
|
|
- validCodeReqNo: '',
|
76
|
|
- autologin: false
|
77
|
|
-})
|
|
69
|
+ const ruleForm = reactive({
|
|
70
|
+ // account: 'superAdmin',
|
|
71
|
+ // password: '123456',
|
|
72
|
+ account: '',
|
|
73
|
+ password: '',
|
|
74
|
+ validCode: '',
|
|
75
|
+ validCodeReqNo: '',
|
|
76
|
+ autologin: false
|
|
77
|
+ })
|
78
|
78
|
|
79
|
|
-const rules = reactive({
|
80
|
|
- account: [required(proxy.$t('login.accountError'), 'blur')],
|
81
|
|
- password: [required(proxy.$t('login.PWError'), 'blur')]
|
82
|
|
-})
|
83
|
|
-const lang = ref([
|
84
|
|
- {
|
85
|
|
- name: '简体中文',
|
86
|
|
- value: 'zh-cn'
|
87
|
|
- },
|
88
|
|
- {
|
89
|
|
- name: 'English',
|
90
|
|
- value: 'en'
|
91
|
|
- }
|
92
|
|
-])
|
93
|
|
-const config = ref({
|
94
|
|
- lang: tool.data.get('APP_LANG') || proxy.$CONFIG.LANG,
|
95
|
|
- theme: tool.data.get('APP_THEME') || 'default'
|
96
|
|
-})
|
|
79
|
+ const rules = reactive({
|
|
80
|
+ account: [required(proxy.$t('login.accountError'), 'blur')],
|
|
81
|
+ password: [required(proxy.$t('login.PWError'), 'blur')]
|
|
82
|
+ })
|
|
83
|
+ const lang = ref([
|
|
84
|
+ {
|
|
85
|
+ name: '简体中文',
|
|
86
|
+ value: 'zh-cn'
|
|
87
|
+ },
|
|
88
|
+ {
|
|
89
|
+ name: 'English',
|
|
90
|
+ value: 'en'
|
|
91
|
+ }
|
|
92
|
+ ])
|
|
93
|
+ const config = ref({
|
|
94
|
+ lang: tool.data.get('APP_LANG') || proxy.$CONFIG.LANG,
|
|
95
|
+ theme: tool.data.get('APP_THEME') || 'default'
|
|
96
|
+ })
|
97
|
97
|
|
98
|
|
-const store = globalStore()
|
99
|
|
-const kStore = keepAliveStore()
|
100
|
|
-const iStore = iframeStore()
|
101
|
|
-const vStore = viewTagsStore()
|
102
|
|
-// const StoreDEl = enumMaplistStore()
|
|
98
|
+ const store = globalStore()
|
|
99
|
+ const kStore = keepAliveStore()
|
|
100
|
+ const iStore = iframeStore()
|
|
101
|
+ const vStore = viewTagsStore()
|
|
102
|
+ const StoreDEl = enumMaplistStore()
|
103
|
103
|
|
104
|
|
-const setSysBaseConfig = store.setSysBaseConfig
|
105
|
|
-const clearKeepLive = kStore.clearKeepLive
|
106
|
|
-const clearIframeList = iStore.clearIframeList
|
107
|
|
-const clearViewTags = vStore.clearViewTags
|
108
|
|
-// const businessDElasync = StoreDEl.businessDElasync
|
|
104
|
+ const setSysBaseConfig = store.setSysBaseConfig
|
|
105
|
+ const clearKeepLive = kStore.clearKeepLive
|
|
106
|
+ const clearIframeList = iStore.clearIframeList
|
|
107
|
+ const clearViewTags = vStore.clearViewTags
|
|
108
|
+ const businessDElasync = StoreDEl.businessDElasync
|
109
|
109
|
|
110
|
|
-const sysBaseConfig = computed(() => {
|
111
|
|
- return store.sysBaseConfig
|
112
|
|
-})
|
|
110
|
+ const sysBaseConfig = computed(() => {
|
|
111
|
+ return store.sysBaseConfig
|
|
112
|
+ })
|
113
|
113
|
|
114
|
|
-onMounted(() => {
|
115
|
|
- let formData = ref(configData.SYS_BASE_CONFIG)
|
116
|
|
- configApi.configSysBaseList().then((data) => {
|
117
|
|
- if (data) {
|
118
|
|
- data.forEach((item) => {
|
119
|
|
- formData.value[item.configKey] = item.configValue
|
120
|
|
- })
|
121
|
|
- captchaOpen.value = formData.value.SNOWY_SYS_DEFAULT_CAPTCHA_OPEN
|
122
|
|
- tool.data.set('SNOWY_SYS_BASE_CONFIG', formData.value)
|
123
|
|
- setSysBaseConfig(formData.value)
|
124
|
|
- refreshSwitch()
|
125
|
|
- }
|
|
114
|
+ onMounted(() => {
|
|
115
|
+ let formData = ref(configData.SYS_BASE_CONFIG)
|
|
116
|
+ configApi.configSysBaseList().then((data) => {
|
|
117
|
+ if (data) {
|
|
118
|
+ data.forEach((item) => {
|
|
119
|
+ formData.value[item.configKey] = item.configValue
|
|
120
|
+ })
|
|
121
|
+ captchaOpen.value = formData.value.SNOWY_SYS_DEFAULT_CAPTCHA_OPEN
|
|
122
|
+ tool.data.set('SNOWY_SYS_BASE_CONFIG', formData.value)
|
|
123
|
+ setSysBaseConfig(formData.value)
|
|
124
|
+ refreshSwitch()
|
|
125
|
+ }
|
|
126
|
+ })
|
126
|
127
|
})
|
127
|
|
-})
|
128
|
128
|
|
129
|
|
-onBeforeMount(() => {
|
130
|
|
- clearViewTags()
|
131
|
|
- clearKeepLive()
|
132
|
|
- clearIframeList()
|
133
|
|
-})
|
|
129
|
+ onBeforeMount(() => {
|
|
130
|
+ clearViewTags()
|
|
131
|
+ clearKeepLive()
|
|
132
|
+ clearIframeList()
|
|
133
|
+ })
|
134
|
134
|
|
135
|
|
-// 监听语言
|
136
|
|
-watch(
|
137
|
|
- () => config.value.lang,
|
138
|
|
- (newValue) => {
|
139
|
|
- proxy.$i18n.locale = newValue
|
140
|
|
- tool.data.set('APP_LANG', newValue)
|
141
|
|
- }
|
142
|
|
-)
|
143
|
|
-// 主题
|
144
|
|
-watch(
|
145
|
|
- () => config.value.theme,
|
146
|
|
- (newValue) => {
|
147
|
|
- document.body.setAttribute('data-theme', newValue)
|
148
|
|
- }
|
149
|
|
-)
|
150
|
|
-// 通过开关加载内容
|
151
|
|
-const refreshSwitch = () => {
|
152
|
|
- // 判断是否开启验证码
|
153
|
|
- if (captchaOpen.value === 'true') {
|
154
|
|
- // 加载验证码
|
155
|
|
- loginCaptcha()
|
156
|
|
- // 加入校验
|
157
|
|
- rules.validCode = [required(proxy.$t('login.validError'), 'blur')]
|
|
135
|
+ // 监听语言
|
|
136
|
+ watch(
|
|
137
|
+ () => config.value.lang,
|
|
138
|
+ (newValue) => {
|
|
139
|
+ proxy.$i18n.locale = newValue
|
|
140
|
+ tool.data.set('APP_LANG', newValue)
|
|
141
|
+ }
|
|
142
|
+ )
|
|
143
|
+ // 主题
|
|
144
|
+ watch(
|
|
145
|
+ () => config.value.theme,
|
|
146
|
+ (newValue) => {
|
|
147
|
+ document.body.setAttribute('data-theme', newValue)
|
|
148
|
+ }
|
|
149
|
+ )
|
|
150
|
+ // 通过开关加载内容
|
|
151
|
+ const refreshSwitch = () => {
|
|
152
|
+ // 判断是否开启验证码
|
|
153
|
+ if (captchaOpen.value === 'true') {
|
|
154
|
+ // 加载验证码
|
|
155
|
+ loginCaptcha()
|
|
156
|
+ // 加入校验
|
|
157
|
+ rules.validCode = [required(proxy.$t('login.validError'), 'blur')]
|
|
158
|
+ }
|
158
|
159
|
}
|
159
|
|
-}
|
160
|
160
|
|
161
|
|
-// 获取验证码
|
162
|
|
-const loginCaptcha = () => {
|
163
|
|
- loginApi.getPicCaptcha().then((data) => {
|
164
|
|
- validCodeBase64.value = data.validCodeBase64
|
165
|
|
- ruleForm.validCodeReqNo = data.validCodeReqNo
|
166
|
|
- })
|
167
|
|
-}
|
168
|
|
-//登陆
|
169
|
|
-const loginForm = ref()
|
170
|
|
-const login = async () => {
|
171
|
|
- if (!ruleForm.account) {
|
172
|
|
- message.error('请输入账号')
|
173
|
|
- return
|
174
|
|
- }
|
175
|
|
- if (!ruleForm.password) {
|
176
|
|
- message.error('请输入密码')
|
177
|
|
- return
|
|
161
|
+ // 获取验证码
|
|
162
|
+ const loginCaptcha = () => {
|
|
163
|
+ loginApi.getPicCaptcha().then((data) => {
|
|
164
|
+ validCodeBase64.value = data.validCodeBase64
|
|
165
|
+ ruleForm.validCodeReqNo = data.validCodeReqNo
|
|
166
|
+ })
|
178
|
167
|
}
|
179
|
|
- loading.value = true
|
180
|
|
- const loginData = {
|
181
|
|
- account: ruleForm.account,
|
182
|
|
- // 密码进行SM2加密,传输过程中看到的只有密文,后端存储使用hash
|
183
|
|
- password: smCrypto.doSm2Encrypt(ruleForm.password),
|
184
|
|
- validCode: ruleForm.validCode,
|
185
|
|
- validCodeReqNo: ruleForm.validCodeReqNo
|
|
168
|
+ //登陆
|
|
169
|
+ const loginForm = ref()
|
|
170
|
+ const login = async () => {
|
|
171
|
+ if (!ruleForm.account) {
|
|
172
|
+ message.error('请输入账号')
|
|
173
|
+ return
|
|
174
|
+ }
|
|
175
|
+ if (!ruleForm.password) {
|
|
176
|
+ message.error('请输入密码')
|
|
177
|
+ return
|
|
178
|
+ }
|
|
179
|
+ loading.value = true
|
|
180
|
+ const loginData = {
|
|
181
|
+ account: ruleForm.account,
|
|
182
|
+ // 密码进行SM2加密,传输过程中看到的只有密文,后端存储使用hash
|
|
183
|
+ password: smCrypto.doSm2Encrypt(ruleForm.password),
|
|
184
|
+ validCode: ruleForm.validCode,
|
|
185
|
+ validCodeReqNo: ruleForm.validCodeReqNo
|
|
186
|
+ }
|
|
187
|
+ // 获取token
|
|
188
|
+ try {
|
|
189
|
+ const loginToken = await loginApi.login(loginData)
|
|
190
|
+ afterLogin(loginToken)
|
|
191
|
+ businessDElasync()
|
|
192
|
+ } catch (err) {
|
|
193
|
+ loading.value = false
|
|
194
|
+ loginCaptcha()
|
|
195
|
+ }
|
186
|
196
|
}
|
187
|
|
- // 获取token
|
188
|
|
- try {
|
189
|
|
- const loginToken = await loginApi.login(loginData)
|
190
|
|
- afterLogin(loginToken)
|
191
|
|
- } catch (err) {
|
192
|
|
- loading.value = false
|
193
|
|
- loginCaptcha()
|
|
197
|
+ const configLang = (key) => {
|
|
198
|
+ config.value.lang = key
|
194
|
199
|
}
|
195
|
|
- // businessDElasync()
|
196
|
|
-}
|
197
|
|
-const configLang = (key) => {
|
198
|
|
- config.value.lang = key
|
199
|
|
-}
|
200
|
200
|
</script>
|
201
|
201
|
<style lang="less">
|
202
|
|
-.login_background {
|
203
|
|
- background: url('/img/login_bg.png') no-repeat center;
|
204
|
|
- position: relative;
|
205
|
|
- width: 100%;
|
206
|
|
- height: 100%;
|
207
|
|
- .login_left {
|
208
|
|
- position: absolute;
|
209
|
|
- top: 204px;
|
210
|
|
- left: 190px;
|
211
|
|
- img {
|
212
|
|
- width: 700px;
|
213
|
|
- }
|
214
|
|
- }
|
215
|
|
- .login_background_front {
|
216
|
|
- background: url('/img/login/LOGO.png') no-repeat center;
|
217
|
|
- width: 800px;
|
218
|
|
- height: 92px;
|
219
|
|
- position: absolute;
|
220
|
|
- left: 10%;
|
221
|
|
- top: 10%;
|
222
|
|
- }
|
223
|
|
- .login_main {
|
224
|
|
- width: 570px;
|
225
|
|
- height: 500px;
|
226
|
|
- position: absolute;
|
227
|
|
- right: 80px;
|
228
|
|
- top: 200px;
|
229
|
|
- background: rgba(255, 255, 255, 0.75);
|
230
|
|
- border-radius: 8px;
|
231
|
|
- }
|
232
|
|
- .login_head {
|
|
202
|
+ .login_background {
|
|
203
|
+ background: url('/img/login_bg.png') no-repeat center;
|
|
204
|
+ position: relative;
|
233
|
205
|
width: 100%;
|
234
|
|
- display: flex;
|
235
|
|
- justify-content: space-between;
|
236
|
|
- align-items: center;
|
237
|
|
- overflow: hidden;
|
238
|
|
- white-space: nowrap;
|
239
|
|
- padding: 50px 0 40px;
|
240
|
|
- user-select: none;
|
241
|
|
- .text {
|
242
|
|
- padding: 0 30px;
|
243
|
|
- font-size: 25px;
|
244
|
|
- }
|
245
|
|
- &:before,
|
246
|
|
- &:after {
|
247
|
|
- width: 50%;
|
248
|
|
- height: 1px;
|
249
|
|
- content: '';
|
250
|
|
- background: rgba(0, 0, 0, 0.3);
|
251
|
|
- }
|
252
|
|
- }
|
253
|
|
- .login_form {
|
254
|
|
- margin: 0 50px;
|
255
|
|
- .icon {
|
256
|
|
- font-size: 16px;
|
257
|
|
- padding: 0 6px;
|
258
|
|
- color: #666;
|
|
206
|
+ height: 100%;
|
|
207
|
+ .login_left {
|
|
208
|
+ position: absolute;
|
|
209
|
+ top: 204px;
|
|
210
|
+ left: 190px;
|
|
211
|
+ img {
|
|
212
|
+ width: 700px;
|
|
213
|
+ }
|
259
|
214
|
}
|
260
|
|
- .LoginInput {
|
261
|
|
- font-size: 15px;
|
262
|
|
- box-shadow: 0 0 3px rgba(0, 0, 0, 0.06);
|
263
|
|
- margin-top: 30px;
|
|
215
|
+ .login_background_front {
|
|
216
|
+ background: url('/img/login/LOGO.png') no-repeat center;
|
|
217
|
+ width: 800px;
|
|
218
|
+ height: 92px;
|
|
219
|
+ position: absolute;
|
|
220
|
+ left: 10%;
|
|
221
|
+ top: 10%;
|
264
|
222
|
}
|
265
|
|
- .login_auto {
|
266
|
|
- margin-top: 20px;
|
267
|
|
- .auto_text {
|
268
|
|
- color: #444;
|
269
|
|
- }
|
|
223
|
+ .login_main {
|
|
224
|
+ width: 570px;
|
|
225
|
+ height: 500px;
|
|
226
|
+ position: absolute;
|
|
227
|
+ right: 80px;
|
|
228
|
+ top: 200px;
|
|
229
|
+ background: rgba(255, 255, 255, 0.75);
|
|
230
|
+ border-radius: 8px;
|
270
|
231
|
}
|
271
|
|
- .login_btn {
|
272
|
|
- cursor: pointer;
|
|
232
|
+ .login_head {
|
273
|
233
|
width: 100%;
|
274
|
|
- border: none;
|
275
|
|
- background: url('/img/login_btn.png') no-repeat center;
|
276
|
|
- height: 74px;
|
277
|
|
- line-height: 50px;
|
278
|
|
- color: #fff;
|
279
|
|
- font-size: 18px;
|
280
|
|
- font-weight: bold;
|
281
|
|
- letter-spacing: 10px;
|
282
|
|
- margin-top: 50px;
|
283
|
234
|
display: flex;
|
284
|
|
- justify-content: center;
|
285
|
|
- align-items: flex-start;
|
286
|
|
- }
|
287
|
|
- .login_forgetbox {
|
288
|
|
- margin-top: 20px;
|
289
|
|
- text-align: right;
|
290
|
|
- .login_forget {
|
291
|
|
- color: #444;
|
|
235
|
+ justify-content: space-between;
|
|
236
|
+ align-items: center;
|
|
237
|
+ overflow: hidden;
|
|
238
|
+ white-space: nowrap;
|
|
239
|
+ padding: 50px 0 40px;
|
|
240
|
+ user-select: none;
|
|
241
|
+ .text {
|
|
242
|
+ padding: 0 30px;
|
|
243
|
+ font-size: 25px;
|
|
244
|
+ }
|
|
245
|
+ &:before,
|
|
246
|
+ &:after {
|
|
247
|
+ width: 50%;
|
|
248
|
+ height: 1px;
|
|
249
|
+ content: '';
|
|
250
|
+ background: rgba(0, 0, 0, 0.3);
|
292
|
251
|
}
|
293
|
252
|
}
|
294
|
|
- }
|
295
|
|
- @media (max-width: 1000px) {
|
296
|
|
- .login_background_front {
|
297
|
|
- left: 50%;
|
298
|
|
- margin-left: -400px;
|
|
253
|
+ .login_form {
|
|
254
|
+ margin: 0 50px;
|
|
255
|
+ .icon {
|
|
256
|
+ font-size: 16px;
|
|
257
|
+ padding: 0 6px;
|
|
258
|
+ color: #666;
|
|
259
|
+ }
|
|
260
|
+ .LoginInput {
|
|
261
|
+ font-size: 15px;
|
|
262
|
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.06);
|
|
263
|
+ margin-top: 30px;
|
|
264
|
+ }
|
|
265
|
+ .login_auto {
|
|
266
|
+ margin-top: 20px;
|
|
267
|
+ .auto_text {
|
|
268
|
+ color: #444;
|
|
269
|
+ }
|
|
270
|
+ }
|
|
271
|
+ .login_btn {
|
|
272
|
+ cursor: pointer;
|
|
273
|
+ width: 100%;
|
|
274
|
+ border: none;
|
|
275
|
+ background: url('/img/login_btn.png') no-repeat center;
|
|
276
|
+ height: 74px;
|
|
277
|
+ line-height: 50px;
|
|
278
|
+ color: #fff;
|
|
279
|
+ font-size: 18px;
|
|
280
|
+ font-weight: bold;
|
|
281
|
+ letter-spacing: 10px;
|
|
282
|
+ margin-top: 50px;
|
|
283
|
+ display: flex;
|
|
284
|
+ justify-content: center;
|
|
285
|
+ align-items: flex-start;
|
|
286
|
+ }
|
|
287
|
+ .login_forgetbox {
|
|
288
|
+ margin-top: 20px;
|
|
289
|
+ text-align: right;
|
|
290
|
+ .login_forget {
|
|
291
|
+ color: #444;
|
|
292
|
+ }
|
|
293
|
+ }
|
299
|
294
|
}
|
300
|
|
- .login_main {
|
301
|
|
- left: calc(50% - 285px);
|
302
|
|
- top: 24%;
|
|
295
|
+ @media (max-width: 1000px) {
|
|
296
|
+ .login_background_front {
|
|
297
|
+ left: 50%;
|
|
298
|
+ margin-left: -400px;
|
|
299
|
+ }
|
|
300
|
+ .login_main {
|
|
301
|
+ left: calc(50% - 285px);
|
|
302
|
+ top: 24%;
|
|
303
|
+ }
|
303
|
304
|
}
|
304
|
305
|
}
|
305
|
|
-}
|
306
|
306
|
</style>
|