|
@@ -1,95 +1,46 @@
|
|
|
<template>
|
|
|
- <view class="ndetail ">
|
|
|
- <!-- 详情 -->
|
|
|
- <view class="ndbox mb12">
|
|
|
- <view class="plr15">
|
|
|
- <view class="tit">{{datainfo.communityTitle}}</view>
|
|
|
- <view class="time mb12">{{datainfo.publishTime}}</view>
|
|
|
- <view class="rich">
|
|
|
- <rich-text :nodes="communityContent" style="word-break: break-all;"></rich-text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="ndbfox flexc">
|
|
|
- <view class="flexcc ndbflist">
|
|
|
- <image :src="nicona"></image>
|
|
|
- <view>32</view>
|
|
|
- </view>
|
|
|
- <view class="flexcc ndbflist">
|
|
|
- <image :src="niconb"></image>
|
|
|
- <view>32</view>
|
|
|
- </view>
|
|
|
- <view class="flexcc ndbflist">
|
|
|
- <image :src="niconc"></image>
|
|
|
- <view>32</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="ndbox mb12 plr15">
|
|
|
- <view class="pltit">评论<text>(31)</text></view>
|
|
|
- <!-- 评论列表 -->
|
|
|
- <view class="pllist flex">
|
|
|
- <image :src="head" class="head"></image>
|
|
|
- <view class="flex1 overh">
|
|
|
- <view class="flexat mb14 ">
|
|
|
- <view class="plname flex1 over">床前明月光</view>
|
|
|
- <view class="plrbtn flexc flex0">
|
|
|
- <!-- <image :src="niconb" class="imga"></image> -->
|
|
|
- <image :src="nicond"></image>
|
|
|
- <view>点赞</view>
|
|
|
- </view>
|
|
|
- <view class="plrbtn flexc flex0">
|
|
|
- <image :src="nicone" class="imgb"></image>
|
|
|
- <view>回复</view>
|
|
|
- </view>
|
|
|
+ <view class="ndetail">
|
|
|
+ <image :src="nonews" v-if="datainfo.status==2" class="noimg"></image>
|
|
|
+ <block v-else>
|
|
|
+ <!-- 详情 -->
|
|
|
+ <view class="ndbox mb12">
|
|
|
+ <view class="plr15">
|
|
|
+ <view class="tit">{{datainfo.communityTitle}}</view>
|
|
|
+ <view class="time mb12">{{datainfo.publishTime}}</view>
|
|
|
+ <view class="rich">
|
|
|
+ <rich-text :nodes="communityContent" style="word-break: break-all;"></rich-text>
|
|
|
</view>
|
|
|
- <view class="infotxt mb15">支持!去看一下优惠政策!<view class="infotime">12-3</view></view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
- <view class="pllist flex">
|
|
|
- <image :src="head" class="head"></image>
|
|
|
- <view class="flex1 overh">
|
|
|
- <view class="flexat mb14 ">
|
|
|
- <view class="plname flex1 over">疑是地上霜</view>
|
|
|
- <view class="plrbtn flexc flex0">
|
|
|
- <image :src="niconb" class="imga"></image>
|
|
|
- <!-- <image :src="nicond"></image> -->
|
|
|
- <view>点赞</view>
|
|
|
- </view>
|
|
|
- <view class="plrbtn flexc flex0">
|
|
|
- <image :src="nicone" class="imgb"></image>
|
|
|
- <view>回复</view>
|
|
|
- </view>
|
|
|
+ <view class="ndbfox flexc">
|
|
|
+ <view class="flexcc ndbflist" @click="getHfFn">
|
|
|
+ <image :src="nicona"></image>
|
|
|
+ <view>{{datainfo.userComment}}</view>
|
|
|
</view>
|
|
|
- <view class="infotxt mb15">提前缴一年的物业费,可以免一个月吗?<view class="infotime">12-3</view></view>
|
|
|
- <!-- 二级回复 -->
|
|
|
- <view class="pllist flex">
|
|
|
- <image :src="head" class="head"></image>
|
|
|
- <view class="flex1 overh">
|
|
|
- <view class="flexat mb14 ">
|
|
|
- <view class="plname flex1 over">幸福小区物业</view>
|
|
|
- <view class="plrbtn flexc flex0">
|
|
|
- <image :src="niconb" class="imga"></image>
|
|
|
- <!-- <image :src="nicond"></image> -->
|
|
|
- <view>点赞</view>
|
|
|
- </view>
|
|
|
- <view class="plrbtn flexc flex0">
|
|
|
- <image :src="nicone" class="imgb"></image>
|
|
|
- <view>回复</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="infotxt mb15">尊敬的业主朋友,您的建议我司已收到,将在内 部讨论后于物业公告中告知结果,谢谢您的宝贵 建议!<view class="infotime">12-3</view></view>
|
|
|
- </view>
|
|
|
+ <view class="flexcc ndbflist" @click="getDzFn('1')">
|
|
|
+ <image :src="nicond" v-if="datainfo.isLike=='Y'"></image>
|
|
|
+ <image :src="niconb" v-else></image>
|
|
|
+ <view>{{datainfo.userLikes}}</view>
|
|
|
+ </view>
|
|
|
+ <view class="flexcc ndbflist" @click="getScFn('1')">
|
|
|
+ <image :src="starb" v-if="datainfo.isStar=='Y'"></image>
|
|
|
+ <image :src="niconc" v-else></image>
|
|
|
+ <view>{{datainfo.userStars}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
- <!-- 评论 -->
|
|
|
- <view class="pjfbtn">
|
|
|
- <view class="flexc pjfbox">
|
|
|
- <uni-easyinput type="textarea" autoHeight v-model="text" :inputBorder='false' placeholder="发表我的评论…" />
|
|
|
- <view class="btns">发送</view>
|
|
|
+ <view class="ndbox mb12 plr15">
|
|
|
+ <view class="pltit">评论<text>({{commenttotal}})</text></view>
|
|
|
+ <!-- 评论列表 -->
|
|
|
+ <box-list :datainfo="commentlist" type="comment" @getZhanFn="getZhanFn" @getShouFn="getShouFn" @getDzFn="getplDzFn" @getHfFn="getplHfFn" @getDelFn="getDelFn"></box-list>
|
|
|
+ </view>
|
|
|
+ <!-- 评论 -->
|
|
|
+ <view class="pjfbtn">
|
|
|
+ <view class="flexc pjfbox">
|
|
|
+ <uni-easyinput :focus="isfocus" type="textarea" autoHeight v-model="text" :inputBorder='false' placeholder="发表我的评论…" />
|
|
|
+ <view class="btns" @click="getPinLunFn">发送</view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
+ </block>
|
|
|
<loading></loading>
|
|
|
</view>
|
|
|
</template>
|
|
@@ -98,9 +49,10 @@
|
|
|
import config from '@/config'
|
|
|
const baseUrl = config.baseUrl
|
|
|
import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
|
|
|
- import {newsDet} from "@/api/work/manage.js"
|
|
|
+ import boxList from "@/manage/components/car/list.vue"
|
|
|
+ import {getRootComment,getParentComment,commentIndex,giveTheThumbs,getStars,commentContentPut,deletepl,newsDet} from "@/api/work/manage.js"
|
|
|
export default{
|
|
|
- components:{},
|
|
|
+ components:{boxList},
|
|
|
data(){
|
|
|
return{
|
|
|
nicona:require('@/manage/static/news/nicona.png'),
|
|
@@ -109,17 +61,31 @@
|
|
|
nicond:require('@/manage/static/news/nicond.png'),
|
|
|
nicone:require('@/manage/static/news/nicone.png'),
|
|
|
head:require('@/manage/static/news/head.png'),
|
|
|
+ starb:require('@/manage/static/news/starb.png'),
|
|
|
+ nonews:require('@/manage/static/news/nonews.png'),
|
|
|
+ baseUrl:config.baseUrl,
|
|
|
datainfo:{
|
|
|
|
|
|
},
|
|
|
communityContent:'<span>hello uni-app x!</span><br/><span>uni-app x,终极跨平台方案</span>',
|
|
|
text:'',
|
|
|
id:"",
|
|
|
+ commentlist:[],//评论列表
|
|
|
+ commenttotal:"0",
|
|
|
+ pageSize: 10,
|
|
|
+ pageNum: 1,
|
|
|
+ userId:this.$store.state.user.userId,
|
|
|
+ nickName:this.$store.state.user.nickName,
|
|
|
+ avatar:this.$store.state.user.avatar,
|
|
|
+ isRoot:'1',//isRoot,根评论id 1:根评论 2:子评论
|
|
|
+ isfocus:false,
|
|
|
+ plinfo:'',//二级评论信息
|
|
|
}
|
|
|
},
|
|
|
onLoad: function(e) {
|
|
|
this.id=e.id;
|
|
|
- // this.getDetailFn()
|
|
|
+ this.getDetailFn();
|
|
|
+ this.getRootComment()
|
|
|
},
|
|
|
// 上拉触底加载更多触发事件
|
|
|
onReachBottom() {
|
|
@@ -141,6 +107,228 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 删除
|
|
|
+ getDelFn(id){
|
|
|
+ var that=this;
|
|
|
+ // var info=JSON.parse(JSON.stringify(data))
|
|
|
+ // var type=info.type;
|
|
|
+ // var pid=info.pid;
|
|
|
+ deletepl(id).then(res=>{
|
|
|
+ if(res.code==200){
|
|
|
+ this.$toast("删除成功");
|
|
|
+ uni.$emit('partyNewsList')
|
|
|
+ setTimeout(function(){
|
|
|
+ // 删除数据
|
|
|
+ that.getRootComment()
|
|
|
+ },1500)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getZhanFn(obj){
|
|
|
+ // 获取自己
|
|
|
+ var obj=JSON.parse(JSON.stringify(obj));
|
|
|
+ var idx=obj.idx;
|
|
|
+ var list=JSON.parse(JSON.stringify(this.commentlist))[idx]
|
|
|
+ var params={
|
|
|
+ parentId:list.id,
|
|
|
+ pageSize:list.pageSize,
|
|
|
+ pageNum: list.pageNum,
|
|
|
+ }
|
|
|
+ getParentComment(params).then(res=>{
|
|
|
+ if(res.code==200){
|
|
|
+ var reachflag=true;
|
|
|
+ if (res.data.length < obj.pageSize) {
|
|
|
+ list.reachflag = false
|
|
|
+ } else {
|
|
|
+ var num = parseInt(res.data.length) + parseInt(obj.pageSize) * parseInt(obj.pageNum - 1)
|
|
|
+ if (num < obj.childrenListCount) {
|
|
|
+ list.reachflag = true
|
|
|
+ } else {
|
|
|
+ list.reachflag = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list.childrenList=list.childrenList.concat(res.data)
|
|
|
+ list.pageNum=obj.pageNum++
|
|
|
+ this.commentlist.splice(idx,1,list)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 点赞
|
|
|
+ getDzFn(type,info){
|
|
|
+ var params={
|
|
|
+ userId:this.userId,
|
|
|
+ nickName:this.nickName,
|
|
|
+ avatar:this.avatar,
|
|
|
+ targetType:type,
|
|
|
+ communityId:this.id,
|
|
|
+ }
|
|
|
+ if(type==1){
|
|
|
+ params.targetId=this.id;
|
|
|
+ params.targetTitle=this.datainfo.communityTitle;
|
|
|
+ }else {
|
|
|
+ params.targetId=info.id;
|
|
|
+ params.targetTitle=info.content;
|
|
|
+ }
|
|
|
+ giveTheThumbs(params).then(res=>{
|
|
|
+ if(res.code==200){
|
|
|
+ uni.$emit('partyNewsList')
|
|
|
+ if(type==1){
|
|
|
+ if(this.datainfo.isLike=='Y'){
|
|
|
+ this.$toast("取消点赞成功");
|
|
|
+ this.datainfo.isLike='N';
|
|
|
+ this.datainfo.userLikes--;
|
|
|
+ }else{
|
|
|
+ this.$toast("点赞成功");
|
|
|
+ this.datainfo.isLike='Y';
|
|
|
+ this.datainfo.userLikes++;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ var idx=info.idx;
|
|
|
+ var aidx=info.aidx;
|
|
|
+ var atype=info.atype;
|
|
|
+ var obj=JSON.parse(JSON.stringify(this.commentlist))[idx];
|
|
|
+ if(atype&&atype=='ejdz'){
|
|
|
+ var erobj=obj.childrenList[aidx];
|
|
|
+ if(erobj.isLike=='Y'){
|
|
|
+ this.$toast("取消点赞成功");
|
|
|
+ erobj.isLike='N';
|
|
|
+ }else{
|
|
|
+ this.$toast("点赞成功");
|
|
|
+ erobj.isLike='Y';
|
|
|
+ }
|
|
|
+ obj.childrenList[aidx]=JSON.parse(JSON.stringify(erobj))
|
|
|
+ this.commentlist.splice(idx,1,obj)
|
|
|
+ }else{
|
|
|
+ if(obj.isLike=='Y'){
|
|
|
+ this.$toast("取消点赞成功");
|
|
|
+ obj.isLike='N';
|
|
|
+ }else{
|
|
|
+ this.$toast("点赞成功");
|
|
|
+ obj.isLike='Y';
|
|
|
+ }
|
|
|
+ this.commentlist.splice(idx,1,obj)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getplDzFn(data){
|
|
|
+ var info=JSON.parse(JSON.stringify(data))
|
|
|
+ console.log(info,1)
|
|
|
+ this.getDzFn('2',info)
|
|
|
+ },
|
|
|
+ // 收藏
|
|
|
+ getScFn(type){
|
|
|
+ var params={
|
|
|
+ userId:this.userId,
|
|
|
+ nickName:this.nickName,
|
|
|
+ avatar:this.avatar,
|
|
|
+ targetType:'1',//目标类型(1:社区 2:党建 )
|
|
|
+ }
|
|
|
+ params.targetId=this.id;
|
|
|
+ params.targetTitle=this.datainfo.communityTitle;
|
|
|
+ getStars(params).then(res=>{
|
|
|
+ if(res.code==200){
|
|
|
+ uni.$emit('partyNewsList')
|
|
|
+ if(this.datainfo.isStar=='Y'){
|
|
|
+ this.$toast("取消收藏成功");
|
|
|
+ this.datainfo.isStar='N';
|
|
|
+ this.datainfo.userStars--;
|
|
|
+ }else{
|
|
|
+ this.$toast("收藏成功");
|
|
|
+ this.datainfo.isStar='Y';
|
|
|
+ this.datainfo.userStars++
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 评论回复
|
|
|
+ getHfFn(data){
|
|
|
+ this.isRoot='1';
|
|
|
+ this.isfocus=true;
|
|
|
+ },
|
|
|
+ getplHfFn(data){
|
|
|
+ this.plinfo=JSON.parse(JSON.stringify(data))
|
|
|
+ this.isRoot='2';
|
|
|
+ this.isfocus=true;
|
|
|
+ },
|
|
|
+ getPinLunFn(){
|
|
|
+ var params={
|
|
|
+ userId:this.userId,
|
|
|
+ nickName:this.nickName,
|
|
|
+ avatar:this.avatar,
|
|
|
+ isRoot:this.isRoot,
|
|
|
+ communityId:this.id,
|
|
|
+ communityType:this.datainfo.communityType,
|
|
|
+ communityTitle:this.datainfo.communityTitle,
|
|
|
+ commentContent:this.text,
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.isRoot==2){
|
|
|
+ var info=JSON.parse(JSON.stringify(this.plinfo))
|
|
|
+ if(info.type=='ejhf'){
|
|
|
+ params.toRoot='Y';
|
|
|
+ }
|
|
|
+ params.parentId=info.parentId;
|
|
|
+ params.toUserId=info.toUserId;
|
|
|
+ params.toNickName=info.toNickName;
|
|
|
+ params.toAvatar=info.toAvatar;
|
|
|
+ }
|
|
|
+ commentIndex(params).then(res=>{
|
|
|
+ if(res.code==200){
|
|
|
+ this.$toast('评论成功,等待审核')
|
|
|
+ this.text='';
|
|
|
+ this.isfocus=false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getShouFn(idx){
|
|
|
+ var list=JSON.parse(JSON.stringify(this.commentlist))[idx];
|
|
|
+ list.childrenList=[];
|
|
|
+ list.pageNum=1;
|
|
|
+ list.reachflag=true;
|
|
|
+ this.commentlist.splice(idx,1,list)
|
|
|
+ },
|
|
|
+ getRootComment(){
|
|
|
+ var that=this;
|
|
|
+ var params={
|
|
|
+ communityId:this.id,
|
|
|
+ pageSize:this.pageSize,
|
|
|
+ pageNum: this.pageNum,
|
|
|
+ }
|
|
|
+ // userid,头像,nickname,标题(或者评论对象的内容) 点赞收藏评论,
|
|
|
+ getRootComment(params).then(res=>{
|
|
|
+ if(res.code==200){
|
|
|
+ this.commenttotal=res.total;
|
|
|
+ if (res.rows.length < this.pageSize) {
|
|
|
+ this.reachflag = false
|
|
|
+ this.wtdt = '到底了~';
|
|
|
+ } else {
|
|
|
+ var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
|
|
|
+ if (num < res.total) {
|
|
|
+ this.reachflag = true
|
|
|
+ this.wtdt = ''
|
|
|
+ } else {
|
|
|
+ this.reachflag = false
|
|
|
+ this.wtdt = '到底了~';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var newArr=JSON.parse(JSON.stringify(res.rows))
|
|
|
+ newArr.forEach(ite=>{
|
|
|
+ ite.pageSize=1
|
|
|
+ ite.pageNum=10
|
|
|
+ ite.reachflag=true
|
|
|
+ })
|
|
|
+ if (this.pageNum == 1) {
|
|
|
+ this.commentlist = newArr;
|
|
|
+ } else {
|
|
|
+ this.commentlist = this.list.concat(newArr)
|
|
|
+ }
|
|
|
+ console.log(this.commentlist)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
//解析富文本方法
|
|
|
formatRichText(html) {
|
|
|
let newContent = html.replace(/<img[^>]*>/gi, function(match, capture) {
|
|
@@ -155,7 +343,7 @@
|
|
|
});
|
|
|
newContent = newContent.replace(/<br[^>]*\/>/gi, '');
|
|
|
newContent = newContent.replace(/\<img src="/gi,
|
|
|
- '<img style="max-width:100%;height:auto;display:block;margin:10rpx auto;" src="' +baseUrlimg);
|
|
|
+ '<img style="max-width:100%;height:auto;display:block;margin:10rpx auto;" src="' +baseUrl);
|
|
|
return newContent;
|
|
|
},
|
|
|
}
|
|
@@ -183,24 +371,7 @@
|
|
|
.pltit{font-weight: bold;font-size: 30rpx;color: #272727;
|
|
|
text{margin-left: 24rpx;font-size: 24rpx;color: #666666;}
|
|
|
}
|
|
|
-.pllist{padding-top: 20rpx;margin-bottom: 16rpx;border-bottom: 2rpx solid #DADADA;
|
|
|
- .head{width: 40rpx;height: 40rpx;margin-right: 18rpx;flex: 0 0 auto;}
|
|
|
- .plname{font-weight: bold;font-size: 30rpx;color: #161616;}
|
|
|
- .plrbtn{margin-left: 36rpx;
|
|
|
- image{width: 26rpx;height: 24rpx;margin-right: 16rpx;
|
|
|
- &.imga{width: 26rpx;height: 26rpx;}
|
|
|
- &.imgb{width: 26rpx;height: 22rpx;}
|
|
|
- }
|
|
|
- view{font-weight: bold;font-size: 24rpx;color: #314081;}
|
|
|
- }
|
|
|
- .infotxt{font-weight: 500;font-size: 26rpx;color: #161616;line-height: 40rpx;
|
|
|
- &:before {content: "";float: right;width: 0;height: calc(100% - 16px);background: red;}
|
|
|
- .infotime{font-weight: 500;font-size: 24rpx;color: #666666; float: right;clear: both;}
|
|
|
- }
|
|
|
- .pllist{
|
|
|
- padding-top: 0;border-bottom: none;margin-bottom: 0;
|
|
|
- }
|
|
|
-}
|
|
|
+
|
|
|
.pjfbtn{background: #FFFFFF;position: fixed;bottom: 0;left: 0;right: 0;padding:20rpx 48rpx;box-shadow: 0px 0px 18rpx 0px rgba(159,159,159,0.47);
|
|
|
.pjfbox{background: #E6E6E6;border-radius: 10rpx;
|
|
|
.btns{nt-weight: bold;padding: 0 34rpx;height: 60rpx;line-height: 60rpx;flex: 0 0 auto;
|
|
@@ -209,6 +380,7 @@
|
|
|
|
|
|
color: #314081;}
|
|
|
}
|
|
|
+
|
|
|
.pjfbtn /deep/ .uni-easyinput{flex: 1;font-size: 26rpx;color: #222327;}
|
|
|
.pjfbtn /deep/ .uni-easyinput__content-textarea{min-height: 40rpx;font-size: 26rpx;margin: 0;background: #E6E6E6;box-sizing: border-box;padding: 10rpx 0 10rpx 36rpx;border-radius:10rpx 0 0 10rpx;}
|
|
|
</style>
|