征信小程序
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.
zhengxinApplets/pages/user/release.vue

203 lines
4.1 KiB

3 months ago
<template>
<view class="release">
<view class="tab">
2 months ago
<view class="li" v-for="(a,i) in typeList" :class="tabIndex == i?'li-on':''" @click="tabItem(i)">{{a.name}}</view>
3 months ago
</view>
2 months ago
<view class="item" v-for="(a,i) in list" :key="i" @click="openPage(a.id)">
3 months ago
<view class="a">
2 months ago
{{a.title}}
<text>{{a.content_tag}}</text>
3 months ago
</view>
<view class="b">
2 months ago
<view class="tag" :class="a.status!=-1?'':'tag-on'">{{a.status_text}}</view>
阅读{{a.readnum}}
3 months ago
</view>
</view>
2 months ago
<view class="empty" v-if="total == 0">
<image src="https://www.lijkj.cn/static/empty.png"></image>
2 months ago
<view class="txt">暂无数据 ~</view>
3 months ago
</view>
</view>
</template>
<script>
export default {
data() {
return {
2 months ago
tabIndex: 0,
list: [],
total: 1,
offset: 1,
typeList: []
3 months ago
};
},
2 months ago
mounted() {
this.getTylelist();
},
onShow() {
1 month ago
this.querytContentList();
2 months ago
},
1 month ago
// onReachBottom() {
// const that = this;
// uni.showLoading({
// title: "加载中"
// })
// if(this.list.length <= this.total){
// that.offset ++;
// setTimeout(function() {
// that.querytContentList(1);
// }, 1000);
// }
// },
3 months ago
methods: {
2 months ago
//数组对象去重
arrayUnique (arr, name) {
var hash = {};
return arr.reduce(function (item, next) {
hash[next[name]]
? ""
: (hash[next[name]] = true && item.push(next));
return item;
}, []);
},
//事件类型
async getTylelist() {
const { code, data } = await this.$api.getTylelist({})
if(code == 1){
let arr = []
if(data && data.length > 0){
data.map(a=>{
a.name = a.title
})
}
this.typeList = [{name: "全部事件"},...data]
}
},
//获取事件
async querytContentList(type) {
const that = this;
if(type==2){
this.offset = 1;
this.tabIndex= 0;
}
const { code, data } = await that.$api.getUserContentList({
offset: this.offset,
1 month ago
limit: 9999,
2 months ago
content_type_id: (this.tabIndex==0?0:this.typeList[this.tabIndex].id),
user_id: uni.getStorageSync("userInfo").id,
token: uni.getStorageSync("token")
})
if(code == 1){
if(type==1){
uni.hideLoading();
1 month ago
}else if(type == 2){
that.list =data.rows
2 months ago
}
1 month ago
// that.list = this.arrayUnique([...that.list,...data.rows],'id');
that.list =data.rows
2 months ago
that.total = data.total;
}
},
3 months ago
tabItem(index){
this.tabIndex = index;
2 months ago
this.list = [];
this.offset = 1;
this.querytContentList();
3 months ago
},
openPage(id){
uni.navigateTo({
url: "/pages/release/detail?id="+id
})
},
}
}
</script>
<style scoped lang="scss">
.release{
padding: 0 25rpx 25rpx;
overflow: hidden;
2 months ago
.empty{
padding: 150rpx 0;
text-align: center;
font-size: 26rpx;
color: #666;
image{
width: 460rpx;
height: 400rpx;
margin-bottom: 30rpx;
}
}
3 months ago
.tab{
width: 110%;
overflow: hidden;
padding-top: 10rpx;
.li{
width: 150rpx;
line-height: 60rpx;
border-radius: 10rpx;
border: 1px solid #D4E4DF;
text-align: center;
font-weight: 500;
font-size: 28rpx;
color: #999999;
margin-top: 20rpx;
float: left;
margin-right: 20rpx;
&-on{
color: #00C6A9;
border-color: #00C6A9;
}
}
}
.item{
padding: 30rpx 25rpx;
overflow: hidden;
display: flex;
align-items: center;
justify-content: space-between;
background-color: #FFFFFF;
margin-top: 20rpx;
box-shadow: 0px 3rpx 10rpx 0px rgba(9,44,39,0.05);
border-radius: 20rpx;
.a{
flex: 1;
font-weight: 500;
font-size: 30rpx;
color: #222222;
text{
font-weight: 500;
font-size: 24rpx;
color: #999999;
display: block;
margin-top: 15rpx;
}
}
.b{
font-weight: 500;
font-size: 24rpx;
color: #333333;
margin-left: 20rpx;
.tag{
width: 100rpx;
height: 50rpx;
line-height: 50rpx;
background: #00C6A9;
border-radius: 4rpx;
font-weight: 500;
font-size: 22rpx;
display: flex;
align-items: center;
justify-content: center;
color: #FFFFFF;
margin: 0 auto 10rpx;
&-on{
background-color: #D80C0C;
}
}
}
}
}
</style>