Эх сурвалжийг харах

chore: sync pro.ant.design login warn message
- remove default `admin` `admin` password
- closed #368

Sendya 5 жил өмнө
parent
commit
60aa352e0c

+ 4 - 2
src/mock/services/auth.js

@@ -1,8 +1,10 @@
 import Mock from 'mockjs2'
 import { builder, getBody } from '../util'
 
-const username = ['admin', 'user', 'super']
-const password = ['21232f297a57a5a743894a0e4a801fc3', '8914de686ab28dc22f30d3d8e107ff6c'] // admin, ant.design
+const username = ['admin', 'super']
+// 强硬要求 ant.design 相同密码
+// '21232f297a57a5a743894a0e4a801fc3',
+const password = ['8914de686ab28dc22f30d3d8e107ff6c'] // admin, ant.design
 
 const login = (options) => {
   const body = getBody(options)

+ 4 - 0
src/views/user/Login.vue

@@ -13,6 +13,7 @@
         @change="handleTabClick"
       >
         <a-tab-pane key="tab1" tab="账号密码登录">
+          <a-alert v-if="isLoginError" type="error" showIcon style="margin-bottom: 24px;" message="账户或密码错误(admin/ant.design )" />
           <a-form-item>
             <a-input
               size="large"
@@ -131,6 +132,7 @@ export default {
       loginBtn: false,
       // login type: 0 email, 1 username, 2 telephone
       loginType: 0,
+      isLoginError: false,
       requiredTwoStepCaptcha: false,
       stepCaptchaVisible: false,
       form: this.$form.createForm(this),
@@ -249,6 +251,7 @@ export default {
     loginSuccess (res) {
       console.log(res)
       this.$router.push({ name: 'dashboard' })
+      this.isLoginError = false
       // 延迟 1 秒显示欢迎信息
       setTimeout(() => {
         this.$notification.success({
@@ -258,6 +261,7 @@ export default {
       }, 1000)
     },
     requestFailed (err) {
+      this.isLoginError = true
       this.$notification['error']({
         message: '错误',
         description: ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试',