|
@@ -48,7 +48,8 @@
|
|
|
<script>
|
|
|
import { validUsername } from '@/utils/validate'
|
|
|
import Cookies from 'js-cookie'
|
|
|
-import { getToken } from '@/utils/auth'
|
|
|
+import { getToken } from '@/utils/auth'
|
|
|
+const md5 = require("md5")
|
|
|
export default {
|
|
|
name: 'Login',
|
|
|
data() {
|
|
@@ -119,13 +120,17 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
handleLogin() {
|
|
|
+ var obj = {
|
|
|
+ username: this.loginForm.username,
|
|
|
+ password: md5(this.loginForm.password)
|
|
|
+ }
|
|
|
var rememberStatus = this.rememberPassword
|
|
|
var accountInfo = this.loginForm.username + '&' + this.loginForm.password
|
|
|
this.$refs.loginForm.validate(valid => {
|
|
|
if (valid) {
|
|
|
- this.loading = true
|
|
|
- this.$store
|
|
|
- .dispatch('user/login', this.loginForm).then(() => {
|
|
|
+ this.loading = true
|
|
|
+ this.$store.dispatch('user/login', obj).then(() => {
|
|
|
+ // this.$store.dispatch('user/login', this.loginForm).then(() => {
|
|
|
if (rememberStatus) {
|
|
|
console.log('勾选了记住密码,现在开始写入cookie')
|
|
|
Cookies.set('accountInfo', accountInfo, 1440 * 3)
|