完善书评第二次提交

This commit is contained in:
yanwenlong
2023-09-26 11:10:35 +08:00
parent f397de5462
commit 6d10bf598b
2 changed files with 203 additions and 47 deletions

View File

@@ -31,8 +31,43 @@
<view class="btns flexbox" style="margin-top:10rpx;">
<span class="left" style="color: #C0C4CC;">{{formatTimeDifferenceFromT(item.createTime)}}</span>
<span class="right flexbox opbtns">
<image class="gzicon" v-if="item.ilike" src="../../static/icon/gz2.png" mode="aspectFill"></image>
<image class="gzicon" v-else src="../../static/icon/gz.png" mode="aspectFill"></image>
<image class="gzicon" v-if="item.ilike" src="../../static/icon/gz2.png" mode="aspectFill" @click.stop="clickLike(item)"></image>
<image class="gzicon" v-else src="../../static/icon/gz.png" mode="aspectFill" @click.stop="clickLike(item)"></image>
<view style="color: #C0C4CC;">{{item.contlike}}</view>
<image class="gzicon" v-if="1" src="../../static/icon/pinglun.png" mode="aspectFill"></image>
<view style="color: #C0C4CC;">{{item.commentNum}}</view>
</span>
</view>
<view style="border-bottom:2rpx solid #e9e9e9;height:50rpx;" v-if="index<item.length-1"></view>
</view>
</view>
</view>
</view>
<view class="quesheng" v-else>
暂无书评内容~
</view>
</view>
<view v-if="commentsListTab == 2">
<view v-if="hotList.length > 0">
<view class="bookInfo" v-for="(item,index) in hotList" :key="index">
<view class="mainContent">
<view class="item" @click.stop="toDetail(item)">
<view class="title">{{item.title}}</view>
<image class="feng" v-if="item.bookimage" :src="item.bookimage" mode="aspectFill"></image>
<view class="description" v-html="item.content">
</view>
<view class="btns flexbox">
<span class="left">{{item.bookname}}</span>
<span class="right flexbox opbtns" style="color:#3c9cff;">
全文
</span>
</view>
<view class="btns flexbox" style="margin-top:10rpx;">
<span class="left" style="color: #C0C4CC;">{{formatTimeDifferenceFromT(item.createTime)}}</span>
<span class="right flexbox opbtns">
<image class="gzicon" v-if="item.ilike" src="../../static/icon/gz2.png" mode="aspectFill" @click.stop="clickLike(item)"></image>
<image class="gzicon" v-else src="../../static/icon/gz.png" mode="aspectFill" @click.stop="clickLike(item)"></image>
<view style="color: #C0C4CC;">{{item.contlike}}</view>
<image class="gzicon" v-if="1" src="../../static/icon/pinglun.png" mode="aspectFill"></image>
<view style="color: #C0C4CC;">{{item.commentNum}}</view>
@@ -54,7 +89,7 @@
<view class="item">
<view class="btns flexbox" @click.stop="toMore(item)">
<view class="title">{{item.name}}</view>
<view class="pianshuping">{{item.id}}篇书评</view>
<view class="pianshuping">{{item.forumNum}}篇书评</view>
</view>
<image class="feng" v-if="item.images" :src="item.images" mode="aspectFill" @click.stop="toMore(item)"></image>
<view class="shupingList">
@@ -145,14 +180,20 @@ import { data } from 'jquery';
console.log('下拉刷新了')
uni.stopPullDownRefresh();
this.booklistpage=1, // 页码
this.productList = []
this.getBookList()
this.newestpage = 1
this.hotestpage = 1
this.booksetpage = 1
this.newList = []
this.hotList = []
this.bookList = []
this.getBookList(this.commentsListTab, true)
},
onReachBottom() {
this.booklistpage++
this.getBookList()
this.newestpage++
this.hotestpage++
this.booksetpage++
this.getBookList(this.commentsListTab, true)
},
onLoad(e) {
this.windowWidth = uni.getSystemInfoSync().windowWidth;
@@ -196,6 +237,9 @@ import { data } from 'jquery';
// 切换tab状态
commentsTabCLi(e) {
this.commentsListTab = e
this.newestpage = 1
this.hotestpage = 1
this.booksetpage = 1
this.newList = []
this.hotList = []
this.bookList = []
@@ -215,6 +259,22 @@ import { data } from 'jquery';
url:'../comments/commentsDetail?bookid='+val.bookid+'&bfa_id='+val.id
})
},
clickLike(item){
this.$http
.post("forum/articles/chickForumContlike?forum_id=" + item.id,)
.then(res => {
if (res.code == 0) {
uni.showToast({
title:'点赞成功!',
icon:'success'
})
item.contlike++
}
}).catch((e)=>{
console.log(e,'e')
})
},
getBookList(flag, clear){
// 根据tab不同获取最新书评、最热书评、书集列表
uni.showLoading({
@@ -226,7 +286,7 @@ import { data } from 'jquery';
}else if(flag == 2){
httpurl = "forum/articles/getForumsHot?page=" + this.hotestpage + '&limit=10'
}else{
httpurl = "forum/articles/getForumsAndBook?page=" + this.booksetpage + '&limit=10&userId=10100'// + this.userId
httpurl = "forum/articles/getForumsAndBook?page=" + this.booksetpage + '&limit=10&userId=' + this.userInfo.id
}
this.$http
.post(httpurl)
@@ -459,10 +519,10 @@ import { data } from 'jquery';
-webkit-line-clamp: 5;
line-clamp: 5;
-webkit-box-orient: vertical;
font-size: 24rpx;
font-size: 26rpx;
margin-bottom: 20rpx;
margin-top:10rpx;
min-height: 144rpx;
height: 172rpx;
}
.btns{
font-size: 22rpx;
@@ -540,7 +600,7 @@ import { data } from 'jquery';
-webkit-line-clamp: 1;
line-clamp: 1;
-webkit-box-orient: vertical;
font-size: 24rpx;
font-size: 26rpx;
margin-bottom: 20rpx;
margin-top:10rpx;
}