完善了评论功能
This commit is contained in:
parent
95ea686ac1
commit
1216e561b7
@ -27,7 +27,6 @@ import com.ruoyi.winery.config.wx.WxMiniProperties;
|
||||
import com.ruoyi.winery.domain.winery.WineryMauser;
|
||||
import com.ruoyi.winery.service.IWineryMauserService;
|
||||
|
||||
import com.sun.tools.javac.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -49,9 +49,9 @@ public class NewsContentController extends BaseController {
|
||||
public TableDataInfo list(UsernamePasswordAuthenticationToken token, NewsContent newsContent) {
|
||||
startPage();
|
||||
LambdaQueryWrapper<NewsContent> lqw = Wrappers.lambdaQuery(newsContent);
|
||||
|
||||
lqw.eq(NewsContent::getDeptId, getDeptId(token));
|
||||
|
||||
|
||||
if (StringUtils.isNotBlank(newsContent.getNewsTitle())) {
|
||||
lqw.eq(NewsContent::getNewsTitle, newsContent.getNewsTitle());
|
||||
}
|
||||
|
@ -1,15 +1,20 @@
|
||||
package com.ruoyi.winery.controller.appdiscuss;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import org.apache.poi.util.StringUtil;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
@ -29,109 +34,112 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* app评论Controller
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-08
|
||||
*/
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/app/discuss" )
|
||||
@RequestMapping("/app/discuss")
|
||||
public class AppDiscussController extends BaseController {
|
||||
|
||||
private final IAppDiscussService iAppDiscussService;
|
||||
|
||||
/**
|
||||
* 查询app评论列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('app:discuss:list')")
|
||||
@PreAuthorize("@ss.hasPermi('app:discuss:list')")//TODO之后去理解
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AppDiscuss appDiscuss)
|
||||
{
|
||||
|
||||
public TableDataInfo list(UsernamePasswordAuthenticationToken token, AppDiscuss appDiscuss) {
|
||||
startPage();
|
||||
|
||||
LambdaQueryWrapper<AppDiscuss> lqw = Wrappers.lambdaQuery(appDiscuss);
|
||||
if (appDiscuss.getDeptId() != null){
|
||||
lqw.eq(AppDiscuss::getDeptId ,appDiscuss.getDeptId());
|
||||
|
||||
lqw.eq(AppDiscuss::getDeptId, SecurityUtils.getDept());
|
||||
|
||||
|
||||
if (StringUtils.isNotBlank(appDiscuss.getAppDiscussReplyId())) {
|
||||
lqw.eq(AppDiscuss::getAppDiscussReplyId, appDiscuss.getAppDiscussReplyId());
|
||||
}
|
||||
if (appDiscuss.getState() != null){
|
||||
lqw.eq(AppDiscuss::getState ,appDiscuss.getState());
|
||||
if (StringUtils.isNotBlank(appDiscuss.getAppDiscussText())) {
|
||||
lqw.eq(AppDiscuss::getAppDiscussText, appDiscuss.getAppDiscussText());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appDiscuss.getCreateUser())){
|
||||
lqw.eq(AppDiscuss::getCreateUser ,appDiscuss.getCreateUser());
|
||||
if (StringUtils.isNotBlank(appDiscuss.getAppAssociationId())) {
|
||||
lqw.eq(AppDiscuss::getAppAssociationId, appDiscuss.getAppAssociationId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appDiscuss.getUpdateUser())){
|
||||
lqw.eq(AppDiscuss::getUpdateUser ,appDiscuss.getUpdateUser());
|
||||
if (StringUtils.isNotBlank(appDiscuss.getAppDiscussImage())) {
|
||||
lqw.eq(AppDiscuss::getAppDiscussImage, appDiscuss.getAppDiscussImage());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appDiscuss.getAppDiscussReplyId())){
|
||||
lqw.eq(AppDiscuss::getAppDiscussReplyId ,appDiscuss.getAppDiscussReplyId());
|
||||
if (StringUtils.isNotBlank(appDiscuss.getAppDiscussExtraUsername())) {
|
||||
lqw.like(AppDiscuss::getAppDiscussExtraUsername, appDiscuss.getAppDiscussExtraUsername());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appDiscuss.getAppDiscussText())){
|
||||
lqw.eq(AppDiscuss::getAppDiscussText ,appDiscuss.getAppDiscussText());
|
||||
if (StringUtils.isNotBlank(appDiscuss.getAppDiscussExtraMobile())) {
|
||||
lqw.eq(AppDiscuss::getAppDiscussExtraMobile, appDiscuss.getAppDiscussExtraMobile());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appDiscuss.getAppAssociationId())){
|
||||
lqw.eq(AppDiscuss::getAppAssociationId ,appDiscuss.getAppAssociationId());
|
||||
if (appDiscuss.getAppDiscussRecommend() != null) {
|
||||
lqw.eq(AppDiscuss::getAppDiscussRecommend, appDiscuss.getAppDiscussRecommend());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appDiscuss.getAppDiscussImage())){
|
||||
lqw.eq(AppDiscuss::getAppDiscussImage ,appDiscuss.getAppDiscussImage());
|
||||
if (appDiscuss.getAppDiscussType() != null) {
|
||||
lqw.eq(AppDiscuss::getAppDiscussType, appDiscuss.getAppDiscussType());
|
||||
}
|
||||
// if (StringUtils.isNotBlank(appDiscuss.getAppDiscussVideo())){
|
||||
// lqw.eq(AppDiscuss::getAppDiscussVideo ,appDiscuss.getAppDiscussVideo());
|
||||
// }
|
||||
if (StringUtils.isNotBlank(appDiscuss.getAppDiscussExtraUsername())){
|
||||
lqw.like(AppDiscuss::getAppDiscussExtraUsername ,appDiscuss.getAppDiscussExtraUsername());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appDiscuss.getAppDiscussExtraMobile())){
|
||||
lqw.eq(AppDiscuss::getAppDiscussExtraMobile ,appDiscuss.getAppDiscussExtraMobile());
|
||||
}
|
||||
if (appDiscuss.getAppDiscussRecommend() != null){
|
||||
lqw.eq(AppDiscuss::getAppDiscussRecommend ,appDiscuss.getAppDiscussRecommend());
|
||||
}
|
||||
if (appDiscuss.getAppDiscussType() != null){
|
||||
lqw.eq(AppDiscuss::getAppDiscussType ,appDiscuss.getAppDiscussType());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appDiscuss.getAppDiscussReplyUser())){
|
||||
lqw.eq(AppDiscuss::getAppDiscussReplyUser ,appDiscuss.getAppDiscussReplyUser());
|
||||
if (StringUtils.isNotBlank(appDiscuss.getAppDiscussReplyUser())) {
|
||||
lqw.eq(AppDiscuss::getAppDiscussReplyUser, appDiscuss.getAppDiscussReplyUser());
|
||||
}
|
||||
|
||||
List<AppDiscuss> list = iAppDiscussService.list(lqw);
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
|
||||
String prentId = list.get(i).getId();
|
||||
|
||||
List children = iAppDiscussService.getAllReply(prentId);
|
||||
|
||||
list.get(i).setChildren(children);
|
||||
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出app评论列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('app:discuss:export')" )
|
||||
@Log(title = "app评论" , businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export" )
|
||||
@PreAuthorize("@ss.hasPermi('app:discuss:export')")
|
||||
@Log(title = "app评论", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(AppDiscuss appDiscuss) {
|
||||
LambdaQueryWrapper<AppDiscuss> lqw = new LambdaQueryWrapper<AppDiscuss>(appDiscuss);
|
||||
List<AppDiscuss> list = iAppDiscussService.list(lqw);
|
||||
ExcelUtil<AppDiscuss> util = new ExcelUtil<AppDiscuss>(AppDiscuss. class);
|
||||
return util.exportExcel(list, "discuss" );
|
||||
ExcelUtil<AppDiscuss> util = new ExcelUtil<AppDiscuss>(AppDiscuss.class);
|
||||
return util.exportExcel(list, "discuss");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取app评论详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('app:discuss:query')" )
|
||||
@GetMapping(value = "/{id}" )
|
||||
public AjaxResult getInfo(@PathVariable("id" ) String id) {
|
||||
return AjaxResult.success(iAppDiscussService.getById(id));
|
||||
@PreAuthorize("@ss.hasPermi('app:discuss:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id) {
|
||||
AppDiscuss appDiscuss = iAppDiscussService.getById(id);
|
||||
List<AppDiscuss> children = iAppDiscussService.getAllReply(appDiscuss.getId());
|
||||
appDiscuss.setChildren(children);
|
||||
return AjaxResult.success(appDiscuss);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增app评论
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('app:discuss:add')" )
|
||||
@Log(title = "app评论" , businessType = BusinessType.INSERT)
|
||||
@PreAuthorize("@ss.hasPermi('app:discuss:add')")
|
||||
@Log(title = "app评论", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AppDiscuss appDiscuss) {
|
||||
public AjaxResult add(UsernamePasswordAuthenticationToken token, @RequestBody AppDiscuss appDiscuss) {
|
||||
appDiscuss.setDeptId(getDeptId(token));
|
||||
return toAjax(iAppDiscussService.save(appDiscuss) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改app评论
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('app:discuss:edit')" )
|
||||
@Log(title = "app评论" , businessType = BusinessType.UPDATE)
|
||||
@PreAuthorize("@ss.hasPermi('app:discuss:edit')")
|
||||
@Log(title = "app评论", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AppDiscuss appDiscuss) {
|
||||
return toAjax(iAppDiscussService.updateById(appDiscuss) ? 1 : 0);
|
||||
@ -140,10 +148,33 @@ public class AppDiscussController extends BaseController {
|
||||
/**
|
||||
* 删除app评论
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('app:discuss:remove')" )
|
||||
@Log(title = "app评论" , businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}" )
|
||||
@PreAuthorize("@ss.hasPermi('app:discuss:remove')")
|
||||
@Log(title = "app评论", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids) {
|
||||
return toAjax(iAppDiscussService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 实现一键添加等功能(修改它的state,让它从 待审核->审核通过)
|
||||
*/
|
||||
|
||||
@PutMapping("/edit_state/{ids}")
|
||||
public AjaxResult editState(@PathVariable String[] ids, @RequestBody Integer state) {
|
||||
|
||||
List<String> idList = CollectionUtil.toList(ids);
|
||||
|
||||
List<AppDiscuss> list = iAppDiscussService.listByIds(idList);
|
||||
|
||||
for (AppDiscuss d : list
|
||||
) {
|
||||
d.setState(state);
|
||||
iAppDiscussService.updateById(d);
|
||||
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,9 @@
|
||||
package com.ruoyi.winery.domain.appdiscuss;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
@ -11,7 +14,10 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* app评论对象 app_discuss
|
||||
@ -54,14 +60,6 @@ private static final long serialVersionUID=1L;
|
||||
@Excel(name = "数据状态,ON为数据启用,OFF为数据停用但仍在前端显示,DEL对数据用户来说已经删除")
|
||||
private Integer state;
|
||||
|
||||
/** 创建数据的用户id */
|
||||
@Excel(name = "创建数据的用户id")
|
||||
private String createUser;
|
||||
|
||||
/** 修改数据的用户id */
|
||||
@Excel(name = "修改数据的用户id")
|
||||
private String updateUser;
|
||||
|
||||
/** 回复评论的id */
|
||||
@Excel(name = "回复评论的id")
|
||||
private String appDiscussReplyId;
|
||||
@ -101,4 +99,14 @@ private static final long serialVersionUID=1L;
|
||||
/** 评论回复人 */
|
||||
@Excel(name = "评论回复人")
|
||||
private String appDiscussReplyUser;
|
||||
|
||||
|
||||
/** 一级评论 */
|
||||
@Excel(name = "评论回复人")
|
||||
@TableField(exist = false)
|
||||
private List<AppDiscuss> children;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,11 @@
|
||||
package com.ruoyi.winery.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.winery.domain.appdiscuss.AppDiscuss;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app评论Mapper接口
|
||||
*
|
||||
@ -11,4 +14,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
*/
|
||||
public interface AppDiscussMapper extends BaseMapper<AppDiscuss> {
|
||||
|
||||
|
||||
Integer replyNum(String num);
|
||||
|
||||
Integer select(LambdaQueryWrapper<AppDiscuss> wrapper);
|
||||
|
||||
void update(AppDiscuss appDiscuss);
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package com.ruoyi.winery.service;
|
||||
import com.ruoyi.winery.domain.appdiscuss.AppDiscuss;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app评论Service接口
|
||||
*
|
||||
@ -11,4 +13,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface IAppDiscussService extends IService<AppDiscuss> {
|
||||
|
||||
|
||||
//获取到所有一级和二级的评论
|
||||
List<AppDiscuss> getAllReply(String prentId);
|
||||
|
||||
}
|
||||
|
@ -1,11 +1,21 @@
|
||||
package com.ruoyi.winery.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.winery.service.IAppDiscussService;
|
||||
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.winery.mapper.AppDiscussMapper;
|
||||
import com.ruoyi.winery.domain.appdiscuss.AppDiscuss;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* app评论Service业务层处理
|
||||
*
|
||||
@ -15,4 +25,52 @@ import com.ruoyi.winery.domain.appdiscuss.AppDiscuss;
|
||||
@Service
|
||||
public class AppDiscussServiceImpl extends ServiceImpl<AppDiscussMapper, AppDiscuss> implements IAppDiscussService {
|
||||
|
||||
}
|
||||
@Override
|
||||
public List<AppDiscuss> getAllReply(String prentId) {
|
||||
//查询所有的一级回复
|
||||
LambdaQueryWrapper<AppDiscuss> wrapperOne = Wrappers.lambdaQuery();
|
||||
wrapperOne.eq(AppDiscuss::getAppDiscussReplyId, prentId);
|
||||
//根据wrapperOne的条件查询全部记录
|
||||
List<AppDiscuss> oneReplyList = baseMapper.selectList(wrapperOne);
|
||||
return oneReplyList;
|
||||
// //查询所有的二级回复
|
||||
// LambdaQueryWrapper<AppDiscuss> wrapperTwo = Wrappers.lambdaQuery();
|
||||
// wrapperTwo.ne(AppDiscuss::getAppDiscussReplyId, 0);
|
||||
// List<AppDiscuss> TwoReplyList = baseMapper.selectList(wrapperTwo);
|
||||
//
|
||||
// //设置一个总集合,把刚刚查到的分层数据全部放到finalReplyList
|
||||
// List<AppDiscuss> finalReplyList = new ArrayList<>();
|
||||
//
|
||||
// //把一级回复装到集合里面
|
||||
// for (int i = 0; i < oneReplyList.size(); i++) {
|
||||
// AppDiscuss appDiscuss = oneReplyList.get(i);
|
||||
//
|
||||
// AppDiscuss reply = new AppDiscuss();
|
||||
// //把查询到的数据拷贝到oneDiscuss
|
||||
// BeanUtils.copyProperties(appDiscuss, reply);
|
||||
// //最后将数据添加到finalReplyList,最后返回它就好了
|
||||
// finalReplyList.add(reply);
|
||||
//
|
||||
// List<AppDiscuss> finalTwoReplyList = new ArrayList<>();
|
||||
// //把二级回复装到集合里面
|
||||
// for (int m = 0; m < TwoReplyList.size(); m++) {
|
||||
// AppDiscuss appDiscuss1 = TwoReplyList.get(m);
|
||||
// //如果二级目录的getAppDiscussExtraUsername和一级目录的getAppDiscussReplyUser内容相同,则为回复它的评论
|
||||
// if (appDiscuss1.getAppDiscussExtraUsername().equals(appDiscuss.getAppDiscussReplyUser())){
|
||||
//
|
||||
// AppDiscuss oneReply = new AppDiscuss();
|
||||
//
|
||||
// BeanUtils.copyProperties(appDiscuss1, oneReply);
|
||||
//
|
||||
// finalTwoReplyList.add(oneReply);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //把数据最后都放到finalTwoReplyList
|
||||
// reply.setChildren(finalTwoReplyList);
|
||||
// }
|
||||
// return finalReplyList;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -3,7 +3,9 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.winery.mapper.AppDiscussMapper">
|
||||
|
||||
|
||||
|
||||
|
||||
<resultMap type="AppDiscuss" id="AppDiscussResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
|
@ -18,7 +18,7 @@ ruoyi:
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 18989
|
||||
port: 1998
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.ruoyi.common.core.page;
|
||||
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@ -8,6 +10,7 @@ import java.util.List;
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
|
||||
public class TableDataInfo implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -29,6 +29,21 @@ public class SecurityUtils
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户部門(租戶)
|
||||
**/
|
||||
public static Long getDept()
|
||||
{
|
||||
try
|
||||
{
|
||||
return getLoginUser().getUser().getDeptId();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new CustomException("获取用户账户异常", HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户
|
||||
**/
|
||||
|
@ -6,3 +6,7 @@ VUE_APP_BASE_API = '/dev-api'
|
||||
|
||||
# 路由懒加载
|
||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||
|
||||
|
||||
npm_config_port = 1024
|
||||
port = 1024
|
||||
|
@ -51,3 +51,20 @@ export function exportDiscuss(query) {
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 批量通过
|
||||
export function passDiscuss(id,state) {
|
||||
return request({
|
||||
url: `/app/discuss/edit_state/${id}`,
|
||||
method: 'put',
|
||||
data:state
|
||||
})
|
||||
}
|
||||
// 评论回复功能
|
||||
export function replyDiscuss() {
|
||||
return request({
|
||||
url: '/app/discuss/reply',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ export default {
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color: #333;
|
||||
color: #ea7272;
|
||||
box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, .3);
|
||||
li {
|
||||
margin: 0;
|
||||
|
@ -1,47 +1,21 @@
|
||||
<template>
|
||||
<template xmlns:border-radius="http://www.w3.org/1999/xhtml">
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="150px">
|
||||
<!-- <el-form-item label="部门id" prop="deptId">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.deptId"-->
|
||||
<!-- placeholder="请输入部门id"-->
|
||||
<!-- clearable-->
|
||||
<!-- size="small"-->
|
||||
<!-- @keyup.enter.native="handleQuery"-->
|
||||
<!-- />-->
|
||||
|
||||
|
||||
<el-form-item label="数据状态" prop="state">
|
||||
<el-select
|
||||
v-model="queryParams.state"
|
||||
placeholder="请输入数据状态,ON为数据启用,OFF为数据停用但仍在前端显示,DEL对数据用户来说已经删除"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
>
|
||||
<el-option label="ON" value="0" />
|
||||
<el-option label="OFF" value="1" />
|
||||
|
||||
<el-select v-model="queryParams.state" placeholder="请输入数据状态,ON为数据启用,OFF为数据停用但仍在前端显示,DEL对数据用户来说已经删除"
|
||||
clearable size="small">
|
||||
<el-option
|
||||
v-for="appdict in appTypeOptions"
|
||||
:key="appdict.dictValue"
|
||||
:label="appdict.dictLabel"
|
||||
:value="appdict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建数据的用户id" prop="createUser">
|
||||
<el-input
|
||||
v-model="queryParams.createUser"
|
||||
placeholder="请输入创建数据的用户id"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="修改数据的用户id" prop="updateUser">
|
||||
<el-input
|
||||
v-model="queryParams.updateUser"
|
||||
placeholder="请输入修改数据的用户id"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
|
||||
|
||||
<el-form-item label="回复评论的id" prop="appDiscussReplyId">
|
||||
<el-input
|
||||
v-model="queryParams.appDiscussReplyId"
|
||||
@ -97,12 +71,19 @@
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="评论类型" prop="appDiscussType">
|
||||
<el-select v-model="queryParams.appDiscussType" placeholder="请选择评论类型" clearable size="small">
|
||||
<el-option label="ON " value="0" />
|
||||
<el-option label="OFF" value="1" />
|
||||
<el-select v-model="queryParams.appDiscussType" placeholder="请选择评论类型"
|
||||
clearable size="small">
|
||||
<el-option
|
||||
v-for="appdict1 in appTypeOptions1"
|
||||
:key="appdict1.dictValue"
|
||||
:label="appdict1.dictLabel"
|
||||
:value="appdict1.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="评论回复人" prop="appDiscussReplyUser">
|
||||
<el-input
|
||||
v-model="queryParams.appDiscussReplyUser"
|
||||
@ -113,11 +94,13 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<!--修改-->
|
||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 新增,删除,导出,修改body按钮框-->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -133,20 +116,20 @@
|
||||
type="success"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
:disabled="multiple"
|
||||
@click="handlePass"
|
||||
v-hasPermi="['system:discuss:edit']"
|
||||
>修改</el-button>
|
||||
>批量通过</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
type="primary"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['system:discuss:remove']"
|
||||
>删除</el-button>
|
||||
v-hasPermi="['system:discuss:delete']"
|
||||
>批量删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -157,25 +140,30 @@
|
||||
v-hasPermi="['system:discuss:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="discussList" @selection-change="handleSelectionChange">
|
||||
<el-table border v-loading="loading" :data="discussList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="表主键" align="center" prop="id" v-if="false"/>
|
||||
<!-- <el-table-column label="部门id" align="center" prop="deptId" />-->
|
||||
<el-table-column label="数据状态" align="center" prop="state" width="75" />
|
||||
<el-table-column label="创建数据的用户id" align="center" prop="createUser" width="125" />
|
||||
<el-table-column label="修改数据的用户id" align="center" prop="updateUser" width="125" />
|
||||
<el-table-column label="回复评论的id" align="center" prop="appDiscussReplyId"width="100" />
|
||||
<el-table-column label="数据状态" align="center" prop="state" :formatter="appTypeFormat"/>
|
||||
<el-table-column label="评论内容" align="center" prop="appDiscussText" />
|
||||
<el-table-column label="评论的内容id" align="center" prop="appAssociationId"width="105" />
|
||||
<el-table-column label="评论的图片" align="center" prop="appDiscussImage" width="105" />
|
||||
|
||||
<el-table-column label="评论的内容id" align="center" prop="appAssociationId" width="105" />
|
||||
<el-table-column label="回复评论的数量" align="center" prop="children" width="105" >
|
||||
<template slot-scope="scope" >
|
||||
{{ scope.row.children.length}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="评论图" align="center" prop="newsImage" width="100px">
|
||||
<template slot-scope="scope">
|
||||
<el-image :src="scope.row.appDiscussImage|getImageForKey" style="width: 60px; height: 60px"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="评论人姓名" align="center" prop="appDiscussExtraUsername" width="105"/>
|
||||
<el-table-column label="评论人手机号码" align="center" prop="appDiscussExtraMobile" width="115" />
|
||||
<el-table-column label="评论推荐" align="center" prop="appDiscussRecommend" />
|
||||
<el-table-column label="评论类型" align="center" prop="appDiscussType" />
|
||||
<el-table-column label="评论类型" align="center" prop="appDiscussType" :formatter="appTypeFormat1" />
|
||||
<el-table-column label="评论回复人" align="center" prop="appDiscussReplyUser" width="95" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
@ -193,6 +181,16 @@
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:discuss:remove']"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleReplyUpdate(scope.row)"
|
||||
v-hasPermi="['system:discuss:edit']"
|
||||
>查看回复的评论</el-button>
|
||||
<el-badge :value="1" :max="10" class="item">
|
||||
<el-button size="small">回复</el-button>
|
||||
</el-badge>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -205,24 +203,15 @@
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改app评论对话框 -->
|
||||
<!-- 添加或修改app评论对话框-->
|
||||
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="135px">
|
||||
<!-- <el-form-item label="部门id" prop="deptId">-->
|
||||
<!-- <el-input v-model="form.deptId" placeholder="请输入部门id" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="数据状态" prop="state">
|
||||
<el-select v-model="form.state" placeholder="请输入数据状态,ON为数据启用,OFF为数据停用但仍在前端显示,DEL对数据用户来说已经删除">
|
||||
<el-option label="ON" value="0" />
|
||||
<el-option label="OFF" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="创建数据的用户id" prop="createUser">
|
||||
<el-input v-model="form.createUser" placeholder="请输入创建数据的用户id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="修改数据的用户id" prop="updateUser">
|
||||
<el-input v-model="form.updateUser" placeholder="请输入修改数据的用户id" />
|
||||
<el-form-item label="数据状态" prop="state">
|
||||
<el-radio-group v-model="form.state">
|
||||
<el-radio v-for="(dict, index) in appTypeOptions" :key="index" :label="parseInt(dict.dictValue)">
|
||||
{{dict.dictLabel}}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="回复评论的id" prop="appDiscussReplyId">
|
||||
<el-input v-model="form.appDiscussReplyId" placeholder="请输入回复评论的id" />
|
||||
@ -236,9 +225,6 @@
|
||||
<el-form-item label="评论的图片">
|
||||
<uploadImage v-model="form.appDiscussImage"/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="评论视频" prop="appDiscussVideo">-->
|
||||
<!-- <el-input v-model="form.appDiscussVideo" placeholder="请输入评论视频" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="评论人姓名" prop="appDiscussExtraUsername">
|
||||
<el-input v-model="form.appDiscussExtraUsername" placeholder="请输入评论人姓名" />
|
||||
</el-form-item>
|
||||
@ -249,10 +235,11 @@
|
||||
<el-input v-model="form.appDiscussRecommend" placeholder="请输入评论推荐" />
|
||||
</el-form-item>
|
||||
<el-form-item label="评论类型" prop="appDiscussType">
|
||||
<el-select v-model="form.appDiscussType" placeholder="请选择评论类型">
|
||||
<el-option label="ON" value="0" />
|
||||
<el-option label="OFF" value="1" />
|
||||
</el-select>
|
||||
<el-radio-group v-model="form.appDiscussType">
|
||||
<el-radio v-for="(dict, index) in appTypeOptions1" :key="index" :label="parseInt(dict.dictValue)">
|
||||
{{dict.dictLabel}}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="评论回复人" prop="appDiscussReplyUser">
|
||||
<el-input v-model="form.appDiscussReplyUser" placeholder="请输入评论回复人" />
|
||||
@ -263,13 +250,47 @@
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
<!-- 回复的评论app评论对话框-->
|
||||
<el-dialog :title="title" :visible.sync="open1" width="900px" append-to-body>
|
||||
<!-- <div>{{JSON.stringify(form.children)}}</div>-->
|
||||
<!-- <el-table border v-loading="false" :data="form.children">-->
|
||||
<!-- <el-table-column label="表主键" align="center" prop="id" v-if="true"/>-->
|
||||
<!-- <el-table-column label="回复信息" align="center" prop="appDiscussText" v-if="true"/>-->
|
||||
<!-- </el-table>-->
|
||||
|
||||
<div
|
||||
v-for="(item,index) in form.children" :key="item.id">{{item.appDiscussExtraUsername}}回复了您,
|
||||
回复内容:{{item.appDiscussText}}
|
||||
</div>
|
||||
|
||||
|
||||
<div v-for="(item,index) in form.children" :key="item.id">{{item.appDiscussExtraUsername}}回复了您,
|
||||
回复内容:{{item.appDiscussText}}
|
||||
</div>
|
||||
|
||||
</el-dialog>
|
||||
|
||||
|
||||
<!-- <el-form ref="form" :model="form" :rules="rules" label-width="135px" >-->
|
||||
<!-- <el-form-item label="回复的内容" prop="appDiscussReplyUser">-->
|
||||
<!-- <el-input v-model="form.appDiscussReplyUser" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-form>-->
|
||||
<!-- <div slot="footer" class="dialog-footer">-->
|
||||
<!-- <el-button type="primary" @click="submitForm">确 定</el-button>-->
|
||||
<!-- <el-button @click="cancel">取 消</el-button>-->
|
||||
<!-- </div>-->
|
||||
<!-- </el-dialog>-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listDiscuss, getDiscuss, delDiscuss, addDiscuss, updateDiscuss, exportDiscuss } from "@/api/appdiscuss/discuss";
|
||||
import { listDiscuss, getDiscuss, delDiscuss, addDiscuss, updateDiscuss, exportDiscuss,passDiscuss,replyDiscuss } from "@/api/app/discuss";
|
||||
import UploadImage from '@/components/UploadImage';
|
||||
|
||||
|
||||
export default {
|
||||
name: "Discuss",
|
||||
components: {
|
||||
@ -283,6 +304,8 @@ export default {
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
//回复的数据
|
||||
reply:undefined,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
@ -291,10 +314,19 @@ export default {
|
||||
total: 0,
|
||||
// app评论表格数据
|
||||
discussList: [],
|
||||
//app数据字典
|
||||
appTypeOptions:[],
|
||||
//评论类型字典
|
||||
appTypeOptions1:[],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
//回复的数量
|
||||
replyNum : undefined,
|
||||
// 是否显示回复弹出层
|
||||
open1 : false,
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
@ -312,7 +344,8 @@ export default {
|
||||
appDiscussExtraMobile: undefined,
|
||||
appDiscussRecommend: undefined,
|
||||
appDiscussType: undefined,
|
||||
appDiscussReplyUser: undefined
|
||||
children:undefined,
|
||||
appDiscussReplyUser: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
@ -336,9 +369,6 @@ export default {
|
||||
updateUser: [
|
||||
{ required: true, message: "修改数据的用户id不能为空", trigger: "blur" }
|
||||
],
|
||||
appDiscussReplyId: [
|
||||
{ required: true, message: "回复评论的id不能为空", trigger: "blur" }
|
||||
],
|
||||
appDiscussText: [
|
||||
{ required: true, message: "评论内容不能为空", trigger: "blur" }
|
||||
],
|
||||
@ -351,14 +381,18 @@ export default {
|
||||
appDiscussExtraMobile: [
|
||||
{ required: true, message: "评论人手机号码不能为空", trigger: "blur" }
|
||||
],
|
||||
appDiscussReplyUser: [
|
||||
{ required: true, message: "评论回复人不能为空", trigger: "blur" }
|
||||
]
|
||||
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getDicts("sys_audit_status").then(response => {
|
||||
this.appTypeOptions = response.data;
|
||||
});
|
||||
this.getDicts("app_discuss").then(response => {
|
||||
this.appTypeOptions1 = response.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/** 查询app评论列表 */
|
||||
@ -368,13 +402,25 @@ export default {
|
||||
this.discussList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
console.log(response);
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.open1 = false;
|
||||
this.reset();
|
||||
},
|
||||
// 数据类型字典翻译
|
||||
appTypeFormat(row, column) {
|
||||
return this.selectDictLabel(this.appTypeOptions, row.state);
|
||||
},
|
||||
|
||||
// 数据类型字典翻译
|
||||
appTypeFormat1(row, column) {
|
||||
return this.selectDictLabel(this.appTypeOptions1, row.appDiscussType);
|
||||
},
|
||||
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
@ -395,11 +441,14 @@ export default {
|
||||
appDiscussExtraUsername: undefined,
|
||||
appDiscussExtraMobile: undefined,
|
||||
appDiscussRecommend: undefined,
|
||||
appDiscussType: undefined,
|
||||
appDiscussType: 0,
|
||||
children:undefined,
|
||||
appDiscussReplyUser: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
@ -430,6 +479,18 @@ export default {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改app评论";
|
||||
console.log(response)
|
||||
});
|
||||
},
|
||||
/** 回复评论按钮操作 */
|
||||
handleReplyUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getDiscuss(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open1 = true;
|
||||
this.title = "查看app评论回复";
|
||||
console.log(response)
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
@ -440,12 +501,14 @@ export default {
|
||||
updateDiscuss(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.open1 = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addDiscuss(this.form).then(response => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.open1 = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
@ -457,7 +520,7 @@ export default {
|
||||
const ids = row.id || this.ids;
|
||||
this.$confirm('是否确认删除app评论编号为"' + ids + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return delDiscuss(ids);
|
||||
@ -466,6 +529,23 @@ export default {
|
||||
this.msgSuccess("删除成功");
|
||||
})
|
||||
},
|
||||
/** 一键通过按钮操作 */
|
||||
handlePass(row) {
|
||||
const ids = row.id || this.ids;
|
||||
|
||||
this.$confirm('是否确认通过app评论编号为"' + ids +'"的数据项?', "通过", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
var state = 1;
|
||||
return passDiscuss(ids,state);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("通过成功");
|
||||
})
|
||||
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
@ -482,3 +562,4 @@ export default {
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -110,7 +110,6 @@
|
||||
<template slot-scope="scope">
|
||||
<el-image :src="scope.row.newsImage|getImageForKey" style="width: 60px; height: 60px"/>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column label="新闻类型" align="center" prop="newsType" :formatter="newsTypeFormat"/>
|
||||
<el-table-column label="状态" align="center" prop="state" :formatter="stateFormat" width="100px">
|
||||
|
@ -1,5 +1,8 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
|
||||
|
||||
<div class="user-info-head" @click="editCropper()"><img v-bind:src="options.img" title="点击上传头像" class="img-circle img-lg" /></div>
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @opened="modalOpened">
|
||||
<el-row>
|
||||
|
@ -34,7 +34,7 @@ module.exports = {
|
||||
proxy: {
|
||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||
[process.env.VUE_APP_BASE_API]: {
|
||||
target: `http://localhost:18989`,
|
||||
target: `http://localhost:1998`,
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||
|
Loading…
x
Reference in New Issue
Block a user