diff --git a/api/common.js b/api/common.js index a2937ac..922d165 100644 --- a/api/common.js +++ b/api/common.js @@ -1,6 +1,5 @@ import request from './request' let app = getApp(); -const token = wx.getStorageSync('accessToken'); export default { getConfig:()=>request.get('/api/config'), @@ -42,7 +41,7 @@ export default { filePath: file.tempFilePath, name: 'file', header:{ - Authorization: `Bearer ${token||app.globalData.accessToken}` + Authorization: `Bearer ${app?.globalData?.accessToken}` }, url: request.baseUrl+'/api/upload/image', success:(res)=>{ diff --git a/api/request.js b/api/request.js index 94d8dfc..561e1b4 100644 --- a/api/request.js +++ b/api/request.js @@ -7,7 +7,6 @@ if(envVersion=='develop'){ baseUrl = 'https://api.beefast.co' } let app = getApp(); -let token = wx.getStorageSync('accessToken'); const sendRequest = (options)=>{ @@ -53,7 +52,7 @@ const sendRequest = (options)=>{ method:options.method, data:options.data, header:{ - Authorization: `Bearer ${token||app?.globalData?.accessToken}` + Authorization: `Bearer ${app?.globalData?.accessToken}` }, fail:(res)=>{ wx.showToast({ diff --git a/app.js b/app.js index bf8decc..0ac7c91 100644 --- a/app.js +++ b/app.js @@ -3,6 +3,8 @@ import commonApi from './api/common'; let token = wx.getStorageSync('accessToken'); App({ async onLaunch(options){ + // await this.aaa(); + console.log(wx.router); console.log('app onlaunch',new Date().getTime()); wx.getStorage({ key:'accessToken', @@ -31,6 +33,13 @@ App({ } }) }, + aaa(){ + return new Promise((rs,rj)=>{ + setTimeout(()=>{ + rs(); + },2000) + }) + }, onShow(options){ console.log('app onShow',new Date().getTime()); /** diff --git a/app.json b/app.json index bcc9b21..5d371ed 100644 --- a/app.json +++ b/app.json @@ -1,8 +1,8 @@ { "pages": [ "pages/help/index/index", - "pages/my/promation/activities/index", "pages/login/login", + "pages/my/promation/activities/index", "pages/help/success/index", "pages/shop/index/index", "pages/order/index/index", diff --git a/assets/icon/help/join-group.png b/assets/icon/help/join-group.png index 1532415..d4a671b 100644 Binary files a/assets/icon/help/join-group.png and b/assets/icon/help/join-group.png differ diff --git a/assets/icon/navbar/home.png b/assets/icon/navbar/home.png new file mode 100644 index 0000000..38749ba Binary files /dev/null and b/assets/icon/navbar/home.png differ diff --git a/components/navbar/index.js b/components/navbar/index.js index d721c55..edef0b9 100644 --- a/components/navbar/index.js +++ b/components/navbar/index.js @@ -28,15 +28,25 @@ Component({ */ data: { statusBarHeight:0, - navBarHeight:44 + navBarHeight:44, + canBack:true }, lifetimes:{ attached(){ const windowInfo = wx.getWindowInfo(); - this.setData({ statusBarHeight:windowInfo.statusBarHeight - }) + }); + const pages = getCurrentPages(); + if(pages.length>1){ + this.setData({ + canBack:true + }) + }else{ + this.setData({ + canBack:false + }) + } } }, /** @@ -46,6 +56,11 @@ Component({ back(){ wx.navigateBack(); }, + backHome(){ + wx.reLaunch({ + url: '/pages/help/index/index', + }) + }, share(){ }, getHeight(){ diff --git a/components/navbar/index.wxml b/components/navbar/index.wxml index 1c1d7a6..fbd66c3 100644 --- a/components/navbar/index.wxml +++ b/components/navbar/index.wxml @@ -2,7 +2,10 @@ - + + + + diff --git a/components/navbar/index.wxss b/components/navbar/index.wxss index 66008ad..3e64b7a 100644 --- a/components/navbar/index.wxss +++ b/components/navbar/index.wxss @@ -31,6 +31,9 @@ width:40rpx;height:40rpx; padding:12rpx 14rpx 12rpx 0; } +.nav-bar-content .back.home{ + width:56rpx;height:56rpx; +} .nav-bar-content .left .btns.border{ border: 1.2px solid #D8D8D8; } diff --git a/pages/help/index/index.js b/pages/help/index/index.js index 5c95f7c..76e219e 100644 --- a/pages/help/index/index.js +++ b/pages/help/index/index.js @@ -39,7 +39,6 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad(options) { - console.log('page onload',new Date().getTime()); let height = this.selectComponent("#navBar").getHeight(); this.setData({ navBarHeight:height @@ -65,14 +64,11 @@ Page({ * 生命周期函数--监听页面初次渲染完成 */ onReady() { - - console.log('page onReady',new Date().getTime()); }, /** * 生命周期函数--监听页面显示 */ onShow() { - console.log('page onShow',new Date().getTime()); wx.getStorage({ key:'pre-order', success:(res)=>{ @@ -324,5 +320,17 @@ Page({ }else{ app.navToLogin(); } + }, + navToWXGroup(){ + if(this.data.currentCommunity&&this.data.currentCommunity.id){ + wx.navigateTo({ + url: `/pages/my/promation/wx-group/index?communityId=${this.data.currentCommunity.id}`, + }) + }else{ + wx.showToast({ + icon:'error', + title: '请先选择小区', + }) + } } }) \ No newline at end of file diff --git a/pages/help/index/index.wxml b/pages/help/index/index.wxml index 7917a0b..dee35b1 100644 --- a/pages/help/index/index.wxml +++ b/pages/help/index/index.wxml @@ -77,16 +77,15 @@ 新手指南 使用流程 - + - 加福利群 - 领优惠券 - + {{appConfig.join_group_title}} + {{appConfig.join_group_desc}} +