284 lines
7.4 KiB
Vue
284 lines
7.4 KiB
Vue
<template>
|
||
<div class="main">
|
||
<div class="tabBox">
|
||
<div
|
||
:class="selectTab === item.value ? 'tabItem selectTabItem' : 'tabItem'"
|
||
v-for="(item, index) in tabList"
|
||
:key="index"
|
||
@click="handleChangeTab(item.value)"
|
||
>
|
||
{{ item.label }}
|
||
</div>
|
||
</div>
|
||
|
||
<div class="contentList">
|
||
<div
|
||
class="contentItem"
|
||
v-for="(item, index) in messageList"
|
||
:key="index"
|
||
@click="handleGoDetail(item)"
|
||
>
|
||
<div class="left">
|
||
<div class="title">{{ item.NOTICEINFO_TITLE || "" }}</div>
|
||
<div class="content">{{ item.NOTICEINFO_CONTENT || "" }}</div>
|
||
<div class="descBox">
|
||
<span class="name">{{ item.STAFF_NAME || "-" }}</span>
|
||
<span class="time">{{ item.START_DATE || "-" }}</span>
|
||
</div>
|
||
</div>
|
||
<div class="right">
|
||
<image
|
||
class="leftIcon"
|
||
:src="
|
||
item.ImageList && item.ImageList.length > 0
|
||
? item.ImageList[0].ImageUrl
|
||
: 'https://eshangtech.com/ShopICO/no-picture.png'
|
||
"
|
||
/>
|
||
</div>
|
||
</div>
|
||
<div v-if="!(messageList && messageList.length > 0)">
|
||
<no-data text="暂无内容" />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import { mapGetters } from "vuex";
|
||
import NoData from "../../components/noData.vue";
|
||
export default {
|
||
data() {
|
||
return {
|
||
tabList: [],
|
||
selectTab: 0,
|
||
messageList: [],
|
||
};
|
||
},
|
||
components: {
|
||
NoData,
|
||
},
|
||
computed: {
|
||
...mapGetters({
|
||
user: "user",
|
||
}),
|
||
},
|
||
onLoad() {
|
||
// 拿到tab的数据
|
||
this.handleGetTabList();
|
||
this.$utils.addUserBehaviorNew();
|
||
},
|
||
methods: {
|
||
// 改变选中
|
||
handleChangeTab(value) {
|
||
this.selectTab = value;
|
||
this.handleGetHighwayHeadlines();
|
||
},
|
||
// 拿到tab的数据
|
||
async handleGetTabList() {
|
||
const data = await this.$api.$get(
|
||
"/EShangApiMain/FrameWork/GetFieldEnumTree",
|
||
{ FieldExplainField: "NOTICEINFO_TYPE" }
|
||
);
|
||
let list = this.$utils.wrapTreeNode(data.Result_Data.List);
|
||
let res = [];
|
||
if (list && list.length > 0) {
|
||
list.forEach((item) => {
|
||
if (item.children && item.children.length > 0) {
|
||
item.children.forEach((subItem) => {
|
||
res.push(subItem);
|
||
});
|
||
}
|
||
});
|
||
}
|
||
res.unshift({
|
||
label: "全部",
|
||
value: "all",
|
||
});
|
||
this.tabList = res;
|
||
console.log("tabList", res);
|
||
if (res && res.length > 0) {
|
||
this.selectTab = res[0].value;
|
||
}
|
||
this.handleGetHighwayHeadlines();
|
||
},
|
||
// 拿到消息列表
|
||
async handleGetHighwayHeadlines() {
|
||
console.log("this.user", this.user);
|
||
let req = {
|
||
SearchParameter: {
|
||
NOTICEINFO_TYPES: this.selectTab === "all" ? "" : this.selectTab,
|
||
PROVINCE_CODE: this.user.PROVINCE_CODE || "530000",
|
||
NOTICEINFO_STATE: 1,
|
||
},
|
||
PageIndex: 1,
|
||
PageSize: 999999,
|
||
};
|
||
const data = await this.$api.$post(
|
||
"/EShangApiMain/Notice/GetNOTICEINFOList",
|
||
req
|
||
);
|
||
console.log("handleGetHighwayHeadlines", data);
|
||
let list = data.Result_Data.List;
|
||
if (list && list.length > 0) {
|
||
this.messageList = list;
|
||
} else {
|
||
this.messageList = [];
|
||
}
|
||
|
||
this.messageList.push({
|
||
NOTICEINFO_TITLE: "最新放假通知:调休2天,免费8天!",
|
||
messageType: "official",
|
||
});
|
||
|
||
console.log("this.messageList", this.messageList);
|
||
},
|
||
// 跳转查看高速头条详情
|
||
handleGoDetail(obj) {
|
||
console.log("obj", obj);
|
||
if (obj.messageType === "official") {
|
||
uni.navigateTo({
|
||
url: "/pages/highwayHeadlines/minprogress",
|
||
});
|
||
} else {
|
||
uni.navigateTo({
|
||
url: `/pages/highwayHeadlines/detail?id=${obj.NOTICEINFO_ID}`,
|
||
});
|
||
}
|
||
},
|
||
},
|
||
};
|
||
</script>
|
||
<style scoped lang="less">
|
||
.main {
|
||
width: 100%;
|
||
height: 100vh;
|
||
.tabBox {
|
||
width: 100%;
|
||
box-sizing: border-box;
|
||
padding: 22rpx 40rpx 22rpx;
|
||
overflow-x: auto;
|
||
display: flex;
|
||
border-bottom: 1px solid #f6f6f6;
|
||
.tabItem {
|
||
font-family: PingFangSC, PingFang SC;
|
||
font-weight: 400;
|
||
font-size: 28rpx;
|
||
color: #716f69;
|
||
line-height: 40rpx;
|
||
text-align: left;
|
||
font-style: normal;
|
||
display: inline-block;
|
||
margin-right: 56rpx;
|
||
white-space: nowrap;
|
||
}
|
||
.tabItem:nth-last-child(1) {
|
||
margin-right: 0;
|
||
}
|
||
.selectTabItem {
|
||
color: #130f05;
|
||
position: relative;
|
||
}
|
||
.selectTabItem::after {
|
||
content: "";
|
||
width: 2rem;
|
||
height: 6rpx;
|
||
background: #ba922f;
|
||
position: absolute;
|
||
bottom: -22rpx;
|
||
left: 50%;
|
||
transform: translateX(-50%);
|
||
}
|
||
}
|
||
.tabBox::-webkit-scrollbar {
|
||
display: none; /* Chrome, Safari 和 Opera */
|
||
}
|
||
|
||
.contentList {
|
||
width: 100%;
|
||
height: calc(100vh - 50px);
|
||
overflow-y: auto;
|
||
.contentItem {
|
||
width: 100%;
|
||
box-sizing: border-box;
|
||
padding: 32rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
border-bottom: 1px solid #f6f6f6;
|
||
.left {
|
||
width: calc(100% - 260rpx);
|
||
height: 220rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: space-between;
|
||
.title {
|
||
font-family: PingFangSC, PingFang SC;
|
||
font-weight: 400;
|
||
font-size: 28rpx;
|
||
color: #130f05;
|
||
line-height: 40rpx;
|
||
text-align: justify;
|
||
font-style: normal;
|
||
width: 100%;
|
||
display: -webkit-box; /* 使用弹性盒模型 */
|
||
-webkit-box-orient: vertical; /* 垂直排列 */
|
||
overflow: hidden; /* 超出部分隐藏 */
|
||
-webkit-line-clamp: 3; /* 限制最多显示3行文本 */
|
||
text-overflow: ellipsis; /* 超出部分用省略号显示 */
|
||
}
|
||
.content {
|
||
font-family: PingFangSC, PingFang SC;
|
||
font-weight: 400;
|
||
font-size: 24rpx;
|
||
color: #716f69;
|
||
line-height: 32rpx;
|
||
text-align: justify;
|
||
font-style: normal;
|
||
width: 100%;
|
||
display: -webkit-box; /* 使用弹性盒模型 */
|
||
-webkit-box-orient: vertical; /* 垂直排列 */
|
||
overflow: hidden; /* 超出部分隐藏 */
|
||
-webkit-line-clamp: 2; /* 限制最多显示3行文本 */
|
||
text-overflow: ellipsis; /* 超出部分用省略号显示 */
|
||
}
|
||
.descBox {
|
||
width: 100%;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin-top: 12rpx;
|
||
.name {
|
||
font-family: PingFangSC, PingFang SC;
|
||
font-weight: 400;
|
||
font-size: 24rpx;
|
||
color: #716f69;
|
||
line-height: 36rpx;
|
||
text-align: left;
|
||
font-style: normal;
|
||
}
|
||
.time {
|
||
font-family: PingFangSC, PingFang SC;
|
||
font-weight: 400;
|
||
font-size: 24rpx;
|
||
color: #716f69;
|
||
line-height: 36rpx;
|
||
text-align: left;
|
||
font-style: normal;
|
||
}
|
||
}
|
||
}
|
||
.right {
|
||
width: 220rpx;
|
||
height: 220rpx;
|
||
margin-left: 40rpx;
|
||
border-radius: 16rpx;
|
||
overflow: hidden;
|
||
.leftIcon {
|
||
width: 100%;
|
||
height: 100%;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</style> |