|
@@ -51,20 +51,30 @@
|
51
|
51
|
placeholder="密码"
|
52
|
52
|
name="password"
|
53
|
53
|
tabindex="3"
|
54
|
|
- @keyup.enter.native="handleLogin"
|
|
54
|
+ @keyup.enter.native="retrievePassword"
|
55
|
55
|
/>
|
56
|
56
|
</el-form-item>
|
57
|
57
|
<el-button
|
58
|
58
|
:loading="loading"
|
59
|
59
|
type="primary"
|
60
|
60
|
style="width: 100%; margin-bottom: 30px"
|
61
|
|
- @click.native.prevent="handleLogin"
|
|
61
|
+ @click.native.prevent="retrievePassword"
|
62
|
62
|
>找回密码</el-button>
|
|
63
|
+ <el-link :underline="false" style="margin:0" type="primary">
|
|
64
|
+ <router-link
|
|
65
|
+ :to="{path: '/login'}"
|
|
66
|
+ >登录系统</router-link>
|
|
67
|
+ </el-link>
|
|
68
|
+ <el-link :underline="false" style="float:right" type="primary">
|
|
69
|
+ <router-link
|
|
70
|
+ :to="{name: 'register'}"
|
|
71
|
+ >注册账号</router-link>
|
|
72
|
+ </el-link>
|
63
|
73
|
</el-form>
|
64
|
74
|
</div>
|
65
|
75
|
</template>
|
66
|
76
|
<script>
|
67
|
|
-import { getCaptcha, signUp } from '@/api/user'
|
|
77
|
+import { getCaptcha, findPassword } from '@/api/user'
|
68
|
78
|
import md5 from 'js-md5'
|
69
|
79
|
export default {
|
70
|
80
|
name: 'Login',
|
|
@@ -132,14 +142,15 @@ export default {
|
132
|
142
|
}
|
133
|
143
|
})
|
134
|
144
|
},
|
135
|
|
- handleLogin() {
|
|
145
|
+ retrievePassword() {
|
136
|
146
|
this.$refs.regisiterForm.validate((valid) => {
|
137
|
147
|
if (valid) {
|
138
|
|
- this.regisiterForm.password = md5(this.regisiterForm.password)
|
139
|
|
- // signUp(this.regisiterForm).then((res) => {
|
140
|
|
- this.$message('修改密码成功')
|
141
|
|
- this.$router.push({ path: '/login' })
|
142
|
|
- // })
|
|
148
|
+ var newData = { ...this.regisiterForm }
|
|
149
|
+ newData.password = md5(newData.password)
|
|
150
|
+ findPassword(newData).then((res) => {
|
|
151
|
+ this.$message('修改密码成功')
|
|
152
|
+ this.$router.push({ path: '/login' })
|
|
153
|
+ })
|
143
|
154
|
} else {
|
144
|
155
|
return false
|
145
|
156
|
}
|