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();
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -6,8 +6,9 @@
|
||||
<view class="text">{{item.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="serve_box">
|
||||
|
||||
<view class="serve_title">功能服务<text class="more" @click="more()">更多</text></view>
|
||||
<view class="serve_list">
|
||||
<view class="serve_item" v-for="(item,index) in serve_list" :key="index" @click="to(item)">
|
||||
@ -16,12 +17,13 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="margin-bottom-xs" @click="_toNoticePage()">
|
||||
<uni-notice-bar showIcon="true" scrollable="true" single="true" speed="30" :text="noticeText">
|
||||
</uni-notice-bar>
|
||||
</view>
|
||||
|
||||
<view class="new_box">
|
||||
<view class="margin-bottom-xs">
|
||||
<uni-notice-bar showIcon="true" scrollable="true" single="true" speed="30" text="欢迎访问智慧物业">
|
||||
</uni-notice-bar>
|
||||
</view>
|
||||
|
||||
<view class="new_list">
|
||||
<view class="new_item" v-for="(item,index) in new_list" :key="index" @click="to(item)">
|
||||
<view class="new_wrap">
|
||||
@ -79,8 +81,11 @@
|
||||
import {
|
||||
getCommunityName,
|
||||
getCommunityTel,
|
||||
getCommunityQrCode
|
||||
} from '../../api/community/communityApi.js';
|
||||
getCommunityQrCode,
|
||||
getCommunityId
|
||||
} from '@/api/community/communityApi.js';
|
||||
|
||||
import {queryNotices} from '@/api/index/indexApi.js';
|
||||
|
||||
export default {
|
||||
name: "indexMenu",
|
||||
@ -90,25 +95,27 @@
|
||||
serve_list: [],
|
||||
callPropertyModal: false,
|
||||
property: {},
|
||||
noticeText:'暂无公告',
|
||||
new_list: [{
|
||||
src: this.imgUrl + '/h5/images/serve/new1.png',
|
||||
name: '报事报修',
|
||||
desc: '一键维修',
|
||||
href: '/pages/repair/repair',
|
||||
ownerAuth:true
|
||||
ownerAuth: true
|
||||
},
|
||||
{
|
||||
src: this.imgUrl + '/h5/images/serve/new2.png',
|
||||
name: '联系物业',
|
||||
desc: '一键搞定',
|
||||
href: '_callPropertyTel',
|
||||
ownerAuth:false
|
||||
ownerAuth: false
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this._loadFunc();
|
||||
this._loadNotices();
|
||||
},
|
||||
components: {
|
||||
authOwnerDialog
|
||||
@ -116,9 +123,9 @@
|
||||
methods: {
|
||||
_loadFunc: function() {
|
||||
this.home_list = [{
|
||||
name: '社区公告',
|
||||
src: this.imgUrl + '/h5/images/serve/7.png',
|
||||
href: '/pages/notice/index',
|
||||
name: '投诉咨询',
|
||||
src: this.imgUrl + '/h5/images/serve/12.png',
|
||||
href: '/pages/complaint/complaint',
|
||||
ownerAuth: false
|
||||
},
|
||||
{
|
||||
@ -223,10 +230,32 @@
|
||||
_cancleCall: function() {
|
||||
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() {
|
||||
uni.switchTab({
|
||||
url: '/pages/homemaking/homemaking'
|
||||
})
|
||||
},
|
||||
_toNoticePage:function(){
|
||||
this.vc.navigateTo({
|
||||
url: '/pages/notice/index'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<view class="user-container">
|
||||
<block v-if="notices.length > 0">
|
||||
<view class="cu-list menu" v-for="(notice, idx) in notices" :key="idx" :data-item="notice"
|
||||
@click="gotoDetail(notice)">
|
||||
@click="gotoDetail(notice)">
|
||||
<view class="cu-item arrow">
|
||||
<view class="content padding-tb-sm">
|
||||
<view>
|
||||
@ -10,7 +10,8 @@
|
||||
<view class="text-cut" style="width:220px">{{notice.title}}</view>
|
||||
</view>
|
||||
<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>
|
||||
@ -35,11 +36,17 @@
|
||||
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
|
||||
/** index.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实例
|
||||
//获取app实例
|
||||
const app = getApp().globalData;
|
||||
|
||||
import {
|
||||
queryNotices
|
||||
} from '@/api/index/indexApi.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -48,7 +55,7 @@
|
||||
currPageIndex: 0,
|
||||
pageSize: 10,
|
||||
page: 1,
|
||||
loadingStatus : 'loading',
|
||||
loadingStatus: 'loading',
|
||||
loadingContentText: {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '加载中',
|
||||
@ -68,44 +75,35 @@
|
||||
onShow: function() {
|
||||
let that = this;
|
||||
},
|
||||
onReachBottom : function(){
|
||||
if(this.loadingStatus == 'noMore'){
|
||||
onReachBottom: function() {
|
||||
if (this.loadingStatus == 'noMore') {
|
||||
return;
|
||||
}
|
||||
this._loadApply();
|
||||
},
|
||||
methods: {
|
||||
_loadNotices: function(){
|
||||
_loadNotices: function() {
|
||||
this.loadingStatus = 'more';
|
||||
let that = this;
|
||||
context.request({
|
||||
header: context.getHeaders(),
|
||||
url: constant.url.GetNoticeListUrl,
|
||||
method: "GET",
|
||||
data: {
|
||||
communityId: that.communityId,
|
||||
page: that.page,
|
||||
row: 10,
|
||||
noticeTypeCd:'1000,1003',
|
||||
clientType: 'H5'
|
||||
},
|
||||
success: function(res) {
|
||||
// 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){
|
||||
that.loadingStatus = 'noMore';
|
||||
return;
|
||||
}
|
||||
queryNotices({
|
||||
communityId: that.communityId,
|
||||
page: that.page,
|
||||
row: 10,
|
||||
noticeTypeCd: '1000,1003',
|
||||
clientType: 'H5'
|
||||
}).then((_notices) => {
|
||||
that.notices = that.notices.concat(_notices);
|
||||
if (that.notices.length == res.data.total) {
|
||||
that.loadingStatus = 'noMore';
|
||||
return;
|
||||
}
|
||||
});
|
||||
},
|
||||
gotoDetail: function(_notice) {
|
||||
let that = this;
|
||||
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,7 +111,8 @@
|
||||
</script>
|
||||
<style>
|
||||
@import "./index.css";
|
||||
|
||||
.cu-list+.cu-list {
|
||||
margin-top: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user