From 20d29d16bdea0baae9bf99d0feb810877513cbcf Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Fri, 17 Jul 2020 16:08:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=81=9C=E8=BD=A6=E8=B4=B9?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=A4=B1=E8=B4=A5=E9=A3=8E=E9=99=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- factory/LoginFactory.js | 36 +++++++++++++++++---------- pages/payParkingFee/payParkingFee.vue | 17 ++++++++++--- 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/factory/LoginFactory.js b/factory/LoginFactory.js index 691cc65..fea9b09 100644 --- a/factory/LoginFactory.js +++ b/factory/LoginFactory.js @@ -202,6 +202,15 @@ class LoginFactory { requsetHcServerToLogin(loginRes, callback = () => {}) { let defaultRawData = '{"nickName":"","gender":1,"language":"","city":"","province":"","country":"","avatarUrl":""}'; // 请求服务端的登录接口 console.log('返回信息', loginRes); + let _appId = ''; + // #ifdef MP-WEIXIN + let accountInfo = uni.getAccountInfoSync(); + _appId = accountInfo.miniProgram.appId; + // #endif + + // #ifdef H5 + _appId = uni.getStorageSync(constant.mapping.W_APP_ID) + // #endif wx.request({ url: constant.url.loginUrl, method: 'post', @@ -215,11 +224,12 @@ class LoginFactory { // 签名 encryptedData: '', // 用户敏感信息 - iv: '' // 解密算法的向量 - + iv: '' ,// 解密算法的向量 + appId:_appId + }, success: function(res) { - + if (res.statusCode == '401') { let data = res.data; uni.setStorageSync(constant.mapping.CURRENT_OPEN_ID, data.openId); @@ -228,30 +238,30 @@ class LoginFactory { }); return; } - + res = res.data; - + if (res.result == 0) { //that.globalData.userInfo = res.userInfo; console.log(res.userInfo); wx.setStorageSync(constant.mapping.USER_INFO, JSON.stringify(res.userInfo)); let date = new Date(); let year = date.getFullYear(); //获取当前年份 - + let mon = date.getMonth(); //获取当前月份 - + let da = date.getDate(); //获取当前日 - + let h = date.getHours() + 1; //获取小时 - + let m = date.getMinutes(); //获取分钟 - + let s = date.getSeconds(); //获取秒 - + console.log("获取过去时间", year, mon, da, h, m, s); //将时间格式转化为时间戳 - + let afterOneHourDate = new Date(year, mon, da, h, m, s); //30s之后的时间 - + console.log("afterOneHourDate", afterOneHourDate); wx.setStorageSync(constant.mapping.LOGIN_FLAG, { sessionKey: res.sessionKey, diff --git a/pages/payParkingFee/payParkingFee.vue b/pages/payParkingFee/payParkingFee.vue index 8908e1a..aa91d21 100644 --- a/pages/payParkingFee/payParkingFee.vue +++ b/pages/payParkingFee/payParkingFee.vue @@ -121,7 +121,8 @@ feePrice: 0.00, communityId: '', communityName: '', - feeId: '' + feeId: '', + appId:'' }; }, @@ -130,6 +131,14 @@ */ onLoad: function(options) { context.onLoad(options); + // #ifdef MP-WEIXIN + let accountInfo = uni.getAccountInfoSync(); + this.appId = accountInfo.miniProgram.appId; + // #endif + + // #ifdef H5 + this.appId = uni.getStorageSync(constant.mapping.W_APP_ID) + // #endif let _fee = JSON.parse(options.fee); let _receivableAmount = this.feeMonth * _fee.feePrice; let _communityInfo = context.getCurrentCommunity(); @@ -233,7 +242,8 @@ feeId: this.feeId, feeName: '停车费', receivedAmount: _receivedAmount, - tradeType:_tradeType + tradeType:_tradeType, + appId: this.appId }; context.request({ url: constant.url.preOrder, @@ -303,7 +313,8 @@ feeId: this.feeId, feeName: '停车费', receivedAmount: _receivedAmount, - tradeType:_tradeType + tradeType:_tradeType, + appId: this.appId } context.request({