完善定位功能
This commit is contained in:
54
bundle/pages/setting/setting.vue
Normal file
54
bundle/pages/setting/setting.vue
Normal file
@ -0,0 +1,54 @@
|
||||
<template>
|
||||
<view>
|
||||
<u-cell-group :border="false">
|
||||
<u-cell-item title="退出登录" :border-bottom="false" @click="logout" hover-class="none"></u-cell-item>
|
||||
</u-cell-group>
|
||||
|
||||
<u-modal v-model="showLogout" :content="content" :show-cancel-button="true" @confirm="confirmLogout"></u-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {userLogout} from '@/api/user'
|
||||
import { mapState, mapGetters } from 'vuex'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
showLogout: false,
|
||||
content: '确定退出登录'
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
logout() {
|
||||
this.showLogout = true
|
||||
},
|
||||
|
||||
confirmLogout() {
|
||||
console.log(this.token)
|
||||
// 退出登录
|
||||
userLogout({
|
||||
token: this.token
|
||||
}).then((res) => {
|
||||
if (res.code == 1) {
|
||||
this.$store.commit('LOGOUT')
|
||||
this.$toast({
|
||||
title: '退出成功'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user