diff --git a/main.js b/main.js index c057a91..705d2d3 100644 --- a/main.js +++ b/main.js @@ -23,6 +23,7 @@ Vue.prototype.goHome = () => { */ Vue.prototype.openPage = function(path, query = '') { let url = query ? `${path}?${query}` : path; + store.commit('user/setPagePath',url) if(!store.state.user.userInfo) { url = '/pages/basic-info/basic-info'; } diff --git a/pages/basic-info/basic-info.vue b/pages/basic-info/basic-info.vue index 76aa106..afa24e3 100644 --- a/pages/basic-info/basic-info.vue +++ b/pages/basic-info/basic-info.vue @@ -31,6 +31,7 @@ *学号 + @@ -81,7 +82,7 @@ } }, - computed: mapState('user', ['userInfo']), + computed: mapState('user', ['userInfo','pagePath']), methods: { ...mapMutations('user', ['setUserInfo']), @@ -130,18 +131,9 @@ data } = res.data; if (success && code === 200) { - console.log('data', data) - this.setUserInfo(data); - // name = data.name; - // idCard = data.idCard; - // phone = data.phone; - // studentID = data.no; - // current = data.post; this.success = true; - - uni.reLaunch({ - url: `/pages/apply-code/apply-code`, - }); + this.setUserInfo(data); + this.openPage(pagePath) } else { uni.showToast({ title: msg || '提交基本信息成功', diff --git a/store/modules/user/mutations.js b/store/modules/user/mutations.js index f813762..c1347f2 100644 --- a/store/modules/user/mutations.js +++ b/store/modules/user/mutations.js @@ -52,6 +52,15 @@ const mutations = { setUserInfo(state, data) { state.userInfo = data; }, + + /** + * 设置页面跳转参数 pagePath + * @param {*} state + * @param {string} data + */ + setPagePath(state, data) { + state.pagePath = data; + } }; export default mutations; diff --git a/store/modules/user/state.js b/store/modules/user/state.js index b669219..727e3a9 100644 --- a/store/modules/user/state.js +++ b/store/modules/user/state.js @@ -3,6 +3,7 @@ const state = { user: null, healthCode: '', // 健康码 userInfo: '', // 个人基本信息 + pagePath: '', //页面跳转参数 }; export default state;