You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
2.1 KiB
93 lines
2.1 KiB
5 years ago
|
// subpages/clerkOnline/pages/ifReadlist/ifReadlist.js
|
||
|
import { getNoticeReadList } from '../../../../api/clerkOnline'
|
||
|
Page({
|
||
|
/**
|
||
|
* 页面的初始数据
|
||
|
*/
|
||
|
data: {
|
||
|
selectTab: 'tab1',
|
||
|
noticeId: '3',//消息id
|
||
|
readType: '1',//阅读类型:0未读,1已读 默认已读
|
||
|
noticeReadList: [],//消息阅读情况列表
|
||
|
isShow: false,
|
||
|
preloadVisible: true,
|
||
|
click:true,//是否允许点击
|
||
|
},
|
||
|
// tab 切换
|
||
|
onTabChange(e: AnyObject) {
|
||
|
|
||
|
let readType = '1';
|
||
|
if (e.currentTarget.dataset.tab == 'tab1'){
|
||
|
readType = '1'
|
||
|
}else{
|
||
|
readType = '0'
|
||
|
}
|
||
|
if (this.data.click ){
|
||
|
this.setData({
|
||
|
selectTab: e.currentTarget.dataset.tab,
|
||
|
readType: readType,
|
||
|
noticeReadList: [],
|
||
|
preloadVisible: true,
|
||
|
isShow: false,
|
||
|
})
|
||
|
this.getNoticeReadList()//获得消息阅读情况列表
|
||
|
}else{
|
||
|
wx.showToast({
|
||
|
title: '数据正在加载',
|
||
|
icon: 'none',
|
||
|
duration: 2000
|
||
|
})
|
||
|
}
|
||
|
},
|
||
|
/**
|
||
|
* 生命周期函数--监听页面加载
|
||
|
*/
|
||
|
onLoad: function (options) {
|
||
|
if (options.type=='read'){
|
||
|
this.setData({
|
||
|
selectTab: 'tab1',
|
||
|
noticeId: options.id,
|
||
|
readType:'1',
|
||
|
})
|
||
|
}else{
|
||
|
this.setData({
|
||
|
selectTab: 'tab2',
|
||
|
noticeId: options.id,
|
||
|
readType:'0',
|
||
|
})
|
||
|
}
|
||
|
|
||
|
this.getNoticeReadList()//获得消息阅读情况列表
|
||
|
},
|
||
|
/**
|
||
|
* 获得消息阅读情况列表
|
||
|
*/
|
||
|
async getNoticeReadList() {
|
||
|
this.setData({
|
||
|
click: false
|
||
|
})
|
||
|
let noticeId = this.data.noticeId;//消息id
|
||
|
let readType = this.data.readType;//阅读类型:0未读,1已读 默认已读
|
||
|
try {
|
||
|
const para = {
|
||
|
noticeId: noticeId,
|
||
|
readType: readType
|
||
|
}
|
||
|
const res: any = await getNoticeReadList(para)
|
||
|
console.log('列表', res)
|
||
|
this.setData({
|
||
|
noticeReadList: res.data,
|
||
|
preloadVisible: false,
|
||
|
click: true,
|
||
|
})
|
||
|
wx.hideToast();
|
||
|
} catch (err) {
|
||
|
console.log(err)
|
||
|
this.setData({
|
||
|
noticeReadList: [],
|
||
|
click: true,
|
||
|
})
|
||
|
wx.hideToast();
|
||
|
}
|
||
|
}
|
||
|
})
|