deming/components/index/video-item/index.vue

261 lines
6.4 KiB
Vue
Raw Normal View History

2020-06-02 08:47:57 +08:00
<template>
2020-08-09 11:31:47 +08:00
<view class="video-item" v-if="item" @click="toDetailsPage(item.article_id,item.video_path)">
2020-07-17 08:36:53 +08:00
<image class="head" :src="item.article_pic" v-if="item.type == 1" ></image>
<view class="header_fist" v-else>
2020-07-20 17:14:18 +08:00
<view class="backes"></view>
2020-07-17 08:36:53 +08:00
<image class="head" :src="item.article_pic" ></image>
</view>
2020-08-06 10:35:59 +08:00
<view class="title" v-if="">{{ item.article_title }}</view>
2020-06-30 18:06:50 +08:00
<view class="jianjie">{{ item.article_content }}</view>
2020-06-02 08:47:57 +08:00
<view class="user">
2020-06-29 17:24:57 +08:00
<view class="info">
<image :src="item.member_avatar"></image>
<text>{{ item.member_nickname }}</text>
2020-06-02 08:47:57 +08:00
</view>
2020-07-01 17:32:36 +08:00
<image src="/static/image/common/4.png" @click.stop="showAction"></image>
2020-06-29 17:24:57 +08:00
<view class="action" v-if="show == item.article_id">
<view class="bubble">
2020-07-18 16:01:49 +08:00
<view @click.stop="articleLike">
2020-06-29 17:37:47 +08:00
<image src="/static/image/common/5.png" v-if="item.is_like == 0"></image>
<image src="/static/image/common/8.png" v-else></image>
2020-06-29 17:24:57 +08:00
<text>点赞</text>
</view>
2020-07-18 16:01:49 +08:00
<view @click.stop="articleCollect">
2020-06-29 17:37:47 +08:00
<image src="/static/image/common/6.png" v-if="item.is_collect == 0"></image>
<image src="/static/image/common/9.png" v-else></image>
2020-06-29 17:24:57 +08:00
<text>收藏</text>
</view>
2020-07-18 16:01:49 +08:00
<view @click.stop="articleAddShield">
2020-06-29 17:24:57 +08:00
<image src="/static/image/common/7.png"></image>
<text>屏蔽用户</text>
</view>
</view>
</view>
<view class="layer" v-if="show == item.article_id" @click.stop="show=-1"></view>
2020-06-02 08:47:57 +08:00
</view>
</view>
</template>
<style lang="scss" scoped>
.video-item{
2020-08-05 21:06:29 +08:00
flex-shrink: 0;
2020-06-02 08:47:57 +08:00
width: 335rpx;
2020-06-02 09:16:41 +08:00
padding-bottom: 20rpx;
2020-08-05 21:06:29 +08:00
margin-top: 20rpx;
2020-06-02 09:16:41 +08:00
overflow: hidden;
2020-08-05 21:06:29 +08:00
border-radius: 20rpx;
box-shadow:0 3rpx 7rpx 0 rgba(153, 153, 153, 0.35);
2020-06-02 08:47:57 +08:00
.head{
width: 100%;
height: 334rpx;
}
.title{
2020-06-02 09:16:41 +08:00
margin:0 auto;
2020-08-05 21:39:02 +08:00
margin-top: 4rpx;
2020-08-04 22:34:03 +08:00
font-size: 28rpx;
2020-06-02 09:16:41 +08:00
color: #333;
font-weight: 500;
2020-08-05 21:39:02 +08:00
line-height: 40rpx;
2020-06-29 17:24:57 +08:00
width: 300rpx;
2020-06-02 09:16:41 +08:00
overflow:hidden;
text-overflow:ellipsis;
display:-webkit-box;
-webkit-box-orient:vertical;
-webkit-line-clamp:2;
}
.jianjie{
margin:0 auto;
2020-08-05 21:39:02 +08:00
margin-top: 10rpx;
2020-06-02 08:47:57 +08:00
font-size: 22rpx;
color: #666;
line-height: 30rpx;
2020-06-29 17:24:57 +08:00
width: 300rpx;
2020-06-02 08:47:57 +08:00
margin-left: 18rpx;
overflow:hidden;
text-overflow:ellipsis;
display:-webkit-box;
-webkit-box-orient:vertical;
-webkit-line-clamp:2;
}
.user{
2020-06-02 09:16:41 +08:00
display: flex;
justify-content: space-between;
align-items: center;
margin:0 auto;
margin-top: 20rpx;
2020-06-29 17:24:57 +08:00
width: 300rpx;
position: relative;
.info {
2020-06-02 08:47:57 +08:00
display: flex;
align-items: center;
>image{
width: 38rpx;
height: 38rpx;
2020-06-02 09:16:41 +08:00
border-radius: 50%;
2020-06-02 08:47:57 +08:00
}
>text{
font-size: 20rpx;
color:#333;
2020-06-02 09:16:41 +08:00
margin-left: 9rpx;
2020-06-02 08:47:57 +08:00
}
}
>image{
width: 37rpx;
height: 8rpx;
}
2020-06-29 17:24:57 +08:00
.action {
z-index: 19;
position: absolute;
2020-08-03 21:40:22 +08:00
right: -10rpx;
bottom: 60rpx;
2020-06-29 17:24:57 +08:00
// width: 234rpx;
2020-08-03 21:40:22 +08:00
border-radius: 6rpx;
2020-06-29 17:24:57 +08:00
background: rgba(255,255,255,1);
box-shadow: 0rpx 0rpx 6rpx 0rpx rgba(35,24,21,0.12);
.bubble {
position: relative;
2020-08-04 19:39:31 +08:00
border-radius: 20rpx;
2020-06-29 17:24:57 +08:00
background-color: #fff;
&::after {
position: absolute;
right: 10rpx;
bottom: 0;
content: '';
width: 60rpx;
height: 40rpx;
background-color: inherit;
transform: rotate(45deg);
margin-top: -10rpx;
z-index: -1;
box-shadow: 0rpx 0rpx 6rpx 0rpx rgba(35,24,21,0.12);
}
> view {
display: flex;
align-items: center;
2020-08-04 19:39:31 +08:00
padding: 20rpx 30rpx;
2020-06-29 17:24:57 +08:00
&:not(:last-child) {
border-bottom: 2rpx #ECECEC solid;
}
@mixin image-class($width, $height, $right) {
width: $width;
height: $height;
margin-right: $right;
}
> image {
&:first-child {
2020-08-04 19:39:31 +08:00
@include image-class($width: 30rpx, $height: 30rpx, $right: 12rpx);
2020-06-29 17:24:57 +08:00
}
&:nth-child(2) {
2020-08-04 19:39:31 +08:00
@include image-class($width: 30rpx, $height: 30rpx, $right: 12rpx);
2020-06-29 17:24:57 +08:00
}
&:last-child {
2020-08-04 19:39:31 +08:00
@include image-class($width: 30rpx, $height: 30rpx, $right: 9rpx);
2020-06-29 17:24:57 +08:00
}
}
> text {
2020-08-04 19:39:31 +08:00
font-size: 24rpx;
2020-06-29 17:24:57 +08:00
color: rgba(51,51,51,1);
}
}
}
}
.layer {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 9;
background-color: transparent;
}
2020-06-02 08:47:57 +08:00
}
2020-07-17 08:36:53 +08:00
.header_fist{
position: relative;
.backes{
position: absolute;
top: 0;
width: 100%;
height: 100%;
2020-07-18 14:05:37 +08:00
color: #fff;
2020-07-17 08:36:53 +08:00
}
2020-07-18 14:05:37 +08:00
2020-07-17 08:36:53 +08:00
}
2020-06-02 08:47:57 +08:00
}
</style>
<script>
export default {
name:"index-item",
data(){
return {
2020-06-29 17:24:57 +08:00
show: -1,
2020-06-02 08:47:57 +08:00
}
2020-06-02 15:37:01 +08:00
},
2020-06-29 17:24:57 +08:00
props:["isguanzhu", "item"],
mounted() {
// console.log(this.item);
this.show = -1;
},
2020-08-05 21:06:29 +08:00
watch: {
item(newVal, old) {
// console.log(newVal);
this.item = newVal;
},
deep: true
},
2020-06-29 17:24:57 +08:00
methods: {
showAction() {
this.show = this.show > 0 ? -1 : this.item.article_id;
2020-06-30 18:06:50 +08:00
},
2020-08-05 21:06:29 +08:00
// 点赞
2020-06-30 18:06:50 +08:00
articleLike() {
2020-08-05 21:06:29 +08:00
this.item.is_like = !this.item.is_like;
2020-06-30 18:06:50 +08:00
this.$u.api.articleLike({
article_id: this.item.article_id,
}).then(res => {
2020-07-17 08:36:53 +08:00
console.log(res)
2020-06-30 18:06:50 +08:00
if(res.errCode == 0) {
2020-08-04 19:39:31 +08:00
this.$u.toast(res.message);
2020-08-05 21:06:29 +08:00
// this.$emit("getArticlelist");
2020-08-04 19:39:31 +08:00
}
2020-06-30 18:06:50 +08:00
})
},
2020-08-05 21:06:29 +08:00
// 收藏
2020-06-30 18:06:50 +08:00
articleCollect() {
2020-08-05 21:06:29 +08:00
this.item.is_collect = !this.item.is_collect;
2020-06-30 18:06:50 +08:00
this.$u.api.articleCollect({
article_id: this.item.article_id,
}).then(res => {
2020-08-04 19:39:31 +08:00
console.log(res);
2020-06-30 18:06:50 +08:00
if(res.errCode == 0) {
2020-08-04 19:39:31 +08:00
this.$u.toast(res.message);
2020-08-05 21:06:29 +08:00
// this.$emit("getArticlelist");
2020-06-30 18:06:50 +08:00
}
})
},
2020-08-10 19:06:47 +08:00
// 屏蔽
2020-06-30 18:06:50 +08:00
articleAddShield() {
this.$u.api.articleAddShield({
article_id: this.item.article_id,
member_id: this.item.member_id,
}).then(res => {
2020-07-18 17:43:37 +08:00
// console.log(res)
2020-06-30 18:06:50 +08:00
if(res.errCode == 0) {
2020-08-04 19:39:31 +08:00
this.$u.toast(res.message);
2020-06-30 18:06:50 +08:00
this.$emit("getArticlelist");
}
})
},
2020-08-09 11:31:47 +08:00
toDetailsPage(id,type) {
if (type) {
uni.navigateTo({
url: '/pageB/video/video?id=' + id
});
} else {
uni.navigateTo({
url: '/pageB/photo/index?id=' + id
});
}
2020-07-01 17:32:36 +08:00
},
2020-06-29 17:24:57 +08:00
},
2020-06-02 08:47:57 +08:00
}
</script>