feat: 公告
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<TopSafe></TopSafe>
|
||||
<Header title="系统公告" :isReturn="true" @return="onReturnClick" />
|
||||
<view class="setting-view">
|
||||
<view class="name-box-title">
|
||||
<view class="value">{{ newsDetail.title }}</view>
|
||||
<view class="name-box-time">{{ formatDate(newsDetail.ctdate) }}</view>
|
||||
</view>
|
||||
|
||||
<view class="name-box">
|
||||
<view class="value" v-html="newsDetail.content"></view>
|
||||
</view>
|
||||
</view>
|
||||
<up-toast ref="uToastRef"></up-toast>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Header from "@/components/common/header.vue";
|
||||
import TopSafe from "@/components/common/top-safe.nvue";
|
||||
import { getNewsDetail } from "@/api/news.js";
|
||||
import { formatDate } from "@/utils/index.js";
|
||||
|
||||
export default {
|
||||
components: { Header, TopSafe },
|
||||
data() {
|
||||
return {
|
||||
newsDetail: {},
|
||||
};
|
||||
},
|
||||
onShow() {},
|
||||
onLoad(option) {
|
||||
if (option && option.id) {
|
||||
this.getNewsDetail(Number(option.id));
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate,
|
||||
async getNewsDetail(id) {
|
||||
const params = {
|
||||
id,
|
||||
};
|
||||
const resp = await getNewsDetail(params);
|
||||
if (resp && resp.bizcode === 100) {
|
||||
this.newsDetail = resp.data || {};
|
||||
}
|
||||
},
|
||||
onReturnClick() {
|
||||
uni.navigateTo({url:"/pages/login_package/announcement/announcement"});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.bottom-btn {
|
||||
width: 100%;
|
||||
margin-bottom: 92rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 0 32rpx;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
}
|
||||
.setting-view {
|
||||
width: 100%;
|
||||
height: calc(100% - 88rpx - var(--status-bar-height));
|
||||
overflow-y: auto;
|
||||
padding: 0 32rpx;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
.name-box-title {
|
||||
border-bottom: 1rpx solid #eaeaea;
|
||||
padding-bottom: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
.value {
|
||||
font-weight: 500;
|
||||
font-size: 40rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.name-box-time {
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
.name-box {
|
||||
width: 100%;
|
||||
border-radius: 16rpx;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
align-content: flex-start;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,141 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<TopSafe></TopSafe>
|
||||
<Header :title="name" :isReturn="true" @return="onReturnClick">
|
||||
<!-- <template v-slot:right>
|
||||
<img
|
||||
src="https://cex-pub.s3.ap-southeast-1.amazonaws.com/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://cex-pub.s3.ap-southeast-1.amazonaws.com/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>
|
||||
</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>
|
||||
Reference in New Issue
Block a user