diff --git a/api/request.js b/api/request.js index eb4718c..01a2e33 100644 --- a/api/request.js +++ b/api/request.js @@ -1,17 +1,19 @@ import baseurl from './baseurl.js' -// Authorization: 'Bearer' + ' ' + uni.getStorageSync('token') var request = function(config) { + if (uni.getStorageSync('openid')) { + config.header.openid = uni.getStorageSync('openid') + } + const urls = config.url.split('?')[0] + if (config.url != '/nurseApplet/chatRecord/updateReadStatus' && config.url != + "/nurseApplet/chatRecord/sendMessage" && config.url != + `/applet/sign/apply/checkSignApply/` + uni.getStorageSync('userinfo').cardNo && urls != + `/nurseApplet/chatRecord/getChatRecord` && urls != '/applet/register/wxSportDecrypt') { + uni.showLoading({ + title: '' + }); + } return new Promise((resolve, rejected) => { - const urls = config.url.split('?')[0] - if (config.url != '/nurseApplet/chatRecord/updateReadStatus' && config.url != - "/nurseApplet/chatRecord/sendMessage" && config.url != - `/applet/sign/apply/checkSignApply/` + uni.getStorageSync('userinfo').cardNo && urls != - `/nurseApplet/chatRecord/getChatRecord` && urls != '/applet/register/wxSportDecrypt') { - uni.showLoading({ - title: '' - }); - } uni.request({ url: baseurl + config.url, data: config.data, diff --git a/pages/homepage/homepage.vue b/pages/homepage/homepage.vue index e1e2dbf..3e63c65 100644 --- a/pages/homepage/homepage.vue +++ b/pages/homepage/homepage.vue @@ -138,11 +138,11 @@ this.address = uni.getStorageSync('location') this.openid = uni.getStorageSync('openid'); this.region = Number(uni.getStorageSync('region')) - this.detailinfo(); if (this.userinfo && this.region != 3) { this.checkSignApplyinfo(); } if (uni.getStorageSync('userinfo')) { + this.detailinfo(); this.wxSportDecryptinfo(); } },