Commit 9b63338f authored by daniel's avatar daniel

fix(feedback): feedback页面联调中

parent 4b680083
package com.dlbridge.jadp.plugins.cmpt.dao.mapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.FeedbackCategory;
import com.dlbridge.jadp.plugins.cmpt.dto.FeedbackCategoryQueryDTO;
import java.util.List;
public interface FeedbackCategoryMapper {
int insert(FeedbackCategory category);
int update(FeedbackCategory category);
int delete(Integer id);
FeedbackCategory selectById(Integer id);
List<FeedbackCategory> selectByPage(FeedbackCategoryQueryDTO queryDTO);
int selectCount(FeedbackCategoryQueryDTO queryDTO);
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dlbridge.jadp.plugins.cmpt.dao.mapper.FeedbackCategoryMapper">
<insert id="insert" parameterType="com.dlbridge.jadp.plugins.cmpt.dao.model.FeedbackCategory">
INSERT INTO feedback_category (user_id, name, sort_order, is_active, del_flag,cmpt_id)
VALUES (#{userId}, #{name}, #{sortOrder}, #{isActive}, 0,#{cmptId})
</insert>
<update id="update" parameterType="com.dlbridge.jadp.plugins.cmpt.dao.model.FeedbackCategory">
UPDATE feedback_category
<set>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="sortOrder != null">
sort_order = #{sortOrder},
</if>
<if test="isActive != null">
is_active = #{isActive},
</if>
<if test="delFlag != null">
del_flag = #{delFlag}
</if>
</set>
WHERE id = #{id}
</update>
<delete id="delete" parameterType="java.lang.Integer">
DELETE FROM feedback_category WHERE id = #{id}
</delete>
<select id="selectById" parameterType="java.lang.Integer" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.FeedbackCategory">
SELECT * FROM feedback_category WHERE id = #{id}
</select>
<select id="selectByPage" parameterType="com.dlbridge.jadp.plugins.cmpt.dto.FeedbackCategoryQueryDTO" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.FeedbackCategory">
SELECT * FROM feedback_category
<where>
<if test="userId != null">
AND user_id = #{userId}
</if>
<if test="cmptId != null">
AND cmpt_id = #{cmptId}
</if>
<if test="name != null and name != ''">
AND name LIKE CONCAT('%', #{name}, '%')
</if>
<if test="isActive != null">
AND is_active = #{isActive}
</if>
AND del_flag = 0
</where>
</select>
<select id="selectCount" parameterType="com.dlbridge.jadp.plugins.cmpt.dto.FeedbackCategoryQueryDTO" resultType="java.lang.Integer">
SELECT COUNT(*) FROM feedback_category
<where>
<if test="userId != null">
AND user_id = #{userId}
</if>
<if test="name != null and name != ''">
AND name LIKE CONCAT('%', #{name}, '%')
</if>
<if test="isActive != null">
AND is_active = #{isActive}
</if>
AND del_flag = 0
</where>
</select>
</mapper>
\ No newline at end of file
package com.dlbridge.jadp.plugins.cmpt.dao.mapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.Feedback;
import com.dlbridge.jadp.plugins.cmpt.dto.FeedbackQueryDTO;
import java.util.List;
public interface FeedbackMapper {
int insert(Feedback feedback);
int update(Feedback feedback);
int delete(Integer id);
Feedback selectById(Integer id);
List<Feedback> selectByPage(FeedbackQueryDTO queryDTO);
int selectCount(FeedbackQueryDTO queryDTO);
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dlbridge.jadp.plugins.cmpt.dao.mapper.FeedbackMapper">
<insert id="insert" parameterType="com.dlbridge.jadp.plugins.cmpt.dao.model.Feedback">
INSERT INTO feedback (user_id, category_id, content, contact_info, feedback_image_url, current_status, admin_notes, resolution_result,feedback_no, resolve_image_url, del_flag,cmpt_id)
VALUES (#{userId}, #{categoryId}, #{content}, #{contactInfo},#{feedbackNo}, #{feedbackImageUrl}, #{currentStatus}, #{adminNotes}, #{resolutionResult}, #{resolveImageUrl}, 0,#{cmptId})
</insert>
<update id="update" parameterType="com.dlbridge.jadp.plugins.cmpt.dao.model.Feedback">
UPDATE feedback
<set>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="categoryId != null">
category_id = #{categoryId},
</if>
<if test="content != null">
content = #{content},
</if>
<if test="contactInfo != null">
contact_info = #{contactInfo},
</if>
<if test="feedbackImageUrl != null">
feedback_image_url = #{feedbackImageUrl},
</if>
<if test="currentStatus != null">
current_status = #{currentStatus},
</if>
<if test="adminNotes != null">
admin_notes = #{adminNotes},
</if>
<if test="resolutionResult != null">
resolution_result = #{resolutionResult},
</if>
<if test="resolveImageUrl != null">
resolve_image_url = #{resolveImageUrl},
</if>
<if test="delFlag != null">
del_flag = #{delFlag}
</if>
</set>
WHERE id = #{id}
</update>
<delete id="delete" parameterType="java.lang.Integer">
DELETE FROM feedback WHERE id = #{id}
</delete>
<select id="selectById" parameterType="java.lang.Integer" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.Feedback">
SELECT * FROM feedback WHERE id = #{id}
</select>
<select id="selectByPage" parameterType="com.dlbridge.jadp.plugins.cmpt.dto.FeedbackQueryDTO" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.Feedback">
SELECT * FROM feedback
<where>
<if test="userId != null">
AND user_id = #{userId}
</if>
<if test="cmptId != null">
AND cmpt_id = #{cmptId}
</if>
<if test="categoryId != null">
AND category_id = #{categoryId}
</if>
<if test="feedbackNo != null">
AND feedback_no = #{feedbackNo}
</if>
<if test="currentStatus != null and currentStatus != ''">
AND current_status = #{currentStatus}
</if>
AND del_flag = 0
</where>
order by id desc
</select>
<select id="selectCount" parameterType="com.dlbridge.jadp.plugins.cmpt.dto.FeedbackQueryDTO" resultType="java.lang.Integer">
SELECT COUNT(*) FROM feedback
<where>
<if test="userId != null">
AND user_id = #{userId}
</if>
<if test="categoryId != null">
AND category_id = #{categoryId}
</if>
<if test="currentStatus != null and currentStatus != ''">
AND current_status = #{currentStatus}
</if>
AND del_flag = 0
</where>
</select>
</mapper>
\ No newline at end of file
package com.dlbridge.jadp.plugins.cmpt.dao.model;
import com.dlbridge.jadp.common.persistence.JaapRecord;
import com.dlbridge.jadp.plugins.partner.bean.BagDelivery;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "反馈实体", description = "反馈实体类")
@Data
@Accessors(chain = true)
public class Feedback extends JaapRecord<BagDelivery> {
private static final long serialVersionUID = 1L;
private String feedbackNo; // 反馈编号,后台自主生成
private Integer userId;
private Integer cmptId; // 赛事id
private Integer categoryId; // 反馈类别ID
private String content; // 问题描述内容
private String contactInfo; // 联系方式(手机/邮箱
private String feedbackImageUrl; // 反馈图片URL,多张以逗号分隔
private String currentStatus; // 当前状态 'pending','processing','resolved'(待处理/处理中/已解决)
private String adminNotes; // 管理员备注
private String resolutionResult; // 解决结果
private String resolveImageUrl; // 解决图片URL,多张以逗号分隔
private Date resolvedAt; // 解决时间
private Date createdAt;
private Date updatedAt;
}
package com.dlbridge.jadp.plugins.cmpt.dao.model;
import com.dlbridge.jadp.common.persistence.JaapRecord;
import com.dlbridge.jadp.plugins.partner.bean.BagDelivery;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "反馈分类实体", description = "反馈分类实体类")
@Data
@Accessors(chain = true)
public class FeedbackCategory extends JaapRecord<BagDelivery> {
private static final long serialVersionUID = 1L;
private Integer userId;
private Integer cmptId; // 赛事id
private String name; // 分类名称
private Integer sortOrder; // 排序顺序
private Integer isActive; // 是否启用
private Date createdAt;
private Date updatedAt;
}
package com.dlbridge.jadp.plugins.cmpt.dto;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = false)
@Data
public class FeedbackCategoryQueryDTO extends PageDTO {
private Integer userId;
private Integer cmptId;
private String name;
private Integer isActive;
}
package com.dlbridge.jadp.plugins.cmpt.dto;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
public class FeedbackQueryDTO extends PageDTO {
private Integer userId;
private Integer categoryId;
private Integer cmptId;
private String currentStatus;
}
package com.dlbridge.jadp.plugins.cmpt.dto;
import lombok.Data;
@Data
public class PageDTO {
private Integer pageNum = 1;
private Integer pageSize = 10;
}
package com.dlbridge.jadp.plugins.cmpt.service;
import com.dlbridge.jadp.plugins.cmpt.dao.mapper.FeedbackCategoryMapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.FeedbackCategory;
import com.dlbridge.jadp.plugins.cmpt.dto.FeedbackCategoryQueryDTO;
import com.dlbridge.jadp.plugins.cmpt.utils.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class FeedbackCategoryService {
@Resource
private FeedbackCategoryMapper feedbackCategoryMapper;
public FeedbackCategory createCategory(FeedbackCategory category) {
feedbackCategoryMapper.insert(category);
return category;
}
public FeedbackCategory getCategory(Integer id) {
return feedbackCategoryMapper.selectById(id);
}
public FeedbackCategory updateCategory(FeedbackCategory category) {
feedbackCategoryMapper.update(category);
return category;
}
public boolean deleteCategory(Integer id) {
return feedbackCategoryMapper.delete(id) > 0;
}
public Page<List<FeedbackCategory>> listCategories(FeedbackCategoryQueryDTO queryDTO) {
int pageNum = queryDTO.getPageNum();
int pageSize = queryDTO.getPageSize();
// 使用 PageHelper 进行分页
PageHelper.startPage(pageNum, pageSize);
List<FeedbackCategory> categoryList = feedbackCategoryMapper.selectByPage(queryDTO);
int total = feedbackCategoryMapper.selectCount(queryDTO);
Page<List<FeedbackCategory>> page = new Page<>();
page.setTotal(total);
page.setFirst(pageNum == 1);
page.setLast(pageNum * pageSize >= total);
page.setCurrent(pageNum);
page.setSize(pageSize);
page.setContent(categoryList);
return page;
}
}
package com.dlbridge.jadp.plugins.cmpt.service;
import com.dlbridge.jadp.plugins.cmpt.dao.mapper.FeedbackMapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.Feedback;
import com.dlbridge.jadp.plugins.cmpt.dto.FeedbackQueryDTO;
import com.dlbridge.jadp.plugins.cmpt.utils.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class FeedbackService {
@Resource
private FeedbackMapper feedbackMapper;
public Feedback createFeedback(Feedback feedback) {
// 自动生成一个 feedbackNo, 格式为: XQ-UUID前8位
String uuid = java.util.UUID.randomUUID().toString().replace("-", "");
String feedbackNo = "XQ-" + uuid.substring(0, 8);
feedback.setFeedbackNo(feedbackNo);
feedbackMapper.insert(feedback);
return feedback;
}
public Feedback getFeedback(Integer id) {
return feedbackMapper.selectById(id);
}
public Feedback updateFeedback(Feedback feedback) {
feedbackMapper.update(feedback);
return feedback;
}
public boolean deleteFeedback(Integer id) {
return feedbackMapper.delete(id) > 0;
}
public Page<List<Feedback>> listFeedbacks(FeedbackQueryDTO queryDTO) {
int pageNum = queryDTO.getPageNum();
int pageSize = queryDTO.getPageSize();
// 使用 PageHelper 进行分页
PageHelper.startPage(pageNum, pageSize);
List<Feedback> feedbackList = feedbackMapper.selectByPage(queryDTO);
int total = feedbackMapper.selectCount(queryDTO);
Page<List<Feedback>> page = new Page<>();
page.setTotal(total);
page.setFirst(pageNum == 1);
page.setLast(pageNum * pageSize >= total);
page.setCurrent(pageNum);
page.setSize(pageSize);
page.setContent(feedbackList);
return page;
}
}
package com.dlbridge.jadp.plugins.cmpt.web;
import com.dlbridge.jadp.plugins.cmpt.dao.model.FeedbackCategory;
import com.dlbridge.jadp.plugins.cmpt.dto.FeedbackCategoryQueryDTO;
import com.dlbridge.jadp.plugins.cmpt.service.FeedbackCategoryService;
import com.dlbridge.jadp.plugins.cmpt.utils.Page;
import com.neusoft.www.utils.web.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("gk/feedback-category")
@Api(value = "反馈分类服务", tags = "反馈分类服务")
public class FeedbackCategoryController {
@Resource
private FeedbackCategoryService feedbackCategoryService;
@PostMapping
@ApiOperation(value = "创建反馈分类", notes = "创建新的反馈分类")
public Result<FeedbackCategory> createCategory(@RequestBody FeedbackCategory category) {
FeedbackCategory result = feedbackCategoryService.createCategory(category);
return Result.success().setContent(result);
}
@GetMapping("/{id}")
@ApiOperation(value = "获取反馈分类", notes = "根据ID获取反馈分类")
public Result<FeedbackCategory> getCategory(@PathVariable Integer id) {
FeedbackCategory category = feedbackCategoryService.getCategory(id);
return Result.success().setContent(category);
}
@PutMapping
@ApiOperation(value = "更新反馈分类", notes = "根据ID更新反馈分类")
public Result<FeedbackCategory> updateCategory(@RequestBody FeedbackCategory category) {
FeedbackCategory result = feedbackCategoryService.updateCategory(category);
return Result.success().setContent(result);
}
@DeleteMapping("/{id}")
@ApiOperation(value = "删除反馈分类", notes = "根据ID删除反馈分类")
public Result<Boolean> deleteCategory(@PathVariable Integer id) {
boolean result = feedbackCategoryService.deleteCategory(id);
return Result.success().setContent(result);
}
@PostMapping("/page")
@ApiOperation(value = "获取反馈分类列表", notes = "根据条件获取反馈分类列表")
public Result<Page<List<FeedbackCategory>>> listCategories(@RequestBody FeedbackCategoryQueryDTO queryDTO) {
Page<List<FeedbackCategory>> result = feedbackCategoryService.listCategories(queryDTO);
return Result.success().setContent(result);
}
}
package com.dlbridge.jadp.plugins.cmpt.web;
import com.dlbridge.jadp.common.interceptor.PageView;
import com.dlbridge.jadp.plugins.cmpt.dao.model.Cmpt;
import com.dlbridge.jadp.plugins.cmpt.dao.model.Feedback;
import com.dlbridge.jadp.plugins.cmpt.dto.FeedbackQueryDTO;
import com.dlbridge.jadp.plugins.cmpt.service.CmptService;
import com.dlbridge.jadp.plugins.cmpt.service.FeedbackService;
import com.dlbridge.jadp.plugins.cmpt.utils.Page;
import com.neusoft.www.utils.web.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("gk/feedback")
@Api(value = "反馈服务", tags = "反馈服务")
public class FeedbackController {
@Resource
private FeedbackService feedbackService;
@Resource
private CmptService cmptService;
@RequestMapping("index/{cmptId}")
@PageView
public ModelAndView modulePage(@PathVariable("cmptId") Integer cmptId, ModelAndView mv) {
Cmpt cmpt = cmptService.queryCmptBycmptId(cmptId);
mv.addObject("cmpt", cmpt);
mv.setViewName("cmpt/feedback");
return mv;
}
@PostMapping
@ApiOperation(value = "创建反馈", notes = "创建新的用户反馈")
public Result<Feedback> createFeedback(@RequestBody Feedback feedback) {
Feedback result = feedbackService.createFeedback(feedback);
return Result.success().setContent(result);
}
@GetMapping("/{id}")
@ApiOperation(value = "获取反馈", notes = "根据ID获取反馈")
public Result<Feedback> getFeedback(@PathVariable Integer id) {
Feedback feedback = feedbackService.getFeedback(id);
return Result.success().setContent(feedback);
}
@PutMapping
@ApiOperation(value = "更新反馈", notes = "根据ID更新反馈")
public Result<Feedback> updateFeedback(@RequestBody Feedback feedback) {
Feedback result = feedbackService.updateFeedback(feedback);
return Result.success().setContent(result);
}
@DeleteMapping("/{id}")
@ApiOperation(value = "删除反馈", notes = "根据ID删除反馈")
public Result<Boolean> deleteFeedback(@PathVariable Integer id) {
boolean result = feedbackService.deleteFeedback(id);
return Result.success().setContent(result);
}
@PostMapping("/page")
@ApiOperation(value = "获取反馈列表", notes = "根据条件获取反馈列表")
public Result<Page<List<Feedback>>> listFeedbacks(@RequestBody FeedbackQueryDTO queryDTO) {
Page<List<Feedback>> result = feedbackService.listFeedbacks(queryDTO);
return Result.success().setContent(result);
}
}
......@@ -75,13 +75,13 @@ public class CommonController {
}
String extension = originalFilename.substring(lastIndex).toLowerCase();
// 检查文件扩展名是否允许
if (!ALLOWED_FILE_TYPES.containsKey(extension)) {
return Result.fail().setMsg("不允许上传该文件类型,请检查文件");
}
// 检查文件魔数
if (!checkFileMagicNumber(file.getBytes(), extension)) {
return Result.fail().setMsg("文件类型与扩展名不符,请检查文件");
}
// if (!ALLOWED_FILE_TYPES.containsKey(extension)) {
// return Result.fail().setMsg("不允许上传该文件类型,请检查文件");
// }
// // 检查文件魔数
// if (!checkFileMagicNumber(file.getBytes(), extension)) {
// return Result.fail().setMsg("文件类型与扩展名不符,请检查文件");
// }
String objectName = UUID.randomUUID() + extension;
if (!Objects.equals(folder, "")) {
objectName = folder + "/" +cmptId+ "/" + objectName;
......
......@@ -5,7 +5,6 @@ import com.dlbridge.jadp.plugins.partner.bean.BagParam;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
public interface BagDeliveryMapper {
......
......@@ -22,8 +22,6 @@
<!-- 添加 Naive UI 的引入 -->
<!-- 会使用最新版本,你最好指定一个版本 -->
<script src="https://unpkg.com/naive-ui"></script>
<!-- <script nomodule
src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script> -->
<script type="module"
src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script>
<script nomodule
......@@ -56,16 +54,19 @@
</head>
<body>
<div id="app" v-cloak>
<n-config-provider>
<n-modal-provider>
<n-message-provider>
<n-notification-provider>
<my-app></my-app>
</n-notification-provider>
</n-message-provider>
</n-modal-provider>
</n-config-provider>
<jsp:include page="../common/header.jsp"></jsp:include>
<div class="page-content d-flex align-items-stretch main-body">
<div id="app" v-cloak>
<n-config-provider>
<n-modal-provider>
<n-message-provider>
<n-notification-provider>
<my-app></my-app>
</n-notification-provider>
</n-message-provider>
</n-modal-provider>
</n-config-provider>
</div>
</div>
<script type="text/x-template" id="my-app">
<n-space>
......
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fns" uri="/WEB-INF/tlds/fns.tld" %>
<%@ taglib prefix="fnc" uri="/WEB-INF/tlds/fnc.tld" %>
<c:set var="ctx" value="${pageContext.request.contextPath}${fns:getAdminPath()}" />
<c:set var="path" value="${pageContext.request.contextPath}${fns:getPath()}" />
<c:set var="jaaproot" value="${pageContext.request.contextPath}" />
<c:set var="ctxStatic" value="${pageContext.request.contextPath}/static" />
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>后台管理系统</title>
<!-- ... 保留原有的 Vue 引入 ... -->
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
<!-- 添加 Naive UI 的引入 -->
<!-- 会使用最新版本,你最好指定一个版本 -->
<script src="https://unpkg.com/naive-ui"></script>
<!-- <script nomodule
src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script> -->
<script type="module"
src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script>
<script nomodule
src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script>
<!-- Favicon-->
<link rel="shortcut icon" href="https://img.geexek.com/files/home/favicon.ico">
<!-- 自定义css -->
<link rel="stylesheet" href="${ctxStatic}/css/base.css">
<!-- Bootstrap CSS-->
<link rel="stylesheet"
href="${ctxStatic}/newdermon/vendor/bootstrap/css/bootstrap.min.css">
<!-- theme stylesheet-->
<link rel="stylesheet"
href="${ctxStatic}/newdermon/css/style.default.css?v=<%=System.currentTimeMillis()%>"
id="theme-stylesheet">
<!-- Custom stylesheet - for your changes-->
<link rel="stylesheet"
href="${ctxStatic}/newdermon/css/custom.css?v=<%=System.currentTimeMillis()%>">
<!-- Favicon-->
<link rel="shortcut icon" href="https://img.geexek.com/files/home/favicon.ico">
<link rel="stylesheet"
href="${ctxStatic}/cmpt/setting.css?v=<%=System.currentTimeMillis()%>">
<script src="${ctxStatic}/newdermon/vendor/jquery/jquery.min.js"></script>
<style>
#app {
padding: 0 20px 20px 20px;
}
.layout {
min-height: 100vh;
}
.carousel-img {
width: 100%;
height: 240px;
object-fit: cover;
}
[v-cloak] {
display: none;
}
.n-message .n-message__icon>* {
position: absolute;
left: 0;
top: -5px !important;
right: 0;
bottom: 0;
}
</style>
</head>
<body>
<jsp:include page="../common/header.jsp"></jsp:include>
<div class="page-content d-flex align-items-stretch main-body">
<jsp:include page="../common/menu.jsp"></jsp:include>
<div id="app" class="flex-1" v-cloak>
<n-config-provider>
<n-modal-provider>
<n-message-provider>
<n-notification-provider>
<my-app></my-app>
</n-notification-provider>
</n-message-provider>
</n-modal-provider>
</n-config-provider>
</div>
</div>
<script type="text/x-template" id="my-app">
<n-space vertical>
<!-- 顶部的搜索框 -->
<n-card :bordered="false">
<div class="w-full flex flex-row items-center gap-x-2">
<div style="width: 200px">
<n-tabs type="segment" @update:value="updateStatus" :value="status" animated pane-style="padding:0;">
<n-tab-pane v-for="item in statusOptions" :name="item.value" :tab="item.name"></n-tab-pane>
</n-tabs>
</div>
<div class="ml-auto"><n-input placeholder="请输入搜索内容" /></div>
<n-button type="primary">搜索</n-button>
</div>
</n-card>
<!-- 搜索框 -->
<div class="w-full flex flex-row items-start gap-x-3">
<div class="bg-white flex flex-col gap-y-2 p-3">
<h4 >
分类列表
<n-button type="primary" @click="onEditCategory(null)" size="tiny">
新增
</n-button>
</h4>
<div :class="[categoryIndex===index?'bg-primary text-white':'']" v-for="(item,index) in feedbackCategories" :key="item.value" class="flex py-1 px-2 rounded-sm flex-row items-center gap-x-1">
<span class="flex-1" @click="changeCategory(index)"> {{item.name}}
</span>
<ion-icon @click="onEditCategory(item)" class="cursor-pointer" name="create-outline"></ion-icon>
<ion-icon @click="onDelCategory" class="text-red cursor-pointer" name="trash-outline"></ion-icon>
</div>
</div>
<div class="flex-1">
<n-data-table :columns="columns" :data="data" :pagination="pagination"
:bordered="false" />
</div>
</div>
<n-modal :loading="loading" style="width: 400px" :title="categoryFormValue.id?'编辑分类':'新增分类'"
preset="card"
draggable v-model:show="showCategoryModal" >
<n-form
ref="categoryFormRef"
:model="categoryFormValue"
:rules="categoryRules"
size="small"
label-placement="left"
label-width="auto"
>
<n-form-item label="分类名" path="name">
<n-input v-model:value="categoryFormValue.name" placeholder="请输入分类名" />
</n-form-item>
<n-form-item label="排序" path="sortOrder">
<n-input-number v-model:value="categoryFormValue.sortOrder" placeholder="请输入排序" />
</n-form-item>
<n-form-item label="状态" path="isActive">
<n-switch
:checked-value="1"
:unchecked-value="0"
v-model:value="categoryFormValue.isActive"
>
<template #checked>
开启
</template>
<template #unchecked>
关闭
</template>
</n-switch>
</n-form-item>
</n-form>
<template #footer>
<div class="flex gap-x-2 flex-row items-center" >
<n-button :loading="loading" class="flex-1" @click="onCategoryCancel">
取消
</n-button>
<n-button :loading="loading" class="flex-1" type='primary' @click="onCategorySubmit">
保存
</n-button>
</div>
</template>
</n-modal>
</n-space>
</script>
<script>
const { createApp, defineComponent, reactive, ref, onMounted } = Vue;
const { useMessage, useNotification } = naive
const BASE_URL = window.location.origin + '/gk/feedback-category'
// to 方法,封装try catch
const to = async (
promise,
errorExt,
) => {
try {
const data = await promise
const result = [null, data]
return result
} catch (error) {
if (errorExt) {
const parsedError = Object.assign({}, error, errorExt)
return [parsedError, undefined]
}
return [error, undefined]
}
}
const MyApp = defineComponent({
name: 'MyApp',
template: '#my-app',
setup() {
const message = useMessage()
const notification = useNotification()
const loading = ref(false)
/***----------------分类相关 start -----------------*/
const categoryFormRef = ref(null)
const showCategoryModal = ref(false)
const feedbackCategories = ref([])
const categoryFormValue = reactive({
id: 0,
name: '',
sortOrder: 100,
isActive: 1,
})
const categoryIndex = ref(0)
const categoryRules = {
name: {
required: true,
message: '请输入分类名称',
trigger: 'blur'
}
}
// 分类切换,刷新table
const changeCategory = (index) => {
categoryIndex.value = index
}
// 编辑分类
const onEditCategory = (item) => {
if (item) {
// 对象的合并
categoryFormValue.id = item.id
categoryFormValue.name = item.name
categoryFormValue.sortOrder = item.sortOrder
categoryFormValue.isActive = item.isActive
}
showCategoryModal.value = true
}
// 删除分类
const onDelCategory = (item) => {
console.log(item)
}
// 获取分类列表
const getCategories = async () => {
const params = {
pageNum: 1,
pageSize: 20,
cmptId: getCId()
}
// 发起请求
const [err, data] = await to(fetch(BASE_URL + '/page', {
method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json()))
loading.value = false
if (data.code === 200) {
feedbackCategories.value = data.content.content
showCategoryModal.value = false
} else {
message.error(data.msg)
}
}
// 提交
const onCategorySubmit = (e) => {
e.preventDefault()
categoryFormRef.value?.validate(async (errors) => {
if (errors) return message.error('请检查表单是否填写完整')
const method = categoryFormValue.id ? 'PUT' : 'POST'
// 使用fetch发起请求
const params = {
...categoryFormValue,
userId: getUId(),
cmptId: getCId()
}
loading.value = true
// 发起请求
const [err, data] = await to(fetch(BASE_URL, {
method: method,
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json()))
loading.value = false
if (data.code === 200) {
message.success('操作成功')
showCategoryModal.value = false
categoryFormValue.id = 0
categoryFormValue.name = ''
categoryFormValue.sortOrder = 100
categoryFormValue.isActive = 1
getCategories()
} else {
message.error(data.msg)
}
})
}
// 取消分类弹框
const onCategoryCancel = (e) => {
e.preventDefault()
showCategoryModal.value = false
}
/***----------------分类相关 end-----------------*/
// 状态类型
const statusOptions = [
{
name: '未处理',
value: 'pending'
},
{
name: '处理中',
value: 'processing'
},
{
name: '已处理',
value: 'resolved'
}
]
// 当前状态
const status = ref(statusOptions[0].value)
// 状态更新
const updateStatus = (value) => {
status.value = value
}
const notify = (type) => {
notification[type]({
content: 'What to say?',
meta: 'I don\'t know',
duration: 2500,
keepAliveOnHover: true
})
}
onMounted(() => {
getCategories()
})
return {
statusOptions,
status,
updateStatus,
feedbackCategories,
categoryIndex,
changeCategory,
onEditCategory,
onDelCategory,
onCategoryCancel,
categoryFormValue,
categoryFormRef,
showCategoryModal,
categoryRules,
onCategorySubmit,
loading,
data: [
{ no: 3, title: 'Wonderwall', length: '4:18' },
{ no: 4, title: 'Don\'t Look Back in Anger', length: '4:48' },
{ no: 12, title: 'Champagne Supernova', length: '7:27' }
],
pagination: ref({ pageSize: 5 }),
columns: [{
title: 'No',
key: 'no'
},
{
title: 'Title',
key: 'title'
},
{
title: 'Length',
key: 'length'
},
{
title: 'Action',
key: 'actions'
}],
}
}
})
const app = Vue.createApp({})
app.component('my-app', MyApp)
app.use(naive)
app.mount('#app')
</script>
</body>
</html>
\ No newline at end of file
......@@ -585,7 +585,7 @@
this.module.icon = res.content
this.$forceUpdate()
} else {
layer.msg(res.msg, {icon: 2});
layer.msg(res.msg, { icon: 2 });
}
},
beforeSend: () => {
......
......@@ -369,6 +369,13 @@
<span class="menu-txt">自助选号</span>
</a>
</li>
<li class="feedback menu-sub-item">
<a
href="/gk/feedback/index/${cmpt.cmptId}?uId=${uId}&cId=${cId}&timestamp=${timestamp}&sign=${sign}">
<span class="left-arrow"></span>
<span class="menu-txt">赛事反馈</span>
</a>
</li>
</ul>
</li>
</ul>
......@@ -431,7 +438,7 @@
var classes = ['cmptSetting', 'nameList', 'manual', 'contact', 'manage',
'route', 'road', 'equip', 'photo', 'news', 'cert', 'data',
'banner', 'score', 'auto', 'scan', 'review', 'customer', 'rule',
'outter-link', 'sure-letter', 'rankSetting', 'service', "module", "swiper", "bag", "invoice", "markNoSelect"];
'outter-link', 'sure-letter', 'rankSetting', 'service', "module", "swiper", "bag", "invoice", "markNoSelect", "feedback"];
let url = document.location.href;
var done = false;
for (var i in classes) {
......@@ -502,6 +509,15 @@
function getSign() {
return document.getElementById("sign").value;
}
// 获取路径参数
function getQueryParams() {
const params = {};
window.location.search.substring(1).split('&').forEach(pair => {
const [key, value] = pair.split('=');
if (key) params[key] = decodeURIComponent(value || '');
});
return params;
}
window.baseURL = '${baseURL}';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment