连云港陪玩陪聊
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.
chunwan/pages/xiaoxi/xitong.vue

125 lines
2.6 KiB

2 months ago
<template>
<view class="xitong">
1 month ago
<view class="item" v-for="(a,i) in list" :key="i" @click="toPage(a)">
<view class="date">{{a.createTime}}</view>
2 months ago
<view class="content">
1 month ago
<view class="title">{{a.noticeTitle}}</view>
<view class="desc">{{a.noticeContent}}</view>
<!-- <image mode="widthFix" v-if="i == 5" src="@/static/pic.jpg"></image> -->
2 months ago
</view>
1 month ago
</view>
<view class="empty" v-if="total == 0">
<image src="@/static/empty.png"></image>
<view class="txt">暂无数据</view>
2 months ago
</view>
</view>
</template>
<script>
export default {
data() {
return {
1 month ago
list: [],
total: 1,
page: 1
2 months ago
};
1 month ago
},
onLoad() {
this.getList();
},
onReachBottom() {
const that = this;
uni.showLoading({
title: "加载中"
})
if(that.list.length <= that.total){
that.page ++;
setTimeout(function() {
that.getList(1);
}, 1000);
}
},
methods: {
toPage(a) {
uni.setStorageSync("pcontent",a);
uni.navigateTo({
url: "/pages/xiaoxi/detail"
})
},
//数组对象去重
arrayUnique (arr, name) {
var hash = {};
return arr.reduce(function (item, next) {
hash[next[name]]
? ""
: (hash[next[name]] = true && item.push(next));
return item;
}, []);
},
async getList(type) {
const {code,data} = await this.$api.systemNoticeList({
userId: uni.getStorageSync("userInfo").id,
limit: 20,
page: this.page
})
if(type == 1){
uni.hideLoading()
}
if(code == 200){
this.isShow = data.total == 0?true:false;
this.list = this.arrayUnique([...this.list,...data.list],"id");
}
}
2 months ago
},
}
</script>
<style scoped lang="scss">
.xitong{
padding: 0 25rpx 25rpx;
overflow: hidden;
.item{
margin-top: 30rpx;
overflow: hidden;
.date{
text-align: center;
font-weight: 500;
font-size: 24rpx;
color: #999999;
}
.content{
background: #FFFFFF;
border-radius: 20rpx;
padding: 30rpx 30rpx;
margin-top: 30rpx;
.title{
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
font-weight: 500;
font-size: 36rpx;
color: #222222;
}
.desc{
margin-top: 20rpx;
font-weight: 500;
font-size: 24rpx;
color: #999999;
line-height: 36rpx;
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2; /* 这里是超出几行省略 */
}
image{
width: 100%;
margin-top: 30rpx;
border-radius: 10rpx;
}
}
}
}
</style>