Преглед изворни кода

问题批示,问题富文本

zk пре 2 година
родитељ
комит
6acdbcd5d8

+ 1 - 0
server/api/v1/autocode/enter.go

@@ -10,5 +10,6 @@ type ApiGroup struct {
 	UnitApi
 	ProblemTypeApi
 	UnitHistoryApi
+	ProblemReplyApi
 	// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
 }

+ 147 - 0
server/api/v1/autocode/problem_reply.go

@@ -0,0 +1,147 @@
+package autocode
+
+import (
+	"github.com/flipped-aurora/gin-vue-admin/server/global"
+	"github.com/flipped-aurora/gin-vue-admin/server/model/autocode"
+	autocodeReq "github.com/flipped-aurora/gin-vue-admin/server/model/autocode/request"
+	"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
+	"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
+	"github.com/flipped-aurora/gin-vue-admin/server/service"
+	"github.com/flipped-aurora/gin-vue-admin/server/utils"
+	"github.com/gin-gonic/gin"
+	"go.uber.org/zap"
+)
+
+type ProblemReplyApi struct {
+}
+
+var problemReplyService = service.ServiceGroupApp.AutoCodeServiceGroup.ProblemReplyService
+
+// CreateProblemReply 创建ProblemReply
+// @Tags ProblemReply
+// @Summary 创建ProblemReply
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body autocode.ProblemReply true "创建ProblemReply"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
+// @Router /problemReply/createProblemReply [post]
+func (problemReplyApi *ProblemReplyApi) CreateProblemReply(c *gin.Context) {
+	var problemReply autocode.ProblemReply
+	_ = c.ShouldBindJSON(&problemReply)
+	_, user := service.ServiceGroupApp.SystemServiceGroup.GetUserInfo(utils.GetUserUuid(c))
+	problemReply.HeaderImg = user.HeaderImg
+	problemReply.Uuid = user.UUID
+	problemReply.NickName = user.NickName
+	if err := problemReplyService.CreateProblemReply(problemReply); err != nil {
+		global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
+		response.FailWithMessage("创建失败", c)
+	} else {
+		response.OkWithMessage("创建成功", c)
+	}
+}
+
+// DeleteProblemReply 删除ProblemReply
+// @Tags ProblemReply
+// @Summary 删除ProblemReply
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body autocode.ProblemReply true "删除ProblemReply"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
+// @Router /problemReply/deleteProblemReply [delete]
+func (problemReplyApi *ProblemReplyApi) DeleteProblemReply(c *gin.Context) {
+	var problemReply autocode.ProblemReply
+	_ = c.ShouldBindJSON(&problemReply)
+	if err := problemReplyService.DeleteProblemReply(problemReply); err != nil {
+		global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
+		response.FailWithMessage("删除失败", c)
+	} else {
+		response.OkWithMessage("删除成功", c)
+	}
+}
+
+// DeleteProblemReplyByIds 批量删除ProblemReply
+// @Tags ProblemReply
+// @Summary 批量删除ProblemReply
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body request.IdsReq true "批量删除ProblemReply"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}"
+// @Router /problemReply/deleteProblemReplyByIds [delete]
+func (problemReplyApi *ProblemReplyApi) DeleteProblemReplyByIds(c *gin.Context) {
+	var IDS request.IdsReq
+	_ = c.ShouldBindJSON(&IDS)
+	if err := problemReplyService.DeleteProblemReplyByIds(IDS); err != nil {
+		global.GVA_LOG.Error("批量删除失败!", zap.Any("err", err))
+		response.FailWithMessage("批量删除失败", c)
+	} else {
+		response.OkWithMessage("批量删除成功", c)
+	}
+}
+
+// UpdateProblemReply 更新ProblemReply
+// @Tags ProblemReply
+// @Summary 更新ProblemReply
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body autocode.ProblemReply true "更新ProblemReply"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
+// @Router /problemReply/updateProblemReply [put]
+func (problemReplyApi *ProblemReplyApi) UpdateProblemReply(c *gin.Context) {
+	var problemReply autocode.ProblemReply
+	_ = c.ShouldBindJSON(&problemReply)
+	if err := problemReplyService.UpdateProblemReply(problemReply); err != nil {
+		global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
+		response.FailWithMessage("更新失败", c)
+	} else {
+		response.OkWithMessage("更新成功", c)
+	}
+}
+
+// FindProblemReply 用id查询ProblemReply
+// @Tags ProblemReply
+// @Summary 用id查询ProblemReply
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data query autocode.ProblemReply true "用id查询ProblemReply"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
+// @Router /problemReply/findProblemReply [get]
+func (problemReplyApi *ProblemReplyApi) FindProblemReply(c *gin.Context) {
+	var problemReply autocode.ProblemReply
+	_ = c.ShouldBindQuery(&problemReply)
+	if err, reproblemReply := problemReplyService.GetProblemReply(problemReply.ID); err != nil {
+		global.GVA_LOG.Error("查询失败!", zap.Any("err", err))
+		response.FailWithMessage("查询失败", c)
+	} else {
+		response.OkWithData(gin.H{"reproblemReply": reproblemReply}, c)
+	}
+}
+
+// GetProblemReplyList 分页获取ProblemReply列表
+// @Tags ProblemReply
+// @Summary 分页获取ProblemReply列表
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data query autocodeReq.ProblemReplySearch true "分页获取ProblemReply列表"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
+// @Router /problemReply/getProblemReplyList [get]
+func (problemReplyApi *ProblemReplyApi) GetProblemReplyList(c *gin.Context) {
+	var pageInfo autocodeReq.ProblemReplySearch
+	_ = c.ShouldBindQuery(&pageInfo)
+	if err, list, total := problemReplyService.GetProblemReplyInfoList(pageInfo); err != nil {
+		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
+		response.FailWithMessage("获取失败", c)
+	} else {
+		response.OkWithDetailed(response.PageResult{
+			List:     list,
+			Total:    total,
+			Page:     pageInfo.Page,
+			PageSize: pageInfo.PageSize,
+		}, "获取成功", c)
+	}
+}

+ 1 - 0
server/initialize/gorm.go

@@ -56,6 +56,7 @@ func MysqlTables(db *gorm.DB) {
 		autocode.Unit{},
 		autocode.ProblemType{},
 		autocode.UnitHistory{},
+		autocode.ProblemReply{},
 		// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
 	)
 	if err != nil {

+ 1 - 0
server/initialize/router.go

@@ -76,6 +76,7 @@ func Routers() *gin.Engine {
 		autocodeRouter.InitUnitRouter(PrivateGroup)
 		autocodeRouter.InitProblemTypeRouter(PrivateGroup)
 		autocodeRouter.InitUnitHistoryRouter(PrivateGroup)
+		autocodeRouter.InitProblemReplyRouter(PrivateGroup)
 		// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
 	}
 

+ 23 - 0
server/model/autocode/problem_reply.go

@@ -0,0 +1,23 @@
+// 自动生成模板ProblemReply
+package autocode
+
+import (
+	"github.com/flipped-aurora/gin-vue-admin/server/global"
+	uuid "github.com/satori/go.uuid"
+)
+
+// ProblemReply 结构体
+// 如果含有time.Time 请自行import time包
+type ProblemReply struct {
+	global.GVA_MODEL
+	Uuid      uuid.UUID `json:"uuid" form:"uuid" gorm:"column:uuid;comment:用户UUID;type:varchar(191);"`
+	NickName  string    `json:"nickName" form:"nickName" gorm:"column:nick_name;comment:用户昵称;type:varchar(191);"`
+	HeaderImg string    `json:"headerImg" form:"headerImg" gorm:"column:header_img;comment:用户头像;type:varchar(191);"`
+	ReplyMsg  string    `json:"replyMsg" form:"replyMsg" gorm:"column:reply_msg;comment:用户回复;type:varchar(1000);"`
+	ProblemId *int      `json:"problemId" form:"problemId" gorm:"column:problem_id;comment:问题 id;type:bigint"`
+}
+
+// TableName ProblemReply 表名
+func (ProblemReply) TableName() string {
+	return "problem_reply"
+}

+ 11 - 0
server/model/autocode/request/problem_reply.go

@@ -0,0 +1,11 @@
+package request
+
+import (
+	"github.com/flipped-aurora/gin-vue-admin/server/model/autocode"
+	"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
+)
+
+type ProblemReplySearch struct{
+    autocode.ProblemReply
+    request.PageInfo
+}

+ 1 - 0
server/router/autocode/enter.go

@@ -10,5 +10,6 @@ type RouterGroup struct {
 	UnitRouter
 	ProblemTypeRouter
 	UnitHistoryRouter
+	ProblemReplyRouter
 	// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
 }

+ 24 - 0
server/router/autocode/problem_reply.go

@@ -0,0 +1,24 @@
+package autocode
+
+import (
+	"github.com/flipped-aurora/gin-vue-admin/server/api/v1"
+	"github.com/flipped-aurora/gin-vue-admin/server/middleware"
+	"github.com/gin-gonic/gin"
+)
+
+type ProblemReplyRouter struct {
+}
+
+// InitProblemReplyRouter 初始化 ProblemReply 路由信息
+func (s *ProblemReplyRouter) InitProblemReplyRouter(Router *gin.RouterGroup) {
+	problemReplyRouter := Router.Group("problemReply").Use(middleware.OperationRecord())
+	var problemReplyApi = v1.ApiGroupApp.AutoCodeApiGroup.ProblemReplyApi
+	{
+		problemReplyRouter.POST("createProblemReply", problemReplyApi.CreateProblemReply)   // 新建ProblemReply
+		problemReplyRouter.DELETE("deleteProblemReply", problemReplyApi.DeleteProblemReply) // 删除ProblemReply
+		problemReplyRouter.DELETE("deleteProblemReplyByIds", problemReplyApi.DeleteProblemReplyByIds) // 批量删除ProblemReply
+		problemReplyRouter.PUT("updateProblemReply", problemReplyApi.UpdateProblemReply)    // 更新ProblemReply
+		problemReplyRouter.GET("findProblemReply", problemReplyApi.FindProblemReply)        // 根据ID获取ProblemReply
+		problemReplyRouter.GET("getProblemReplyList", problemReplyApi.GetProblemReplyList)  // 获取ProblemReply列表
+	}
+}

+ 1 - 0
server/service/autocode/enter.go

@@ -10,5 +10,6 @@ type ServiceGroup struct {
 	UnitService
 	ProblemTypeService
 	UnitHistoryService
+	ProblemReplyService
 	// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
 }

+ 63 - 0
server/service/autocode/problem_reply.go

@@ -0,0 +1,63 @@
+package autocode
+
+import (
+	"github.com/flipped-aurora/gin-vue-admin/server/global"
+	"github.com/flipped-aurora/gin-vue-admin/server/model/autocode"
+	autoCodeReq "github.com/flipped-aurora/gin-vue-admin/server/model/autocode/request"
+	"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
+)
+
+type ProblemReplyService struct {
+}
+
+// CreateProblemReply 创建ProblemReply记录
+// Author [piexlmax](https://github.com/piexlmax)
+func (problemReplyService *ProblemReplyService) CreateProblemReply(problemReply autocode.ProblemReply) (err error) {
+	err = global.GVA_DB.Create(&problemReply).Error
+	return err
+}
+
+// DeleteProblemReply 删除ProblemReply记录
+// Author [piexlmax](https://github.com/piexlmax)
+func (problemReplyService *ProblemReplyService) DeleteProblemReply(problemReply autocode.ProblemReply) (err error) {
+	err = global.GVA_DB.Delete(&problemReply).Error
+	return err
+}
+
+// DeleteProblemReplyByIds 批量删除ProblemReply记录
+// Author [piexlmax](https://github.com/piexlmax)
+func (problemReplyService *ProblemReplyService) DeleteProblemReplyByIds(ids request.IdsReq) (err error) {
+	err = global.GVA_DB.Delete(&[]autocode.ProblemReply{}, "id in ?", ids.Ids).Error
+	return err
+}
+
+// UpdateProblemReply 更新ProblemReply记录
+// Author [piexlmax](https://github.com/piexlmax)
+func (problemReplyService *ProblemReplyService) UpdateProblemReply(problemReply autocode.ProblemReply) (err error) {
+	err = global.GVA_DB.Save(&problemReply).Error
+	return err
+}
+
+// GetProblemReply 根据id获取ProblemReply记录
+// Author [piexlmax](https://github.com/piexlmax)
+func (problemReplyService *ProblemReplyService) GetProblemReply(id uint) (err error, problemReply autocode.ProblemReply) {
+	err = global.GVA_DB.Where("id = ?", id).First(&problemReply).Error
+	return
+}
+
+// GetProblemReplyInfoList 分页获取ProblemReply记录
+// Author [piexlmax](https://github.com/piexlmax)
+func (problemReplyService *ProblemReplyService) GetProblemReplyInfoList(info autoCodeReq.ProblemReplySearch) (err error, list interface{}, total int64) {
+	limit := info.PageSize
+	offset := info.PageSize * (info.Page - 1)
+	// 创建db
+	db := global.GVA_DB.Model(&autocode.ProblemReply{})
+	var problemReplys []autocode.ProblemReply
+	if info.ProblemId != nil && *info.ProblemId != 0 {
+		db.Where("problem_id=?", info.ProblemId)
+	}
+	// 如果有条件搜索 下方会自动创建搜索语句
+	err = db.Count(&total).Error
+	err = db.Limit(limit).Offset(offset).Find(&problemReplys).Error
+	return err, problemReplys, total
+}

+ 97 - 0
web/src/api/problemReply.js

@@ -0,0 +1,97 @@
+import service from '@/utils/request'
+
+// @Tags ProblemReply
+// @Summary 创建ProblemReply
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body model.ProblemReply true "创建ProblemReply"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
+// @Router /problemReply/createProblemReply [post]
+export const createProblemReply = (data) => {
+  return service({
+    url: '/problemReply/createProblemReply',
+    method: 'post',
+    data
+  })
+}
+
+// @Tags ProblemReply
+// @Summary 删除ProblemReply
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body model.ProblemReply true "删除ProblemReply"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
+// @Router /problemReply/deleteProblemReply [delete]
+export const deleteProblemReply = (data) => {
+  return service({
+    url: '/problemReply/deleteProblemReply',
+    method: 'delete',
+    data
+  })
+}
+
+// @Tags ProblemReply
+// @Summary 删除ProblemReply
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body request.IdsReq true "批量删除ProblemReply"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
+// @Router /problemReply/deleteProblemReply [delete]
+export const deleteProblemReplyByIds = (data) => {
+  return service({
+    url: '/problemReply/deleteProblemReplyByIds',
+    method: 'delete',
+    data
+  })
+}
+
+// @Tags ProblemReply
+// @Summary 更新ProblemReply
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body model.ProblemReply true "更新ProblemReply"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
+// @Router /problemReply/updateProblemReply [put]
+export const updateProblemReply = (data) => {
+  return service({
+    url: '/problemReply/updateProblemReply',
+    method: 'put',
+    data
+  })
+}
+
+// @Tags ProblemReply
+// @Summary 用id查询ProblemReply
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data query model.ProblemReply true "用id查询ProblemReply"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
+// @Router /problemReply/findProblemReply [get]
+export const findProblemReply = (params) => {
+  return service({
+    url: '/problemReply/findProblemReply',
+    method: 'get',
+    params
+  })
+}
+
+// @Tags ProblemReply
+// @Summary 分页获取ProblemReply列表
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data query request.PageInfo true "分页获取ProblemReply列表"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
+// @Router /problemReply/getProblemReplyList [get]
+export const getProblemReplyList = (params) => {
+  return service({
+    url: '/problemReply/getProblemReplyList',
+    method: 'get',
+    params
+  })
+}

+ 223 - 0
web/src/view/problemReply/problemReply.vue

@@ -0,0 +1,223 @@
+<template>
+  <div>
+    <div class="search-term">
+      <el-form :inline="true" :model="searchInfo" class="demo-form-inline">
+        <el-form-item>
+          <el-button size="mini" type="primary" icon="el-icon-search" @click="onSubmit">查询</el-button>
+          <el-button size="mini" type="primary" icon="el-icon-plus" @click="openDialog">新增</el-button>
+          <el-popover v-model:visible="deleteVisible" placement="top" width="160">
+            <p>确定要删除吗?</p>
+            <div style="text-align: right; margin: 0">
+              <el-button size="mini" type="text" @click="deleteVisible = false">取消</el-button>
+              <el-button size="mini" type="primary" @click="onDelete">确定</el-button>
+            </div>
+            <template #reference>
+              <el-button icon="el-icon-delete" size="mini" type="danger" style="margin-left: 10px;">批量删除</el-button>
+            </template>
+          </el-popover>
+        </el-form-item>
+      </el-form>
+    </div>
+    <el-table
+      ref="multipleTable"
+      border
+      stripe
+      style="width: 100%"
+      tooltip-effect="dark"
+      :data="tableData"
+      @selection-change="handleSelectionChange"
+    >
+      <el-table-column type="selection" width="55" />
+      <el-table-column label="日期" width="180">
+        <template #default="scope">{{ formatDate(scope.row.CreatedAt) }}</template>
+      </el-table-column>
+      <el-table-column label="用户UUID" prop="uuid" />
+      <el-table-column label="用户昵称" prop="nickName" />
+      <el-table-column label="用户头像" prop="headerImg" />
+      <el-table-column label="用户回复" prop="replyMsg" />
+      <el-table-column label="问题 id" prop="problemId" />
+      <el-table-column label="按钮组">
+        <template #default="scope">
+          <el-button size="small" type="primary" icon="el-icon-edit" class="table-button" @click="updateProblemReply(scope.row)">变更</el-button>
+          <el-button type="danger" icon="el-icon-delete" size="mini" @click="deleteRow(scope.row)">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <el-pagination
+      layout="total, sizes, prev, pager, next, jumper"
+      :current-page="page"
+      :page-size="pageSize"
+      :page-sizes="[10, 30, 50, 100]"
+      :style="{float:'right',padding:'20px'}"
+      :total="total"
+      @current-change="handleCurrentChange"
+      @size-change="handleSizeChange"
+    />
+    <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" title="弹窗操作">
+      <el-form :model="formData" label-position="right" label-width="80px">
+        <el-form-item label="用户UUID:">
+          <el-input v-model="formData.uuid" clearable placeholder="请输入" />
+        </el-form-item>
+        <el-form-item label="用户昵称:">
+          <el-input v-model="formData.nickName" clearable placeholder="请输入" />
+        </el-form-item>
+        <el-form-item label="用户头像:">
+          <el-input v-model="formData.headerImg" clearable placeholder="请输入" />
+        </el-form-item>
+        <el-form-item label="用户回复:">
+          <el-input v-model="formData.replyMsg" clearable placeholder="请输入" />
+        </el-form-item>
+        <el-form-item label="问题 id:">
+          <el-input v-model.number="formData.problemId" clearable placeholder="请输入" />
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button @click="closeDialog">取 消</el-button>
+          <el-button type="primary" @click="enterDialog">确 定</el-button>
+        </div>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {
+  createProblemReply,
+  deleteProblemReply,
+  deleteProblemReplyByIds,
+  updateProblemReply,
+  findProblemReply,
+  getProblemReplyList
+} from '@/api/problemReply' //  此处请自行替换地址
+import infoList from '@/mixins/infoList'
+export default {
+  name: 'ProblemReply',
+  mixins: [infoList],
+  data() {
+    return {
+      listApi: getProblemReplyList,
+      dialogFormVisible: false,
+      type: '',
+      deleteVisible: false,
+      multipleSelection: [],
+      formData: {
+        uuid: '',
+        nickName: '',
+        headerImg: '',
+        replyMsg: '',
+        problemId: 0,
+      }
+    }
+  },
+  async created() {
+    await this.getTableData()
+  },
+  methods: {
+  // 条件搜索前端看此方法
+    onSubmit() {
+      this.page = 1
+      this.pageSize = 10
+      this.getTableData()
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val
+    },
+    deleteRow(row) {
+      this.$confirm('确定要删除吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.deleteProblemReply(row)
+      })
+    },
+    async onDelete() {
+      const ids = []
+      if (this.multipleSelection.length === 0) {
+        this.$message({
+          type: 'warning',
+          message: '请选择要删除的数据'
+        })
+        return
+      }
+      this.multipleSelection &&
+        this.multipleSelection.map(item => {
+          ids.push(item.ID)
+        })
+      const res = await deleteProblemReplyByIds({ ids })
+      if (res.code === 0) {
+        this.$message({
+          type: 'success',
+          message: '删除成功'
+        })
+        if (this.tableData.length === ids.length && this.page > 1) {
+          this.page--
+        }
+        this.deleteVisible = false
+        this.getTableData()
+      }
+    },
+    async updateProblemReply(row) {
+      const res = await findProblemReply({ ID: row.ID })
+      this.type = 'update'
+      if (res.code === 0) {
+        this.formData = res.data.reproblemReply
+        this.dialogFormVisible = true
+      }
+    },
+    closeDialog() {
+      this.dialogFormVisible = false
+      this.formData = {
+        uuid: '',
+        nickName: '',
+        headerImg: '',
+        replyMsg: '',
+        problemId: 0,
+      }
+    },
+    async deleteProblemReply(row) {
+      const res = await deleteProblemReply({ ID: row.ID })
+      if (res.code === 0) {
+        this.$message({
+          type: 'success',
+          message: '删除成功'
+        })
+        if (this.tableData.length === 1 && this.page > 1) {
+          this.page--
+        }
+        this.getTableData()
+      }
+    },
+    async enterDialog() {
+      let res
+      switch (this.type) {
+        case 'create':
+          res = await createProblemReply(this.formData)
+          break
+        case 'update':
+          res = await updateProblemReply(this.formData)
+          break
+        default:
+          res = await createProblemReply(this.formData)
+          break
+      }
+      if (res.code === 0) {
+        this.$message({
+          type: 'success',
+          message: '创建/更改成功'
+        })
+        this.closeDialog()
+        this.getTableData()
+      }
+    },
+    openDialog() {
+      this.type = 'create'
+      this.dialogFormVisible = true
+    }
+  },
+}
+</script>
+
+<style>
+</style>

+ 90 - 0
web/src/view/problemReply/problemReplyForm.vue

@@ -0,0 +1,90 @@
+<template>
+  <div>
+    <el-form :model="formData" label-position="right" label-width="80px">
+      <el-form-item label="用户UUID:">
+        <el-input v-model="formData.uuid" clearable placeholder="请输入" />
+      </el-form-item>
+      <el-form-item label="用户昵称:">
+        <el-input v-model="formData.nickName" clearable placeholder="请输入" />
+      </el-form-item>
+      <el-form-item label="用户头像:">
+        <el-input v-model="formData.headerImg" clearable placeholder="请输入" />
+      </el-form-item>
+      <el-form-item label="用户回复:">
+        <el-input v-model="formData.replyMsg" clearable placeholder="请输入" />
+      </el-form-item>
+      <el-form-item label="问题 id:">
+        <el-input v-model.number="formData.problemId" clearable placeholder="请输入" />
+      </el-form-item>
+      <el-form-item>
+        <el-button size="mini" type="primary" @click="save">保存</el-button>
+        <el-button size="mini" type="primary" @click="back">返回</el-button>
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+
+<script>
+import {
+  createProblemReply,
+  updateProblemReply,
+  findProblemReply
+} from '@/api/problemReply' //  此处请自行替换地址
+import infoList from '@/mixins/infoList'
+export default {
+  name: 'ProblemReply',
+  mixins: [infoList],
+  data() {
+    return {
+      type: '',
+      formData: {
+        uuid: '',
+        nickName: '',
+        headerImg: '',
+        replyMsg: '',
+        problemId: 0,
+      }
+    }
+  },
+  async created() {
+    // 建议通过url传参获取目标数据ID 调用 find方法进行查询数据操作 从而决定本页面是create还是update 以下为id作为url参数示例
+    if (this.$route.query.id) {
+      const res = await findProblemReply({ ID: this.$route.query.id })
+      if (res.code === 0) {
+        this.formData = res.data.reproblemReply
+        this.type = 'update'
+      }
+    } else {
+      this.type = 'create'
+    }
+  },
+  methods: {
+    async save() {
+      let res
+      switch (this.type) {
+        case 'create':
+          res = await createProblemReply(this.formData)
+          break
+        case 'update':
+          res = await updateProblemReply(this.formData)
+          break
+        default:
+          res = await createProblemReply(this.formData)
+          break
+      }
+      if (res.code === 0) {
+        this.$message({
+          type: 'success',
+          message: '创建/更改成功'
+        })
+      }
+    },
+    back() {
+      this.$router.go(-1)
+    }
+  }
+}
+</script>
+
+<style>
+</style>