update:community.page

master
xhhing 2 weeks ago
parent ca790b11ab
commit a301977d29

@ -27,30 +27,30 @@
<view class="post_box" v-for="(item, index) in posts" :key="index"> <view class="post_box" v-for="(item, index) in posts" :key="index">
<view class="post_top_box"> <view class="post_top_box">
<view class="post_avatar_box"> <view class="post_avatar_box">
<image class="post_avatar" src="../../../../static/homepages/community/community/pictures/dog_image.png" mode="widthFix"></image> <image class="post_avatar" :src=item.avatar mode="widthFix"></image>
</view> </view>
<view class="post_info"> <view class="post_info">
<view class="post_name">puppy</view> <view class="post_name">{{item.name}}</view>
<view class="post_date">2024年11月13日</view> <view class="post_date">{{item.date}}</view>
</view> </view>
</view> </view>
<view class="post_word_box">今天去海边锻炼看见的真是太美了啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊</view> <view class="post_word_box">{{item.word}}</view>
<view class="post_images_box"> <view class="post_images_box">
<community_image_box class="post_images" :imgList='imgList' :num='imgList.length'></community_image_box> <community_image_box class="post_images" :imgList='item.imgList' :num='item.imgList.length'></community_image_box>
</view> </view>
<view class="post_bottom_box"> <view class="post_bottom_box">
<view class="comments_box"> <view class="comments_box">
<image class="chat_icon" src="../../../../static/homepages/community/community/pictures/chat_icon.png" mode="widthFix"></image> <image class="chat_icon" src="../../../../static/homepages/community/community/pictures/chat_icon.png" mode="widthFix"></image>
<view class="comments_num">10</view> <view class="comments_num">{{item.comments_num}}</view>
</view> </view>
<view class="like_box"> <view class="like_box">
<image <image
class="love_icon" class="love_icon"
src="../../../../static/homepages/community/community/pictures/love_image.png" :src=getLikeImage(index)
mode="widthFix" mode="widthFix"
@click="likeClick" @click="likeClick(index)"
></image> ></image>
<view class="like_num">122</view> <view class="like_num">{{item.like_num}}</view>
</view> </view>
</view> </view>
</view> </view>
@ -70,30 +70,79 @@ export default {
return { return {
posts:[ posts:[
{ {
content:'' avatar:'../../../../static/homepages/community/community/pictures/dog_image.png',
}, name:'cat',
{ date:'2024年9月31日',
content:'' word:'今天去海边锻炼看见的,真是太美了啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊',
imgList:[
'../../../../static/homepages/community/community/pictures/dog_image.png',
'../../../../static/homepages/community/community/pictures/dog_image.png',
'../../../../static/homepages/community/community/pictures/dog_image.png',
'../../../../static/homepages/community/community/pictures/dog_image.png',
],
comments_num:1,
like_num:100,
islike:false,
}, },
{ {
content:'' avatar:'../../../../static/homepages/community/community/pictures/dog_image.png',
name:'puppy',
date:'2024年11月13日',
word:'今天去海边锻炼看见的,真是太美了',
imgList:[
'../../../../static/homepages/community/community/pictures/dog_image.png',
'../../../../static/homepages/community/community/pictures/dog_image.png',
'../../../../static/homepages/community/community/pictures/dog_image.png',
],
comments_num:12,
like_num:17,
islike:false,
}, },
{ {
content:'' avatar:'../../../../static/homepages/community/community/pictures/dog_image.png',
}, name:'cat',
], date:'2024年10月13日',
word:'今天去海边锻炼看见的',
imgList:[ imgList:[
'../../../../static/homepages/community/community/pictures/dog_image.png', '../../../../static/homepages/community/community/pictures/dog_image.png',
'../../../../static/homepages/community/community/pictures/dog_image.png', '../../../../static/homepages/community/community/pictures/dog_image.png',
],
comments_num:10,
like_num:100,
islike:false,
},
{
avatar:'../../../../static/homepages/community/community/pictures/dog_image.png',
name:'cat',
date:'2024年1月13日',
word:'今天去锻炼',
imgList:[
'../../../../static/homepages/community/community/pictures/dog_image.png', '../../../../static/homepages/community/community/pictures/dog_image.png',
'../../../../static/homepages/community/community/pictures/dog_image.png', ],
] comments_num:10,
like_num:100,
islike:false,
},
],
}; };
}, },
mounted(){ mounted(){
this.getAllPost() this.getAllPost()
}, },
computed:{
likeImages() {
return this.posts.map((post, index) => ({
index,
image: post.islike ? '../../../../static/homepages/community/community/pictures/red_love_image.png' : '../../../../static/homepages/community/community/pictures/love_image.png'
}));
}
},
methods:{ methods:{
getLikeImage(index) {
//TODO:
const item = this.likeImages.find(item => item.index === index);
return item ? item.image : '';
},
getAllPost(){ getAllPost(){
//TODO: //TODO:
const app = getApp() const app = getApp()
@ -110,8 +159,9 @@ export default {
}, },
}) })
}, },
likeClick(){ likeClick(index){
//TODO: //TODO:
this.posts[index].islike = this.posts[index].islike ? false:true
}, },
toAddPostPage(){ toAddPostPage(){
//TODO: //TODO:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Loading…
Cancel
Save