mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-02-23 21:36:38 +08:00
优化代码
This commit is contained in:
parent
3a76409221
commit
aed35786ea
@ -251,4 +251,28 @@ export function listCommunityMarketGoods(dataObj) {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 查询通知
|
||||||
|
* @param {Object} dataObj
|
||||||
|
*/
|
||||||
|
export function queryNotices(dataObj) {
|
||||||
|
return new Promise(
|
||||||
|
(resolve, reject) => {
|
||||||
|
requestNoAuth({
|
||||||
|
url: url.GetNoticeListUrl,
|
||||||
|
method: "GET",
|
||||||
|
data: dataObj,
|
||||||
|
//动态数据
|
||||||
|
success: function(res) {
|
||||||
|
res.data.notices.forEach(function(item, index) {
|
||||||
|
item.timeStr = item.startTime.replace(/:\d{1,2}$/, ' ');
|
||||||
|
});
|
||||||
|
resolve(res.data.notices);
|
||||||
|
},
|
||||||
|
fail: function(e) {
|
||||||
|
reject();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="serve_box">
|
<view class="serve_box">
|
||||||
|
|
||||||
<view class="serve_title">功能服务<text class="more" @click="more()">更多</text></view>
|
<view class="serve_title">功能服务<text class="more" @click="more()">更多</text></view>
|
||||||
<view class="serve_list">
|
<view class="serve_list">
|
||||||
<view class="serve_item" v-for="(item,index) in serve_list" :key="index" @click="to(item)">
|
<view class="serve_item" v-for="(item,index) in serve_list" :key="index" @click="to(item)">
|
||||||
@ -16,12 +17,13 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="margin-bottom-xs" @click="_toNoticePage()">
|
||||||
<view class="new_box">
|
<uni-notice-bar showIcon="true" scrollable="true" single="true" speed="30" :text="noticeText">
|
||||||
<view class="margin-bottom-xs">
|
|
||||||
<uni-notice-bar showIcon="true" scrollable="true" single="true" speed="30" text="欢迎访问智慧物业">
|
|
||||||
</uni-notice-bar>
|
</uni-notice-bar>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view class="new_box">
|
||||||
|
|
||||||
<view class="new_list">
|
<view class="new_list">
|
||||||
<view class="new_item" v-for="(item,index) in new_list" :key="index" @click="to(item)">
|
<view class="new_item" v-for="(item,index) in new_list" :key="index" @click="to(item)">
|
||||||
<view class="new_wrap">
|
<view class="new_wrap">
|
||||||
@ -79,8 +81,11 @@
|
|||||||
import {
|
import {
|
||||||
getCommunityName,
|
getCommunityName,
|
||||||
getCommunityTel,
|
getCommunityTel,
|
||||||
getCommunityQrCode
|
getCommunityQrCode,
|
||||||
} from '../../api/community/communityApi.js';
|
getCommunityId
|
||||||
|
} from '@/api/community/communityApi.js';
|
||||||
|
|
||||||
|
import {queryNotices} from '@/api/index/indexApi.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "indexMenu",
|
name: "indexMenu",
|
||||||
@ -90,6 +95,7 @@
|
|||||||
serve_list: [],
|
serve_list: [],
|
||||||
callPropertyModal: false,
|
callPropertyModal: false,
|
||||||
property: {},
|
property: {},
|
||||||
|
noticeText:'暂无公告',
|
||||||
new_list: [{
|
new_list: [{
|
||||||
src: this.imgUrl + '/h5/images/serve/new1.png',
|
src: this.imgUrl + '/h5/images/serve/new1.png',
|
||||||
name: '报事报修',
|
name: '报事报修',
|
||||||
@ -109,6 +115,7 @@
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this._loadFunc();
|
this._loadFunc();
|
||||||
|
this._loadNotices();
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
authOwnerDialog
|
authOwnerDialog
|
||||||
@ -116,9 +123,9 @@
|
|||||||
methods: {
|
methods: {
|
||||||
_loadFunc: function() {
|
_loadFunc: function() {
|
||||||
this.home_list = [{
|
this.home_list = [{
|
||||||
name: '社区公告',
|
name: '投诉咨询',
|
||||||
src: this.imgUrl + '/h5/images/serve/7.png',
|
src: this.imgUrl + '/h5/images/serve/12.png',
|
||||||
href: '/pages/notice/index',
|
href: '/pages/complaint/complaint',
|
||||||
ownerAuth: false
|
ownerAuth: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -223,10 +230,32 @@
|
|||||||
_cancleCall: function() {
|
_cancleCall: function() {
|
||||||
this.callPropertyModal = false;
|
this.callPropertyModal = false;
|
||||||
},
|
},
|
||||||
|
_loadNotices: function() {
|
||||||
|
this.loadingStatus = 'more';
|
||||||
|
let that = this;
|
||||||
|
queryNotices({
|
||||||
|
communityId: getCommunityId(),
|
||||||
|
page: 1,
|
||||||
|
row: 3,
|
||||||
|
noticeTypeCd: '1000,1003',
|
||||||
|
clientType: 'H5'
|
||||||
|
}).then((_notices) => {
|
||||||
|
let _notice = "";
|
||||||
|
for(let _nIndex = 0;_nIndex < _notices.length; _nIndex++){
|
||||||
|
_notice +=("【公告"+(_nIndex+1)+"】"+_notices[_nIndex].title+"; ");
|
||||||
|
}
|
||||||
|
that.noticeText = _notice;
|
||||||
|
});
|
||||||
|
},
|
||||||
more: function() {
|
more: function() {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: '/pages/homemaking/homemaking'
|
url: '/pages/homemaking/homemaking'
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
_toNoticePage:function(){
|
||||||
|
this.vc.navigateTo({
|
||||||
|
url: '/pages/notice/index'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,8 @@
|
|||||||
<view class="text-cut" style="width:220px">{{notice.title}}</view>
|
<view class="text-cut" style="width:220px">{{notice.title}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-gray text-sm">
|
<view class="text-gray text-sm">
|
||||||
<text class="margin-right-xs">发布时间:</text> {{notice.timeStr}}</view>
|
<text class="margin-right-xs">发布时间:</text> {{notice.timeStr}}
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -35,11 +36,17 @@
|
|||||||
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
|
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
|
||||||
/** index.js **/
|
/** index.js **/
|
||||||
import context from '../../lib/java110/Java110Context.js';
|
import context from '../../lib/java110/Java110Context.js';
|
||||||
import { getCommunityId } from '../../api/community/communityApi.js';
|
import {
|
||||||
|
getCommunityId
|
||||||
|
} from '../../api/community/communityApi.js';
|
||||||
const constant = context.constant; //获取app实例
|
const constant = context.constant; //获取app实例
|
||||||
//获取app实例
|
//获取app实例
|
||||||
const app = getApp().globalData;
|
const app = getApp().globalData;
|
||||||
|
|
||||||
|
import {
|
||||||
|
queryNotices
|
||||||
|
} from '@/api/index/indexApi.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -78,34 +85,25 @@
|
|||||||
_loadNotices: function() {
|
_loadNotices: function() {
|
||||||
this.loadingStatus = 'more';
|
this.loadingStatus = 'more';
|
||||||
let that = this;
|
let that = this;
|
||||||
context.request({
|
queryNotices({
|
||||||
header: context.getHeaders(),
|
|
||||||
url: constant.url.GetNoticeListUrl,
|
|
||||||
method: "GET",
|
|
||||||
data: {
|
|
||||||
communityId: that.communityId,
|
communityId: that.communityId,
|
||||||
page: that.page,
|
page: that.page,
|
||||||
row: 10,
|
row: 10,
|
||||||
noticeTypeCd: '1000,1003',
|
noticeTypeCd: '1000,1003',
|
||||||
clientType: 'H5'
|
clientType: 'H5'
|
||||||
},
|
}).then((_notices) => {
|
||||||
success: function(res) {
|
that.notices = that.notices.concat(_notices);
|
||||||
// TODO 判断
|
|
||||||
res.data.notices.forEach(function(item, index) {
|
|
||||||
item.timeStr = item.startTime.replace(/:\d{1,2}$/, ' ');
|
|
||||||
});
|
|
||||||
that.notices = that.notices.concat(res.data.notices);
|
|
||||||
if (that.notices.length == res.data.total) {
|
if (that.notices.length == res.data.total) {
|
||||||
that.loadingStatus = 'noMore';
|
that.loadingStatus = 'noMore';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
gotoDetail: function(_notice) {
|
gotoDetail: function(_notice) {
|
||||||
let that = this;
|
let that = this;
|
||||||
this.vc.navigateTo({
|
this.vc.navigateTo({
|
||||||
url: "/pages/notice/detail/detail?noticeId=" + _notice.noticeId+"&communityId="+that.communityId
|
url: "/pages/notice/detail/detail?noticeId=" + _notice.noticeId + "&communityId=" + that
|
||||||
|
.communityId
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -113,6 +111,7 @@
|
|||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
@import "./index.css";
|
@import "./index.css";
|
||||||
|
|
||||||
.cu-list+.cu-list {
|
.cu-list+.cu-list {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user