HomeUserInfo.vue
2.11 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
<template>
<div class="home_user_info">
<van-cell-group>
<van-cell title="姓名" :value="nickName" />
<!-- <van-popover v-model="showGenderPopover" trigger="click" :actions="actions" @select="onSelect">
<template #reference>
<van-cell title="性别">
{{gender==1?'男':gender==2?'女':'-'}}
</van-cell>
</template>
</van-popover> -->
<van-cell title="身份证" :value="idCard" />
<van-cell title="手机号" :value="phone" />
<van-cell title="关注主学校" :value="schoolNamesChoose" />
</van-cell-group>
</div>
</template>
<script>
export default {
data() {
return {
nickName: '', //姓名
gender: '', //性别
idCard: '', //身份证
phone: '', //手机号
schoolNamesChoose: '', //学校
showGenderPopover: false,
actions: [{ text: '选项一' }, { text: '选项二' }, { text: '选项三' }],
}
},
mounted() {
this.centerNo = localStorage.getItem('centerNo')
const userInfo = JSON.parse(localStorage.getItem('userInfo'))
this.nickName = userInfo.nickName
this.gender = userInfo.gender
this.idCard = userInfo.idCard || '-'
this.phone = userInfo.phone
let schoolNamesChoose = localStorage.getItem('schoolNamesChoose')
if (schoolNamesChoose) {
this.schoolNamesChoose = JSON.parse(schoolNamesChoose)
}
},
methods: {
onSelect(action) {
Toast(action.text)
},
// 获取用户信息
getUserInfo: function() {
this.$toast.loading({
message: '加载中...',
duration: 0,
forbidClick: true,
})
this.yxAxios.get(`${this.proxyUrl}/user/info/getPortalUserByNum?userNum=${this.centerNo}`).then((res) => {
this.$toast.clear()
if (res.data.code == 200) {
const userInfo = res.data.data.userInfo
localStorage.setItem('userInfo', JSON.stringify(userInfo))
}
})
},
},
}
</script>
<style lang="scss">
.home_user_info {
height: 100%;
padding-top: 10px;
box-sizing: border-box;
background: rgb(247, 245, 251);
.van-cell {
padding: 30px 32px;
}
}
</style>