优化 代码

This commit is contained in:
java110 2022-05-16 21:54:09 +08:00
parent e57ee10feb
commit f2743e8db0
5 changed files with 66 additions and 39 deletions

View File

@ -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);
})
}
})
}

View File

@ -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'
},
]
};

View File

@ -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演示小区";

View File

@ -11,7 +11,7 @@
<swiper-item>
<block v-for="(item, index2) in item" :key="index2">
<view class="category-info" v-if="item.href != 'callProperty'">
<navigator @tap="toPage(item.href)">
<navigator @tap="toPage(item.href,item.needLogin)">
<image :src="item.src" class="category-image"></image>
<view class="category-text">{{item.name}}</view>
</navigator>
@ -73,7 +73,7 @@
</view>
</view>
<view class="padding-xl">
您确认拨打,{{property.communityName}}物业客服电话<br />{{property.sCommunityTel}}
您确认拨打,{{communityName}}物业客服电话<br />{{tel}}
</view>
<view class="cu-bar bg-white justify-end">
<view class="action margin-0 flex-sub solid-left" @tap="_cancleCall()">取消</view>
@ -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

View File

@ -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;
},
/**