书评主要逻辑修改
This commit is contained in:
@@ -18,7 +18,11 @@
|
||||
<span class="author">作者:{{productInfo.authorName}}</span>
|
||||
<!-- <view class="description">{{productInfo.bookdesc}}</view> -->
|
||||
|
||||
<span class="author">听书、读书打卡、立即购买</span>
|
||||
<view class="ting-du-mai">
|
||||
<view class="ting-du-mai-item" @click="toOtherPage(1,productInfo)">听书</view>
|
||||
<view class="ting-du-mai-item" @click="toOtherPage(2,productInfo)">读书打卡</view>
|
||||
<view class="ting-du-mai-item" @click="toOtherPage(3,productInfo)">立即购买</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
@@ -29,6 +33,16 @@
|
||||
</view>
|
||||
<view class="mainContent">
|
||||
<view v-if="shupingList.length > 0">
|
||||
<view class="flexbox shuping-topbar">
|
||||
<view class="shuping-topbar-tiao">{{shupingNum || 0}}条书评</view>
|
||||
<view class="shuping-topbar-order">
|
||||
<!-- <view v-for="(item,index) in orderTabs" @click="orderTabCLi(item.value)" :key="index"
|
||||
:class="orderListTab==item.value?'orderdefine ordStyle':'orderdefine'">{{item.name}}</view> -->
|
||||
<view :class="orderListTab==1?'orderdefine ordStyle':'orderdefine'" @click="orderTabCLi(1)">按时间</view>
|
||||
<view style="border-left:2rpx solid #e9e9e9;height:36rpx;"></view>
|
||||
<view :class="orderListTab==2?'orderdefine ordStyle':'orderdefine'" @click="orderTabCLi(2)">按热度</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" @click.stop="toDetail(item)" v-for="(item,index1) in shupingList" :key="index">
|
||||
<view class="title">{{item.title}}</view>
|
||||
<image class="feng" v-if="item.image" :src="item.image" mode="aspectFill"></image>
|
||||
@@ -39,14 +53,16 @@
|
||||
<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" @click.stop="pinglun(item.id)"></image>
|
||||
<view style="color: #C0C4CC;" @click.stop="pinglun(item.id)">{{item.commentNum}}</view>
|
||||
<!-- <image class="gzicon" v-if="1" src="../../static/icon/pinglun.png" mode="aspectFill" @click.stop="pinglun(item.id)"></image>
|
||||
<view style="color: #C0C4CC;" @click.stop="pinglun(item.id)">{{item.commentNum}}</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="index1<shupingList.length-1"></view>
|
||||
<view style="border-bottom:2rpx solid #e9e9e9;height:36rpx;" v-if="index1<shupingList.length-1"></view>
|
||||
<!-- <image class="feng" v-if="item.image == ''" src="../../static/icon/home_bg.jpg" mode="scaleToFill" style="width: 100%;"></image>
|
||||
<image class="feng" v-else :src="item.image" mode="scaleToFill" style="width: 100%;"></image>
|
||||
<text class="title">{{item.title}}</text> -->
|
||||
@@ -126,6 +142,15 @@ import { data } from 'jquery';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
orderListTab: 1,
|
||||
orderTabs: [{
|
||||
name: '按时间',
|
||||
value: 1
|
||||
}, {
|
||||
name: '按热度',
|
||||
value: 2
|
||||
}],
|
||||
shupingNum: 0,
|
||||
loadingNow : false,
|
||||
playData:{},
|
||||
isShowEmj: false,
|
||||
@@ -156,7 +181,7 @@ import { data } from 'jquery';
|
||||
|
||||
this.page=1, // 页码
|
||||
this.shupingList = []
|
||||
this.getBookCom()
|
||||
this.getBookCom(this.orderListTab)
|
||||
|
||||
},
|
||||
onReachBottom() {
|
||||
@@ -165,7 +190,7 @@ import { data } from 'jquery';
|
||||
this.page++
|
||||
console.log('加载',this.page)
|
||||
this.status = 0
|
||||
this.getBookCom()
|
||||
this.getBookCom(this.orderListTab)
|
||||
|
||||
}else{
|
||||
this.status = 1
|
||||
@@ -178,12 +203,55 @@ import { data } from 'jquery';
|
||||
console.log(e,'onload')
|
||||
this.bookid = e.bookid
|
||||
this.getProDetail(e)
|
||||
this.getBookCom()
|
||||
this.getBookCom(this.orderListTab)
|
||||
},
|
||||
computed:{
|
||||
...mapState(['userInfo']),
|
||||
},
|
||||
methods: {
|
||||
toOtherPage(e,productInfo) {
|
||||
if(e==1){
|
||||
// 跳转到听书
|
||||
uni.navigateTo({
|
||||
url: "../listen/listen?bookid=" + productInfo.id
|
||||
});
|
||||
}
|
||||
if(e==2){
|
||||
// 跳转到读书打卡
|
||||
uni.navigateTo({
|
||||
url: '../clock/clock?bookid='+ productInfo.id
|
||||
})
|
||||
}
|
||||
if(e==3){
|
||||
// 跳转到购买
|
||||
uni.navigateTo({
|
||||
url: '../bookShop/commodityDetail?id=' + productInfo.id
|
||||
});
|
||||
}
|
||||
},
|
||||
// 切换tab状态
|
||||
orderTabCLi(e) {
|
||||
this.orderListTab = e
|
||||
this.page = 1
|
||||
this.shupingList = []
|
||||
this.getBookCom(this.orderListTab)
|
||||
},
|
||||
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')
|
||||
})
|
||||
},
|
||||
formatTimeDifferenceFromT(dateTimeT) {
|
||||
const now = new Date();
|
||||
const t = new Date(dateTimeT);
|
||||
@@ -237,24 +305,26 @@ import { data } from 'jquery';
|
||||
})
|
||||
},
|
||||
// 获得书评
|
||||
getBookCom(){
|
||||
getBookCom(flag){
|
||||
let data = {
|
||||
'page': this.page,
|
||||
'limit': this.pageSize,
|
||||
'bookid' : this.bookid
|
||||
'bookId' : this.bookid,
|
||||
'order' : flag
|
||||
}
|
||||
console.log(data,'data')
|
||||
this.$http
|
||||
.post('forum/articles/descupdatelist', data)
|
||||
.post('forum/articles/getForumByBook', data)
|
||||
.then(res => {
|
||||
console.log(res,'获取成功')
|
||||
this.total = res.page.totalPage
|
||||
this.shupingList = this.shupingList.concat(res.page.list)
|
||||
this.total = res.page.pages
|
||||
this.shupingNum = res.page.total
|
||||
this.shupingList = this.shupingList.concat(res.page.records)
|
||||
// console.log(res,'已购买')
|
||||
this.status = 3
|
||||
}).catch((e)=>{
|
||||
console.log(e,'e')
|
||||
})
|
||||
console.log(e,'e')
|
||||
})
|
||||
},
|
||||
// 获得输入的表情数组
|
||||
handleEmj(i) {
|
||||
@@ -462,18 +532,59 @@ import { data } from 'jquery';
|
||||
margin-right: 5rpx;
|
||||
}
|
||||
}}
|
||||
|
||||
.shuping-topbar{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
.shuping-topbar-tiao{
|
||||
font-size: 28rpx;
|
||||
color: #8b8a91;
|
||||
}
|
||||
.shuping-topbar-order{
|
||||
width: 280rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
.orderdefine {
|
||||
display: inline-block;
|
||||
padding: 20rpx 0 20rpx 0;
|
||||
// margin: 40rpx 0 15rpx 0;
|
||||
width:230rpx;
|
||||
text-align: center;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.ordStyle {
|
||||
// border-bottom: 4rpx solid #54a966;
|
||||
// color: #54a966;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
.quesheng{text-align: center; margin-top: 100rpx; color: #8b8a91; padding-bottom: 20rpx; padding-top: 20rpx;}
|
||||
.bookInfo{
|
||||
justify-content: space-between;
|
||||
margin-bottom: 15px;
|
||||
background-color: #fff;
|
||||
padding:10px;
|
||||
border: 1px splid #999;
|
||||
// border: 1px splid #999;
|
||||
box-sizing: border-box;
|
||||
padding-bottom: 20rpx;
|
||||
border-radius: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
.ting-du-mai{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-content: center;
|
||||
font-size: 28rpx;
|
||||
width: 400rpx;
|
||||
.ting-du-mai-item{
|
||||
color: deepskyblue;
|
||||
border: 1px solid deepskyblue;
|
||||
border-radius: 6rpx;
|
||||
padding: 4rpx 6rpx;
|
||||
}
|
||||
}
|
||||
.imageradius{
|
||||
border-radius: 20rpx;
|
||||
border:1rpx solid #e9e9e9;
|
||||
@@ -522,8 +633,20 @@ import { data } from 'jquery';
|
||||
border-radius: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.feng{margin:10rpx 0 0 0;height: 200rpx;width: 200rpx;float:right;border-radius: 20rpx;border:1rpx solid #e9e9e9;}
|
||||
.title{font-size: 30rpx; font-weight: 700; color: #000; overflow: hidden;}
|
||||
.feng{
|
||||
margin:10rpx 20rpx 0 0;
|
||||
height: 160rpx;
|
||||
width: 140rpx;
|
||||
float:left;
|
||||
border-radius: 20rpx;
|
||||
border:1rpx solid #e9e9e9;
|
||||
}
|
||||
.title{
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #000;
|
||||
overflow: hidden;
|
||||
}
|
||||
.description{
|
||||
overflow: hidden;
|
||||
color: #666;
|
||||
@@ -534,10 +657,10 @@ import { data } from 'jquery';
|
||||
-webkit-line-clamp: 5;
|
||||
line-clamp: 5;
|
||||
-webkit-box-orient: vertical;
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 15px;
|
||||
margin-top:5px;
|
||||
min-height: 186rpx;
|
||||
font-size: 26rpx;
|
||||
margin-bottom: 20rpx;
|
||||
margin-top:10rpx;
|
||||
height: 172rpx;
|
||||
}
|
||||
// .btns{
|
||||
// font-size: 24rpx;
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
<view v-if="plList.length > 0">
|
||||
<view class="pl-item" v-for="item in plList" :key="item.id">
|
||||
<view class="plusername">{{item.user.name}}</view>
|
||||
<view class="content" v-html="item.phtml"></view>
|
||||
<view class="content" v-html="item.content"></view>
|
||||
<!-- <view class="btns flexbox"> -->
|
||||
<!-- <span class="time">{{formatTimeDifferenceFromT(item.createTime)}}</span> -->
|
||||
<!-- <span class="flexbox opbtns">
|
||||
@@ -106,6 +106,7 @@
|
||||
<!-- <view style="color: #C0C4CC;" @click="pinglun(item1)">{{item1.commentsNum}}</view> -->
|
||||
</span>
|
||||
</view>
|
||||
<view style="border-bottom:2rpx solid #e9e9e9;height:20rpx;" v-if="index<item.comments.length-1"></view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- </view> -->
|
||||
@@ -258,18 +259,15 @@
|
||||
this.status = 3
|
||||
// 评论格式化
|
||||
var newarr = []
|
||||
plList1.forEach((item1)=>{
|
||||
var pjstr = ''
|
||||
pjstr = this.getHtmlComment(item1.content)
|
||||
item1.phtml = pjstr
|
||||
if(item1.comments && item1.comments.length>0){
|
||||
item1.comments.forEach((item2)=>{
|
||||
var pjstr1 = ''
|
||||
item2.content = this.getHtmlComment(item2.content)
|
||||
})
|
||||
}
|
||||
// console.log(pjstr)
|
||||
newarr.push(item1)
|
||||
plList1.forEach((item1)=>{
|
||||
item1.content = this.getHtmlComment(item1.content)
|
||||
if(item1.comments && item1.comments.length>0){
|
||||
item1.comments.forEach((item2)=>{
|
||||
item2.content = this.getHtmlComment(item2.content)
|
||||
})
|
||||
}
|
||||
// console.log(pjstr)
|
||||
newarr.push(item1)
|
||||
|
||||
})
|
||||
this.plList = this.plList.concat(newarr)
|
||||
@@ -508,18 +506,40 @@
|
||||
.post("forum/articles/pushMsgToForum", data)
|
||||
.then(res => {
|
||||
if (res.code == 0) {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
title:'评论成功!',
|
||||
icon:'success'
|
||||
})
|
||||
// this.getCommPL()
|
||||
this.pingjiaShow = false
|
||||
this.Pform.comment = ''
|
||||
this.Pform.name = ''
|
||||
this.Pform.pid = ''
|
||||
this.Pform.puserId = ''
|
||||
// this.pinglunId = null
|
||||
uni.showToast({
|
||||
title:'评论成功!',
|
||||
icon:'success'
|
||||
})
|
||||
// this.getCommPL()
|
||||
this.pingjiaShow = false
|
||||
this.Pform.comment = ''
|
||||
this.Pform.name = ''
|
||||
this.Pform.pid = ''
|
||||
this.Pform.puserId = ''
|
||||
// this.pinglunId = null
|
||||
|
||||
// 把回复的评论拼进this.plList回复列表中
|
||||
let comment = res.comment
|
||||
// 第一种情况:1级回复
|
||||
if(comment&&comment.pid == 0){
|
||||
comment.content = this.getHtmlComment(comment.content)
|
||||
console.log('this.userInfo',this.userInfo)
|
||||
comment.user = this.userInfo
|
||||
comment.comments = []
|
||||
this.plList.unshift(comment)
|
||||
}else if(comment&&comment.pid > 0){// 第二种情况:回复第1级回复和回复第2级回复
|
||||
|
||||
for(let i=0;i<this.plList.length;i++){
|
||||
if(this.plList[i].id == comment.pid){
|
||||
|
||||
comment.content = this.getHtmlComment(comment.content)
|
||||
console.log('this.userInfo',this.userInfo)
|
||||
comment.user = this.userInfo
|
||||
comment.puser = this.plList[i].user
|
||||
// comment.comments = []
|
||||
this.plList[i].comments.push(comment)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}).catch((e)=>{
|
||||
@@ -569,7 +589,7 @@
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
.pl-son{
|
||||
margin: 14rpx 0 14rpx 60rpx;
|
||||
padding: 0 0 14rpx 14rpx;
|
||||
padding: 0 14rpx 14rpx 14rpx;
|
||||
background-color: #f0f0f0;
|
||||
border-radius: 10rpx;
|
||||
.pl-son-item{
|
||||
|
||||
Reference in New Issue
Block a user