deming/pageE/mine/ImageTextCollection.vue

176 lines
4.0 KiB
Vue
Raw Normal View History

2020-06-08 07:23:23 +00:00
<template>
<view class="collection">
2020-08-04 13:13:47 +00:00
<view class="container">
2020-08-14 02:58:05 +00:00
<view class="item-box" v-for="(item, index) in articleList" :key="index" @click="toDetailsPage({ id: item.article_id, type: item.type })">
2020-08-04 13:13:47 +00:00
<view class="video-item" v-if="item">
2020-08-12 02:10:59 +00:00
<image class="head" :src="item.article_pic" mode="aspectFill" v-if="item.type == 1"></image>
2020-08-04 13:13:47 +00:00
<view class="header_fist" v-else>
2020-08-14 02:58:05 +00:00
<view class="backs">
<image class="play-icon" src="/static/videoPlay.png"></image>
</view>
2020-08-04 13:13:47 +00:00
<image class="head" :src="item.article_pic"></image>
2020-08-03 06:34:56 +00:00
</view>
2020-08-04 13:13:47 +00:00
<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>
2020-08-03 06:34:56 +00:00
</view>
2020-08-14 02:58:05 +00:00
<view @click.stop="viewAction(item.article_id)">
<u-icon name="more-dot-fill" color="#333" size="36"></u-icon>
2020-08-04 13:13:47 +00:00
</view>
</view>
2020-08-03 06:34:56 +00:00
</view>
</view>
2020-06-08 07:23:23 +00:00
</view>
2020-08-14 02:58:05 +00:00
<u-action-sheet :list="actionList" v-model="showAction" :cancel-btn="true" @click="delArticle" border-radius="20"></u-action-sheet>
2020-08-04 13:13:47 +00:00
<u-empty mode="list" v-if="!articleList.length" color="#000" img-width="200" font-size="30" margin-top="120"></u-empty>
2020-06-08 07:23:23 +00:00
</view>
</template>
<script>
export default {
data() {
2020-08-03 06:34:56 +00:00
return {
2020-08-14 02:58:05 +00:00
tid: '',
2020-08-03 06:34:56 +00:00
show: -1,
articleList: [],
2020-08-14 02:58:05 +00:00
showAction: false,
actionList: [
{
text: '删除',
color: '#000000',
fontSize: 36
}
]
2020-08-03 06:34:56 +00:00
}
},
onShow() {
2020-08-06 12:42:03 +00:00
this.articleCollectList();
2020-06-08 07:23:23 +00:00
},
2020-08-03 06:34:56 +00:00
// 下拉刷新
onPullDownRefresh() {
2020-08-06 12:42:03 +00:00
this.articleCollectList();
2020-08-03 06:34:56 +00:00
},
methods: {
articleCollectList() {
this.$u.api.articleCollectList().then(res => {
uni.stopPullDownRefresh();
if(res.errCode == 0) {
this.articleList = res.data;
} else {
this.articleList = [];
}
})
},
2020-08-14 02:58:05 +00:00
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 => {
2020-08-03 06:34:56 +00:00
if(res.errCode == 0) {
this.articleCollectList();
} else {
this.$u.toast(res.message);
}
})
},
2020-06-08 07:23:23 +00:00
}
};
</script>
<style lang="scss" scoped>
.collection {
2020-08-04 13:13:47 +00:00
.container {
border-top: 1rpx solid #ECECEC;
padding: 21rpx 30rpx 0;
display: flex;
flex-wrap: wrap;
2020-08-14 02:58:05 +00:00
justify-content: space-between;
2020-08-04 13:13:47 +00:00
.item-box {
2020-08-14 02:58:05 +00:00
.video-item {
2020-08-06 12:42:03 +00:00
width: 330rpx;
height: 510rpx;
2020-08-03 06:34:56 +00:00
margin-top: 20rpx;
2020-08-04 13:13:47 +00:00
border-radius: 20rpx;
overflow: hidden;
2020-08-06 12:42:03 +00:00
box-shadow:0 3rpx 7rpx 0 rgba(153, 153, 153, 0.35);
2020-08-04 13:13:47 +00:00
.head{
2020-08-06 12:42:03 +00:00
width: 330rpx;
height: 330rpx !important;
2020-08-04 13:13:47 +00:00
}
.title{
2020-08-14 02:58:05 +00:00
margin: 20rpx auto 0;
2020-08-04 13:13:47 +00:00
font-size: 22rpx;
color: #333;
font-weight: 500;
2020-08-14 02:58:05 +00:00
height: 30rpx;
2020-08-04 13:13:47 +00:00
line-height: 30rpx;
width: 300rpx;
}
.jianjie{
2020-08-14 02:58:05 +00:00
height: 30rpx;
margin: 20rpx auto 0;
2020-08-04 13:13:47 +00:00
font-size: 22rpx;
color: #666;
line-height: 30rpx;
width: 300rpx;
margin-left: 18rpx;
}
2020-08-14 02:58:05 +00:00
.user {
2020-08-03 06:34:56 +00:00
display: flex;
2020-08-04 13:13:47 +00:00
justify-content: space-between;
2020-08-03 06:34:56 +00:00
align-items: center;
2020-08-14 02:58:05 +00:00
margin: 20rpx auto 0;
2020-08-04 13:13:47 +00:00
width: 300rpx;
position: relative;
.info {
display: flex;
align-items: center;
>image{
width: 38rpx;
height: 38rpx;
border-radius: 50%;
2020-08-03 06:34:56 +00:00
2020-08-04 13:13:47 +00:00
}
>text{
font-size: 20rpx;
color:#333;
margin-left: 9rpx;
}
2020-08-03 06:34:56 +00:00
}
2020-08-04 13:13:47 +00:00
>image{
width: 37rpx;
height: 8rpx;
2020-08-03 06:34:56 +00:00
}
}
2020-08-14 02:58:05 +00:00
.header_fist {
width: 330rpx;
height: 330rpx;
2020-08-04 13:13:47 +00:00
position: relative;
2020-08-14 02:58:05 +00:00
.backs {
2020-08-04 13:13:47 +00:00
width: 100%;
height: 100%;
2020-08-14 02:58:05 +00:00
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%);
}
2020-08-04 13:13:47 +00:00
}
2020-08-03 06:34:56 +00:00
}
}
}
2020-06-08 07:23:23 +00:00
}
}
</style>