From e28209811ce8e8bb40cdae492aa157741151fafa Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Mon, 10 Aug 2020 22:48:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- constant/AppConstant.js | 3 ++ context/Java110Context.js | 6 ++++ pages/index/index.vue | 60 ++++++++++++++------------------------- 3 files changed, 31 insertions(+), 38 deletions(-) diff --git a/constant/AppConstant.js b/constant/AppConstant.js index 1877016..49fdafa 100644 --- a/constant/AppConstant.js +++ b/constant/AppConstant.js @@ -4,6 +4,8 @@ * add by wuxw 2019-12-28 */ class AppConstant { + + static wAppId="wx43458162e3c31d92"; //微信AppId /** * 应用信息,主要是用来和后端服务交互时的时候用 */ @@ -13,6 +15,7 @@ class AppConstant { // #endif // #ifdef H5 + static appId = "992020061452450002"; static appSecurity = ""; // #endif diff --git a/context/Java110Context.js b/context/Java110Context.js index ffc3adb..f3c3d66 100644 --- a/context/Java110Context.js +++ b/context/Java110Context.js @@ -10,6 +10,7 @@ const constant = require("../constant/index.js"); const util = require("../utils/index.js"); const factory = require("../factory/index.js"); + /** * 获取请后台服务时的头信息 */ @@ -386,6 +387,11 @@ const onLoad = function(_option) { if (wAppId != null && wAppId != undefined && wAppId != '') { uni.setStorageSync(constant.mapping.W_APP_ID, _option.wAppId); + }else{ + wAppId = uni.getStorageInfoSync(constant.mapping.W_APP_ID) + if(wAppId != null && wAppId != undefined && wAppId != ''){ + uni.setStorageSync(constant.mapping.W_APP_ID, constant.app.wAppId); + } } // #endif diff --git a/pages/index/index.vue b/pages/index/index.vue index d360218..d5b3641 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -178,23 +178,7 @@ onLoad: function(options) { let _that = this; context.onLoad(options); - let loginStatus = context.checkLoginStatus(); - if(!loginStatus){ - //HC测试小区id - _that.communityId = constant.mapping.HC_TEST_COMMUNITY_ID; - }else{ - context.getOwner(function(_owner) { - let _communityId = ''; - if (_owner == null) { - _communityId = constant.mapping.HC_TEST_COMMUNITY_ID; - } else { - _communityId = _owner.communityId; - } - _that.communityId = _communityId; - }); - } - _that.loadActivitesFun(); //查询小区广告 - _that.loadCommunityAdvertPhotoFun(); + }, /** @@ -211,23 +195,9 @@ if(context.checkLoginStatus()){ _that.judgeBindOwnerFun(); } + this._initIndexData(); }, - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function() {}, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function() {}, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function() {}, - /** * 页面上拉触底事件的处理函数 */ @@ -236,14 +206,28 @@ this.page = this.page +1; this.loadActivitesFun(); } - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function() {}, methods: { + _initIndexData:function(){ + let _that = this; + let loginStatus = context.checkLoginStatus(); + if(!loginStatus){ + //HC测试小区id + _that.communityId = constant.mapping.HC_TEST_COMMUNITY_ID; + }else{ + context.getOwner(function(_owner) { + let _communityId = ''; + if (_owner == null) { + _communityId = constant.mapping.HC_TEST_COMMUNITY_ID; + } else { + _communityId = _owner.communityId; + } + _that.communityId = _communityId; + }); + } + _that.loadActivitesFun(); //查询小区广告 + _that.loadCommunityAdvertPhotoFun(); + }, judgeBindOwnerFun: function() { context.getOwner(function(_owner) {