|
@@ -19,16 +19,23 @@ export default {
|
|
|
},
|
|
|
components: {},
|
|
|
async created () {
|
|
|
- const userinfo = sessionStorage.getItem('userinfo')
|
|
|
- if (!userinfo) {
|
|
|
+ const openid = sessionStorage.getItem('openid')
|
|
|
+ if (!openid) {
|
|
|
this.$router.push('/login/userInfo')
|
|
|
return false
|
|
|
}
|
|
|
- this.info = JSON.parse(userinfo)
|
|
|
+ this.query()
|
|
|
},
|
|
|
computed: {},
|
|
|
methods: {
|
|
|
- ...mapActions(['userupdate']),
|
|
|
+ ...mapActions(['userupdate', 'userquery']),
|
|
|
+ async query () {
|
|
|
+ const openid = sessionStorage.getItem('openid')
|
|
|
+ const res = await this.userquery({ openid })
|
|
|
+ if (res.errcode === 0) {
|
|
|
+ this.info = res.data[0]
|
|
|
+ }
|
|
|
+ },
|
|
|
clear () {
|
|
|
this.info.name = null
|
|
|
},
|
|
@@ -42,8 +49,10 @@ export default {
|
|
|
return false
|
|
|
}
|
|
|
const res = await this.userupdate(this.info)
|
|
|
- console.log(res)
|
|
|
- if (res.errcode === 0 || !res.errcode) Toast.success('修改成功')
|
|
|
+ if (res.errcode === 0 || !res.errcode) {
|
|
|
+ Toast.success('修改成功')
|
|
|
+ this.query()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|