token
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
<i class="icon-eye" :class="type === 'password' ? 'icon-eye-close' : 'icon-eye-open'" @click="changeType"></i>
|
||||
</div>
|
||||
<div class="fxrow check-box">
|
||||
<i class="icon-name-check" :class="{'icon-name-checked': memberName}" @click="Remember"></i>
|
||||
<span class="fxcol">记住用户名</span>
|
||||
<router-link :to="{path: '/setup'}" class="fxcol" style="text-align:right;color:#6798ef">设置</router-link>
|
||||
</div>
|
||||
<button class="login-btn" :disabled="disabled" @click="_Login">确认登录</button>
|
||||
@@ -28,43 +30,40 @@ export default {
|
||||
loginname: '',
|
||||
password: '',
|
||||
type: 'password',
|
||||
jobnum: '',
|
||||
qrcode: '',
|
||||
memberName: false,
|
||||
disabled: false
|
||||
}
|
||||
},
|
||||
created () {
|
||||
if (this.$store.getters.userInfo !== '') {
|
||||
this.loginname = JSON.parse(this.$store.getters.userInfo).loginname
|
||||
this.memberName = this.loginname !== ''
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
document.getElementsByTagName('body')[0].className = 'login-bg'
|
||||
// window.getSystemInfoCallback = this.getSystemInfoCallback
|
||||
// window.location.href = 'getSystemInfo'
|
||||
},
|
||||
methods: {
|
||||
// getSystemInfoCallback (result) {
|
||||
// window.localStorage.setItem('hhtId', result)
|
||||
// },
|
||||
// handleTest () {
|
||||
// this.test = false
|
||||
// setTimeout(() => {
|
||||
// this.test = true
|
||||
// this.testNumber = this.testNumber === 1 ? 2 : 1
|
||||
// }, 200)
|
||||
// },
|
||||
changeType () {
|
||||
this.type = this.type === 'password' ? 'text' : 'password'
|
||||
},
|
||||
Remember () {
|
||||
this.memberName = !this.memberName
|
||||
},
|
||||
async loginApi () {
|
||||
try {
|
||||
let res = await loginApi(this.loginname, encrypt(this.password))
|
||||
if (res.code === '1') {
|
||||
this.$store.dispatch('userInfo', JSON.stringify(res.result))
|
||||
this.$router.push('/home')
|
||||
let obj = {}
|
||||
if (this.memberName) {
|
||||
obj = Object.assign({}, res.user.user, {token: res.token, loginname: this.loginname})
|
||||
} else {
|
||||
this.Dialog(res.desc)
|
||||
obj = Object.assign({}, res.user.user, {token: res.token, loginname: ''})
|
||||
}
|
||||
this.$store.dispatch('userInfo', JSON.stringify(obj))
|
||||
this.$router.push('/home')
|
||||
this.disabled = false
|
||||
} catch (err) {
|
||||
this.disabled = false
|
||||
this.Dialog(err)
|
||||
}
|
||||
},
|
||||
_Login () {
|
||||
|
||||
Reference in New Issue
Block a user