Browse Source

优化

master
陈裕财 3 years ago
parent
commit
9bb597cdbb
  1. 4
      src/api/xm/core/xmMenuComment.js
  2. 5
      src/views/xm/core/xmMenu/XmMenuEdit.vue
  3. 204
      src/views/xm/core/xmMenuComment/XmMenuCommentEdit.vue
  4. 372
      src/views/xm/core/xmMenuComment/XmMenuCommentMng.vue
  5. 30
      src/views/xm/core/xmMenuComment/comment-area.vue
  6. 60
      src/views/xm/core/xmMenuComment/comment-list.vue
  7. BIN
      static/images/like.png
  8. BIN
      static/images/man.png
  9. BIN
      static/images/no-information.png

4
src/api/xm/core/xmMenuComment.js

@ -27,6 +27,10 @@ export const editXmMenuComment = params => { return axios.post(`${base}/xm/core/
//新增一条档案评论表
export const addXmMenuComment = params => { return axios.post(`${base}/xm/core/xmMenuComment/add`, params); };
//点赞一条评论
export const praiseXmMenuComment = params => { return axios.post(`${base}/xm/core/xmMenuComment/praise`, params); };
//批量修改某些字段
export const editSomeFieldsXmMenuComment = params => { return axios.post(`${base}/xm/core/xmMenuComment/editSomeFields`, params); };

5
src/views/xm/core/xmMenu/XmMenuEdit.vue

@ -244,6 +244,9 @@
<el-tab-pane label="日志" name="9">
<xm-record v-if="activateTabPaneName=='9'" :biz-id="editForm.menuId" :obj-type="'menu'"></xm-record>
</el-tab-pane>
<el-tab-pane label="评论区" name="10">
<comment-area v-if="activateTabPaneName=='10'" :target-id="editForm.menuId"></comment-area>
</el-tab-pane>
</el-tabs>
</el-form>
</el-col>
@ -300,6 +303,7 @@
import XmEpicFeaturesSelect from "../xmMenu/XmEpicFeaturesSelect";
import MdpSelectUserXm from '@/views/xm/core/components/MdpSelectUserXm'
import CommentArea from '../xmMenuComment/comment-area.vue';
export default {
computed: {
...mapGetters([
@ -638,6 +642,7 @@
'xm-workload-record':()=>import("../xmWorkload/XmWorkloadRecord"),
XmEpicFeaturesSelect,
xmQuestionMng,
CommentArea,
},
mounted() {

204
src/views/xm/core/xmMenuComment/XmMenuCommentEdit.vue

@ -1,204 +0,0 @@
<template>
<section class="page-container padding">
<el-row class="page-header">
</el-row>
<el-row class="page-main" :style="{overflowX:'auto',height:maxTableHeight+'px'}" ref="table">
<!--编辑界面 XmMenuComment 档案评论表-->
<el-form :model="editForm" label-width="120px" :rules="editFormRules" ref="editFormRef">
<el-form-item label="主键" prop="id">
<el-input v-model="editForm.id" placeholder="主键" :maxlength="50" @change="editSomeFields(editForm,'id',$event)"></el-input>
</el-form-item>
<el-form-item label="评论人" prop="userid">
<el-input v-model="editForm.userid" placeholder="评论人" :maxlength="50" @change="editSomeFields(editForm,'userid',$event)"></el-input>
</el-form-item>
<el-form-item label="评论人姓名" prop="username">
<el-input v-model="editForm.username" placeholder="评论人姓名" :maxlength="50" @change="editSomeFields(editForm,'username',$event)"></el-input>
</el-form-item>
<el-form-item label="星级" prop="star">
<el-input v-model="editForm.star" placeholder="星级" :maxlength="1" @change="editSomeFields(editForm,'star',$event)"></el-input>
</el-form-item>
<el-form-item label="时间" prop="cdate">
<el-date-picker type="date" placeholder="选择日期" v-model="editForm.cdate" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker>
</el-form-item>
<el-form-item label="需求编号" prop="menuId">
<el-input v-model="editForm.menuId" placeholder="需求编号" :maxlength="50" @change="editSomeFields(editForm,'menuId',$event)"></el-input>
</el-form-item>
<el-form-item label="上级评论" prop="pid">
<el-input v-model="editForm.pid" placeholder="上级评论" :maxlength="50" @change="editSomeFields(editForm,'pid',$event)"></el-input>
</el-form-item>
<el-form-item label="点赞数量" prop="ups">
<el-input v-model="editForm.ups" placeholder="点赞数量" :maxlength="10"></el-input>
</el-form-item>
<el-form-item label="是否显示0否1是" prop="isShow">
<el-input v-model="editForm.isShow" placeholder="是否显示0否1是" :maxlength="1" @change="editSomeFields(editForm,'isShow',$event)"></el-input>
</el-form-item>
<el-form-item label="回复用户编号" prop="toUserid">
<el-input v-model="editForm.toUserid" placeholder="回复用户编号" :maxlength="50" @change="editSomeFields(editForm,'toUserid',$event)"></el-input>
</el-form-item>
<el-form-item label="回复用户名" prop="toUsername">
<el-input v-model="editForm.toUsername" placeholder="回复用户名" :maxlength="50" @change="editSomeFields(editForm,'toUsername',$event)"></el-input>
</el-form-item>
<el-form-item label="层级0,1,2,3,4" prop="lvl">
<el-input v-model="editForm.lvl" placeholder="层级0,1,2,3,4" :maxlength="1" @change="editSomeFields(editForm,'lvl',$event)"></el-input>
</el-form-item>
<el-form-item label="评论内容" prop="context">
<el-input v-model="editForm.context" placeholder="评论内容" :maxlength="65535" @change="editSomeFields(editForm,'context',$event)"></el-input>
</el-form-item>
<el-form-item label="机构编号" prop="branchId">
<el-input v-model="editForm.branchId" placeholder="机构编号" :maxlength="50" @change="editSomeFields(editForm,'branchId',$event)"></el-input>
</el-form-item>
<el-form-item label="ip地址" prop="ip">
<el-input v-model="editForm.ip" placeholder="ip地址" :maxlength="50" @change="editSomeFields(editForm,'ip',$event)"></el-input>
</el-form-item>
<el-form-item label="城市编号" prop="cityId">
<el-input v-model="editForm.cityId" placeholder="城市编号" :maxlength="50" @change="editSomeFields(editForm,'cityId',$event)"></el-input>
</el-form-item>
<el-form-item label="城市名称" prop="cityName">
<el-input v-model="editForm.cityName" placeholder="城市名称" :maxlength="50" @change="editSomeFields(editForm,'cityName',$event)"></el-input>
</el-form-item>
<el-form-item label="状态0未审核,1已审核,3审核不通过" prop="status">
<el-input v-model="editForm.status" placeholder="状态0未审核,1已审核,3审核不通过" :maxlength="1" @change="editSomeFields(editForm,'status',$event)"></el-input>
</el-form-item>
<el-form-item label="儿子节点数量" prop="childNums">
<el-input-number v-model="editForm.childNums" :min="0" :max="200"></el-input-number>
</el-form-item>
</el-form>
</el-row>
<el-row v-if="opType=='add'" class="page-bottom bottom-fixed">
<el-button @click.native="handleCancel">取消</el-button>
<el-button v-loading="load.edit" type="primary" @click.native="saveSubmit" :disabled="load.edit==true">提交</el-button>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
import config from "@/common/config"; //import
import { initDicts, addXmMenuComment,editXmMenuComment,editSomeFieldsXmMenuComment } from '@/api/xm/core/xmMenuComment';
import { mapGetters } from 'vuex'
export default {
name:'xmMenuCommentEdit',
components: {
},
computed: {
...mapGetters([ 'userInfo' ]),
},
props:['xmMenuComment','visible','opType'],
watch: {
'xmMenuComment':function( xmMenuComment ) {
if(xmMenuComment){
this.editForm = {...xmMenuComment};
}
},
'visible':function(visible) {
if(visible==true){
this.initData()
}
}
},
data() {
return {
currOpType:'add',//add/edit
load:{ list: false, edit: false, del: false, add: false },//...
dicts:{},// params={categoryId:'all',itemCodes:['sex']} {sex: [{id:'1',name:''},{id:'2',name:''}]}
editFormRules: {
id: [
//{ required: true, message: '', trigger: 'blur' }
]
},
editForm: {
id:'',userid:'',username:'',star:'',cdate:'',menuId:'',pid:'',ups:'',isShow:'',toUserid:'',toUsername:'',lvl:'',context:'',branchId:'',ip:'',cityId:'',cityName:'',status:'',childNums:''
},
maxTableHeight:300,
}//end return
},//end data
methods: {
...util,
// @cancel="editFormVisible=false"
handleCancel:function(){
this.$refs['editFormRef'].resetFields();
this.$emit('cancel');
},
//XmMenuComment @submit="afterEditSubmit"
saveSubmit: function () {
this.$refs.editFormRef.validate((valid) => {
if (valid) {
this.$confirm('确认提交吗?', '提示', {}).then(() => {
this.load.edit=true
let params = Object.assign({}, this.editForm);
var func=addXmMenuComment
if(this.currOpType=='edit'){
func=editXmMenuComment
}
func(params).then((res) => {
this.load.edit=false
var tips=res.data.tips;
if(tips.isOk){
this.editForm=res.data.data
this.initData()
this.currOpType="edit";
this.$emit('submit');// @submit="afterAddSubmit"
}
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err =>this.load.edit=false);
});
}else{
this.$notify({ showClose:true, message: "表单验证不通过,请修改表单数据再提交", type: 'error' });
}
});
},
initData: function(){
this.currOpType=this.opType
if(this.xmMenuComment){
this.editForm = Object.assign({},this.xmMenuComment);
}
if(this.opType=='edit'){
}else{
}
this.editFormBak={...this.editForm}
},
editSomeFields(row,fieldName,$event){
if(this.opType=='add'){
return;
}
let params={};
params['ids']=[row].map(i=>i.id)
params[fieldName]=$event
var func = editSomeFieldsXmMenuComment
func(params).then(res=>{
let tips = res.data.tips;
if(tips.isOk){
this.editFormBak=[...this.editForm]
}else{
Object.assign(this.editForm,this.editFormBak)
this.$notify({position:'bottom-left',showClose:true,message:tips.msg,type:tips.isOk?'success':'error'})
}
}).catch((e)=>Object.assign(this.editForm,this.editFormBak))
},
},//end method
mounted() {
this.$nextTick(() => {
initDicts(this);
this.initData()
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.table.$el)
});
}
}
</script>
<style scoped>
</style>

372
src/views/xm/core/xmMenuComment/XmMenuCommentMng.vue

@ -1,372 +0,0 @@
<template>
<section class="page-container border padding">
<el-row>
<el-input v-model="filters.key" style="width: 20%;" placeholder="模糊查询"></el-input>
<el-button v-loading="load.list" :disabled="load.list==true" @click="searchXmMenuComments" icon="el-icon-search">查询</el-button>
<span style="float:right;">
<el-button type="primary" @click="showAdd" icon="el-icon-plus" plain> </el-button>
<el-button type="danger" v-loading="load.del" @click="batchDel" :disabled="this.sels.length===0 || load.del==true" icon="el-icon-delete" plain></el-button>
</span>
</el-row>
<el-row class="padding-top">
<!--列表 XmMenuComment 档案评论表-->
<el-table ref="xmMenuCommentTable" :data="xmMenuComments" :height="maxTableHeight" @sort-change="sortChange" highlight-current-row v-loading="load.list" border @selection-change="selsChange" @row-click="rowClick" style="width: 100%;">
<el-table-column type="selection" width="55" show-overflow-tooltip fixed="left"></el-table-column>
<el-table-column sortable type="index" width="55" show-overflow-tooltip fixed="left"></el-table-column>
<!--
<el-table-column sortable prop="username" width="55" show-overflow-tooltip fixed="left">
<span class="cell-text"> {{scope.row.username}}} </span>
<span class="cell-bar"><el-input style="display:inline;" v-model="scope.row.username" placeholder="" @change="editSomeFields(scope.row,'username',$event)" :maxlength="22"></el-input></span>
</el-table-column>
-->
<el-table-column prop="id" label="主键" min-width="120" show-overflow-tooltip fixed="left"></el-table-column>
<el-table-column prop="userid" label="评论人" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.userid}} </span>
</template>
</el-table-column>
<el-table-column prop="username" label="评论人姓名" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.username}} </span>
</template>
</el-table-column>
<el-table-column prop="star" label="星级" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.star}} </span>
</template>
</el-table-column>
<el-table-column prop="cdate" label="时间" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.cdate}} </span>
</template>
</el-table-column>
<el-table-column prop="menuId" label="需求编号" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.menuId}} </span>
</template>
</el-table-column>
<el-table-column prop="pid" label="上级评论" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.pid}} </span>
</template>
</el-table-column>
<el-table-column prop="ups" label="点赞数量" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.ups}} </span>
</template>
</el-table-column>
<el-table-column prop="isShow" label="是否显示0否1是" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.isShow}} </span>
</template>
</el-table-column>
<el-table-column prop="toUserid" label="回复用户编号" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.toUserid}} </span>
</template>
</el-table-column>
<el-table-column prop="toUsername" label="回复用户名" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.toUsername}} </span>
</template>
</el-table-column>
<el-table-column prop="lvl" label="层级0,1,2,3,4" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.lvl}} </span>
</template>
</el-table-column>
<el-table-column prop="context" label="评论内容" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.context}} </span>
</template>
</el-table-column>
<el-table-column prop="branchId" label="机构编号" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.branchId}} </span>
</template>
</el-table-column>
<el-table-column prop="ip" label="ip地址" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.ip}} </span>
</template>
</el-table-column>
<el-table-column prop="cityId" label="城市编号" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.cityId}} </span>
</template>
</el-table-column>
<el-table-column prop="cityName" label="城市名称" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.cityName}} </span>
</template>
</el-table-column>
<el-table-column prop="status" label="状态0未审核,1已审核,3审核不通过" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.status}} </span>
</template>
</el-table-column>
<el-table-column prop="childNums" label="儿子节点数量" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.childNums}} </span>
</template>
</el-table-column>
<el-table-column label="操作" width="180" fixed="right">
<template scope="scope">
<el-button type="primary" @click="showEdit( scope.row,scope.$index)" icon="el-icon-edit" plain></el-button>
<el-button type="danger" @click="handleDel(scope.row,scope.$index)" icon="el-icon-delete" plain></el-button>
</template>
</el-table-column>
</el-table>
<el-pagination layout="total, sizes, prev, pager, next" @current-change="handleCurrentChange" @size-change="handleSizeChange" :page-sizes="[10,20, 50, 100, 500]" :current-page="pageInfo.pageNum" :page-size="pageInfo.pageSize" :total="pageInfo.total" style="float:right;"></el-pagination>
</el-row>
<el-row>
<!--编辑 XmMenuComment 档案评论表界面-->
<el-drawer title="编辑档案评论表" :visible.sync="editFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-menu-comment-edit op-type="edit" :xm-menu-comment="editForm" :visible="editFormVisible" @cancel="editFormVisible=false" @submit="afterEditSubmit"></xm-menu-comment-edit>
</el-drawer>
<!--新增 XmMenuComment 档案评论表界面-->
<el-drawer title="新增档案评论表" :visible.sync="addFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-menu-comment-edit op-type="add" :visible="addFormVisible" @cancel="addFormVisible=false" @submit="afterAddSubmit"></xm-menu-comment-edit>
</el-drawer>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
import config from '@/common/config';//
import { initDicts,listXmMenuComment, delXmMenuComment, batchDelXmMenuComment,editSomeFieldsXmMenuComment } from '@/api/xm/core/xmMenuComment';
import XmMenuCommentEdit from './XmMenuCommentEdit';//
import { mapGetters } from 'vuex'
export default {
name:'xmMenuCommentMng',
components: {
XmMenuCommentEdit,
},
props:['visible'],
computed: {
...mapGetters(['userInfo']),
},
watch:{
visible(val){
if(val==true){
this.initData();
this.searchXmMenuComments()
}
}
},
data() {
return {
filters: {
key: ''
},
xmMenuComments: [],//
pageInfo:{//
total:0,//0>0
pageSize:10,//
count:false,//
pageNum:1,//1
orderFields:[],// ['sex','student_id']
orderDirs:[]// asc,desc ['asc','desc']
},
load:{ list: false, edit: false, del: false, add: false },//...
sels: [],//
dicts:{
//sex: [{id:'1',name:''},{id:'2',name:''}]
},// params={categoryId:'all',itemCodes:['sex']} {sex: [{id:'1',name:''},{id:'2',name:''}]}
addFormVisible: false,//xmMenuComment
addForm: {
id:'',userid:'',username:'',star:'',cdate:'',menuId:'',pid:'',ups:'',isShow:'',toUserid:'',toUsername:'',lvl:'',context:'',branchId:'',ip:'',cityId:'',cityName:'',status:'',childNums:''
},
editFormVisible: false,//
editForm: {
id:'',userid:'',username:'',star:'',cdate:'',menuId:'',pid:'',ups:'',isShow:'',toUserid:'',toUsername:'',lvl:'',context:'',branchId:'',ip:'',cityId:'',cityName:'',status:'',childNums:''
},
maxTableHeight:300,
}
},//end data
methods: {
...util,
handleSizeChange(pageSize) {
this.pageInfo.pageSize=pageSize;
this.getXmMenuComments();
},
handleCurrentChange(pageNum) {
this.pageInfo.pageNum = pageNum;
this.getXmMenuComments();
},
// obj.order=ascending/descending, asc/desc ; obj.prop=,
sortChange( obj ){
if(obj.order==null){
this.pageInfo.orderFields=[];
this.pageInfo.orderDirs=[];
}else{
var dir='asc';
if(obj.order=='ascending'){
dir='asc'
}else{
dir='desc';
}
this.pageInfo.orderFields=[util.toLine(obj.prop)];
this.pageInfo.orderDirs=[dir];
}
this.getXmMenuComments();
},
searchXmMenuComments(){
this.pageInfo.count=true;
this.getXmMenuComments();
},
// XmMenuComment
getXmMenuComments() {
let params = {
pageSize: this.pageInfo.pageSize,
pageNum: this.pageInfo.pageNum,
total: this.pageInfo.total,
count:this.pageInfo.count
};
if(this.pageInfo.orderFields!=null && this.pageInfo.orderFields.length>0){
let orderBys=[];
for(var i=0;i<this.pageInfo.orderFields.length;i++){
orderBys.push(this.pageInfo.orderFields[i]+" "+this.pageInfo.orderDirs[i])
}
params.orderBy= orderBys.join(",")
}
if(this.filters.key){
params.key=this.filters.key
}
this.load.list = true;
listXmMenuComment(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.total = res.data.total;
this.pageInfo.count=false;
this.xmMenuComments = res.data.data;
}else{
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: 'error' });
}
this.load.list = false;
}).catch( err => this.load.list = false );
},
// XmMenuComment
showEdit: function ( row,index ) {
this.editFormVisible = true;
this.editForm = Object.assign({}, row);
},
// XmMenuComment
showAdd: function () {
this.addFormVisible = true;
//this.addForm=Object.assign({}, this.editForm);
},
afterAddSubmit(){
this.addFormVisible=false;
this.pageInfo.count=true;
this.getXmMenuComments();
},
afterEditSubmit(){
this.editFormVisible=false;
},
//xmMenuComment
selsChange: function (sels) {
this.sels = sels;
},
//xmMenuComment
handleDel: function (row,index) {
this.$confirm('确认删除该记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
let params = { id:row.id };
delXmMenuComment(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if(tips.isOk){
this.searchXmMenuComments();
}
this.$notify({ position:'bottom-left', showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.del=false );
});
},
//xmMenuComment
batchDel: function () {
if(this.sels.length<=0){
return;
}
var params=this.sels.map(i=>{
return { id:i.id}
})
this.$confirm('确认删除选中记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
batchDelXmMenuComment(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if( tips.isOk ){
this.searchXmMenuComments();
}
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: tips.isOk?'success':'error'});
}).catch( err => this.load.del=false );
});
},
editSomeFields(row,fieldName,$event){
let params={};
if(this.sels.length>0){
if(!this.sels.some(k=> k.id==row.id)){
this.$notify({position:'bottom-left',showClose:true,message:'请编辑选中的行',type:'warning'})
Object.assign(this.editForm,this.editFormBak)
return;
}
params['ids']=this.sels.map(i=>i.id)
}else{
params['ids']=[row].map(i=>i.id)
}
params[fieldName]=$event
var func = editSomeFieldsXmMenuComment
func(params).then(res=>{
let tips = res.data.tips;
if(tips.isOk){
if(this.sels.length>0){
this.searchXmMenuComments();
}
this.editFormBak=[...this.editForm]
}else{
Object.assign(this.editForm,this.editFormBak)
this.$notify({position:'bottom-left',showClose:true,message:tips.msg,type:tips.isOk?'success':'error'})
}
}).catch((e)=>Object.assign(this.editForm,this.editFormBak))
},
rowClick: function(row, event, column){
this.editForm=row
this.editFormBak={...row};
this.$emit('row-click',row, event, column);// @row-click="rowClick"
},
initData: function(){
},
},//end methods
mounted() {
this.$nextTick(() => {
initDicts(this);
this.initData()
this.searchXmMenuComments();
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.xmMenuCommentTable.$el)
});
}
}
</script>
<style scoped>
</style>

30
src/views/xm/core/xmMenuComment/comment-area.vue

@ -13,7 +13,7 @@
</div>
</div>
<div v-if="commentsList.length > 0" class="comment-list">
<comment-list v-for="(item, index) in commentsList" :self="item" :parent="item" :key="item.id" @getList="getCList">
<comment-list v-for="(item, index) in commentsList" :self="item" :parent="item" :key="item.id" @getList="getXmMenuComments">
</comment-list>
<div class="page-set">
<el-pagination layout="total, sizes, prev, pager, next" @current-change="handleCurrentChange"
@ -30,7 +30,7 @@
<script>
import { initDicts,listXmMenuComment, delXmMenuComment, batchDelXmMenuComment,editSomeFieldsXmMenuComment } from '@/api/xm/core/xmMenuComment';
import { initDicts,listXmMenuComment, addXmMenuComment,delXmMenuComment, batchDelXmMenuComment,editSomeFieldsXmMenuComment } from '@/api/xm/core/xmMenuComment';
import commentList from './comment-list.vue';
import { mapGetters } from 'vuex';
@ -55,7 +55,7 @@ export default {
pageSize: 10,//
count: false,//
pageNum: 1,//1
orderFields: ['CREATE_DATE'],// ['sex','student_id']
orderFields: ['CDATE'],// ['sex','student_id']
orderDirs: ['desc']// asc,desc ['asc','desc']
},
};
@ -64,33 +64,33 @@ export default {
...imgUtil,
handleSizeChange(pageSize) {
this.pageInfo.pageSize = pageSize;
this.getCList();
this.getXmMenuComments();
},
handleCurrentChange(pageNum) {
this.pageInfo.pageNum = pageNum;
this.getCList();
this.getXmMenuComments();
},
//
commentListFormat() {
this.commentsList.forEach((item) => {
this.$set(item, 'childList', []);
// childList
let arr = this.commentsList.filter((i) => i.pcommentId === item.id);
let arr = this.commentsList.filter((i) => i.pid === item.id);
if (arr.length > 0) {
item.childList = arr;
}
});
//
this.commentsList = this.commentsList.filter((item) => item.pcommentId === null);
this.commentsList = this.commentsList.filter((item) => item.pid === null);
},
publishComment() {
if (this.userInfo.userid) {
let params = {
archiveId: this.targetId,
menuId: this.targetId,
context: this.commentTxt,
};
if (params.context) {
addarchiveComment(params).then((res) => {
addXmMenuComment(params).then((res) => {
let tips = res.data.tips;
if (tips.isOk) {
this.$message({
@ -98,7 +98,7 @@ export default {
message: '评论成功',
});
this.commentTxt = '';
this.getCList();
this.getXmMenuComments();
} else {
this.$message({
message: tips.msg,
@ -119,7 +119,7 @@ export default {
});
}
},
getCList() {
getXmMenuComments() {
if (!this.targetId) {
return;
}
@ -129,8 +129,8 @@ export default {
pageNum: this.pageInfo.pageNum,
total: this.pageInfo.total,
count: this.pageInfo.count,
archiveId: this.targetId,
pcommentIdIsNull: "1",
menuId: this.targetId,
pidIsNull: "1",
};
if (this.pageInfo.orderFields != null && this.pageInfo.orderFields.length > 0) {
let orderBys = [];
@ -140,7 +140,7 @@ export default {
params.orderBy = orderBys.join(",")
}
getCommentList(params).then((res) => {
listXmMenuComment(params).then((res) => {
let tips = res.data.tips;
if (tips.isOk) {
this.pageInfo.total = res.data.total;
@ -163,7 +163,7 @@ export default {
},
},
mounted() {
this.getCList();
this.getXmMenuComments();
},
};
</script>

60
src/views/xm/core/xmMenuComment/comment-list.vue

@ -2,17 +2,17 @@
<div class="comment-list-box">
<div class="comment-list">
<!-- 回复 -->
<div v-if="self.pcommentId" class="list-item clear-bd">
<div v-if="self.pid" class="list-item clear-bd">
<div class="top-msg">
<div class="info" @click="toPersonCenter(self)" style="cursor: pointer;">
<img :src="getHeadimgurl(self.userid)" class="user-avatar" @error="onImgError(self.userid,$event)" />
<span class="user-name">{{ self.username }} </span>
<span class="time">{{ self.createDate }}</span>
<span class="time">{{ self.cdate }}</span>
</div>
<div class="btns">
<span v-if="!self.isPraise" class="like"><img src="../../../../../static/images/like.png" class="like-logo" @click="praiseComment(self)" />{{ self.praiseSum }}</span>
<span v-else class="like"><img src="../../../../../static/images/like-selected.png" class="like-logo" />{{ self.praiseSum }}</span>
<span class="reply" @click="isShow = true"><i class="el-icon-s-comment"></i>&nbsp;回复</span>
<span v-if="!self.isPraise" class="like"><img src="../../../../../static/images/like.png" class="like-logo" @click="praiseComment(self)" />{{ self.ups }}</span>
<span v-else class="like"><img src="../../../../../static/images/like-selected.png" class="like-logo" />{{ self.ups }}</span>
<span class="reply" @click="isShow = true"><i class="el-icon-s-comment"></i>回复</span>
</div>
</div>
<div class="bottom-con">
@ -36,9 +36,9 @@
<span class="time">{{ self.createDate }}</span>
</div>
<div class="btns">
<span v-if="!self.isPraise" class="like"><img src="../../../../../static/images/like-not.png" class="like-logo" @click="praiseComment(self)" />{{ self.praiseSum }}</span>
<span v-else class="like"><img src="../../../../../static/images/like-selected.png" class="like-logo" />{{ self.praiseSum }}</span>
<span class="reply" @click="isShow = true"><i class="el-icon-s-comment"></i>&nbsp;回复</span>
<span v-if="!self.isPraise" class="like"><img src="../../../../../static/images/like-not.png" class="like-logo" @click="praiseComment(self)" />{{ self.ups }}</span>
<span v-else class="like"><img src="../../../../../static/images/like-selected.png" class="like-logo" />{{ self.ups }}</span>
<span class="reply" @click="isShow = true"><i class="el-icon-s-comment"></i> 回复</span>
</div>
</div>
<div class="bottom-con">
@ -54,14 +54,15 @@
</div>
</div>
</div>
<el-dialog title="评论回复" :visible.sync="isShow" width="50%">
<div class="w-box">
<el-dialog title="评论回复" :visible.sync="isShow" width="50%" append-to-body>
<div class="w-box" v-if="isShow">
<div class="edit">
<el-input type="textarea" :rows="8" placeholder="请输入你的回复内容 ......" v-model="replyTxt"> </el-input>
</div>
<div class="bottom-btns">
<img src="../../../../../static/images/expression.png" class="expression" />
<el-button type="primary" @click="publishComment">发表评论</el-button>
<img src="../../../../../static/images/expression.png" class="expression" />
<el-button type="primary" @click="publishComment">发表评论</el-button>
</div>
</div>
</el-dialog>
@ -70,7 +71,7 @@
<script>
import { initDicts,listXmMenuComment, delXmMenuComment, batchDelXmMenuComment,editSomeFieldsXmMenuComment } from '@/api/xm/core/xmMenuComment';
import { initDicts,listXmMenuComment,addXmMenuComment,praiseXmMenuComment, delXmMenuComment, batchDelXmMenuComment,editSomeFieldsXmMenuComment } from '@/api/xm/core/xmMenuComment';
import commentList from './comment-list.vue';
import imgUtil from '@/api/imgUtil.js';
@ -101,8 +102,8 @@ export default {
});
},
praiseComment() {
this.self.praiseSum += 1;
praisearchiveComment(this.self).then((res) => {
this.self.ups += 1;
praiseXmMenuComment(this.self).then((res) => {
let tips = res.data.tips;
if (tips.isOk) {
this.self.isPraise = true;
@ -130,11 +131,11 @@ export default {
return;
}
let params = {
pcommentId:this.self.id
pid:this.self.id
};
params.orderBy=" CREATE_DATE DESC "
params.orderBy=" CDATE DESC "
getCommentList(params).then((res) => {
listXmMenuComment(params).then((res) => {
let tips = res.data.tips;
if (tips.isOk) {
let list = res.data.data;
@ -151,14 +152,14 @@ export default {
},
publishComment() {
let params = {
archiveId: this.self.archiveId,
pcommentId: this.self.id,
menuId: this.self.menuId,
pid: this.self.id,
toUserid: this.self.userid,
toUsername: this.self.username,
context: this.replyTxt,
};
if (params.context) {
addarchiveComment(params).then((res) => {
addXmMenuComment(params).then((res) => {
let tips = res.data.tips;
if (tips.isOk) {
this.$message({
@ -258,6 +259,7 @@ export default {
}
}
.reply {
width: 100px;
display: flex;
align-items: center;
cursor: pointer;
@ -301,18 +303,25 @@ export default {
border-bottom: none;
}
}
.w-box {
}
</style>
<style lang="scss">
.w-box {
.edit {
display: flex;
}
.bottom-btns {
margin-top: 14px;
margin-top: 24px;
display: flex;
justify-content: flex-end;
align-items: center;
.expression {
width: 22px;
height: 22px;
width: 21px !important;
height: 21px !important;
margin-right: 16px;
border-radius: 50%;
cursor: pointer;
@ -322,5 +331,4 @@ export default {
}
}
}
}
</style>

BIN
static/images/like.png

After

Width: 200  |  Height: 200  |  Size: 3.1 KiB

BIN
static/images/man.png

After

Width: 200  |  Height: 200  |  Size: 8.9 KiB

BIN
static/images/no-information.png

After

Width: 200  |  Height: 200  |  Size: 9.1 KiB

Loading…
Cancel
Save