Explorar el Código

提交日报周报页面

message
douzhuo hace 2 años
padre
commit
435fef24e2
Se han modificado 1 ficheros con 229 adiciones y 165 borrados
  1. +229
    -165
      pages/mine/messageList.vue

+ 229
- 165
pages/mine/messageList.vue Ver fichero

@@ -1,81 +1,81 @@
<template>
<view class="message_list">
<!-- <u-tabs :list="list" :show-bar="false" :is-scroll="false" :current="current" @change="change"></u-tabs> -->
<view class="listMain">
<view class="upgradeList">
<scroll-view :scroll-top="scrollTop" refresher-enabled="true" :refresher-triggered="triggered"
@refresherpulling="onPulling" @refresherrefresh="onRefresh" @refresherrestore="onRestore"
:scroll-y="true" class="scroll-Y" @scrolltolower="lower">
<block v-if="updateAnnList.length!=0">
<block v-for="(item,index) in updateAnnList" :key="index">
<view class="upgradeItem" @click="goDetail(item.content,item.id,item.title)">
<view class="notRead">
<view v-if="item.readFlag==0" class="red"></view>
</view>
<view class="right">
<view class="title">{{item.title}}</view>
<view class="time">{{item.createTime}}</view>
</view>
</view>
</block>
</block>
<block v-else>
<view style=" padding: 100rpx 0;">
<u-empty text="暂无数据" mode="list"></u-empty>
</view>
</block>
</scroll-view>
<!-- 公告 -->
<view class="m-nav">
<view class="m-n-lside">
<image src="@/static/images/notice.png" mode=""></image>
全部{{ count }}条新消息
</view>
<view class="m-n-rside" @click="allRead">
全部已读
</view>
</view>
<!-- 选项卡 -->
<view class="m-tabs">
<u-tabs :list="list" :current="current" :is-scroll="false" @change="change"></u-tabs>
</view>
<!-- <view class="systemList" v-if="current==0">
<block v-if="sysItemList.length!=0">
<block v-for="(item,index) in sysItemList" :key="index">
<view class="sysItem">
<image class="headpic" src="../../static/images/function1.png"></image>
<template v-if="current == 0">
<scroll-view :scroll-top="scrollTop" refresher-enabled="true" :refresher-triggered="triggered"
@refresherpulling="onPulling" @refresherrefresh="onRefresh" @refresherrestore="onRestore"
:scroll-y="true" class="scroll-Y" @scrolltolower="lower">
<template v-if="updateAnnList.length!=0">
<block v-for="(item,index) in updateAnnList" :key="index">
<view class="upgradeItem" @click="goReception(item, index)">
<view class="right">
<view class="headInfo">
<view class="title">优秀案例</view>
<view class="info">评价你:非常好,品牌价值观还需要补充</view>
</view>
<view class="content">
我的评论:非常好,品牌价值观还需要补充我的评论:非常好,品牌价值观还需要补充我的评论:非常好,品牌价值观还需要补充我的评论:非常好,品牌价值观还需要补充
</view>
<view class="time">
2021-01-12 12:23:01
<view class="title">
<template v-if="item.messageType == 2">
{{ item.weekDate }}
</template>
<template v-else>
{{ fomatDate(item.createTime) }}
</template>
{{item.title}}
<template v-if="item.readFlag==0">
<view class="notRead"></view>
</template>
</view>
<view class="time">{{item.createTime}}</view>
</view>
</view>
</block>
</block>
<block v-else>
<view style=" padding: 100rpx 0;">
</template>
<template v-else>
<view style="padding: 100rpx 0;">
<u-empty text="暂无数据" mode="list"></u-empty>
</view>
</block>
</view>
<view class="upgradeList" v-if="current==1">
<block v-if="updateAnnList.length!=0">
</template>
</scroll-view>
</template>
<!-- 升级公告 -->
<template v-if="current == 1">
<scroll-view :scroll-top="scrollTop" refresher-enabled="true" :refresher-triggered="triggered"
@refresherpulling="onPulling" @refresherrefresh="onRefresh" @refresherrestore="onRestore"
:scroll-y="true" class="scroll-Y" @scrolltolower="lower">
<template v-if="updateAnnList.length!=0">
<block v-for="(item,index) in updateAnnList" :key="index">
<view class="upgradeItem" @click="goDetail(item.content,item.id)">
<view class="notRead">
<view v-if="item.readFlag==0" class="red"></view>
</view>
<view class="upgradeItem" @click="goDetail(item)">
<view class="right">
<view class="title">{{item.title}}</view>
<view class="title">
{{item.title}}
<template v-if="item.readFlag==0">
<view class="notRead"></view>
</template>
</view>
<view class="time">{{item.createTime}}</view>
</view>
</view>
</block>
</block>
<block v-else>
<view style=" padding: 100rpx 0;">
</template>
<template v-else>
<view style="padding: 100rpx 0;">
<u-empty text="暂无数据" mode="list"></u-empty>
</view>
</block>
</view>
-->
</view>
</template>
</scroll-view>
</template>
</view>
</template>
@@ -93,11 +93,13 @@
updateAnnList: [],
sysItemList: [],
list: [{
name: '系统消息'
name: '接待报告',
id: 1, // 1日报 2周报 3其他(非3为接待报告,3是系统消息)
}, {
name: `升级公告`,
count: "",
name: '升级公告',
id: 3, // 1日报 2周报 3其他(非3为接待报告,3是系统消息)
}],
count: 0, // 全部条数
current: 0,
pageNum: 1,
pageSize: 10,
@@ -107,30 +109,31 @@
this.updateAnnList = []
this.pageNum = 1
this.updateInit()
this.getMessageNotRed()
},
onLoad() {
this._freshing = false;
setTimeout(() => {
this.triggered = true;
}, 1000)
},
onPullDownRefresh() {
this.updateInit()
this.initPage()
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
// onReachBottom(){
// this.pageNum++
// this.updateInit()
// },
methods: {
onPulling(e) {
console.log("onpulling", e);
},
onRefresh() {
if (this._freshing) return;
this.updateAnnList = []
this.pageNum = 1
this.updateInit()
this._freshing = true;
setTimeout(() => {
@@ -138,161 +141,222 @@
this._freshing = false;
}, 3000)
},
onRestore() {
this.triggered = 'restore'; // 需要重置
console.log("onRestore");
},
// uppers(e) {
// this.pageNum = 1
// this.updateInit()
// },
lower(e) {
this.pageNum++
this.updateInit()
},
initPage() {
this.updateAnnList = []
this.pageNum = 1
this.updateInit()
},
// 全部标记已读
allRead() {
this.$u.get('/zkMessage/updateState', {
accountId: uni.getStorageSync('weapp_session_userInfo_data').accountId,
projectId: uni.getStorageSync('buildingID').id,
}).then(res => {
uni.showToast({
title: '全部已读成功!',
duration: 2000
});
this.initPage()
}).catch(e => {
console.log(e)
})
},
updateInit() {
uni.request({
url: config.service.updateList,
method: "GET",
data: {
messageType: this.list[this.current].id,
projectId: uni.getStorageSync('buildingID').id,
id: uni.getStorageSync('weapp_session_userInfo_data').accountId,
num: this.pageNum,
size: this.pageSize
},
header: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + uni.getStorageSync('weapp_session_login_data').token
'Authorization': 'Bearer ' + uni.getStorageSync('weapp_session_login_data').token
},
success: (res) => {
// this.updateAnnList = res.data.data.list.results
if (res.data.data != null) {
this.list[1].count = res.data.data.count
}
if (res.data.data == null) {
uni.showToast({
title: '已经到底了!',
icon: 'none',
duration: 2000
});
} else {
if (res.data.data) {
if (this.pageNum != 1) {
this.updateAnnList = [...this.updateAnnList, ...res.data.data.list.records];
this.updateAnnList = [...this.updateAnnList, ...res.data.data.list.results];
} else {
this.updateAnnList = res.data.data.list.records
this.updateAnnList = res.data.data.list.results || []
}
}
},
fail: e => {
console.log(e)
}
})
},
goDetail(text, id, title) {
let link = encodeURIComponent(JSON.stringify(text))
goDetail(data) {
this.$store.commit('setMessageObj', data)
uni.navigateTo({
url: "./messageDetail?content=" + link + "&id=" + id + "&tit=" + title
url: "./messageDetail"
})
},
// 获取未读消息数量
getMessageNotRed() {
uni.request({
url: config.service.notReadNum,
method: "GET",
data: {
id: uni.getStorageSync('weapp_session_userInfo_data').accountId,
projectId: uni.getStorageSync('buildingID').id,
},
header: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + uni.getStorageSync('weapp_session_login_data').token
},
success: (res) => {
this.count = res.data.data || 0
}
})
},
// 跳转日报
goReception(data, index) {
this.$store.commit('setMessageObj', data)
data.readFlag = 1
if (data.messageType == 2) {
uni.navigateTo({
url: `/pages/reportExcel/weekReport?id=${data.id}`
})
} else {
uni.navigateTo({
url: `/pages/reportExcel/dayReport?id=${data.id}`
})
}
},
fomatDate(date) {
if (!date) return '--'
let arr = date.split(' ')
let str = arr[0]
let result = str.split('-')
return `${result[1]}月${result[2]}日`
},
// 转换时间
getTimeLine(date, type = 1) {
let resu = '--'
if (!date) return resu
let time = new Date(date.replace(/-/g, '/'))
time.setDate(time.getDate() - 7)
let arr = date.split(' ')
let str = arr[0]
let result = str.split('-')
let m = (time.getMonth() + 1) < 10 ? `0${time.getMonth() + 1}` : (time.getMonth() + 1)
let d = time.getDate() < 10 ? `0${time.getDate()}` : time.getDate()
if (type == 1) {
resu = `${m}.${d}-${result[1]}.${result[2]}`
} else {
resu = `${m}月${d}日~${result[1]}月${result[2]}日`
}
return resu
},
change(index) {
this.current = index;
if (this.current == 1) {
this.updateInit()
}
this.initPage()
}
}
}
</script>
<style lang="scss">
.scroll-Y {
height: 100%;
width: 100%;
position: fixed;
}
.message_list {
.u-tab-item {
border: 0.5rpx solid #dedede;
}
width: 100vw;
height: calc(100vh - var(--window-top));
background: #F8F8F8;
display: flex;
flex-direction: column;
.listMain {
margin-top: 20rpx;
.m-nav {
flex-shrink: 0;
padding: 0 30rpx;
width: 100%;
height: 68rpx;
display: flex;
align-items: center;
.systemList {
.sysItem {
padding: 20rpx;
border: 1rpx solid #ccc;
display: flex;
margin: 16rpx 0;
.m-n-lside {
flex-grow: 1;
display: flex;
align-items: center;
.headpic {
width: 70rpx;
height: 70rpx;
border-radius: 100%;
margin-right: 30rpx;
}
image {
margin-right: 16rpx;
width: 36rpx;
height: 36rpx;
}
}
.right {
.headInfo {
.title {
font-size: 32rpx;
font-weight: bold;
margin-bottom: 8rpx;
}
}
.m-n-rside {
flex-shrink: 0;
padding: 6rpx 14rpx;
border: 1rpx solid #E0E0E0;
font-size: 24rpx;
}
}
.content {
width: 600rpx;
background: #e6e6e6;
padding: 10rpx;
margin: 14rpx 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.m-tabs {
flex-shrink: 0;
}
.time {
color: #6f6f6f;
font-size: 24rpx;
}
}
}
}
.scroll-Y {
padding: 20rpx 0 0 0;
flex-grow: 1;
overflow-y: scroll;
.upgradeList {
.upgradeItem {
padding: 20rpx;
border: 1rpx solid #ccc;
margin: 16rpx 0;
display: flex;
.upgradeItem {
margin: 0 0 20rpx 0;
padding: 24rpx 30rpx 28rpx;
height: 156rpx;
display: flex;
background: #fff;
.notRead {
width: 14rpx;
height: 14rpx;
margin-right: 20rpx;
margin-top: 16rpx;
.right {
.title {
font-size: 32rpx;
font-weight: bold;
display: flex;
.red {
.notRead {
width: 14rpx;
height: 14rpx;
background: #FF0000;
width: 100%;
height: 100%;
border-radius: 100%;
}
}
.right {
.title {
font-size: 32rpx;
font-weight: bold;
margin-bottom: 8rpx;
}
.time {
color: #6f6f6f;
font-size: 24rpx;
}
.time {
margin: 18rpx 0 0 0;
color: #6f6f6f;
font-size: 24rpx;
}
}
}
}
}


Cargando…
Cancelar
Guardar