diff --git a/common/ajax.js b/common/ajax.js index 7ddcc38..09a3c78 100644 --- a/common/ajax.js +++ b/common/ajax.js @@ -2,7 +2,7 @@ // 引入 uni-ajax 模块 import ajax from '@/uni_modules/u-ajax' - +import store from '@/store/index.js'; // 创建请求实例 const instance = ajax.create({ // 初始配置 @@ -11,7 +11,10 @@ const instance = ajax.create({ // 添加请求拦截器 instance.interceptors.request.use( - config => { + config => { + if (store.getters.getuserIsLogin) { + config.header['token'] = store.state.user.token + } // 在发送请求前做些什么 return config }, @@ -25,12 +28,14 @@ instance.interceptors.request.use( instance.interceptors.response.use( response => { if (response.statusCode == 200) { - + let res = response.data; + if (res.hasOwnProperty('token')) + uni.setStorageSync('token', res.token); return response.data - } + } // 对响应数据做些什么 console.log(response) - + return response.data }, error => { diff --git a/components/ywx-auth-model/ywx-auth-model.vue b/components/ywx-auth-model/ywx-auth-model.vue index fcd8f61..c27e103 100644 --- a/components/ywx-auth-model/ywx-auth-model.vue +++ b/components/ywx-auth-model/ywx-auth-model.vue @@ -113,13 +113,11 @@ }, onLoad: function() {}, methods: { - ...mapMutations(["updateUserInfo", "saveUserInfoToStorge"]), - onChooseAvatar(e) { - console.log(e) + ...mapMutations(["updateUserInfo"]), + onChooseAvatar(e) { const { avatarUrl } = e.detail - this.formDataReg.avatarUrl = avatarUrl }, submitLogin(loginform) { @@ -169,8 +167,7 @@ sessionKey: this.sessionKey, openId: this.openId, }).then(res => { - this.formDataReg.mobile = res.data.phoneNumber - console.log(res.data) + this.formDataReg.mobile = res.data.phoneNumber }); } } diff --git a/cpzs/chucang/chucang.vue b/cpzs/chucang/chucang.vue new file mode 100644 index 0000000..8183fd0 --- /dev/null +++ b/cpzs/chucang/chucang.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/cpzs/chushou/chushou.vue b/cpzs/chushou/chushou.vue new file mode 100644 index 0000000..8183fd0 --- /dev/null +++ b/cpzs/chushou/chushou.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/cpzs/diaohuo/diaohuo.vue b/cpzs/diaohuo/diaohuo.vue new file mode 100644 index 0000000..8183fd0 --- /dev/null +++ b/cpzs/diaohuo/diaohuo.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/cpzs/index/index.vue b/cpzs/index/index.vue new file mode 100644 index 0000000..3d15f3b --- /dev/null +++ b/cpzs/index/index.vue @@ -0,0 +1,114 @@ + + + + + + + diff --git a/cpzs/rucang/rucang.vue b/cpzs/rucang/rucang.vue new file mode 100644 index 0000000..8183fd0 --- /dev/null +++ b/cpzs/rucang/rucang.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/cpzs/ruku/ruku.vue b/cpzs/ruku/ruku.vue new file mode 100644 index 0000000..8183fd0 --- /dev/null +++ b/cpzs/ruku/ruku.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/cpzs/shouhou/shouhou.vue b/cpzs/shouhou/shouhou.vue new file mode 100644 index 0000000..8183fd0 --- /dev/null +++ b/cpzs/shouhou/shouhou.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/cpzs/shouhoudo/shouhoudo.vue b/cpzs/shouhoudo/shouhoudo.vue new file mode 100644 index 0000000..8183fd0 --- /dev/null +++ b/cpzs/shouhoudo/shouhoudo.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/member/profile/profile.vue b/member/profile/profile.vue index 8718f40..11c3750 100644 --- a/member/profile/profile.vue +++ b/member/profile/profile.vue @@ -1,77 +1,62 @@