个人中心

This commit is contained in:
liuye
2023-02-17 17:06:04 +08:00
parent ae600dc2c3
commit a36f3741bf
2 changed files with 31 additions and 10 deletions

View File

@@ -40,16 +40,21 @@
</div> </div>
</template> </template>
<script> <script>
import {mapActions, mapState} from "vuex"; import {mapState, mapActions} from "vuex";
export default { export default {
name: "AppPcMine", name: "AppPcMine",
appName: "我的", appName: "我的",
customNavigation: true, customNavigation: true,
data() {
return {
user: {}
}
},
computed: { computed: {
...mapState(['user', 'token']), ...mapState(['token']),
isApprove() { isApprove() {
return this.user?.status == 2; return this.user?.areaId ? true : false
}, },
listGroup() { listGroup() {
return [ return [
@@ -86,6 +91,13 @@ export default {
}, },
methods: { methods: {
...mapActions(['getUserInfo']), ...mapActions(['getUserInfo']),
getUserInfo() {
this.$instance.post(`/app/appwechatuserqujing/check`).then(res=> {
if(res?.data) {
this.user = res.data
}
})
},
approve() { approve() {
if (!this.token) { if (!this.token) {
this.$refs.login.show(); this.$refs.login.show();
@@ -133,7 +145,8 @@ export default {
} }
}, },
onShow() { onShow() {
this.getAuth(); this.getAuth()
this.getUserInfo()
}, },
onShareAppMessage() { onShareAppMessage() {
return { return {

View File

@@ -22,7 +22,7 @@
<div>{{ user.phone || '' }}</div> <div>{{ user.phone || '' }}</div>
</div> </div>
</div> </div>
<div class="item-content mar-b8" v-if="user.idNumber"> <div class="item-content mar-b8" v-if="user.areaId">
<div class="item solid"> <div class="item solid">
<p>姓名</p> <p>姓名</p>
<div>{{ user.realName || '' }}</div> <div>{{ user.realName || '' }}</div>
@@ -33,7 +33,7 @@
</div> </div>
<div class="item"> <div class="item">
<p>地区</p> <p>地区</p>
<div>{{ user.homeName || '' }}</div> <div>{{ user.areaName || '' }}</div>
</div> </div>
</div> </div>
<div class="item-content" @click="onLogout"> <div class="item-content" @click="onLogout">
@@ -51,7 +51,7 @@ export default {
name: "userInfo", name: "userInfo",
appName: "个人中心", appName: "个人中心",
computed: { computed: {
...mapState(['user', 'token']), ...mapState(['token']),
nickName: { nickName: {
set(v) { set(v) {
}, },
@@ -73,11 +73,12 @@ export default {
}, },
data() { data() {
return { return {
editNickName: false editNickName: false,
user: {}
} }
}, },
methods: { methods: {
...mapActions(['getUserInfo', 'autoLogin']), ...mapActions(['autoLogin']),
upLoad(img) { upLoad(img) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.uploadFile({ uni.uploadFile({
@@ -117,7 +118,14 @@ export default {
handleWeixinSync({detail}) { handleWeixinSync({detail}) {
const {value: nickName, avatarUrl} = detail const {value: nickName, avatarUrl} = detail
this.autoLogin({nickName, avatarUrl}) this.autoLogin({nickName, avatarUrl})
},
getUserInfo() {
this.$instance.post(`/app/appwechatuserqujing/check`).then(res=> {
if(res?.data) {
this.user = res.data
} }
})
},
} }
} }
</script> </script>