userInfo.vue
1.7 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
<template>
<view class="usrInfo">
<view class="box">
<u-cell-group :border="false">
<u-cell
v-for="(item, index) in userInfoList"
:key="index"
:icon="item.iconName"
:title="item.title"
isLink
@click="goRouter(item.routerPath)"
/>
</u-cell-group>
</view>
<view class="logOut" @click="logOut">退出登录</view>
</view>
</template>
<script>
export default {
data() {
return {
userInfoList: [
{ title: '用户信息', iconName: 'account', routerPath: '/pages_my/editUserInfo/editUserInfo' },
{ title: '修改密码', iconName: 'lock-open', routerPath: '/pages_my/editPassword/editPassword' }
]
}
},
methods: {
// 跳转路由
goRouter(path){
uni.navigateTo({
url: path
})
},
// 退出登录
logOut(){
let that = this
uni.showModal({
title: '提示',
content: '是否退出登录',
success: async function (res) {
if (res.confirm) {
that.$store.dispatch('Logout').then(res => {
uni.$u.toast('退出成功')
uni.navigateTo({
url: '/pages/login/index'
})
})
} else if (res.cancel) {
uni.$u.toast('取消退出')
}
}
})
}
}
}
</script>
<style lang="scss" scoped>
.usrInfo {
min-height: 100vh;
background-color: #F6F7FB;
.box{
background-color: #fff;
.item{
width: 100%;
border-bottom: 2rpx solid #eee;
&:last-child{
border-bottom: 0;
}
.avatar{
margin: 0;
background-color: #fff;
}
}
}
.logOut{
height: 80rpx;
line-height: 80rpx;
text-align: center;
color: #3D3D3D;
font-size: 30rpx;
background: #FFFFFF;
margin-top: 20rpx;
}
}
</style>