176 lines
4.0 KiB
Vue
176 lines
4.0 KiB
Vue
<template>
|
||
<view class="collection">
|
||
<view class="container">
|
||
<view class="item-box" v-for="(item, index) in articleList" :key="index" @click="toDetailsPage({ id: item.article_id, type: item.type })">
|
||
<view class="video-item" v-if="item">
|
||
<image class="head" :src="item.article_pic" mode="aspectFill" v-if="item.type == 1"></image>
|
||
<view class="header_fist" v-else>
|
||
<view class="backs">
|
||
<image class="play-icon" src="/static/videoPlay.png"></image>
|
||
</view>
|
||
<image class="head" :src="item.article_pic"></image>
|
||
</view>
|
||
<view class="title u-line-1">{{ item.article_title }}</view>
|
||
<view class="jianjie u-line-1">{{ item.article_content }}</view>
|
||
<view class="user">
|
||
<view class="info">
|
||
<image :src="item.member_avatar"></image>
|
||
<text>{{ item.member_nickname }}</text>
|
||
</view>
|
||
<view @click.stop="viewAction(item.article_id)">
|
||
<u-icon name="more-dot-fill" color="#333" size="36"></u-icon>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<u-action-sheet :list="actionList" v-model="showAction" :cancel-btn="true" @click="delArticle" border-radius="20"></u-action-sheet>
|
||
<u-empty mode="list" v-if="!articleList.length" color="#000" img-width="200" font-size="30" margin-top="120"></u-empty>
|
||
</view>
|
||
</template>
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
tid: '',
|
||
show: -1,
|
||
articleList: [],
|
||
showAction: false,
|
||
actionList: [
|
||
{
|
||
text: '删除',
|
||
color: '#000000',
|
||
fontSize: 36
|
||
}
|
||
]
|
||
}
|
||
},
|
||
onShow() {
|
||
this.articleCollectList();
|
||
},
|
||
// 下拉刷新
|
||
onPullDownRefresh() {
|
||
this.articleCollectList();
|
||
},
|
||
methods: {
|
||
articleCollectList() {
|
||
this.$u.api.articleCollectList().then(res => {
|
||
uni.stopPullDownRefresh();
|
||
if(res.errCode == 0) {
|
||
this.articleList = res.data;
|
||
} else {
|
||
this.articleList = [];
|
||
}
|
||
})
|
||
},
|
||
viewAction(id) {
|
||
this.showAction = true;
|
||
this.tid = id;
|
||
},
|
||
toDetailsPage({ id, type }) {
|
||
let src = type == 1 ? 'pageB/photo/index' : 'pageB/video/video';
|
||
this.$u.route(src, { id: id });
|
||
},
|
||
delArticle() {
|
||
this.$u.api.articleCollect({ article_id: this.tid }).then(res => {
|
||
if(res.errCode == 0) {
|
||
this.articleCollectList();
|
||
} else {
|
||
this.$u.toast(res.message);
|
||
}
|
||
})
|
||
},
|
||
}
|
||
};
|
||
</script>
|
||
<style lang="scss" scoped>
|
||
.collection {
|
||
.container {
|
||
border-top: 1rpx solid #ECECEC;
|
||
padding: 21rpx 30rpx 0;
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
justify-content: space-between;
|
||
.item-box {
|
||
.video-item {
|
||
width: 330rpx;
|
||
height: 510rpx;
|
||
margin-top: 20rpx;
|
||
border-radius: 20rpx;
|
||
overflow: hidden;
|
||
box-shadow:0 3rpx 7rpx 0 rgba(153, 153, 153, 0.35);
|
||
.head{
|
||
width: 330rpx;
|
||
height: 330rpx !important;
|
||
}
|
||
.title{
|
||
margin: 20rpx auto 0;
|
||
font-size: 22rpx;
|
||
color: #333;
|
||
font-weight: 500;
|
||
height: 30rpx;
|
||
line-height: 30rpx;
|
||
width: 300rpx;
|
||
}
|
||
.jianjie{
|
||
height: 30rpx;
|
||
margin: 20rpx auto 0;
|
||
font-size: 22rpx;
|
||
color: #666;
|
||
line-height: 30rpx;
|
||
width: 300rpx;
|
||
margin-left: 18rpx;
|
||
}
|
||
.user {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin: 20rpx auto 0;
|
||
width: 300rpx;
|
||
position: relative;
|
||
.info {
|
||
display: flex;
|
||
align-items: center;
|
||
>image{
|
||
width: 38rpx;
|
||
height: 38rpx;
|
||
border-radius: 50%;
|
||
|
||
}
|
||
>text{
|
||
font-size: 20rpx;
|
||
color:#333;
|
||
margin-left: 9rpx;
|
||
}
|
||
}
|
||
>image{
|
||
width: 37rpx;
|
||
height: 8rpx;
|
||
}
|
||
}
|
||
.header_fist {
|
||
width: 330rpx;
|
||
height: 330rpx;
|
||
position: relative;
|
||
.backs {
|
||
width: 100%;
|
||
height: 100%;
|
||
z-index: 9;
|
||
position: absolute;
|
||
background-color: rgba(0, 0, 0, 0.35);
|
||
.play-icon {
|
||
z-index: 19;
|
||
position: absolute;
|
||
width: 100rpx;
|
||
height: 100rpx;
|
||
top: 50%;
|
||
left: 50%;
|
||
transform: translate(-50%, -50%);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</style> |