fanzhen1219
This commit is contained in:
@@ -111,6 +111,11 @@ export default {
|
||||
imgIdentify: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
$auth (newVal, oldVal) {
|
||||
console.log(newVal, '$auth$auth$auth$auth')
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
navClick (indexs, url) {
|
||||
if (indexs !== 1) {
|
||||
@@ -148,6 +153,7 @@ export default {
|
||||
},
|
||||
loginWindow () {
|
||||
this.showWinStatic = true
|
||||
this.$auth.auth = true
|
||||
this.get_identity()
|
||||
},
|
||||
// 关闭登录窗口
|
||||
@@ -177,11 +183,13 @@ export default {
|
||||
alert(res.data.message)
|
||||
if (res.data.code === 200) {
|
||||
this.showWinStatic = !this.showWinStatic
|
||||
this.$auth.auth = this.showWinStatic
|
||||
// 用户信息存本地
|
||||
localStorage.setItem('username', res.data.data.username)
|
||||
localStorage.setItem('pic', res.data.data.pic)
|
||||
localStorage.setItem('userPwd', this.userpwd)
|
||||
localStorage.setItem('token', 'Bearer ' + res.data.data.token)
|
||||
localStorage.setItem('tokenB', res.data.data.token)
|
||||
// 登录状态
|
||||
localStorage.setItem('userLogin', true)
|
||||
console.log(this.$route, '000111')
|
||||
@@ -196,7 +204,9 @@ export default {
|
||||
})
|
||||
}
|
||||
} else {
|
||||
console.log(!this.showWinStatic, 'this.showWinStatic')
|
||||
this.showWinStatic = !this.showWinStatic
|
||||
this.$auth.auth = this.showWinStatic
|
||||
}
|
||||
},
|
||||
// 获取验证码图片及内容
|
||||
@@ -212,6 +222,7 @@ export default {
|
||||
},
|
||||
regirest () {
|
||||
this.showWinStatic = !this.showWinStatic
|
||||
this.$auth.auth = this.showWinStatic
|
||||
this.$router.push({ path: '/register' })
|
||||
},
|
||||
// 跳到数据页面
|
||||
@@ -248,13 +259,19 @@ export default {
|
||||
method: 'GET',
|
||||
url: 'member/index/logout',
|
||||
params: {
|
||||
'access-token': localStorage.getItem('token')
|
||||
'access-token': localStorage.getItem('tokenB')
|
||||
}
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
alert(res.data.message)
|
||||
// 请求接口完成注册 请求成功
|
||||
if (res.data.code === 200) {
|
||||
console.log(this.$route.path, 'this.$router.path')
|
||||
if (this.$route.path !== '/') {
|
||||
this.$router.push({
|
||||
path: '/'
|
||||
})
|
||||
}
|
||||
localStorage.clear()
|
||||
this.$router.go(0)
|
||||
}
|
||||
@@ -270,10 +287,22 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
mounted () {
|
||||
let that = this
|
||||
this.userLogin = localStorage.getItem('userLogin')
|
||||
this.userName = localStorage.getItem('username')
|
||||
this.userPic = localStorage.getItem('pic')
|
||||
// 监听对象的变化
|
||||
/* eslint-disable */
|
||||
Object.defineProperty(this.$auth, 'auth', {
|
||||
set: function (newVal) {
|
||||
console.log(newVal, 'newValnewValnewVal')
|
||||
that.showWinStatic = newVal
|
||||
that.get_identity()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user