首页消息,首页来款项目,工作组,列表详情
This commit is contained in:
+109
-46
@@ -1,3 +1,5 @@
|
||||
import UserApi from '../../assets/js/http/userApi'
|
||||
|
||||
// pages/home/home.js
|
||||
Page({
|
||||
|
||||
@@ -5,23 +7,66 @@ Page({
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
date: '',
|
||||
list: [], // 消息列表
|
||||
selectArr: [
|
||||
{ path: '../../assets/images/laikuan.png', text: '来款项目' },
|
||||
{ path: '../../assets/images/gongzuozu.png', text: '工作组' },
|
||||
{ path: '../../assets/images/fenbiaowei.png', text: '分标委' },
|
||||
{ path: '../../assets/images/huiyi.png', text: '会议活动' },
|
||||
{ path: '../../assets/images/ziliao.png', text: '资料网员' },
|
||||
]
|
||||
],
|
||||
titleList: [
|
||||
'会议提醒',
|
||||
'文件提醒',
|
||||
'邮寄提醒',
|
||||
'催款提醒',
|
||||
],
|
||||
index: 0,
|
||||
list: [], // 消息列表
|
||||
searchParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
titile: '', // 提醒类型 3:会议 6:文件 7:邮寄 8:催款
|
||||
startTime: '', // 开始日期
|
||||
endTime: '' // 结束日期
|
||||
}
|
||||
},
|
||||
loadData(){
|
||||
UserApi.messageList(this.data.searchParams).then(res=>{
|
||||
if(res.success){
|
||||
// 搜索时,把原数据清空,重新筛选
|
||||
if(this.data.searchParams.pageNo === 1) {
|
||||
this.setData({
|
||||
list: []
|
||||
})
|
||||
}
|
||||
const reg = new RegExp("<p>","g")
|
||||
const reg1 = new RegExp("</p>","g")
|
||||
if(res.result.records && res.result.records.length){
|
||||
res.result.records.forEach(item=>{
|
||||
item.msgContent = item.msgContent.replace(reg,"")
|
||||
item.msgContent = item.msgContent.replace(reg1,"")
|
||||
const startIndex = item.msgContent.indexOf("<")
|
||||
const endIndex = item.msgContent.lastIndexOf(">")
|
||||
item.msgContent = item.msgContent.substring(0, startIndex) + item.msgContent.slice(endIndex+1) + '点击报名'
|
||||
})
|
||||
this.setData({
|
||||
list: [...this.data.list, ...res.result.records]
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 点击首页的五个选项跳转页面
|
||||
clickSelect(e){
|
||||
clickSelect(e){
|
||||
let index = e.currentTarget.dataset.index
|
||||
let url = ''
|
||||
if(index === 0) { // 来款项目
|
||||
url = '../project/project'
|
||||
url = '../project/project?type=project'
|
||||
} else if(index === 1) { // 工作组
|
||||
// url = '../work/work'
|
||||
url = '../project/project'
|
||||
url = '../project/project?type=work'
|
||||
} else if(index === 2) { // 分标委
|
||||
url = '../committee/committee'
|
||||
} else if(index === 3) { // 会议活动
|
||||
@@ -34,59 +79,77 @@ Page({
|
||||
url,
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
// 会议去报名,切换已读状态
|
||||
messageDetail(e){
|
||||
const readFlag = e.currentTarget.dataset.message.readFlag
|
||||
const templateCode = e.currentTarget.dataset.message.templateCode
|
||||
if(readFlag == 0) { // 标记已读
|
||||
UserApi.messageStatus({anntId: e.currentTarget.dataset.message.anntId}).then(res=>{
|
||||
wx.showToast({
|
||||
title: '已读成功',
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
if(templateCode == 'QY_1_HYTZ_WORK_GROUP_CREATE'){ // 去报名页
|
||||
wx.navigateTo({
|
||||
url: 'url',
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
// 类型选中
|
||||
bindTitleChange(e){
|
||||
this.data.searchParams.pageNo = 1
|
||||
if(e.detail.value == 0){
|
||||
this.setData({
|
||||
"searchParams.titile": 3,
|
||||
})
|
||||
}else if(e.detail.value == 1){
|
||||
this.setData({
|
||||
"searchParams.titile": 6,
|
||||
})
|
||||
}else if(e.detail.value == 2){
|
||||
this.setData({
|
||||
"searchParams.titile": 7,
|
||||
})
|
||||
}else {
|
||||
this.setData({
|
||||
"searchParams.titile": 8,
|
||||
})
|
||||
}
|
||||
this.loadData()
|
||||
},
|
||||
// 日期选中
|
||||
bindDateChange: function (e) {
|
||||
this.data.searchParams.pageNo = 1
|
||||
this.setData({
|
||||
"searchParams.startTime": e.detail.value,
|
||||
"searchParams.endTime": e.detail.value
|
||||
})
|
||||
this.loadData()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
let searchParams = {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
titile: '', // 提醒类型 3:会议 6:文件 7:邮寄 8:催款
|
||||
startTime: '', // 开始日期
|
||||
endTime: '' // 结束日期
|
||||
}
|
||||
this.setData({
|
||||
searchParams
|
||||
})
|
||||
this.loadData()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
this.data.searchParams.pageNo++
|
||||
this.loadData()
|
||||
}
|
||||
})
|
||||
@@ -1,4 +1,7 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"usingComponents": {
|
||||
"popup": "../../components/popup/popup",
|
||||
"dateMonth": "../../components/dateMonth/dateMonth"
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
+48
-3
@@ -1,11 +1,12 @@
|
||||
<view>
|
||||
<view class="home-bg">
|
||||
<!-- 顶部背景图 mode="scaleToFill" 按照宽高填充,忽略图片原比例-->
|
||||
<image mode="scaleToFill" src="../../assets/images/home-bg.png"></image>
|
||||
<image mode="scaleToFill" src="../../assets/images/home-bg.png"></image>
|
||||
<!-- 顶部选项栏 -->
|
||||
<view class="select-box">
|
||||
<view class="select">
|
||||
<view class="select-item" wx:for="{{selectArr}}" wx:for-item="item" wx:key="path" bindtap="clickSelect" data-item="{{item}}" data-index="{{index}}">
|
||||
<view class="select-item" wx:for="{{selectArr}}" wx:for-item="item" wx:key="path" bindtap="clickSelect"
|
||||
data-item="{{item}}" data-index="{{index}}">
|
||||
<view class="image-box">
|
||||
<image mode="scaleToFill" src="{{item.path}}"></image>
|
||||
</view>
|
||||
@@ -13,5 +14,49 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 消息列表筛选框 -->
|
||||
<view class="list-box">
|
||||
<view class="sign-list">
|
||||
<view class="select-list">
|
||||
<view class="select-item">
|
||||
<picker bindchange="bindTitleChange" value="{{searchParams.titile}}" range="{{titleList}}">
|
||||
<view class="picker">
|
||||
<text wx:if="{{!searchParams.titile}}">类型</text>
|
||||
<text wx:if="{{searchParams.titile}}" wx:if="{{searchParams.titile == 3}}">会议提醒</text>
|
||||
<text wx:if="{{searchParams.titile}}" wx:if="{{searchParams.titile == 6}}">文件提醒</text>
|
||||
<text wx:if="{{searchParams.titile}}" wx:if="{{searchParams.titile == 7}}">邮寄提醒</text>
|
||||
<text wx:if="{{searchParams.titile}}" wx:if="{{searchParams.titile == 8}}">催款提醒</text>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="select-item">
|
||||
<picker mode="date" value="{{searchParams.startTime}}" start="2021-01-01" end="2030-12-31" bindchange="bindDateChange">
|
||||
<view class="picker">
|
||||
<text wx:if="{{!searchParams.startTime}}">时间</text>
|
||||
<text wx:if="{{searchParams.startTime}}">{{searchParams.startTime}}</text>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 列表 -->
|
||||
<view class="list-content">
|
||||
<view class="list-content-item" wx:for="{{list}}" wx:key="item" wx:for-item="item" bindtap="messageDetail" data-message="{{item}}">
|
||||
<view class="content-top">
|
||||
<view>
|
||||
<text class="blue" class="">{{item.titile_dictText}}</text>
|
||||
</view>
|
||||
<text class="content-time">{{item.sendTime}}</text>
|
||||
</view>
|
||||
<text class="content-bottom">{{item.msgContent}}</text>
|
||||
<text class="status" wx:if="{{item.readFlag == 0}}"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{list.length === 0}}" class="no-data">
|
||||
<text>暂无数据</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<popup visible="{{visible}}" bindclose="close" outClickCanClose="true" bindok="ok" data="{{data}}"></popup>
|
||||
<!-- <dateMonth visible="{{visibleDate}}" mode="year" outClickCanClose="true" bindok="dateOk" bindclose="close"></dateMonth> -->
|
||||
|
||||
@@ -33,3 +33,76 @@ page{
|
||||
.image-box image{
|
||||
max-height: 100%;
|
||||
}
|
||||
.list-box{
|
||||
margin: 0 15pt;
|
||||
margin-top: -30pt;
|
||||
padding: 15px 0;
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.sign-list .select-list {
|
||||
height: 40px;
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
}
|
||||
.sign-list .select-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.sign-list .select-item image {
|
||||
width: 11px;
|
||||
height: 6px;
|
||||
margin-left: 9px;
|
||||
}
|
||||
.list-content{
|
||||
max-height: 500px;
|
||||
overflow-y: auto;
|
||||
padding: 15px 15pt;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.list-content .list-content-item{
|
||||
height: 60px;
|
||||
border-bottom: 0.5px solid #f5f5f5;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
position: relative;
|
||||
}
|
||||
.list-content-item:last-child{
|
||||
border: 0;
|
||||
}
|
||||
.content-top{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 11px;
|
||||
color: #999;
|
||||
}
|
||||
.content-top image{
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.content-bottom{
|
||||
color: #555;
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
.status{
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: -5px;
|
||||
display: block;
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
background-color: #FF5E60;
|
||||
border-radius: 50%;
|
||||
}
|
||||
Reference in New Issue
Block a user