main
fanfan 8 months ago
parent 6fca3df410
commit 757609b5f9
  1. 2
      src/config/router.config.js
  2. 2
      src/views/dataCenter/goods/Create.vue
  3. 2
      src/views/dataCenter/goods/Update.vue
  4. 51
      src/views/user/Login.vue

@ -8,7 +8,7 @@ export const asyncRouterMap = [
name: 'index',
component: BasicLayout,
meta: { title: '超级管理后台' },
redirect: '/store/index',
// redirect: '/store/index',
children: [
{
name: 'Store',

@ -177,7 +177,7 @@
<a-form-item label="规格值" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input
placeholder="多个规格值,以英文分号分隔"
v-decorator="['specific_value', { rules: [{ required: true, message: '请输入规格值' }] }]"
v-decorator="['specific_value']"
/>
</a-form-item>
<!-- 多规格的表单内容 -->

@ -167,7 +167,7 @@
<a-form-item label="规格值" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input
placeholder="多个规格值,以英文分号分隔"
v-decorator="['specific_value', { rules: [{ required: true, message: '请输入规格值' }] }]"
v-decorator="['specific_value']"
/>
</a-form-item>
<!-- 多规格的表单内容 -->

@ -4,21 +4,9 @@
<!-- <img src="~@/assets/logo.svg" class="logo" alt="logo" /> -->
<span class="title">管理后台登录</span>
</div>
<a-form
id="formLogin"
class="user-layout-login"
ref="formLogin"
:form="form"
@submit="handleSubmit"
>
<a-form id="formLogin" class="user-layout-login" ref="formLogin" :form="form" @submit="handleSubmit">
<!-- 错误提示 -->
<a-alert
v-if="isLoginError"
type="error"
showIcon
style="margin-bottom: 24px;"
:message="loginErrorMsg"
/>
<a-alert v-if="isLoginError" type="error" showIcon style="margin-bottom: 24px" :message="loginErrorMsg" />
<a-form-item>
<a-input
size="large"
@ -26,7 +14,7 @@
placeholder="请输入用户名"
v-decorator="[
'username',
{rules: [{ required: true, message: '您还没有输入用户名' }], validateTrigger: 'change'}
{ rules: [{ required: true, message: '您还没有输入用户名' }], validateTrigger: 'change' },
]"
>
<a-icon slot="prefix" type="user" :style="{ color: 'rgba(0,0,0,.25)' }" />
@ -41,14 +29,14 @@
placeholder="请输入用户密码"
v-decorator="[
'password',
{rules: [{ required: true, message: '您还没有输入用户密码' }], validateTrigger: 'blur'}
{ rules: [{ required: true, message: '您还没有输入用户密码' }], validateTrigger: 'blur' },
]"
>
<a-icon slot="prefix" type="lock" :style="{ color: 'rgba(0,0,0,.25)' }" />
</a-input>
</a-form-item>
<a-form-item style="margin-top:24px">
<a-form-item style="margin-top: 24px">
<a-button
size="large"
type="primary"
@ -56,7 +44,8 @@
class="login-button"
:loading="state.loginBtn"
:disabled="state.loginBtn"
>确定</a-button>
>确定</a-button
>
</a-form-item>
</a-form>
</div>
@ -67,7 +56,7 @@ import { mapActions } from 'vuex'
import { timeFix } from '@/utils/util'
export default {
data () {
data() {
return {
//
isLoginError: false,
@ -76,21 +65,21 @@ export default {
//
form: this.$form.createForm(this),
//
state: { loginBtn: false }
state: { loginBtn: false },
}
},
created () { },
created() {},
methods: {
...mapActions(['Login', 'Logout']),
/**
* 表单提交: 确定登录
*/
handleSubmit (e) {
handleSubmit(e) {
e.preventDefault()
const {
form: { validateFields },
state,
Login
Login,
} = this
state.loginBtn = true
@ -99,8 +88,8 @@ export default {
validateFields(['username', 'password'], { force: true }, (err, values) => {
if (!err) {
Login(values)
.then(res => this.loginSuccess(res))
.catch(err => this.loginFailed(err))
.then((res) => this.loginSuccess(res))
.catch((err) => this.loginFailed(err))
.finally(() => {
state.loginBtn = false
})
@ -115,13 +104,13 @@ export default {
/**
* 登录成功
*/
loginSuccess (res) {
this.$router.push({ path: '/' })
loginSuccess(res) {
this.$router.push('/goods/index')
//
setTimeout(() => {
this.$notification.success({
message: '欢迎',
description: `${timeFix()},欢迎回来`
description: `${timeFix()},欢迎回来`,
})
}, 1000)
this.isLoginError = false
@ -130,11 +119,11 @@ export default {
/**
* 登录请求失败
*/
loginFailed (response) {
loginFailed(response) {
this.isLoginError = true
this.loginErrorMsg = response.message
}
}
},
},
}
</script>

Loading…
Cancel
Save