同步操作将从 java110/HC小区业主版 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/*** 上下文对象,再其他文件调用常量 方法 时间工具类时 只引入上下文文件** add by wuxw 2019年12月27日** the source opened https://gitee.com/java110/WechatOwnerService*/import constant from '../../constant/index.js'import factory from '../../factory/index.js'import {getHeaders,request,requestNoAuth} from './java110Request.js'import {getCurOwner} from '../../api/owner/ownerApi.js';import {getProperty} from '../../api/property/propertyApi.js'import {onLoad,checkSession} from './page/Page.js'import {getLoginFlag,getUserInfo} from './utils/StorageUtil.js'let util = {};/*** http 请求 加入是否登录判断*/const requestObj = function(_reqObj) {//白名单直接跳过检查登录if (constant.url.NEED_NOT_LOGIN_URL.includes(_reqObj.url)) {_reqObj.communityId = constant.mapping.HC_TEST_COMMUNITY_ID;requestNoAuth(_reqObj);return;}//校验是否登录,如果没有登录跳转至温馨提示页面request(_reqObj);};/*** 获取位置* add by wuxw 2019年12月28日*/const getLocation = function() {return wx.getStorageSync('location');};const getCurrentLocation = function() {return wx.getStorageSync('currentLocation');};const _loadArea = function(_level, _parentAreaCode, callBack = _areaList => {}) {let areaList = wx.getStorageSync(constant.mapping.AREA_INFO);if (areaList) {callBack(areaList);return;}uni.request({url: constant.url.areaUrl,header: getHeaders(),data: {areaLevel: _level,// 临时登录凭证parentAreaCode: _parentAreaCode},success: function(res) {res = res.data;var province = [],city = [],area = [];var _currentArea = [];province = res.areas.filter(item => {return item.areaLevel == '101';});city = res.areas.filter(item => {return item.areaLevel == '202';});area = res.areas.filter(item => {return item.areaLevel == '303';});var provinceList = {};province.forEach(function(item) {provinceList[item.areaCode] = item.areaName;});var cityList = {};city.forEach(function(item) {cityList[item.areaCode] = item.areaName;});var quyuList = {};area.forEach(function(item) {quyuList[item.areaCode] = item.areaName;});let areaList = {province_list: provinceList,city_list: cityList,county_list: quyuList};callBack(areaList); //将 地区信息存储起来wx.setStorageSync(constant.mapping.AREA_INFO, areaList);},fail: function(error) {// 调用服务端登录接口失败wx.showToast({title: '调用接口失败'});console.log(error);}});};const getOwner = function(callBack = _ownerInfo => {}) {// 从硬盘中获取 业主信息getCurOwner().then((_owner) => {callBack(_owner);})};/*** 获取当前小区信息*/const getCurrentCommunity = function() {let communityInfo = wx.getStorageSync(constant.mapping.CURRENT_COMMUNITY_INFO);return communityInfo;};/*** add by shil 2020年01月08日* 获取当前用户的房屋信息*/const getRooms = function() {return new Promise((resolve, reject) => {getOwner(function(_owner) {if(!_owner.ownerId || _owner.ownerId == '-1'){resolve({data:{rooms:[]}});return;}request({url: constant.url.queryRoomsByOwner,header: getHeaders(),method: "GET",data: {communityId: _owner.communityId,ownerId: _owner.ownerId},success: function(res) {if (res.statusCode == 200) {//将业主信息和房屋信息一起返回res.data['owner'] = _owner;if (res.data.rooms.length == 0) {wx.showToast({title: "未查询到房屋信息",icon: 'none',duration: 2000});}resolve(res);} else {wx.showToast({title: '未查询到房屋信息',icon: 'none',duration: 2000});}},fail: function(res) {// 调用服务端登录接口失败wx.showToast({title: '调用接口失败'});reject(res);}});});});};//判断当前登录状态,不调跳转登录界面const checkLoginStatus = function() {let loginFlag = wx.getStorageSync(constant.mapping.LOGIN_FLAG);let nowDate = new Date();if (loginFlag && loginFlag.expireTime > nowDate.getTime()) {return true;} else {return false;}};/*** 跳转功能封装* @param {Object} _param 跳转入参*/const navigateTo = function(_param) {let _url = _param.url;let _tempUrl = _url.indexOf('?') > 0 ? _url.substring(0, _url.indexOf('?')) : _url;//是否需要登录constant.url.NEED_NOT_LOGIN_PAGE.forEach(item => {if (item == _tempUrl) {uni.navigateTo(_param);return;}});console.log('跳转参数', _param);//校验是否登录,如果没有登录跳转至温馨提示页面checkSession(_param.url,function(){//有回话 跳转至相应页面uni.navigateTo(_param);})};module.exports = {constant: constant,util: util,factory: factory,getHeaders: getHeaders,getLocation: getLocation,getUserInfo: getUserInfo,getLoginFlag: getLoginFlag,_loadArea: _loadArea,getCurrentLocation: getCurrentLocation,getOwner: getOwner,getCurrentCommunity: getCurrentCommunity,request: requestObj,getRooms: getRooms,getProperty: getProperty,checkLoginStatus: checkLoginStatus,onLoad: onLoad,navigateTo: navigateTo,};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。