index.vue
2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<template>
<view class="personalData-v">
<u-cell-group>
<u-cell-item title="头像" :arrow="false">
<u-avatar :src="baseUrl+userInfo.headIcon" size="64" slot="right-icon"></u-avatar>
</u-cell-item>
<u-cell-item title="姓名" :value="userInfo.userInfo.userAccount" :arrow="false"></u-cell-item>
<u-cell-item title="性别" :value="gender" :arrow="false"></u-cell-item>
<u-cell-item title="所属公司" :value="userInfo.userInfo.organizeName" :arrow="false" v-if="userInfo.userInfo.userId !== '360267753694692613'"></u-cell-item>
<!-- <u-cell-item title="手机号" :value="userInfo.mobilePhone" :arrow="false"></u-cell-item> -->
<!-- <u-cell-item title="邮箱" :value="userInfo.email" :arrow="false"></u-cell-item> -->
</u-cell-group>
<button type="primary" style="width: 90%;margin: 0 auto;border-radius: 20rpx; background-color: #D32D25;color: white;margin-top: 100rpx;" @click="loginOut">退出登录</button>
</view>
</template>
<script>
export default {
data() {
return {
gender: '',
birthday: '',
userInfo: {},
baseUrl:'http://deyanggaoxin.fengshiyun.com',
}
},
computed: {
baseURL() {
return this.define.baseURL
}
},
onLoad() {
this.userInfo = uni.getStorageSync('user') || {};
console.log(this.userInfo)
this.gender = this.userInfo.gender == 1 ? '男' : this.userInfo.gender == 2 ? '女' : '保密'
this.birthday = this.userInfo.birthday ? this.$u.timeFormat(this.userInfo.birthday, 'yyyy-mm-dd') : ''
},
methods:{
// 退出登录
loginOut(){
console.log('1111')
uni.showModal({
title: '提示',
content: '确定退出当前账号吗?',
success: res => {
if (res.confirm) {
uni.removeStorage({
key: 'user',
// success: function (res) {
// uni.showToast({
// icon:'success',
// title:'已退出登录',
// duration:'1'
// })
// }
});
uni.removeStorage({
key: 'AuthToken_KEY',
success: function (res) {
console.log(res)
// uni.showToast({
// icon:'success',
// title:'已退出登录'
// })
}
});
uni.removeStorage({
key: 'token',
success: function (res) {
console.log(res)
// uni.showToast({
// icon:'success',
// title:'已退出登录'
// })
}
});
uni.reLaunch({
url:'/pages/home/home'
})
}
}
})
}
}
}
</script>
<style lang="scss">
page {
background-color: #f0f2f6;
}
</style>