From b77282d0dcbc567cdc7d30efa8886b29cb0b6708 Mon Sep 17 00:00:00 2001 From: YangWork Date: Thu, 16 Feb 2023 18:00:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=BA=A7=E5=93=81=E8=BF=BD?= =?UTF-8?q?=E6=BA=AF=E9=A1=B5=E9=9D=A2=20=E8=BF=9B=E4=B8=80=E6=AD=A5?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=90=84=E9=A1=B9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: YangWork --- common/ajax.js | 15 ++- components/ywx-auth-model/ywx-auth-model.vue | 9 +- cpzs/chucang/chucang.vue | 22 ++++ cpzs/chushou/chushou.vue | 22 ++++ cpzs/diaohuo/diaohuo.vue | 22 ++++ cpzs/index/index.vue | 114 +++++++++++++++++++ cpzs/rucang/rucang.vue | 22 ++++ cpzs/ruku/ruku.vue | 22 ++++ cpzs/shouhou/shouhou.vue | 22 ++++ cpzs/shouhoudo/shouhoudo.vue | 22 ++++ member/profile/profile.vue | 80 +++++++------ pages.json | 66 ++++++++++- pages/tabbar/home/home.vue | 27 +++-- pages/tabbar/my/my.vue | 65 ++++++----- store/modules/user.js | 37 +++--- 15 files changed, 451 insertions(+), 116 deletions(-) create mode 100644 cpzs/chucang/chucang.vue create mode 100644 cpzs/chushou/chushou.vue create mode 100644 cpzs/diaohuo/diaohuo.vue create mode 100644 cpzs/index/index.vue create mode 100644 cpzs/rucang/rucang.vue create mode 100644 cpzs/ruku/ruku.vue create mode 100644 cpzs/shouhou/shouhou.vue create mode 100644 cpzs/shouhoudo/shouhoudo.vue 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 @@