From 9631b4c7c1bb9f77957bdb5f50eff317c70a3407 Mon Sep 17 00:00:00 2001 From: XiaoXinPro 14 IAH5R <568170040@qq.com> Date: Wed, 17 May 2023 17:09:46 +0800 Subject: [PATCH] upload --- index/passCar.js | 190 ++++++++++++++++------------- index/user.js | 1 - pages/getphoneInfo/index.js | 9 +- pages/passCar/showList/showList.js | 11 +- 4 files changed, 124 insertions(+), 87 deletions(-) diff --git a/index/passCar.js b/index/passCar.js index 4e728e2..645b7a7 100644 --- a/index/passCar.js +++ b/index/passCar.js @@ -301,68 +301,75 @@ Page({ showCancel: false, }) }, + onShow: function (options) { - this.setData({ - goHomeUrl: app.globalData.goHomeUrl - }) - if (typeof this.getTabBar === 'function' && - this.getTabBar()) { - this.getTabBar().setData({ - selected: 2 - }) - } var that = this; - that.setData({ - etcpAppId: extConfig.attr.car.etcp.etcpAppId, - carMiniVersion: extConfig.attr.car.version, - etcpCallbackUrl: extConfig.attr.car.etcp.etcpCallbackUrl, - payPath: extConfig.attr.car.etcp.payPath, - ifHaveCarModular: extConfig.attr.ifHaveCarModular - }) - console.log(this.data.ifHaveCarModular, 'ifHaveCarModular'); - if (app.globalData.token) { - that.getList(); - that.init(); - } else { - that.init(); - } - /** - * 只有用户选择了优惠券 - * 才会进行券和车牌的绑定 - */ - /* if (wx.getStorageSync("chosed") && that.data.quanid) { - that.getStopFee(that.data.listCardNum); - that.bindCoupon(that.data.quanid); - wx.setStorage({ - key: 'chosed', - data: '', + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + this.setData({ + goHomeUrl: app.globalData.goHomeUrl }) - }; */ - if (app.globalData.token) { - // that.initUsrCarList(); - that.initUsrCarList("flags"); + if (typeof this.getTabBar === 'function' && + this.getTabBar()) { + this.getTabBar().setData({ + selected: 2 + }) + } + that.setData({ - current: 0 + etcpAppId: extConfig.attr.car.etcp.etcpAppId, + carMiniVersion: extConfig.attr.car.version, + etcpCallbackUrl: extConfig.attr.car.etcp.etcpCallbackUrl, + payPath: extConfig.attr.car.etcp.payPath, + ifHaveCarModular: extConfig.attr.ifHaveCarModular }) - } - - if (that.data.addCar) { - // 绑车牌 - if (app.globalData.carLogin) { - that.bindCar(that.data.addCar); + console.log(this.data.ifHaveCarModular, 'ifHaveCarModular'); + if (app.globalData.token) { + that.getList(); + that.init(); } else { - that.bindCar(that.data.addCar); + that.init(); + } + /** + * 只有用户选择了优惠券 + * 才会进行券和车牌的绑定 + */ + /* if (wx.getStorageSync("chosed") && that.data.quanid) { + that.getStopFee(that.data.listCardNum); + that.bindCoupon(that.data.quanid); + wx.setStorage({ + key: 'chosed', + data: '', + }) + }; */ + if (app.globalData.token) { + // that.initUsrCarList(); + that.initUsrCarList("flags"); + that.setData({ + current: 0 + }) } - that.setData({ - addCar: null - }); - } - - this.getTicketList(0, 1); - + if (that.data.addCar) { + // 绑车牌 + if (app.globalData.carLogin) { + that.bindCar(that.data.addCar); + } else { + that.bindCar(that.data.addCar); + } + that.setData({ + addCar: null + }); + } + this.getTicketList(0, 1); + }).catch(err => { + that.init(); + }) }, + cancelMove: function () { console.log(111) return false; @@ -376,39 +383,45 @@ Page({ }) }, onLoad: function (options) { - var that = this; - /** - * 获得分享小程序的 - * title - * desc - */ + Http.get({ - url: config.api.getWeapNote, - data: { - appId: config.weapp.AppId, + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + /** + * 获得分享小程序的 + * title + * desc + */ + Http.get({ + url: config.api.getWeapNote, + data: { + appId: config.weapp.AppId, + } + }) + .then(res => { + let weapNote = JSON.parse(res.data.weapNote); + that.setData({ + desc: weapNote.carpage.desc, + title: weapNote.carpage.title + }) + }) + .catch(err => { + console.log(err); + }) + // 登录 + var scene = decodeURIComponent(options.scene); + that.setData({ + scene: scene + }); + if (app.globalData.token) { } else { + // app.getLocation(); + that.userLogin() } + }).catch(err => { + return }) - .then(res => { - let weapNote = JSON.parse(res.data.weapNote); - that.setData({ - desc: weapNote.carpage.desc, - title: weapNote.carpage.title - }) - }) - .catch(err => { - console.log(err); - }) - // 登录 - var scene = decodeURIComponent(options.scene); - that.setData({ - scene: scene - }); - if (app.globalData.token) { } else { - // app.getLocation(); - that.userLogin() - } - }, /** * 用户登录 @@ -499,9 +512,18 @@ Page({ .catch(err => { }) }, jumpToAdd: function () { - wx.navigateTo({ - url: `/pages/addPark/addPark?flags=managepalte` - }); + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + wx.navigateTo({ + url: `/pages/addPark/addPark?flags=managepalte` + }); + }).catch(err => { + wx.navigateTo({ + url: `/pages/getphoneInfo/index?mineFlag=passCar`, + }) + }) }, passc: function () { wx.navigateTo({ diff --git a/index/user.js b/index/user.js index 2e07150..6e12987 100644 --- a/index/user.js +++ b/index/user.js @@ -101,7 +101,6 @@ Page({ }, //是否授权手机号 ifPhoneInfo() { - let that = this; Http.get({ url: config.api.checkPhoneStatus, data: {} diff --git a/pages/getphoneInfo/index.js b/pages/getphoneInfo/index.js index 7921956..4e862af 100755 --- a/pages/getphoneInfo/index.js +++ b/pages/getphoneInfo/index.js @@ -227,10 +227,13 @@ Page({ url: `/pages/radetail/joinActivity/edit?activityId=${that.data.signActivity}` }) } else if (that.data.mineFlag == 'mine') { - wx.switchTab({ url: '/index/user' }); + } else if (that.data.mineFlag == 'passCar') { + wx.switchTab({ + url: '/index/passCar' + }); } else if (that.data.mineFlag == 'index') { wx.switchTab({ url: app.globalData.goHomeUrl @@ -243,6 +246,10 @@ Page({ wx.navigateTo({ url: `/pages/index/searchbar/detail/index?id=${that.data.id}` }) + } else if (that.data.path == 'passCarList') { + wx.navigateTo({ + url: `/pages/passCar/showList/showList` + }) } else { wx.showToast({ title: res.data.msg, diff --git a/pages/passCar/showList/showList.js b/pages/passCar/showList/showList.js index 72cb4b2..39e1967 100644 --- a/pages/passCar/showList/showList.js +++ b/pages/passCar/showList/showList.js @@ -112,7 +112,16 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad(options) { - this.getList(this.data.pageNum) + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + this.getList(this.data.pageNum) + }).catch(err => { + wx.navigateTo({ + url: `/pages/getphoneInfo/index?path=passCarList`, + }) + }) }, /**