diff --git a/app.json b/app.json index c71ad03..89036ea 100644 --- a/app.json +++ b/app.json @@ -95,7 +95,8 @@ "van-image": "lib/image/index", "van-submit-bar": "lib/submit-bar/index", "van-search": "lib/search/index", - "van-notice-bar": "lib/notice-bar/index" + "van-notice-bar": "lib/notice-bar/index", + "van-dialog": "lib/dialog/index" }, "sitemapLocation": "sitemap.json" } \ No newline at end of file diff --git a/context/Java110Context.js b/context/Java110Context.js index c2840e2..45ad576 100644 --- a/context/Java110Context.js +++ b/context/Java110Context.js @@ -147,6 +147,10 @@ const getOwner = function(callBack = (_ownerInfo) => {}) { console.log(res); if (res.statusCode == 200) { _ownerInfo = data.auditAppUserBindingOwners[0]; + if (_ownerInfo == null || _ownerInfo == undefined){ + callBack(null); + return ; + } if (_ownerInfo.state == '12000') { wx.setStorageSync(constant.mapping.OWNER_INFO, _ownerInfo); let _currentCommunityInfo = { diff --git a/pages/index/index.js b/pages/index/index.js index 066fe6c..7e96682 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,5 +1,7 @@ // pages/index/index.js const context = require("../../context/Java110Context.js"); +const constant = context.constant; +import Dialog from '../../lib/dialog/dialog'; Page({ /** @@ -156,7 +158,36 @@ Page({ that.setData({ location: wx.getStorageSync('location') - }) + }); + that._judgeBindOwner(); + }, + + _judgeBindOwner:function(){ + context.getOwner(function(_owner){ + if(_owner == null){ + Dialog.confirm({ + title: '温馨提示', + message: '您还没有绑定业主,请先绑定业主或取消查看演示环境' + }).then(() => { + // on confirm + wx.navigateTo({ + url: '../bindOwner/bindOwner', + }) + }).catch(() => { + // on cancel + //这里写死 演示数据 + let _ownerInfo = { "appUserId": "982020011296320035", "appUserName": "吴学文", "communityId": "7020181217000001", "communityName": "万博家博园(城西区)", "idCard": "632126199109162011", "link": "18999999999", "memberId": "772019092507000013", "state": "12000", "stateName": "审核成功" }; + + wx.setStorageSync(constant.mapping.OWNER_INFO, _ownerInfo); + let _currentCommunityInfo = { + communityId: _ownerInfo.communityId, + communityName: _ownerInfo.communityName + } + wx.setStorageSync(constant.mapping.CURRENT_COMMUNITY_INFO, _currentCommunityInfo); + }); + } + }); + }, /** diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 9f23b35..0481c8d 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -79,4 +79,6 @@ - \ No newline at end of file + + + \ No newline at end of file