|
|
@@ -13,26 +13,20 @@
|
|
|
<v-icon>
|
|
|
mdi-arrow-left
|
|
|
</v-icon>
|
|
|
- 返回
|
|
|
+ 返回主页
|
|
|
</v-btn>
|
|
|
</v-col>
|
|
|
</v-row>
|
|
|
<v-row justify="center">
|
|
|
- <img
|
|
|
- :src="this.$store.state.webInfo.logoUrl"
|
|
|
- height="36px"
|
|
|
- >
|
|
|
- </v-row>
|
|
|
- <v-row justify="center">
|
|
|
- <h1>{{ this.$store.state.webInfo.name }} {{ type }}</h1>
|
|
|
+ <h1>{{ type }}</h1>
|
|
|
</v-row>
|
|
|
<v-row style="height: 48px" />
|
|
|
<LoginFormMobile v-show="showLogin" @login="userLogin" />
|
|
|
- <LoginFormPassword v-show="showLogin1 === true" @login="userLogin" />
|
|
|
+ <ResetPasswordForm v-show="pageCode === 2" @login="resetPassword" />
|
|
|
<RegisterForm v-show="showLogin === false" @register="userRegister" />
|
|
|
<v-row justify="center">
|
|
|
- <v-col cols="5">
|
|
|
- <v-btn text color="primary">忘记密码</v-btn>
|
|
|
+ <v-col cols="5" style="text-align:left">
|
|
|
+ <v-btn text @click="moveResetPassword">{{ moveResetPasswordMessage }}</v-btn>
|
|
|
</v-col>
|
|
|
<v-col cols="5" style="text-align:right">
|
|
|
<v-btn text @click="moveRegister">{{ moveMessage }}</v-btn>
|
|
|
@@ -41,6 +35,7 @@
|
|
|
</v-card>
|
|
|
</v-col>
|
|
|
</v-row>
|
|
|
+
|
|
|
<v-snackbar
|
|
|
v-model="showMessage"
|
|
|
:top="true"
|
|
|
@@ -64,14 +59,14 @@
|
|
|
|
|
|
<script>
|
|
|
import LoginFormMobile from '@/components/login-form-mobile.vue'
|
|
|
-import LoginFormPassword from '@/components/login-form-password.vue'
|
|
|
+import ResetPasswordForm from '@/components/reset-password-form'
|
|
|
import RegisterForm from '@/components/register-form.vue'
|
|
|
|
|
|
export default {
|
|
|
name: 'Login',
|
|
|
components: {
|
|
|
LoginFormMobile,
|
|
|
- LoginFormPassword,
|
|
|
+ ResetPasswordForm,
|
|
|
RegisterForm
|
|
|
},
|
|
|
data() {
|
|
|
@@ -81,8 +76,10 @@ export default {
|
|
|
user: {},
|
|
|
type: '登录',
|
|
|
moveMessage: '没有账号,创建账号',
|
|
|
+ moveResetPasswordMessage: '忘记密码?',
|
|
|
showLogin: true,
|
|
|
- showLogin1: false,
|
|
|
+ pageCode: 1,
|
|
|
+ pageType: '登录',
|
|
|
message: '',
|
|
|
showMessage: false
|
|
|
}
|
|
|
@@ -95,7 +92,18 @@ export default {
|
|
|
this.$store.dispatch('user/login', value).then(() => {
|
|
|
// 登录成功后返回到首页
|
|
|
this.$router.push('/')
|
|
|
+ }).catch(error => {
|
|
|
+ this.message = error.data
|
|
|
+ this.showMessage = true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ resetPassword(value) {
|
|
|
+ this.$store.dispatch('user/register', value).then(() => {
|
|
|
+ this.message = '注册成功,即将为你跳转到登录页面!'
|
|
|
+ this.showMessage = true
|
|
|
+ this.moveRegister()
|
|
|
}).catch(() => {
|
|
|
+ alert('用户注册失败')
|
|
|
})
|
|
|
},
|
|
|
userRegister(value) {
|
|
|
@@ -107,12 +115,15 @@ export default {
|
|
|
alert('用户注册失败')
|
|
|
})
|
|
|
},
|
|
|
+ moveResetPassword() {
|
|
|
+ },
|
|
|
moveRegister() {
|
|
|
if (this.type === '登录') {
|
|
|
this.type = '注册'
|
|
|
} else {
|
|
|
this.type = '登录'
|
|
|
}
|
|
|
+
|
|
|
if (this.moveMessage === '没有账号,创建账号') {
|
|
|
this.moveMessage = '已有账号,我要登录'
|
|
|
} else {
|