From f2743e8db0b224beabd30502fdc0e0b0cf1a9be1 Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Mon, 16 May 2022 21:54:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/community/communityApi.js | 31 ++++++++++----- api/index/indexApi.js | 9 ++++- conf/config.js | 2 +- pages/index/index.vue | 50 +++++++++++++++---------- pages/reportInfoBack/reportInfoBack.vue | 13 +++---- 5 files changed, 66 insertions(+), 39 deletions(-) diff --git a/api/community/communityApi.js b/api/community/communityApi.js index 4bf2f5b..f77f7b8 100755 --- a/api/community/communityApi.js +++ b/api/community/communityApi.js @@ -36,9 +36,10 @@ export function getCommunitys(dataObj) { success: function(res) { if (res.statusCode == 200) { let _communtiys = res.data.communitys; - - _that.communitys = _communtiys; + resolve(_communtiys); + return ; } + }, fail: function(e) { wx.showToast({ @@ -103,23 +104,33 @@ export function getCurCommunity() { .then(function(_ownerInfo) { let _currentCommunityInfo = { communityId: _ownerInfo.communityId, - communityName: _ownerInfo.communityName + communityName: _ownerInfo.communityName, + tel:_ownerInfo.sCommunityTel }; resolve(_currentCommunityInfo); - }).then(function() { + },function() { let _currentCommunityInfo = { communityId: mapping.HC_TEST_COMMUNITY_ID, - communityName: mapping.HC_TEST_COMMUNITY_NAME + communityName: mapping.HC_TEST_COMMUNITY_NAME, + tel:'' }; resolve(_currentCommunityInfo); }) } else { //没有登录直接写演示小区信息 - let _currentCommunityInfo = { - communityId: mapping.HC_TEST_COMMUNITY_ID, - communityName: mapping.HC_TEST_COMMUNITY_NAME - }; - resolve(_currentCommunityInfo); + getCommunitys({ + communityId:mapping.HC_TEST_COMMUNITY_ID, + page:1, + row:1 + }).then(function(_communitys){ + let _currentCommunityInfo = { + communityId: _communitys[0].communityId, + communityName: _communitys[0].name, + tel:_communitys[0].tel + }; + resolve(_currentCommunityInfo); + }) + } }) } diff --git a/api/index/indexApi.js b/api/index/indexApi.js index 2a7721e..5bef2c5 100755 --- a/api/index/indexApi.js +++ b/api/index/indexApi.js @@ -124,7 +124,14 @@ export function getCategoryList() { name: "访客登记", src: "/static/images/index_complaint.png", href: "/pages/visit/addVisit" - } + }, + { + name: "反省上报", + src: "/static/images/index_complaint.png", + href: "/pages/reportInfoBack/reportInfoBack", + needLogin:'N' + }, + ] }; diff --git a/conf/config.js b/conf/config.js index 37594c6..9cf034b 100755 --- a/conf/config.js +++ b/conf/config.js @@ -32,7 +32,7 @@ const mallUrlRefresh = mallUrl + "#/pages/mallTokenRefresh/mallTokenRefresh?mall //默认的小区ID和名称,用户还没有登录时显示的小区信息 -const DEFAULT_COMMUNITY_ID = "2021080494780158"; //HC测试小区id 用于没有登录时展示相关信息 +const DEFAULT_COMMUNITY_ID = "2021081177860471"; //HC测试小区id 用于没有登录时展示相关信息 const DEFAULT_COMMUNITY_NAME = "HC演示小区"; diff --git a/pages/index/index.vue b/pages/index/index.vue index b5b0c4f..b871de4 100755 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -11,7 +11,7 @@ - + {{item.name}} @@ -73,7 +73,7 @@ - 您确认拨打,{{property.communityName}}物业客服电话
{{property.sCommunityTel}} + 您确认拨打,{{communityName}}物业客服电话
{{tel}}
取消 @@ -98,7 +98,8 @@ data() { return { communityId: '', - property: {}, + communityName: '', + tel:'', callPropertyModal: false, ad: [], notices: [], @@ -177,6 +178,8 @@ this.vc.getCurCommunity() .then(function(_communityInfo){ _that.communityId = _communityInfo.communityId; + _that.communityName = _communityInfo.communityName; + _that.tel = _communityInfo.tel; //查询小区活动信息 _that._loadAdvertPhoto(); }) @@ -260,28 +263,29 @@ }, callPropertyTel: function() { //拨打电话 let _that = this; - if (!hasLogin()) { - this.vc.navigateTo({ - url: '../showlogin/showlogin' - }); - return; - } - hasOwner(); - uni.getStorage({ - key: 'ownerInfo', - success: function (res) { - console.log(res.data); - _that.property = res.data; - _that.callPropertyModal = true; - } - }); + // if (!hasLogin()) { + // this.vc.navigateTo({ + // url: '../showlogin/showlogin' + // }); + // return; + // } + // hasOwner(); + // uni.getStorage({ + // key: 'ownerInfo', + // success: function (res) { + // console.log(res.data); + // _that.property = res.data; + // _that.callPropertyModal = true; + // } + // }); + _that.callPropertyModal = true; }, _doCall: function() { let _that = this; uni.makePhoneCall({ // 手机号 - phoneNumber: _that.property.sCommunityTel, + phoneNumber: _that.tel, // 成功回调 success: (res) => { console.log('调用成功!') @@ -307,7 +311,13 @@ this.page = 1; this._loadActivites(); }, - toPage: function(pageUrl) { + toPage: function(pageUrl,_needLogin) { + if(_needLogin == 'N'){ + this.vc.navigateTo({ + url: pageUrl + }); + return ; + } hasOwner(); this.vc.navigateTo({ url: pageUrl diff --git a/pages/reportInfoBack/reportInfoBack.vue b/pages/reportInfoBack/reportInfoBack.vue index 9fa99ac..5ae86e6 100644 --- a/pages/reportInfoBack/reportInfoBack.vue +++ b/pages/reportInfoBack/reportInfoBack.vue @@ -67,6 +67,7 @@ } from '../../api/reportInfo/reportInfoApi.js' import context from '../../lib/java110/Java110Context.js'; const constant = context.constant; + import {getCurCommunity} from '../../api/community/communityApi.js' export default { data() { @@ -101,14 +102,12 @@ onLoad: function(options) { let _that = this; if(!options.communityId){ - wx.showToast({ - title: "小区信息错误,请从新扫码!", - icon: 'none', - duration: 2000 - }); - return + getCurCommunity().then((_community)=>{ + _that.communityId = _community.communityId; + }); + }else{ + this.communityId = options.communityId; } - this.communityId = options.communityId; _that.source = _that.arraySourceType[_that.indexSource].code; }, /**