diff --git a/App.vue b/App.vue
index 02c7786..e429760 100644
--- a/App.vue
+++ b/App.vue
@@ -1,13 +1,61 @@
diff --git a/components/user-agreement/user-agreement.vue b/components/user-agreement/user-agreement.vue
new file mode 100644
index 0000000..d1f8803
--- /dev/null
+++ b/components/user-agreement/user-agreement.vue
@@ -0,0 +1,57 @@
+
+
+
+
+ 请认真阅读
+ 《用户服务协议》和
+ 《隐私政策》,
+ 勾选代表您已同意此协议
+
+
+
+
+
+
+
diff --git a/main.js b/main.js
index 484f4dc..c057a91 100644
--- a/main.js
+++ b/main.js
@@ -22,8 +22,11 @@ Vue.prototype.goHome = () => {
* @param {string} query 参数字符串a=x&b=y
*/
Vue.prototype.openPage = function(path, query = '') {
- let url = query ? `${path}?${query}` : path;
- uni.navigateTo({ url });
+ let url = query ? `${path}?${query}` : path;
+ if(!store.state.user.userInfo) {
+ url = '/pages/basic-info/basic-info';
+ }
+ uni.navigateTo({ url });
};
App.mpType = 'app';
diff --git a/pages.json b/pages.json
index e19261a..6d6d4e8 100644
--- a/pages.json
+++ b/pages.json
@@ -1,12 +1,5 @@
{
"pages": [
- // {
- // "path": "pages/my-code/my-code",
- // "style": {
- // "navigationBarTitleText": "我的健康打卡"
- // }
- // },
-
{
"path": "pages/index/index",
"style": {
@@ -63,6 +56,18 @@
"style": {
"navigationBarTitleText": "我的行程"
}
+ },
+ {
+ "path": "pages/service-agreement/service-agreement",
+ "style": {
+ "navigationBarTitleText": "服务协议"
+ }
+ },
+ {
+ "path": "pages/privacy-aolicy/privacy-aolicy",
+ "style": {
+ "navigationBarTitleText": "隐私政策"
+ }
}
],
"globalStyle": {
diff --git a/pages/basic-info/basic-info.vue b/pages/basic-info/basic-info.vue
index a9dacc4..76aa106 100644
--- a/pages/basic-info/basic-info.vue
+++ b/pages/basic-info/basic-info.vue
@@ -2,20 +2,20 @@
-
+
+
@@ -42,6 +44,7 @@
import {
SUBMIT_USER_INFO
} from 'api/api';
+ import { mapState,mapMutations } from 'vuex';
export default {
data() {
@@ -63,10 +66,25 @@
},
],
studentID: '',
- current: 0
+ current: 0,
+ agree: false
};
},
+
+ created() {
+ if(this.userInfo){
+ this.name = this.userInfo.name;
+ this.idCard = this.userInfo.idCard;
+ this.phone = this.userInfo.phone;
+ this.studentID = this.userInfo.no;
+ this.current = this.userInfo.post;
+ }
+ },
+
+ computed: mapState('user', ['userInfo']),
+
methods: {
+ ...mapMutations('user', ['setUserInfo']),
RadioChange: function(evt) {
for (let i = 0; i < this.identitys.length; i++) {
if (this.identitys[i].value === evt.target.value) {
@@ -76,6 +94,10 @@
}
},
+ changeIntentions(data){
+ this.agree = data;
+ },
+
/**
* 提交基本信息
*/
@@ -109,12 +131,14 @@
} = res.data;
if (success && code === 200) {
console.log('data', data)
- name = data.name;
- idCard = data.idCard;
- phone = data.phone;
- studentID = data.no;
- current = data.post;
+ 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`,
});
@@ -137,7 +161,7 @@
// 验证信息
checkRules() {
- const { name,idCard,phone,identitys,studentID } = this;
+ const { name,idCard,phone,identitys,studentID,agree } = this;
if (!name) {
showToast('请输入姓名');
return;
@@ -158,6 +182,10 @@
showToast('请输入学号');
return;
}
+ if(!agree) {
+ showToast('请选择是否同意《用户服务协议》和《隐私政策》');
+ return;
+ }
return true;
},
diff --git a/pages/my-code/my-code.vue b/pages/my-code/my-code.vue
index aaf6c74..8829c78 100644
--- a/pages/my-code/my-code.vue
+++ b/pages/my-code/my-code.vue
@@ -37,6 +37,10 @@
import {
showToast
} from 'common/script/util';
+ import {
+ SUBMIT_USER_INFO
+ } from 'api/api';
+ import { mapState,mapMutations } from 'vuex';
export default {
data() {
@@ -77,7 +81,17 @@
],
};
},
+
+ created() {
+ if(this.userInfo){
+
+ }
+ },
+
+ computed: mapState('user', ['userInfo']),
+
methods: {
+ ...mapMutations('user', ['setUserInfo']),
},
};
diff --git a/pages/privacy-aolicy/privacy-aolicy.vue b/pages/privacy-aolicy/privacy-aolicy.vue
new file mode 100644
index 0000000..8be5f93
--- /dev/null
+++ b/pages/privacy-aolicy/privacy-aolicy.vue
@@ -0,0 +1,13 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/service-agreement/service-agreement.vue b/pages/service-agreement/service-agreement.vue
new file mode 100644
index 0000000..9742d4e
--- /dev/null
+++ b/pages/service-agreement/service-agreement.vue
@@ -0,0 +1,13 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/store/modules/user/actions.js b/store/modules/user/actions.js
index 8f216c2..19dea1b 100644
--- a/store/modules/user/actions.js
+++ b/store/modules/user/actions.js
@@ -12,6 +12,7 @@ const actions = {
.then(data => {
commit('setToken', data.token);
commit('setUser', data);
+
resolve(data);
})
.catch(err => {
diff --git a/store/modules/user/mutations.js b/store/modules/user/mutations.js
index ec63bcb..f813762 100644
--- a/store/modules/user/mutations.js
+++ b/store/modules/user/mutations.js
@@ -43,6 +43,15 @@ const mutations = {
setHealthCode(state, data) {
state.healthCode = data;
},
+
+ /**
+ * 设置个人信息 userInfo
+ * @param {*} state
+ * @param {string} data
+ */
+ setUserInfo(state, data) {
+ state.userInfo = data;
+ },
};
export default mutations;
diff --git a/store/modules/user/state.js b/store/modules/user/state.js
index 6fe77e4..b669219 100644
--- a/store/modules/user/state.js
+++ b/store/modules/user/state.js
@@ -2,6 +2,7 @@ const state = {
token: '',
user: null,
healthCode: '', // 健康码
+ userInfo: '', // 个人基本信息
};
export default state;