咨询等功能完善

This commit is contained in:
menxipeng
2025-08-15 15:55:13 +08:00
parent ebc3e110b7
commit 37623bcab9
18 changed files with 937 additions and 11 deletions

View File

@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询咨询列列表
export function listInfo(query) {
return request({
url: '/system/info/list',
method: 'get',
params: query
})
}
// 查询咨询列详细
export function getInfo(id) {
return request({
url: '/system/info/' + id,
method: 'get'
})
}
// 新增咨询列
export function addInfo(data) {
return request({
url: '/system/info',
method: 'post',
data: data
})
}
// 修改咨询列
export function updateInfo(data) {
return request({
url: '/system/info',
method: 'put',
data: data
})
}
// 删除咨询列
export function delInfo(id) {
return request({
url: '/system/info/' + id,
method: 'delete'
})
}

View File

@@ -30,6 +30,34 @@ import Layout from '@/layout'
// 公共路由
export const constantRoutes = [
// 咨询管理路由
{
path: '/consult',
component: Layout,
hidden: false,
children: [
{
path: 'index',
component: () => import('@/views/consult/index'),
name: 'ConsultList',
meta: { title: '咨询列表', icon: 'list' }
},
{
path: 'add',
component: () => import('@/views/consult/add'),
name: 'ConsultAdd',
meta: { title: '添加文章', activeMenu: '/consult/index' },
hidden: true
},
{
path: 'edit/:id',
component: () => import('@/views/consult/edit'),
name: 'ConsultEdit',
meta: { title: '编辑文章', activeMenu: '/consult/index' },
hidden: true
}
]
},
{
path: '/redirect',
component: Layout,

View File

@@ -0,0 +1,243 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="文章名称" prop="title">
<el-input
v-model="queryParams.title"
placeholder="请输入文章名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="子标题" prop="subTitle">
<el-input
v-model="queryParams.subTitle"
placeholder="请输入子标题"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="作者" prop="author">
<el-input
v-model="queryParams.author"
placeholder="请输入作者"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" 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>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:info:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:info:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:info:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:info:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="文章名称" align="center" prop="title" />
<el-table-column label="子标题" align="center" prop="subTitle" />
<el-table-column label="封面图片" align="center" prop="bannerImg">
<template slot-scope="scope">
<el-image
style="width: 80px; height: 50px"
:src="scope.row.bannerImg"
:preview-src-list="[scope.row.bannerImg]">
</el-image>
</template>
</el-table-column>
<el-table-column label="轮播图片" align="center" prop="rotaImg">
<template slot-scope="scope">
<el-tag v-if="scope.row.rotaImg" type="info">{{ scope.row.rotaImg.split(',').length }}张图片</el-tag>
<el-tag v-else type="info">无图片</el-tag>
</template>
</el-table-column>
<el-table-column label="正文" align="center" prop="content">
<template slot-scope="scope">
<el-tooltip class="item" effect="dark" :content="scope.row.content" placement="top-start">
<div class="content-preview">{{ scope.row.content | ellipsis }}</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="作者" align="center" prop="author" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:info:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:info:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 已移除对话框改为使用独立页面 -->
</div>
</template>
<script>
import { listInfo, getInfo, delInfo } from "@/api/consult/info"
import { parseTime } from "@/utils/ruoyi"
export default {
name: "Info",
filters: {
// 内容截取过滤器
ellipsis(value) {
if (!value) return '';
if (value.length > 30) {
return value.slice(0, 30) + '...';
}
return value;
}
},
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 咨询列表格数据
infoList: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
title: null,
subTitle: null,
content: null,
author: null
}
}
},
created() {
this.getList()
},
methods: {
/** 查询咨询列列表 */
getList() {
this.loading = true
listInfo(this.queryParams).then(response => {
this.infoList = response.rows
this.total = response.total
this.loading = false
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.$router.push('/consult/add');
},
/** 修改按钮操作 */
handleUpdate(row) {
const id = row.id || this.ids
this.$router.push(`/consult/edit/${id}`);
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除咨询列编号为"' + ids + '"的数据项?').then(function() {
return delInfo(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('system/info/export', {
...this.queryParams
}, `info_${new Date().getTime()}.xlsx`)
}
}
}
</script>

View File

@@ -206,6 +206,7 @@
:limit="1"
:file-type="['mp3', 'wav', 'flac']"
action="/back/upload/music/file"
:fileSize="500"
/>
</el-form-item>
</el-form>

View File

@@ -11,7 +11,7 @@ const name = process.env.VUE_APP_TITLE || '音乐APP后台管理系统' // 网
// const baseUrl = 'http://localhost:8080' // 后端接口
// const baseUrl = 'http://60.205.107.210:8080' // 后端接口
const baseUrl = 'http://192.168.31.239:8080' // 后端接口
const baseUrl = 'http://192.168.31.240:8080' // 后端接口
const port = process.env.port || process.env.npm_config_port || 80 // 端口