|
@@ -16,9 +16,9 @@
|
|
|
{{ item.content }}
|
|
|
</view>
|
|
|
<view v-if="item.pic.length > 0">
|
|
|
- <view class="grid flex-sub padding-lr col-1" v-if="item.pic.length == 1">
|
|
|
+ <view class="grid flex-sub padding-lr col-1" v-if="item.pic.length == 1 && item.pic[0]">
|
|
|
<view @tap.stop @tap="Dever.viewPic(item.pic, child)" class="bg-img only-img" :style="{backgroundImage: 'url('+child+')'}"
|
|
|
- v-for="(child, idx) in item.pic" :key="idx">
|
|
|
+ v-for="(child, idx) in item.pic" :key="idx" v-if="child">
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
@@ -30,44 +30,46 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="text-gray text-sm text-right padding">
|
|
|
- <view class="icon-display" @click="updateOppose">
|
|
|
+ <view class="icon-display" @click="updateOppose(item)">
|
|
|
<text class="cuIcon-flashbuyfill margin-lr-xs" :class="item.is_oppose ? 'text-red' : ''"></text> {{item.num_oppose}}
|
|
|
</view>
|
|
|
- <view class="icon-display" @click="updateUp">
|
|
|
+ <view class="icon-display" @click="updateUp(item)">
|
|
|
<text class="cuIcon-appreciatefill margin-lr-xs" :class="item.is_up ? 'text-red' : ''"></text> {{item.num_up}}
|
|
|
</view>
|
|
|
- <view class="icon-display" @click="updateComment(20, item.id)">
|
|
|
+ <view class="icon-display" @click="updateComment(item.id)">
|
|
|
<text class="cuIcon-messagefill margin-lr-xs"></text> {{item.num_comment}}
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
- <view class="cu-list menu-avatar comment solids-top" v-if="fetch.info.length">
|
|
|
- <view class="cu-item" v-for="(v, k) in fetch.info" :key="k">
|
|
|
+ <view class="cu-list menu-avatar comment solids-top" v-if="item.child.length">
|
|
|
+ <view class="cu-item" v-for="(v, k) in item.child" :key="k">
|
|
|
<image :src="v.user.avatar" mode="widthFix" class="cu-avatar round"></image>
|
|
|
<view class="content">
|
|
|
<view class="text-grey">{{v.user.username}}</view>
|
|
|
- <view class="text-grays text-content text-df">
|
|
|
- {{v.content}}
|
|
|
- </view>
|
|
|
- <view class="bg-greys padding-sm radius margin-top-sm text-sm">
|
|
|
- <view class="flex">
|
|
|
- <view>凯尔:</view>
|
|
|
- <view class="flex-sub">妹妹,你在帮他们给黑暗找借口吗?</view>
|
|
|
- </view>
|
|
|
+ <view class="text-content text-df text-content-margin">
|
|
|
+ <text class="text-grey" v-if="v.to_uid > 0">回复@{{v.to_user.username}}:</text> {{v.content}}
|
|
|
</view>
|
|
|
<view class="margin-top-sm flex justify-between">
|
|
|
<view class="text-gray text-df">{{v.cdate_string}}</view>
|
|
|
- <view>
|
|
|
- <text class="cuIcon-appreciatefill text-red"></text>
|
|
|
- <text class="cuIcon-messagefill text-gray margin-left-sm"></text>
|
|
|
+ <view class="text-gray">
|
|
|
+ <view class="icon-display" @click="updateOppose(v)">
|
|
|
+ <text class="cuIcon-flashbuyfill margin-lr-xs" :class="v.is_oppose ? 'text-red' : ''"></text> {{v.num_oppose}}
|
|
|
+ </view>
|
|
|
+ <view class="icon-display" @click="updateUp(v)">
|
|
|
+ <text class="cuIcon-appreciatefill margin-lr-xs" :class="v.is_up ? 'text-red' : ''"></text> {{v.num_up}}
|
|
|
+ </view>
|
|
|
+ <view class="icon-display" @click="updateComment(item.id, v.id, v.uid)">
|
|
|
+ <text class="cuIcon-messagefill margin-lr-xs"></text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <view class="text-grey flex solid-bottom padding justify-center more" @click="getMore" v-if="item.child_total > 1">{{more}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view v-if="show">
|
|
|
- <communityPush :title="title" :is_upload="false" @hideModal="hideModal" @getRefresh="getRefresh" :cate_id="cate_id" :type="type" :type_id="type_id"></communityPush>
|
|
|
+ <communityPush :title="title" :is_upload="false" @hideModal="hideModal" @getRefresh="getRefresh" :cate_id="cate_id" :type="type" :type_id="type_id" :to_id="to_id" :to_uid="to_uid"></communityPush>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
@@ -88,8 +90,12 @@
|
|
|
components:{
|
|
|
communityPush
|
|
|
},
|
|
|
- mounted() {
|
|
|
- this.getData(1, 20, this.item.id);
|
|
|
+ created() {
|
|
|
+ this.more = '展开'+(this.item.child_total-1)+'条回复';
|
|
|
+ if (this.item.child_total > 0) {
|
|
|
+ this.id = this.item.child[0].id;
|
|
|
+ }
|
|
|
+ this.child = this.item.child;
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -98,50 +104,94 @@
|
|
|
showPop: false,
|
|
|
type : 20,
|
|
|
type_id : 0,
|
|
|
- fetch: {
|
|
|
- info : [],
|
|
|
- },
|
|
|
+ to_id : 0,
|
|
|
+ to_uid : 0,
|
|
|
+ page : 1,
|
|
|
+ num : 5,
|
|
|
+ more : '',
|
|
|
+ id : 0,
|
|
|
+ child : [],
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
getRefresh : function(cate_id, type, type_id) {
|
|
|
- this.getData(1, type, type_id);
|
|
|
+ this.item.num_comment++;
|
|
|
+ this.getMore(1, 1);
|
|
|
},
|
|
|
- getData : function(page, type, type_id) {
|
|
|
+ getMore : function(page, push) {
|
|
|
var self = this;
|
|
|
- this.Dever.get(this, 'app/community/?l=api.info', {cate_id:self.cate_id, type:type, type_id:type_id}, function(t) {
|
|
|
+ if (page && typeof(page) != 'object') {
|
|
|
+ self.page = page;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (self.page > 1 && self.more == '收起') {
|
|
|
+ // 收起
|
|
|
+ self.item.child = self.child;
|
|
|
+ self.more = '展开'+(self.item.child_total-1)+'条回复';
|
|
|
+ self.page = 1;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var send = {cate_id:self.cate_id, type:self.type, type_id:self.item.id, pg:self.page, noconcat:true};
|
|
|
+ send.id = self.id;
|
|
|
+ this.Dever.get(this, 'app/community/?l=api.info', send, function(t) {
|
|
|
+ if (self.page == 1) {
|
|
|
+ self.item.child = self.child;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (t.info && t.info.length > 0) {
|
|
|
+ self.item.child = self.item.child.concat(t.info);
|
|
|
+ self.page = self.page + 1;
|
|
|
+ }
|
|
|
+ if (self.Dever.pageData.status == 0) {
|
|
|
+ self.more = '收起';
|
|
|
+ } else {
|
|
|
+ self.more = '展开更多回复';
|
|
|
+ }
|
|
|
self.hideModal();
|
|
|
});
|
|
|
},
|
|
|
- updateUp : function() {
|
|
|
- let that = this;
|
|
|
- if (that.item.is_oppose) {
|
|
|
+ updateUp : function(item) {
|
|
|
+ var self = this;
|
|
|
+ if (item.is_oppose) {
|
|
|
return;
|
|
|
}
|
|
|
- if (that.item.is_up) {
|
|
|
- that.item.num_up--;
|
|
|
- that.item.is_up = false;
|
|
|
+ if (item.is_up) {
|
|
|
+ item.num_up--;
|
|
|
+ item.is_up = false;
|
|
|
} else {
|
|
|
- that.item.num_up++;
|
|
|
- that.item.is_up = true;
|
|
|
+ item.num_up++;
|
|
|
+ item.is_up = true;
|
|
|
}
|
|
|
+ self.Dever.post('app/community/?l=api.up', {id:item.id,noloading:1});
|
|
|
},
|
|
|
- updateOppose : function() {
|
|
|
- let that = this;
|
|
|
- if (that.item.is_up) {
|
|
|
+ updateOppose : function(item) {
|
|
|
+ var self = this;
|
|
|
+ if (item.is_up) {
|
|
|
return;
|
|
|
}
|
|
|
- if (that.item.is_oppose) {
|
|
|
- that.item.num_oppose--;
|
|
|
- that.item.is_oppose = false;
|
|
|
+ if (item.is_oppose) {
|
|
|
+ item.num_oppose--;
|
|
|
+ item.is_oppose = false;
|
|
|
} else {
|
|
|
- that.item.num_oppose++;
|
|
|
- that.item.is_oppose = true;
|
|
|
+ item.num_oppose++;
|
|
|
+ item.is_oppose = true;
|
|
|
}
|
|
|
+ self.Dever.post('app/community/?l=api.oppose', {id:item.id,noloading:1});
|
|
|
},
|
|
|
- updateComment : function (type, type_id) {
|
|
|
- this.type = type;
|
|
|
+ updateComment : function (type_id, to_id, to_uid) {
|
|
|
+ this.type = this.type;
|
|
|
this.type_id = type_id;
|
|
|
+ if (to_id) {
|
|
|
+ this.to_id = to_id;
|
|
|
+ } else {
|
|
|
+ this.to_id = 0;
|
|
|
+ }
|
|
|
+ if (to_uid) {
|
|
|
+ this.to_uid = to_uid;
|
|
|
+ } else {
|
|
|
+ this.to_uid = 0;
|
|
|
+ }
|
|
|
this.show = true;
|
|
|
},
|
|
|
hideModal : function () {
|
|
@@ -158,8 +208,14 @@
|
|
|
.cu-list.menu-avatar>.cu-item:after, .cu-list.menu>.cu-item:after {
|
|
|
border: 0px;
|
|
|
}
|
|
|
+.text-content-margin {
|
|
|
+ margin-top:10rpx;
|
|
|
+}
|
|
|
.icon-display {
|
|
|
display: inline;
|
|
|
margin-left: 20rpx;
|
|
|
}
|
|
|
+.more {
|
|
|
+ margin-top:-40rpx;
|
|
|
+}
|
|
|
</style>
|