This commit is contained in:
Gdpao
2020-08-05 21:06:29 +08:00
parent a47238a7a4
commit c4c11781fb
15 changed files with 305 additions and 159 deletions

View File

@@ -1,6 +1,6 @@
<template>
<view class="daren-item" @click="toDetailsPage">
<image class="head" :src="info.member_avatar"></image>
<view class="daren-item">
<image class="head" @click="toDetailsPage" :src="info.member_avatar"></image>
<text class="name">{{ info.member_nickname }}</text>
<text class="zhuangtai">状态: {{ info.live_status == 1 ? '正在直播' : '未开播' }}</text>
<view class="guanzhu action" @tap="changeType(info.member_id)" v-if="info.is_attention == 1">已关注</view>
@@ -8,17 +8,31 @@
</view>
</template>
<script>
import { mapState } from 'vuex';
export default {
name:"daren-item",
props: {
info: Object,
},
computed: {
...mapState(["login","hasLogin"]),
},
watch: {
info(newVal, old) {
// console.log(newVal);
},
deep: true
},
methods: {
toDetailsPage() {
// 判断是否登录
const toke = uni.getStorageSync('token');
if (toke) {
console.log(toke);
// console.log();
if (this.hasLogin) {
this.$u.route({
url: "/pageB/details/index",
params: {
id: this.info.member_id
}
});
}else{
uni.navigateTo({
url: '/pageA/login/login'
@@ -32,8 +46,8 @@ export default {
// })
},
changeType:function(type){
console.log("111")
this.$emit("pChangeType",type)
// console.log("111")
this.$emit("pChangeType",type);
},
},

View File

@@ -37,12 +37,13 @@
</template>
<style lang="scss" scoped>
.video-item{
margin-top: 20rpx;
flex-shrink: 0;
width: 335rpx;
box-shadow:0 3rpx 7rpx 0 rgba(153, 153, 153, 0.35);
padding-bottom: 20rpx;
border-radius: 20rpx;
margin-top: 20rpx;
overflow: hidden;
border-radius: 20rpx;
box-shadow:0 3rpx 7rpx 0 rgba(153, 153, 153, 0.35);
.head{
width: 100%;
height: 334rpx;
@@ -195,29 +196,40 @@ export default {
// console.log(this.item);
this.show = -1;
},
watch: {
item(newVal, old) {
// console.log(newVal);
this.item = newVal;
},
deep: true
},
methods: {
showAction() {
this.show = this.show > 0 ? -1 : this.item.article_id;
},
// 点赞
articleLike() {
this.item.is_like = !this.item.is_like;
this.$u.api.articleLike({
article_id: this.item.article_id,
}).then(res => {
console.log(res)
if(res.errCode == 0) {
this.$u.toast(res.message);
this.$emit("getArticlelist");
// this.$emit("getArticlelist");
}
})
},
// 收藏
articleCollect() {
this.item.is_collect = !this.item.is_collect;
this.$u.api.articleCollect({
article_id: this.item.article_id,
}).then(res => {
console.log(res);
if(res.errCode == 0) {
this.$u.toast(res.message);
this.$emit("getArticlelist");
// this.$emit("getArticlelist");
}
})
},