|
@@ -4,13 +4,18 @@
|
|
|
<u-cell-group :border="false" :customStyle="{background: '#fff', margin: '30rpx', borderRadius: '20rpx'}">
|
|
|
<u-cell title="头像" isLink>
|
|
|
<template #value>
|
|
|
- <up-avatar size="116rpx" :src="user.avatar" defaultUrl="/static/mine/avatar-def.png"
|
|
|
+ <up-avatar size="116rpx" :src="vuex_user.avatar" defaultUrl="/static/mine/avatar-def.png"
|
|
|
bgColor="#305BFF" />
|
|
|
</template>
|
|
|
</u-cell>
|
|
|
<u-cell title="姓名" isLink :border="false">
|
|
|
<template #value>
|
|
|
- <view>{{user.nickName}}</view>
|
|
|
+ <view>{{vuex_user.nickName}}</view>
|
|
|
+ </template>
|
|
|
+ </u-cell>
|
|
|
+ <u-cell title="手机号码" :isLink="false" :border="false">
|
|
|
+ <template #value>
|
|
|
+ <view>{{vuex_user.phonenumber}}</view>
|
|
|
</template>
|
|
|
</u-cell>
|
|
|
</u-cell-group>
|
|
@@ -24,25 +29,36 @@
|
|
|
<script setup>
|
|
|
import {
|
|
|
onMounted,
|
|
|
- ref
|
|
|
+ ref,
|
|
|
+ getCurrentInstance
|
|
|
} from 'vue';
|
|
|
import {
|
|
|
useStore
|
|
|
} from 'vuex';
|
|
|
+
|
|
|
+ const {
|
|
|
+ proxy
|
|
|
+ } = getCurrentInstance();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// 获取 Vuex store 实例
|
|
|
const store = useStore();
|
|
|
const user = ref({
|
|
|
nickName: ' '
|
|
|
})
|
|
|
|
|
|
- function logout() {
|
|
|
+ // 登出
|
|
|
+ const logout = () => {
|
|
|
uni.showModal({
|
|
|
title: '提示',
|
|
|
content: '您确定要退出登录吗?',
|
|
|
success(res) {
|
|
|
if (res.confirm) {
|
|
|
- store.state.vuex_token = 'none';
|
|
|
- store.state.vuex_user = {};
|
|
|
+ // store.state.vuex_token = 'none';
|
|
|
+ // store.state.vuex_user = {};
|
|
|
+ proxy.$u.vuex('vuex_token', '');
|
|
|
+ proxy.$u.vuex('vuex_login', false);
|
|
|
uni.redirectTo({
|
|
|
url: '/pages/subpack/pages/login/login'
|
|
|
})
|