Files
2025-09-04 17:04:21 +08:00

61 lines
1.3 KiB
Vue

<template>
<view>
<u-cell-group :border="false">
<u-cell-item title="退出登录" @click="logout" hover-class="none"></u-cell-item>
<!-- <u-cell-item title="收货地址" @click="toAddress" :border-bottom="false" 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() {
// 退出登录
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)
}
})
},
toAddress() {
uni.navigateTo({
url: '/bundle/pages/address/address'
})
}
}
}
</script>
<style lang="scss">
page {
background-color: #fff;
}
</style>