diff --git a/app.js b/app.js index b8cdb5e..92ba920 100644 --- a/app.js +++ b/app.js @@ -5,24 +5,8 @@ App({ data: { newArr:[],//存放分享二维进入消息信息 }, - // 这里这么写,是要在其他界面监听,而不是在app.js中监听,而且这个监听方法,需要一个回调方法。 - watch: function (method) { - var obj = this.globalData; - Object.defineProperty(obj, "ifShowTab", { - configurable: true, - enumerable: true, - set: function (value) { - this._ifShowTab = value; - console.log('是否会被执行2') - method(value); - }, - get: function () { - // 可以在这里打印一些东西,然后在其他界面调用getApp().globalData.name的时候,这里就会执行。 - return this._ifShowTab - } - }) - }, onLaunch: function(options) { + wx.hideTabBar() var that = this; if (that.globalData.previewFlag) {//解决微信图片预览重复进入app.js onshow that.globalData.previewFlag = false @@ -160,6 +144,7 @@ App({ }) } }, + /** * 下载小程序新版本并重启应用 */ @@ -182,7 +167,6 @@ App({ }, globalData: { styleLsit:{}, - ifShowTab: true, previewFlag:false,//解决图片预览调用noshow activityId:'',//活动id方便授权数据回传 typeLsit: [],//初始哈样式 diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js index d2a8d4e..07f4c45 100644 --- a/custom-tab-bar/index.js +++ b/custom-tab-bar/index.js @@ -100,8 +100,6 @@ Component({ console.log(data.index) const url = data.path; if (data.index == 0 || data.index == 3) { - console.log("ifShowTab = false") - app.globalData.ifShowTab = false this.getTemplateId() } @@ -123,63 +121,42 @@ Component({ } = res if (code == 200) { app.globalData.styleLsit = data - this.setData({ - list: [{ - "pagePath": "/index/index", - "iconPath": `${data.t_in.icon}`, - "selectedIconPath": `${data.t_in_std.icon}`, - "text": "首页" - }, - { - "pagePath": "/index/searchbar", - "iconPath": `${data.t_md.icon}`, - "selectedIconPath": `${data.t_md_std.icon}`, - "text": "门店" - }, - { - "pagePath": "/index/passCar", - "iconPath": `${data.t_tc.icon}`, - "selectedIconPath": `${data.t_tc_std.icon}`, - "text": "停车" - }, - { - "pagePath": "/index/user", - "iconPath": `${data.t_uc.icon}`, - "selectedIconPath": `${data.t_uc_std.icon}`, - "text": "我的" - } - ], - selectedColor: `${data.t_uc_std.styleClass}`, - home_a_img: [{ - "pagePath": "/index/index", - "iconPath": `${data.t_in.icon}`, - "selectedIconPath": `${data.t_in_std.icon}`, - "text": "首页" - }, - { - "pagePath": "/index/searchbar", - "iconPath": `${data.t_md.icon}`, - "selectedIconPath": `${data.t_md_std.icon}`, - "text": "门店" - }, - { - "pagePath": "/index/passCar", - "iconPath": `${data.t_tc.icon}`, - "selectedIconPath": `${data.t_tc_std.icon}`, - "text": "停车" - }, - { - "pagePath": "/index/user", - "iconPath": `${data.t_uc.icon}`, - "selectedIconPath": `${data.t_uc_std.icon}`, - "text": "我的" - } - ], - }) + this.setTabStyle() } // console.log(this.data.list[0].selectedIconPath, '99999999999999999999999999999999999999999') }) }, + // 初始换底部导航栏 + setTabStyle: function () { + this.getTabBar().setData({ + selectedColor: `${app.globalData.styleLsit.t_in_std.styleClass}`, + list: [{ + "pagePath": "/index/index", + "iconPath": `${app.globalData.styleLsit.t_in.icon}`, + "selectedIconPath": `${app.globalData.styleLsit.t_in_std.icon}`, + "text": "首页" + }, + { + "pagePath": "/index/searchbar", + "iconPath": `${app.globalData.styleLsit.t_md.icon}`, + "selectedIconPath": `${app.globalData.styleLsit.t_md_std.icon}`, + "text": "门店" + }, + { + "pagePath": "/index/passCar", + "iconPath": `${app.globalData.styleLsit.t_tc.icon}`, + "selectedIconPath": `${app.globalData.styleLsit.t_tc_std.icon}`, + "text": "停车" + }, + { + "pagePath": "/index/user", + "iconPath": `${app.globalData.styleLsit.t_uc.icon}`, + "selectedIconPath": `${app.globalData.styleLsit.t_uc_std.icon}`, + "text": "我的" + } + ], + }) + }, getTemplateId() { // console.log("隐藏") @@ -210,7 +187,6 @@ Component({ this.data.templateId.map(res => { tmplIds.push(res.templateId) }) - // console.log(tmplIds[0], "?|?|?|", this.data.templateId) wx.requestSubscribeMessage({ tmplIds: tmplIds, success(res) { @@ -225,7 +201,7 @@ Component({ Http.post({ url: config.api.wxMsg }).then(res => { - app.globalData.ifShowTab = true + wx.setStorageSync({ key: 'ifShowTab', data: true, @@ -234,7 +210,7 @@ Component({ }) return } - app.globalData.ifShowTab = true + // for (let i = 0; i < tmplIds.length;i++){ // if (res.tmplIds[i] == 'accept'){ @@ -243,7 +219,7 @@ Component({ // } }, complete(){ - app.globalData.ifShowTab = true + } }) }, diff --git a/custom-tab-bar/index.wxml b/custom-tab-bar/index.wxml index 7e45c49..5340c7c 100644 --- a/custom-tab-bar/index.wxml +++ b/custom-tab-bar/index.wxml @@ -1,8 +1,8 @@ - - - - - {{item.text}} - - + + + + + {{item.text}} + + diff --git a/custom-tab-bar/index.wxss b/custom-tab-bar/index.wxss index 210656d..1bb4d4b 100644 --- a/custom-tab-bar/index.wxss +++ b/custom-tab-bar/index.wxss @@ -8,6 +8,7 @@ background: white; display: flex; padding-bottom: env(safe-area-inset-bottom); + overflow: hidden; } .tab-bar-border { @@ -29,11 +30,11 @@ flex-direction: column; } -.tab-bar-item cover-image { +.tab-bar-item image { width: 46rpx; height: 46rpx; } -.tab-bar-item cover-view { +.tab-bar-item view { font-size: 20rpx; } diff --git a/ext.json b/ext.json index 5a139c3..30429db 100644 --- a/ext.json +++ b/ext.json @@ -1,13 +1,6 @@ { "ext": { "attr": { - "car": { - "etcp": { - "etcpAppId": "wx192b7d2e8dcbefd0", - "etcpVersion": "release", - "etcpCallbackUrl": "https://admintest.malls.iformall.com/api/carCallback/etcpPaidCallback" - } - }, "imgProxy": [ { "newUrl": "https://ctest.malls.iformall.com/img", @@ -23,11 +16,14 @@ } ], "configUrl": "https://ctest.malls.iformall.com/C/api", + "etcpAppId": "wx9f3a77763caa7c89", + "etcpVersion": "release", + "etcpCallbackUrl": "https://admintest.malls.iformall.com/api/carCallback/etcpPaidCallback", "ifHaveWebSocket": "0", "ifHaveCarModular": "1" }, - "name": "金泸商务", - "weappId": "wx649b3be73c1afe47", + "name": "富茂望京测试版", + "weappId": "wx9f3a77763caa7c89", "appVersion": "C.test.5.2.0" }, "debug": false, @@ -73,7 +69,7 @@ "provider": "wx2b03c6e691cd7370" } }, - "extAppid": "wx649b3be73c1afe47", + "extAppid": "wx9f3a77763caa7c89", "extEnable": true, "permission": { "scope.userLocation": { diff --git a/index/index.js b/index/index.js index e01f952..93052ff 100644 --- a/index/index.js +++ b/index/index.js @@ -259,7 +259,6 @@ Page({ * 生命周期函数--监听页面初次渲染完成 */ onLoad: function(options) { - console.log("我只执行一次") this.getType() this.getLocation(); let that = this; @@ -320,110 +319,43 @@ Page({ onUnload() { // wx.removeStorageSync('squareList') }, - watchBack: function (ifShowTab) { //监听ifShowTab变化 - if (ifShowTab){ - this.getTabBar().setData({ - list: [{ - "pagePath": "/index/index", - "iconPath": `${app.globalData.styleLsit.t_in.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_in_std.icon}`, - "text": "首页" - }, - { - "pagePath": "/index/searchbar", - "iconPath": `${app.globalData.styleLsit.t_md.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_md_std.icon}`, - "text": "门店" - }, - { - "pagePath": "/index/passCar", - "iconPath": `${app.globalData.styleLsit.t_tc.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_tc_std.icon}`, - "text": "停车" - }, - { - "pagePath": "/index/user", - "iconPath": `${app.globalData.styleLsit.t_uc.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_uc_std.icon}`, - "text": "我的" - } - ], - }) - }else{ - console.log("我隐藏了") - this.getTabBar().setData({ - list:[] - }) - } - + // 初始换底部导航栏 + setTabStyle: function () { + this.getTabBar().setData({ + selectedColor: `${app.globalData.styleLsit.t_in_std.styleClass}`, + list: [{ + "pagePath": "/index/index", + "iconPath": `${app.globalData.styleLsit.t_in.icon}`, + "selectedIconPath": `${app.globalData.styleLsit.t_in_std.icon}`, + "text": "首页" + }, + { + "pagePath": "/index/searchbar", + "iconPath": `${app.globalData.styleLsit.t_md.icon}`, + "selectedIconPath": `${app.globalData.styleLsit.t_md_std.icon}`, + "text": "门店" + }, + { + "pagePath": "/index/passCar", + "iconPath": `${app.globalData.styleLsit.t_tc.icon}`, + "selectedIconPath": `${app.globalData.styleLsit.t_tc_std.icon}`, + "text": "停车" + }, + { + "pagePath": "/index/user", + "iconPath": `${app.globalData.styleLsit.t_uc.icon}`, + "selectedIconPath": `${app.globalData.styleLsit.t_uc_std.icon}`, + "text": "我的" + } + ], + }) }, + onShow: function() { - if (app.globalData.ifShowTab){ - this.getTabBar().setData({ - list: [{ - "pagePath": "/index/index", - "iconPath": `${app.globalData.styleLsit.t_in.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_in_std.icon}`, - "text": "首页" - }, - { - "pagePath": "/index/searchbar", - "iconPath": `${app.globalData.styleLsit.t_md.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_md_std.icon}`, - "text": "门店" - }, - { - "pagePath": "/index/passCar", - "iconPath": `${app.globalData.styleLsit.t_tc.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_tc_std.icon}`, - "text": "停车" - }, - { - "pagePath": "/index/user", - "iconPath": `${app.globalData.styleLsit.t_uc.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_uc_std.icon}`, - "text": "我的" - } - ], - }) - } else { - console.log("我隐藏") - this.getTabBar().setData({ - list: [] - }) - } - if (wx.getStorageSync("tabFlag") && wx.getStorageSync("tabFlag")==1){//处理授权取消后回到首页底部导航栏显示 - this.getTabBar().setData({ - list: [{ - "pagePath": "/index/index", - "iconPath": `${app.globalData.styleLsit.t_in.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_in_std.icon}`, - "text": "首页" - }, - { - "pagePath": "/index/searchbar", - "iconPath": `${app.globalData.styleLsit.t_md.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_md_std.icon}`, - "text": "门店" - }, - { - "pagePath": "/index/passCar", - "iconPath": `${app.globalData.styleLsit.t_tc.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_tc_std.icon}`, - "text": "停车" - }, - { - "pagePath": "/index/user", - "iconPath": `${app.globalData.styleLsit.t_uc.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_uc_std.icon}`, - "text": "我的" - } - ], - }) - wx.removeStorageSync("tabFlag") + if(JSON.stringify(app.globalData.styleLsit)!="{}"){ + this.setTabStyle() } - console.log("我每次都执行" ,app.globalData.ifShowTab) - app.watch(this.watchBack) + this.ifShowSqare(); if (wx.getStorageSync("squareList")) { var temp = wx.getStorageSync("squareList").filter(item => item.tenantId == wx.getStorageSync("selectedMall"))[0].name diff --git a/index/user.js b/index/user.js index 23cd835..b8e6cfa 100644 --- a/index/user.js +++ b/index/user.js @@ -79,7 +79,20 @@ Page({ url: `/pages/getphoneInfo/index?path=main` }); }, - +//是否授权手机号 + ifPhoneInfo() { + let that = this; + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + return + }).catch(err => { + wx.navigateTo({ + url: `/pages/getphoneInfo/index?mineFlag=mine`, + }) + }) + }, /* 判断是否授权*/ userAuthorization() { Http.get({ @@ -88,7 +101,7 @@ Page({ token: app.globalData.token } }).then(res => { - // this.getUserInfo() + this.ifPhoneInfo() }).catch(err => { wx.navigateTo({ url: `/pages/getuserinfo/index`, @@ -128,67 +141,7 @@ Page({ gotoedit: function() { this.checkUserStatus(); }, - watchBack: function (ifShowTab) { //监听ifShowTab变化 - console.log("ifShowTab",ifShowTab) - if (ifShowTab) { - console.log("ifShowTab", ifShowTab) - this.getTabBar().setData({ - list: [{ - "pagePath": "/index/index", - "iconPath": `${app.globalData.styleLsit.t_in.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_in_std.icon}`, - "text": "首页" - }, - { - "pagePath": "/index/searchbar", - "iconPath": `${app.globalData.styleLsit.t_md.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_md_std.icon}`, - "text": "门店" - }, - { - "pagePath": "/index/passCar", - "iconPath": `${app.globalData.styleLsit.t_tc.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_tc_std.icon}`, - "text": "停车" - }, - { - "pagePath": "/index/user", - "iconPath": `${app.globalData.styleLsit.t_uc.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_uc_std.icon}`, - "text": "我的" - } - ], - }) - } else { - console.log("我隐藏") - this.getTabBar().setData({ - list: [] - }) - } - }, onLoad() { - if (typeof this.getTabBar === 'function' && - this.getTabBar()) { - if (ifStoreApp == 1) { - this.getTabBar().setData({ - selected: 1 - }) - } else if (ifStoreApp == 2) { - this.getTabBar().setData({ - selected: 2 - }) - } else { - this.getTabBar().setData({ - selected: 3, - list: [] - }) - } - - } - - - - this.getLocation(); this.updateScene(); // this.getRoomId(); @@ -263,42 +216,6 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function() { - console.log(app.globalData.ifShowTab,"////") - if (app.globalData.ifShowTab){ - this.getTabBar().setData({ - list: [{ - "pagePath": "/index/index", - "iconPath": `${app.globalData.styleLsit.t_in.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_in_std.icon}`, - "text": "首页" - }, - { - "pagePath": "/index/searchbar", - "iconPath": `${app.globalData.styleLsit.t_md.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_md_std.icon}`, - "text": "门店" - }, - { - "pagePath": "/index/passCar", - "iconPath": `${app.globalData.styleLsit.t_tc.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_tc_std.icon}`, - "text": "停车" - }, - { - "pagePath": "/index/user", - "iconPath": `${app.globalData.styleLsit.t_uc.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_uc_std.icon}`, - "text": "我的" - } - ], - }) - } else { - console.log("我隐藏") - this.getTabBar().setData({ - list: [] - }) - } - app.watch(this.watchBack) let that = this; that.userAuthorization() if (typeof that.getTabBar === 'function' && @@ -314,40 +231,10 @@ Page({ } else { that.getTabBar().setData({ selected: 3, - }) } } - if (wx.getStorageSync("tabFlag") && wx.getStorageSync("tabFlag") == 1) {//处理授权取消后回到首页底部导航栏显示 - this.getTabBar().setData({ - list: [{ - "pagePath": "/index/index", - "iconPath": `${app.globalData.styleLsit.t_in.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_in_std.icon}`, - "text": "首页" - }, - { - "pagePath": "/index/searchbar", - "iconPath": `${app.globalData.styleLsit.t_md.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_md_std.icon}`, - "text": "门店" - }, - { - "pagePath": "/index/passCar", - "iconPath": `${app.globalData.styleLsit.t_tc.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_tc_std.icon}`, - "text": "停车" - }, - { - "pagePath": "/index/user", - "iconPath": `${app.globalData.styleLsit.t_uc.icon}`, - "selectedIconPath": `${app.globalData.styleLsit.t_uc_std.icon}`, - "text": "我的" - } - ], - }) - wx.removeStorageSync("tabFlag") - } + that.setData({ appVersion: extConfig.appVersion, }) diff --git a/pages/getphoneInfo/index.js b/pages/getphoneInfo/index.js index 4766202..7375858 100755 --- a/pages/getphoneInfo/index.js +++ b/pages/getphoneInfo/index.js @@ -67,13 +67,11 @@ Page({ }) }, backHome: function() { - wx.setStorageSync("tabFlag", 1) wx.switchTab({ url: '/index/index', }) }, getPhoneNumber: function(e) { - wx.setStorageSync("tabFlag", 1) var that = this; var iv = e.detail.iv; var encryptedData = e.detail.encryptedData; @@ -166,7 +164,11 @@ Page({ wx.switchTab({ url: '/index/user' }); - } else { + } else if (that.data.mineFlag == 'index'){ + wx.switchTab({ + url: '/index/index' + }); + }else { wx.showToast({ title: res.data.msg, diff --git a/pages/getuserinfo/index.js b/pages/getuserinfo/index.js index 90e577c..23eb6f7 100755 --- a/pages/getuserinfo/index.js +++ b/pages/getuserinfo/index.js @@ -136,7 +136,7 @@ Page({ }) }, backHome: function() { - wx.setStorageSync("tabFlag", 1) + wx.switchTab({ url: '/index/index', }) diff --git a/pages/specialcourtesy/specialcourtesy.js b/pages/specialcourtesy/specialcourtesy.js index d9b0d16..8f160eb 100644 --- a/pages/specialcourtesy/specialcourtesy.js +++ b/pages/specialcourtesy/specialcourtesy.js @@ -22,10 +22,25 @@ Page({ phoneNumber: e.currentTarget.dataset.merchantlinkphone }); }, + //是否授权手机号 + ifPhoneInfo() { + let that = this; + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + return + }).catch(err => { + wx.navigateTo({ + url: `/pages/getphoneInfo/index?mineFlag=index`, + }) + }) + }, /** * 生命周期函数--监听页面显示 */ onShow: function () { + this.ifPhoneInfo() let that = this; console.log("渲染开始") Http.get({