143 lines
3.4 KiB
Vue
143 lines
3.4 KiB
Vue
<template>
|
|
<view class="content">
|
|
<TopSafe></TopSafe>
|
|
<Header :title="name" :isReturn="true" @return="onReturnClick">
|
|
<!-- <template v-slot:right>
|
|
<img
|
|
src="https://static.tbmall.xin/static/newClear.png"
|
|
alt=""
|
|
class="clear_but"
|
|
/>
|
|
</template> -->
|
|
</Header>
|
|
|
|
<view class="setting-view">
|
|
<view
|
|
class="news_content_item"
|
|
v-for="(item, index) in dataList"
|
|
:key="index"
|
|
@click="onJumpShop(item.id)"
|
|
>
|
|
<image
|
|
class="news_content_item_img"
|
|
src="https://static.tbmall.xin/static/new-logo.png"
|
|
mode="aspectFill"
|
|
></image>
|
|
<view class="news_content_item_warp">
|
|
<view class="news_content_item_title">{{ item.title }}</view>
|
|
<view class="news_content_item_content">{{
|
|
formatDate(item.ctdate)
|
|
}}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<up-toast ref="uToastRef"></up-toast>
|
|
<qiaobao-assistant page-key="pages/login_package/announcement/announcement" title="商城公告" />
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import Header from "@/components/common/header.vue";
|
|
import TopSafe from "@/components/common/top-safe.nvue";
|
|
import { getNewsList } from "@/api/news.js";
|
|
import { formatDate } from "@/utils/index.js";
|
|
|
|
export default {
|
|
components: { Header, TopSafe },
|
|
data() {
|
|
return {
|
|
dataList: [],
|
|
name: "系统公告",
|
|
};
|
|
},
|
|
onShow() {},
|
|
onLoad() {
|
|
this.getSearchList();
|
|
},
|
|
methods: {
|
|
formatDate,
|
|
async getSearchList() {
|
|
getNewsList({
|
|
category: 2,
|
|
type: 0,
|
|
page: 1,
|
|
pageSize: 1000,
|
|
}).then((res) => {
|
|
console.log("获取公告", res);
|
|
|
|
if (res.bizcode === 100) {
|
|
this.dataList = res.data.entitys || [];
|
|
console.log(this.dataList);
|
|
}
|
|
});
|
|
},
|
|
onJumpShop(id) {
|
|
uni.setStorageSync("isReadNews", this.dataList[0].id);
|
|
uni.navigateTo({
|
|
url:
|
|
"/pages/login_package/announcement-detail/announcement-detail?id=" +
|
|
id,
|
|
});
|
|
},
|
|
// 返回
|
|
onReturnClick() {
|
|
uni.switchTab({
|
|
url:'/pages/home/home'
|
|
})
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.clear_but{
|
|
width: 44rpx;
|
|
height: 44rpx;
|
|
}
|
|
.setting-view {
|
|
width: 100%;
|
|
height: calc(100% - 88rpx - var(--status-bar-height));
|
|
display: flex;
|
|
background-color: #fff;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
overflow-y: auto;
|
|
box-sizing: border-box;
|
|
position: relative;
|
|
|
|
.news_content_item {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 0 32rpx;
|
|
width:calc(100% - 64rpx);
|
|
height: 128rpx;
|
|
|
|
.news_content_item_img {
|
|
width: 64rpx;
|
|
height: 64rpx;
|
|
border-radius: 50%;
|
|
margin-right: 10rpx;
|
|
}
|
|
|
|
.news_content_item_warp {
|
|
.news_content_item_title {
|
|
overflow: hidden;
|
|
display: -webkit-box;
|
|
-webkit-box-orient: vertical;
|
|
-webkit-line-clamp: 1;
|
|
/* 下面两行是为了兼容老版本 Firefox */
|
|
line-clamp: 1;
|
|
box-orient: vertical;
|
|
font-size: 28rpx;
|
|
color: #333333;
|
|
}
|
|
.news_content_item_content {
|
|
font-size: 12px;
|
|
color: #999999;
|
|
margin-top: 4rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|