退出页面强制清除登录状态和token
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapState, mapActions} from "vuex"
|
||||
import {mapState, mapActions, mapMutations} from "vuex"
|
||||
|
||||
export default {
|
||||
name: "voteDetail",
|
||||
@@ -22,7 +22,7 @@ export default {
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
wxCode: v => v.$route.query.code,
|
||||
canotVote: v => v.detail.isVote == '0' && v.user.token
|
||||
canotVote: v => !!v.user.token && v.detail.isVote == '0'
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -31,9 +31,10 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getWechatToken', 'getCode']),
|
||||
...mapMutations(['setToken']),
|
||||
getDetail() {
|
||||
const {id} = this.$route.query
|
||||
this.$http.post("/app/appvideoinfo/queryDetailById", null, {params: {id}, withoutToken: true}).then(res => {
|
||||
this.$http.post("/app/appvideoinfo/queryDetailById", null, {params: {id}, withoutToken: !this.user.token}).then(res => {
|
||||
if (res?.data) {
|
||||
this.detail = res.data
|
||||
document.title = this.detail.videoName
|
||||
@@ -67,6 +68,9 @@ export default {
|
||||
if (!!this.wxCode) {
|
||||
this.getWechatToken({module: "AppVote", code: this.wxCode}).then(this.handleVote)
|
||||
}
|
||||
},
|
||||
destroyed() {
|
||||
this.setToken(null)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user