优化代码

This commit is contained in:
java110 2020-08-10 22:48:24 +08:00
parent f76e39316f
commit e28209811c
3 changed files with 31 additions and 38 deletions

View File

@ -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

View File

@ -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

View File

@ -178,23 +178,7 @@
onLoad: function(options) {
let _that = this;
context.onLoad(options);
let loginStatus = context.checkLoginStatus();
if(!loginStatus){
//HCid
_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){
//HCid
_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) {