整合获取用户登录信息

This commit is contained in:
aixianling
2022-06-29 18:15:53 +08:00
parent 2655a44573
commit 13567fcb3d
4 changed files with 13 additions and 12 deletions

View File

@@ -69,7 +69,7 @@ export default {
}).then(res => {
if (res.code == 0) {
if (res.data == 2 || res.data == 0) {
this.$store.commit('getUserInfo')
this.$store.dispatch('getUserInfo')
uni.redirectTo({
url: `./authSuccess?status=${res.data}`, success: () => {
if (res.data == 0) {

View File

@@ -139,7 +139,7 @@ export default {
if (res?.code == 0) {
this.$toast('党组织变更成功')
this.getUserInfo()
this.$store.commit("getUserInfo")
this.$store.dispatch("getUserInfo")
}
})
},

View File

@@ -13,6 +13,8 @@
</div>
</template>
<script>
import {mapActions, mapState} from "vuex"
export default {
data() {
return {
@@ -24,6 +26,9 @@ export default {
isSign: true
};
},
computed: {
...mapState(['user']),
},
onShow() {
uni.setNavigationBarColor({
frontColor: "#ffffff",
@@ -32,7 +37,10 @@ export default {
if (uni.getStorageSync('token')) {
this.meetingId = this.$mp.query.scene
// this.meetingId = 'c29aacb54f074c14ab93532e384a6daa'
this.getUserInfo()
this.getUserInfo().then(() => {
this.userId = this.user.id
this.getDetailInfo()
})
} else {
uni.showModal({
title: '提示',
@@ -50,14 +58,7 @@ export default {
}
},
methods: {
getUserInfo() {
this.$store.commit("getUserInfo", v => {
if (v) {
this.userId = res.data.id
this.getDetailInfo()
}
})
},
...mapActions(['getUserInfo']),
getDetailInfo() {
this.$instance.post(`/app/appthreemeetinguser/queryWeathersignByMeetingIdAndUserIdForWX?meetingId=${this.meetingId}&userId=${this.userId}`, null, {}).then(res => {
if (res.data) {

View File

@@ -69,7 +69,7 @@ export default {
}).then(res => {
if (res.code == 0) {
if (res.data == 2 || res.data == 0) {
this.$store.commit('getUserInfo')
this.$store.dispatch('getUserInfo')
uni.redirectTo({
url: `./authSuccess?status=${res.data}`, success: () => {
if (res.data == 0) {