Browse Source

main.js

remotes/origin/HEAD
songsong428 5 years ago
parent
commit
c5eec5750a
  1. 1
      main.js
  2. 16
      pages/basic-info/basic-info.vue
  3. 9
      store/modules/user/mutations.js
  4. 1
      store/modules/user/state.js

1
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';
}

16
pages/basic-info/basic-info.vue

@ -31,6 +31,7 @@
<view class="title padding-bottom-sm"><span v-show="!userInfo" class="text-red padding-right-xs">*</span>学号</view>
<input :disabled="userInfo ? true : false" placeholder="请输入学号" name="input" type="text" v-model="studentID" />
</view>
</form>
<user-agreement v-if="!userInfo" @changeIntentions='changeIntentions'></user-agreement>
<button v-show="!userInfo" class="bg-cyan margin primary-btn" hover-class="cc-active" @tap="handleSubmitUserInfo">确认提交</button>
@ -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 || '提交基本信息成功',

9
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;

1
store/modules/user/state.js

@ -3,6 +3,7 @@ const state = {
user: null,
healthCode: '', // 健康码
userInfo: '', // 个人基本信息
pagePath: '', //页面跳转参数
};
export default state;

Loading…
Cancel
Save