完善书评第二次提交
This commit is contained in:
@@ -47,8 +47,8 @@
|
||||
<view class="btns flexbox" style="margin-top:10rpx;">
|
||||
<span class="left" style="color: #C0C4CC;"></span>
|
||||
<span class="right flexbox opbtns">
|
||||
<image class="gzicon" v-if="commentInfo.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="commentInfo.ilike" src="../../static/icon/gz2.png" mode="aspectFill" @click.stop="clickLikeshuping(commentInfo)"></image>
|
||||
<image class="gzicon" v-else src="../../static/icon/gz.png" mode="aspectFill" @click.stop="clickLikeshuping(commentInfo)"></image>
|
||||
<view style="color: #C0C4CC;">{{commentInfo.contlike}}</view>
|
||||
<image class="gzicon" v-if="1" src="../../static/icon/pinglun.png" mode="aspectFill" @click="pinglun()"></image>
|
||||
<view style="color: #C0C4CC;" @click="pinglun()">{{commentInfo.commentNum}}</view>
|
||||
@@ -73,14 +73,24 @@
|
||||
<view class="item mb30" v-for="item in plList" :key="item.id">
|
||||
user
|
||||
<view class="content" v-html="item.phtml"></view>
|
||||
<view class="btns flexbox">
|
||||
<span class="time">{{item.createTime}}</span>
|
||||
<!-- <view class="btns flexbox"> -->
|
||||
<!-- <span class="time">{{formatTimeDifferenceFromT(item.createTime)}}</span> -->
|
||||
<!-- <span class="flexbox opbtns">
|
||||
<span class="flexbox pingjia" @click="pinglun(item.id)">
|
||||
<u-icon name="chat" color="#888" size="26"></u-icon>
|
||||
</span>
|
||||
</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="clickLikehuifu(item)"></image>
|
||||
<image class="gzicon" v-else src="../../static/icon/gz.png" mode="aspectFill" @click.stop="clickLikehuifu(item)"></image>
|
||||
<view style="color: #C0C4CC;">{{item.contlike}}</view>
|
||||
<image class="gzicon" v-if="1" src="../../static/icon/pinglun.png" mode="aspectFill" @click="pinglun()"></image>
|
||||
<view style="color: #C0C4CC;" @click="pinglun()">{{item.commentNum}}</view>
|
||||
</span>
|
||||
</view>
|
||||
<!-- </view> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="quesheng" v-else>
|
||||
@@ -210,34 +220,34 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
// 获得书评评论列表
|
||||
// 获得书评回复列表
|
||||
getCommPL(){
|
||||
let data = {
|
||||
'bfa_id':this.bfa_id,
|
||||
'forumId':this.bfa_id,
|
||||
'limit': 5,
|
||||
'page': this.pPage,
|
||||
}
|
||||
console.log(data,'data')
|
||||
this.$http
|
||||
.post('forum/comment/list', data)
|
||||
.post('forum/articles/getCommentByForum', data)
|
||||
.then(res => {
|
||||
if(res.code == 0){
|
||||
console.log(res,'书评评论')
|
||||
// this.plList = this.plList.concat(res.page.list)
|
||||
this.plList = res.page.list
|
||||
this.pTotal = res.page.totalPage
|
||||
let plList1 = res.page.records
|
||||
this.pTotal = res.page.size
|
||||
this.status = 3
|
||||
// 评论格式化
|
||||
var newarr = []
|
||||
this.plList.forEach((item1)=>{
|
||||
plList1.forEach((item1)=>{
|
||||
var pjstr = ''
|
||||
pjstr = this.getHtmlComment(item1.content)
|
||||
item1.phtml = pjstr
|
||||
// console.log(pjstr)
|
||||
newarr.push(item1)
|
||||
item1.phtml = pjstr
|
||||
// console.log(pjstr)
|
||||
newarr.push(item1)
|
||||
|
||||
})
|
||||
this.plList = newarr
|
||||
this.plList = this.plList.concat(newarr)
|
||||
console.log('改变格式后', this.plList)
|
||||
}
|
||||
}).catch((e)=>{
|
||||
@@ -257,6 +267,41 @@
|
||||
console.log(e)
|
||||
})
|
||||
},
|
||||
clickLikeshuping(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')
|
||||
})
|
||||
},
|
||||
clickLikehuifu(item){
|
||||
let data = {
|
||||
comment_id: item.id
|
||||
}
|
||||
this.$http
|
||||
.post("forum/articles/chickCommentConlike", data)
|
||||
.then(res => {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
title:'点赞成功!',
|
||||
icon:'success'
|
||||
})
|
||||
|
||||
item.contlike++
|
||||
}
|
||||
}).catch((e)=>{
|
||||
console.log(e,'e')
|
||||
})
|
||||
},
|
||||
getProDetail(){
|
||||
// 获取商品详情
|
||||
uni.showLoading({
|
||||
@@ -404,33 +449,61 @@
|
||||
submitPJ(){
|
||||
if(this.Pform.comment != ''){
|
||||
|
||||
let data={
|
||||
'content':this.Pform.comment,
|
||||
'userid':this.userInfo.id,
|
||||
'bookid':this.bookid,
|
||||
'bfaid' : this.bfa_id,
|
||||
// 'id': this.pinglunId
|
||||
// let data={
|
||||
// 'content':this.Pform.comment,
|
||||
// 'userid':this.userInfo.id,
|
||||
// 'bookid':this.bookid,
|
||||
// 'bfaid' : this.bfa_id,
|
||||
// // 'id': this.pinglunId
|
||||
// }
|
||||
// console.log(data,'data')
|
||||
|
||||
|
||||
let data = {
|
||||
forumId : this.bfa_id,
|
||||
userId: this.userInfo.id,
|
||||
content: this.Pform.comment,
|
||||
pid: '',
|
||||
puserId: '',
|
||||
}
|
||||
console.log(data,'data')
|
||||
$http.request({
|
||||
url: "forum/comment/save",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$http
|
||||
.post("forum/articles/pushMsgToForum", data)
|
||||
.then(res => {
|
||||
if (res.code == 0) {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
title:'评论成功!',
|
||||
icon:'success'
|
||||
})
|
||||
this.getCommPL()
|
||||
// this.getCommPL()
|
||||
this.pingjiaShow = false
|
||||
this.Pform.comment = ''
|
||||
this.pinglunId = null
|
||||
}
|
||||
})
|
||||
}
|
||||
}).catch((e)=>{
|
||||
console.log(e,'e')
|
||||
})
|
||||
|
||||
// $http.request({
|
||||
// url: "forum/comment/save",
|
||||
// method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
// data,
|
||||
// header: { //默认 无 说明:请求头
|
||||
// 'Content-Type': 'application/json'
|
||||
// },
|
||||
// }).then(res => {
|
||||
// if (res.code == 0) {
|
||||
// uni.showToast({
|
||||
// title:'评论成功!',
|
||||
// icon:'success'
|
||||
// })
|
||||
// this.getCommPL()
|
||||
// this.pingjiaShow = false
|
||||
// this.Pform.comment = ''
|
||||
// this.pinglunId = null
|
||||
// }
|
||||
// })
|
||||
}else{
|
||||
uni.showToast({
|
||||
title:'请先输入您的评价内容 !',
|
||||
@@ -460,12 +533,35 @@
|
||||
h4{color: #55aa00; font-size: 40rpx; margin:30rpx 0 ; text-align: center;}
|
||||
.time{color: #888; font-size: 24rpx;}
|
||||
.btns{
|
||||
color: #666; justify-content: space-between;
|
||||
font-size: 22rpx;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
.left{
|
||||
width: 300rpx;
|
||||
color: #a1a1a1;
|
||||
}
|
||||
.right{
|
||||
width: 300rpx;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
.gzicon{
|
||||
margin:0 0 0 20rpx;
|
||||
height: 40rpx;
|
||||
width: 40rpx;
|
||||
// float:left;
|
||||
// border-radius: 20rpx;
|
||||
// border:1rpx solid #e9e9e9;
|
||||
}
|
||||
.opbtns{
|
||||
.pingjia{margin-left: 10px;}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// .mbtns{padding: 5px; background-color: #f4fff5; border-radius: 10px; font-size: 34rpx; color: #8b8a91; margin:15px 0; justify-content: space-between;}
|
||||
.zhengwen{line-height: 50rpx; font-size: 30rpx;margin-top: 20rpx;}
|
||||
.zhengwen{line-height: 50rpx; font-size: 28rpx;margin-top: 20rpx;}
|
||||
.flexbox{display: flex;}
|
||||
.container{padding: 10px;}
|
||||
.star{display: inline-block; width: 20px; height: 20px; margin-right: 10rpx;}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user