|
|
@@ -19,12 +19,14 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="dynamic-item" v-for="(item,itemIndex) in list">
|
|
|
+ {{dynamicList.length}}
|
|
|
+ <view class="dynamic-item" v-for="(item,itemIndex) in dynamicList">
|
|
|
+ 12121
|
|
|
<view class="dynamic-title">
|
|
|
<view class="dynamic-title-left">
|
|
|
- <text class="dynamic-title-text sys-weight-600" :style="{'color':textColor}">12</text>
|
|
|
- <text class="dynamic-title-text sys-weight-400" :style="{'color':textColor}">04月</text>
|
|
|
- <text class="dynamic-title-text sys-weight-400" :style="{'color':textColor}">2020年</text>
|
|
|
+ <text class="dynamic-title-text sys-weight-600" :style="{'color':textColor}">item.dateArr[2]</text>
|
|
|
+ <text class="dynamic-title-text sys-weight-400" :style="{'color':textColor}">item.dateArr[1]月</text>
|
|
|
+ <text class="dynamic-title-text sys-weight-400" :style="{'color':textColor}">item.dateArr[0]年</text>
|
|
|
</view>
|
|
|
<view class="dynamic-title-right">
|
|
|
<image class="dynamic-right-img" mode="aspectFill" src="/static/img/index/dynamic-all.png" ></image>
|
|
|
@@ -32,22 +34,22 @@
|
|
|
</view>
|
|
|
<view class="dynamic-data" :style="{'border-left':' 1rpx solid '+divisionColor}">
|
|
|
<view class="data-text">
|
|
|
- <text class="text-item" :style="{'color':textColor}">{{item.text}}</text>
|
|
|
+ <text class="text-item" :style="{'color':textColor}">{{item.content}}</text>
|
|
|
</view>
|
|
|
|
|
|
- <view class="data-img" v-if="item.img.length>0">
|
|
|
- <view class="one-img" v-if="item.img.length===1">
|
|
|
- <img-one :file-list="item.img"></img-one>
|
|
|
+ <view class="data-img" v-if="item.galleryUrls.length>0">
|
|
|
+ <view class="one-img" v-if="item.galleryUrls.length===1">
|
|
|
+ <img-one :file-list="item.galleryUrls"></img-one>
|
|
|
</view>
|
|
|
- <view class="two-img" v-else-if="item.img.length===2 || item.img.length===4">
|
|
|
- <img-two :file-list="item.img"></img-two>
|
|
|
+ <view class="two-img" v-else-if="item.galleryUrls.length===2 || item.galleryUrls.length===4">
|
|
|
+ <img-two :file-list="item.galleryUrls"></img-two>
|
|
|
</view>
|
|
|
<view class="three-img" v-else>
|
|
|
- <img-three :file-list="item.img"></img-three>
|
|
|
+ <img-three :file-list="item.galleryUrls"></img-three>
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
- <view class="data-tag-list" >
|
|
|
+ <view class="data-tag-list" v-if="false" >
|
|
|
<dynamic-tag :list="item.tag" :tag-bg="tagBg" :tag-color="tagColor"></dynamic-tag>
|
|
|
|
|
|
</view>
|
|
|
@@ -55,15 +57,15 @@
|
|
|
<view class="operation-item" @click="setLike(itemIndex)">
|
|
|
<!-- <image class="operation-img" mode="aspectFill" :src="'/static/img/index/like-'+(item.isLike?'ok':'no')+'.png'" ></image>-->
|
|
|
<view class="operation-icon">
|
|
|
- <text class="iconfont icon-dianzan" v-if="!item.isLike" :style="{'color':operateColor}"> </text>
|
|
|
+ <text class="iconfont icon-dianzan" v-if="!item.liked" :style="{'color':operateColor}"> </text>
|
|
|
<text class="iconfont icon-dianzan1" v-else :style="{'color':'#ED301D'}"> </text>
|
|
|
</view>
|
|
|
- <view class="operation-text sys-weight-400" :style="{'color':operateColor}">{{item.likeNum>0?item.likeNum:'点赞'}}</view>
|
|
|
+ <view class="operation-text sys-weight-400" :style="{'color':operateColor}">{{item.likeCount>0?item.likeCount:'点赞'}}</view>
|
|
|
</view>
|
|
|
<view class="operation-item">
|
|
|
<!-- <image class="operation-img" mode="aspectFill" src="/static/img/index/evaluate.png" ></image>-->
|
|
|
<view class="operation-icon"><text class="iconfont icon-pinglun" :style="{'color':operateColor}"></text></view>
|
|
|
- <view class="operation-text sys-weight-400" :style="{'color':operateColor}">{{item.evaluateNum>0?item.evaluateNum:'评论'}}</view>
|
|
|
+ <view class="operation-text sys-weight-400" :style="{'color':operateColor}">{{item.commentCount>0?item.commentCount:'评论'}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -78,10 +80,15 @@ import ImgOne from "@/pages/common/img/img-one";
|
|
|
import ImgTwo from "@/pages/common/img/img-two";
|
|
|
import ImgThree from "@/pages/common/img/img-three";
|
|
|
import DynamicTag from "@/pages/common/tag/dynamic-tag";
|
|
|
+import {getMoments} from "@/api/discovery";
|
|
|
+import tools from "@/service/tools";
|
|
|
export default {
|
|
|
name: "dynamic-items",
|
|
|
components: {DynamicTag, ImgThree, ImgTwo, ImgOne},
|
|
|
props: {
|
|
|
+ 'userId':{
|
|
|
+ default:0
|
|
|
+ },
|
|
|
textColor:{
|
|
|
type:String,
|
|
|
default:'#fff'
|
|
|
@@ -109,31 +116,59 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- list:[
|
|
|
- {'text':'我是阳光大男孩我','img':['/static/img/temporary/1.png'],'tag':[{'text':'南亭新都会商场','icon':'1'},{'text':'你好认识一哈','icon':'2'}],'likeNum':1,'evaluateNum':0,'isLike':true},
|
|
|
- {'text':'我是阳光大男孩我','img':['/static/img/temporary/1.png','/static/img/temporary/2.png','/static/img/temporary/3.png','/static/img/temporary/2.png'],'tag':[{'text':'南亭新都会商场','icon':'1'},{'text':'你好认识一哈','icon':'2'}],'likeNum':0,'evaluateNum':20,'isLike':false},
|
|
|
- {'text':'我是阳光大男孩我','img':[
|
|
|
- '/static/img/temporary/1.png',
|
|
|
- '/static/img/temporary/3.png',
|
|
|
- '/static/img/temporary/2.png',
|
|
|
- '/static/img/temporary/1.png',
|
|
|
- '/static/img/temporary/3.png',
|
|
|
- '/static/img/temporary/2.png',
|
|
|
- ],'tag':[{'text':'南亭新都会商场','icon':'1'},{'text':'你好认识一哈','icon':'2'}],'likeNum':10,'evaluateNum':20,'isLike':true},
|
|
|
- ]
|
|
|
+ page:1,
|
|
|
+ total:undefined,
|
|
|
+ isAjax:false,
|
|
|
+ dynamicList:[]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ 'userId':function () {
|
|
|
+ // this.startList()
|
|
|
}
|
|
|
},
|
|
|
- watch: {},
|
|
|
mounted() {
|
|
|
-
|
|
|
+ this.startList()
|
|
|
},
|
|
|
methods: {
|
|
|
+ startList(){
|
|
|
+ if(this.userId<=0){
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ // this.dynamicList=[]
|
|
|
+ this.isAjax=false
|
|
|
+ this.total=undefined
|
|
|
+ this.page=1
|
|
|
+ this.getMoments()
|
|
|
+ },
|
|
|
+ getMoments(){
|
|
|
+ if(this.isAjax){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.isAjax=true
|
|
|
+ let that=this
|
|
|
+ getMoments({'userId':this.userId,'pageNo':this.page,'pageSize':20}).then((res)=>{
|
|
|
+ this.isAjax=false
|
|
|
+ if(res.code===0){
|
|
|
+ // console.log(this.dynamicList)
|
|
|
+ res.data.data.forEach((item)=>{
|
|
|
+ item.dateArr=tools.getDateArr(item.createdAt)
|
|
|
+ console.log(that.dynamicList)
|
|
|
+ that.dynamicList.push(item)
|
|
|
+ })
|
|
|
+ // console.log( this.dynamicList)
|
|
|
+ // console.log( this.dynamicList.length)
|
|
|
+ ++that.page
|
|
|
+ that.total=res.data.total
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
setLike(index){
|
|
|
- this.list[index].isLike=!this.list[index].isLike
|
|
|
- if(this.list[index].isLike){
|
|
|
- ++this.list[index].likeNum
|
|
|
+ this.dynamicList[index].liked=!this.dynamicList[index].liked
|
|
|
+ if(this.dynamicListdynamicList[index].liked){
|
|
|
+ ++this.dynamicList[index].likeCount
|
|
|
}else {
|
|
|
- --this.list[index].likeNum
|
|
|
+ --this.dynamicList[index].likeCount
|
|
|
}
|
|
|
}
|
|
|
}
|