|
|
<template>
|
|
|
<view>
|
|
|
<view class="container">
|
|
|
<!-- 消息列表 -->
|
|
|
<view class="" hover-class="none" hover-stop-propagation="false">
|
|
|
<view class="g_mb_10 g_radius_8" style="padding: 20px 10px; background-color: #fff" hover-class="thover" :hover-stop-propagation="false" @click="goDetail(item)" :data-id="item.id" data-type="info" v-for="(item, index) in infoList" :key="index">
|
|
|
<view class="g_fs_16 g_mb_12 g_flex_row_between" style="line-height: 16px">
|
|
|
<view class="g_flex_row_start flex_center g_fs_18 g_fw_600" hover-class="none" :hover-stop-propagation="false">
|
|
|
<i v-if="item.readed === 0" class="g_mr_4" style="display: inline-block; width: 8px; height: 8px; background: #f5222d; border-radius: 50%"></i>
|
|
|
{{ item.title }}
|
|
|
</view>
|
|
|
<view class="g_fw_400 g_fs_12 g_c_9" hover-class="none" :hover-stop-propagation="false">{{ item.pubTime || "-" }}</view>
|
|
|
</view>
|
|
|
<view class="g_fs_14 g_c_9 g_ell_1" style="width: 100%">{{ item.remark || "[图片]" }}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class v-if="infoList.length <= 0" style="text-align: center; margin-top: 120px" hover-class="none" :hover-stop-propagation="false">
|
|
|
<rh-empty text="暂无消息"></rh-empty>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
const app = getApp();
|
|
|
export default {
|
|
|
onShareAppMessage() {
|
|
|
return this.G.shareFun();
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
tabbarShow: true,
|
|
|
keys: "",
|
|
|
placeholder: "请输入关键字",
|
|
|
isLogin: uni.getStorageSync("apply-token") ? true : false,
|
|
|
infoList: [],
|
|
|
agencyId: uni.getStorageSync("apply-agencyId"),
|
|
|
tabInfo: {
|
|
|
list: [
|
|
|
{
|
|
|
name: "站内消息",
|
|
|
classify: 2,
|
|
|
},
|
|
|
{
|
|
|
name: "职位通知",
|
|
|
classify: 3,
|
|
|
},
|
|
|
],
|
|
|
active: 0,
|
|
|
},
|
|
|
appid: uni.getAccountInfoSync().miniProgram.appId,
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
let that = this;
|
|
|
that.getInfoList();
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
onHide() {},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload() {},
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|
|
|
onPullDownRefresh() {},
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom() {},
|
|
|
methods: {
|
|
|
getEmptyDom(text = "暂无数据", subText = ""){
|
|
|
this.G.getEmptyDom(text, subText)
|
|
|
},
|
|
|
getSearch(e) {
|
|
|
// console.log(e);
|
|
|
this.keys = e;
|
|
|
this.getInfoList();
|
|
|
},
|
|
|
/**
|
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
|
onShareAppMessage1() {},
|
|
|
timeShow(val) {
|
|
|
// console.log(val);
|
|
|
if (!val) {
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
if (typeof val == "string") {
|
|
|
val = val + "";
|
|
|
if (val.indexOf("T")) {
|
|
|
val = val.replace("T", " "); //原来L端可能返回的时间格式有带T的格式,处理一下
|
|
|
}
|
|
|
val = val.replace("-", "/").replace("-", "/");
|
|
|
}
|
|
|
|
|
|
var date = new Date();
|
|
|
var value = new Date(val);
|
|
|
|
|
|
const year0 = date.getFullYear();
|
|
|
const month0 = date.getMonth() + 1;
|
|
|
const day0 = date.getDate();
|
|
|
const hour0 = date.getHours();
|
|
|
const minute0 = date.getMinutes();
|
|
|
// const second = date.getSeconds()
|
|
|
|
|
|
const year1 = value.getFullYear();
|
|
|
const month1 = value.getMonth() + 1;
|
|
|
const day1 = value.getDate();
|
|
|
const hour1 = value.getHours();
|
|
|
const minute1 = value.getMinutes();
|
|
|
// const second = value.getSeconds()
|
|
|
|
|
|
if (year0 == year1 && month0 == month1 && day0 == day1) {
|
|
|
return hour1 + ":" + (minute1 >= 10 ? minute1 : "0" + minute1);
|
|
|
}
|
|
|
|
|
|
let d = new Date(val).setHours(0, 0, 0, 0);
|
|
|
let today = new Date().setHours(0, 0, 0, 0);
|
|
|
|
|
|
if (d - today == -86400000) {
|
|
|
return "昨天";
|
|
|
}
|
|
|
|
|
|
if (year0 == year1) {
|
|
|
return month1 + "月" + day1 + "日";
|
|
|
}
|
|
|
return (year1 + "").slice(2) + "年" + month1 + "月" + day1 + "日";
|
|
|
|
|
|
return hour;
|
|
|
},
|
|
|
getInfoList() {
|
|
|
let that = this;
|
|
|
that.G.Post(
|
|
|
that.api.message_list,
|
|
|
{
|
|
|
pageSize: 100,
|
|
|
pageNum: 1,
|
|
|
keys: that.keys || "",
|
|
|
agencyId: that.agencyId,
|
|
|
status: 10,
|
|
|
category: that.tabInfo.active == 1 ? 100 : "",
|
|
|
},
|
|
|
(res) => {
|
|
|
res.pageBean.recordList.forEach((item) => {
|
|
|
item["pubTime"] = that.timeShow(item.publishTime);
|
|
|
// console.log(item);
|
|
|
});
|
|
|
that.infoList = res.pageBean.recordList;
|
|
|
}
|
|
|
);
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 阻止滑动穿透
|
|
|
*
|
|
|
*
|
|
|
*/
|
|
|
modalMove() {
|
|
|
return false;
|
|
|
},
|
|
|
|
|
|
goDetail(e) {
|
|
|
// console.log(e);
|
|
|
e.readed = 1;
|
|
|
uni.navigateTo({
|
|
|
url: "/root/detail/message?id=" + e.id,
|
|
|
});
|
|
|
},
|
|
|
handleUpdateTab(e) {
|
|
|
// console.log(e);
|
|
|
this.tabInfo.active = e;
|
|
|
this.getInfoList();
|
|
|
},
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
<style scoped lang="less">
|
|
|
/* pages/message/index.wxss */
|
|
|
.container {
|
|
|
background-color: #ededed;
|
|
|
min-height: calc(100vh - 50px);
|
|
|
}
|
|
|
.container {
|
|
|
padding: 10px;
|
|
|
}
|
|
|
.contact {
|
|
|
width: 80%;
|
|
|
height: 350px;
|
|
|
}
|
|
|
.contact .weui-dialog__hd {
|
|
|
margin-top: 40px;
|
|
|
padding: 0;
|
|
|
position: relative;
|
|
|
}
|
|
|
.contact .contact_bottomBtn .v-center {
|
|
|
width: 80px !important;
|
|
|
}
|
|
|
.contact .contact_bottomBtn .rflex button {
|
|
|
padding: 0;
|
|
|
width: 100%;
|
|
|
}
|
|
|
.guanbi {
|
|
|
position: absolute;
|
|
|
right: 16px;
|
|
|
top: -28px;
|
|
|
}
|
|
|
.mb32 {
|
|
|
margin-bottom: 32px;
|
|
|
}
|
|
|
</style>
|