整合获取用户登录信息

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 => { }).then(res => {
if (res.code == 0) { if (res.code == 0) {
if (res.data == 2 || res.data == 0) { if (res.data == 2 || res.data == 0) {
this.$store.commit('getUserInfo') this.$store.dispatch('getUserInfo')
uni.redirectTo({ uni.redirectTo({
url: `./authSuccess?status=${res.data}`, success: () => { url: `./authSuccess?status=${res.data}`, success: () => {
if (res.data == 0) { if (res.data == 0) {

View File

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

View File

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

View File

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