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.
120 lines
3.2 KiB
120 lines
3.2 KiB
// subpages/clerkOnline/pages/noticeDetail/noticeDetail.js
|
|
import { getNoticeDetail, setTopNotice, closeNotice} from '../../../../api/clerkOnline'
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
noticeDetail:{},
|
|
imgList:[],
|
|
noticeId:'',
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.setData({
|
|
noticeId: options.id
|
|
})
|
|
this.getNoticeDetail()//通知详情
|
|
},
|
|
|
|
/**
|
|
* 查看群成员列表
|
|
*/
|
|
async getNoticeDetail() {
|
|
wx.showLoading({
|
|
title: '加载中',
|
|
})
|
|
let noticeId = this.data.noticeId;
|
|
try {
|
|
const res: any = await getNoticeDetail(noticeId)
|
|
console.log('列表', res)
|
|
this.setData({
|
|
noticeDetail: res.data,
|
|
imgList: res.data.images
|
|
})
|
|
wx.hideLoading()
|
|
} catch (err) {
|
|
console.log(err)
|
|
}
|
|
},
|
|
/**
|
|
* 是否置顶点击事件
|
|
*/
|
|
onTabqxzd(e: any) {
|
|
let topType = '1';//操作类型:1,置顶,2取消
|
|
let title = "";
|
|
let content = "";
|
|
let that = this;
|
|
if(e.currentTarget.dataset.flag=='0'){//置顶标识:0否,1是
|
|
topType = '1';
|
|
title ='确认要将本条内容置顶吗?';
|
|
content ='置顶后,话题会被群成员优先看到 查看内容';
|
|
wx.setStorageSync("isBackOpen", false)
|
|
}else{
|
|
topType = '2';
|
|
title = '确认要将本条通知取消置顶吗?';
|
|
content = '取消置顶后,通知会按照发布时间排序需要滑动查找通知';
|
|
wx.setStorageSync("isBackOpen", false)
|
|
}
|
|
let params = {
|
|
noticeId: this.data.noticeId,
|
|
topType: topType
|
|
}
|
|
wx.showModal({
|
|
title: title,
|
|
content: content,
|
|
cancelColor: '#999999', //取消文字的颜色
|
|
confirmColor: '#04BCA0', //确定文字的颜色
|
|
async success(res) {
|
|
if (res.confirm) {
|
|
try {
|
|
const res: any = await setTopNotice(params)
|
|
if (res.code == 0) {//置顶话题(置顶/取消)成功
|
|
that.getNoticeDetail()//通知详情//通知详情
|
|
}
|
|
} catch (err) {
|
|
console.log(err)
|
|
}
|
|
} else if (res.cancel) {
|
|
console.log('用户点击取消')
|
|
}
|
|
}
|
|
})
|
|
},
|
|
/**
|
|
* 关闭通知
|
|
*/
|
|
onTabgb(){
|
|
let that = this;
|
|
wx.showModal({
|
|
title: '确认要将本条通知关闭吗?',
|
|
content: '关闭后,在群内不显示通知信息管理后台保留数据,可以查看',
|
|
cancelColor: '#999999', //取消文字的颜色
|
|
confirmColor: '#04BCA0', //确定文字的颜色
|
|
async success(res) {
|
|
if (res.confirm) {
|
|
try {
|
|
wx.setStorageSync("isBackOpen", false)
|
|
const res: any = await closeNotice(that.data.noticeId)
|
|
wx.navigateBack({
|
|
delta: 1
|
|
})
|
|
} catch (err) {
|
|
console.log(err)
|
|
}
|
|
} else if (res.cancel) {
|
|
console.log('用户点击取消')
|
|
}
|
|
}
|
|
})
|
|
},
|
|
/**
|
|
* 跳转已读未读列表
|
|
*/
|
|
toreadlist(e: any) {
|
|
wx.navigateTo({ url: `/subpages/clerkOnline/pages/readlist/readlist?id=${e.currentTarget.dataset.id}&type=${e.currentTarget.dataset.type}` });
|
|
},
|
|
})
|