index.vue
6.42 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<template>
<view class="mine-container" :style="{height: `${windowHeight}px`}">
<!-- 个人信息卡片 -->
<view class="profile-card">
<view class="profile-bg" />
<view class="profile-header">
<view class="flex align-center">
<view class="cu-avatar xl round avatar-initial">
<text class="avatar-text">{{ initialNameChar }}</text>
</view>
<view class="profile-text" @click="name ? handleToInfo() : handleToLogin()">
<view class="name">{{ name || '点击登录' }}</view>
<view class="muted omit1">{{ deptPathsText }}</view>
<view class="muted omit1">{{ telephone }}</view>
</view>
</view>
</view>
</view>
<!-- 菜单列表 -->
<view class="menu-list">
<view class="list-cell list-cell-arrow" @click="handleToPwd">
<view class="menu-item-box">
<view class="iconfont icon-password menu-icon"></view>
<view>修改密码</view>
</view>
</view>
<!-- <view class="list-cell list-cell-arrow" @click="handleClearCache">
<view class="menu-item-box">
<view class="iconfont icon-clean menu-icon"></view>
<view>清除缓存</view>
</view>
</view> -->
<view class="list-cell list-cell-arrow" @click="handleToSetting">
<view class="menu-item-box">
<view class="iconfont icon-setting menu-icon"></view>
<view>设置</view>
</view>
</view>
<view class="list-cell list-cell-arrow" @click="handleAbout">
<view class="menu-item-box">
<view class="iconfont icon-aixin menu-icon"></view>
<view>关于我们</view>
</view>
</view>
</view>
<view>
<uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog type="info" cancelText="关闭" confirmText="确定" title="公众号" content="公众号">
<view><image src="../../static/images/gzh.jpg" style="width: 250px;height: 250px;"></image></view>
</uni-popup-dialog>
</uni-popup>
</view>
</view>
</template>
<script>
import storage from '@/utils/storage'
export default {
data() {
return {
globalConfig: getApp().globalData.config,
name: '',
username: '',
version: getApp().globalData.config.appInfo.version,
deptPathsText: '',
telephone: '',
initialNameChar: ''
}
},
onShow() {
// this.$store.dispatch('GetInfo');
const color = getApp().globalData.config.themeColor
uni.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: color
})
},
computed: {
initialNameChar() {
const n = (this.username || '').trim()
return n ? n.charAt(0) : '登'
},
windowHeight() {
return uni.getSystemInfoSync().windowHeight - 50
}
},
created() {
console.log('this.$store.state.user', this.$store.state.user)
this.name = this.$store.state.user.name || '';
this.username = this.$store.state.user.username || '',
this.deptPathsText =this.$store.state.user.deptPaths.length ? this.$store.state.user.deptPaths.join(',') : '',
this.telephone = this.$store.state.user.telephone
const _username = (this.username || '').trim()
this.initialNameChar = _username ? _username.charAt(0) : '登'
},
methods: {
handleToPwd() {
this.$tab.navigateTo('/pages/mine/pwd/index')
},
handleClearCache() {
try {
storage.clean()
uni.clearStorage()
this.$modal.showToast('缓存已清除')
} catch (e) {
this.$modal.showToast('清除失败')
}
},
handleToInfo() {
this.$tab.navigateTo('/pages/mine/info/index')
},
handleToEditInfo() {
this.$tab.navigateTo('/pages/mine/info/edit')
},
handleToSetting() {
this.$tab.navigateTo('/pages/mine/setting/index')
},
handleToLogin() {
this.$tab.reLaunch('/pages/login')
},
handleToAvatar() {
this.$tab.navigateTo('/pages/mine/avatar/index')
},
handleLogout() {
this.$modal.confirm('确定注销并退出系统吗?').then(() => {
this.$store.dispatch('LogOut').then(() => {
this.$tab.reLaunch('/pages/index')
})
})
},
handleHelp() {
this.$tab.navigateTo('/pages/mine/help/index')
},
handleAbout() {
this.$tab.navigateTo('/pages/mine/about/index')
},
handleJiaoLiuQun() {
this.$refs.alertDialog.open('center');
},
handleBuilding() {
this.$modal.showToast('添加CDERP客服 QQ:3783722918')
},
handleLink() {
// let site = this.globalConfig.appInfo.agreements[2]
// this.$tab.navigateTo('/pages/common/webview/index?title='+site.title+'&url='+site.url)
this.$refs.alertDialog.open('center');
}
}
}
</script>
<style scoped lang="scss">
page {
background: #F2F3FF;
}
.mine-container {
width: 100%;
height: 100%;
.profile-card {
position: relative;
height: 284rpx;
.profile-bg {
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 1;
background: $theme-primary;
height: 134rpx;
}
.profile-header {
position: absolute;
top: 50rpx;
left: 50%;
transform: translateX(-50%);
z-index: 2;
width: 686rpx;
padding: 36rpx 36rpx 46rpx;
border-radius: 16rpx;
background: linear-gradient( 358deg, #FFFFFF 0%, #CBE2FD 100%);
}
.cu-avatar {
margin-right: 26rpx;
&.avatar-initial {
background-color: #fbecc0;
display: flex;
align-items: center;
justify-content: center;
}
.avatar-text {
color: #666;
font-weight: 600;
font-size: 36rpx;
}
}
.profile-text {
display: flex;
flex-direction: column;
gap: 4rpx;
.name { font-size: 18px; font-weight: 600; color: rgba(0,0,0,0.9); }
.muted { font-size: 12px; color: rgba(0,0,0,0.5); }
}
}
.menu-list {
margin: 0 32rpx;
.list-cell {
padding: 32rpx 40rpx;
color: rgba(0,0,0,0.9);
font-size: 32rpx;
}
.menu-icon {
color: rgba(0,0,0,0.9);
font-size: 40rpx;
}
}
}
</style>