feat:敏感词页面
This commit is contained in:
1 parent
f68a0f9b5e
commit
94ee3201e2
8 files changed
+402
-88
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// 查询私聊消息列表
|
||||
export const page = async (data: any) => {
|
||||
return await request.post({
|
||||
url: '/chat/private-msg/page',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 获取私聊详细信息
|
||||
export const getInfo = async (id: any) => {
|
||||
return await request.get({
|
||||
url: '/chat/private-msg/getById?id=' + id,
|
||||
})
|
||||
}
|
||||
|
||||
// 私聊消息统计
|
||||
export const dailyCount = async (params: any) => {
|
||||
return await request.get({
|
||||
url: '/chat/private-msg/cout',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// 查询敏感词列表
|
||||
export const page = async (data: any) => {
|
||||
return await request.post({
|
||||
url: '/chat/sensitive/page',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 获取敏感词详细信息
|
||||
export const getInfo = async (id: any) => {
|
||||
return await request.get({
|
||||
url: '/chat/sensitive/getById?id=' + id,
|
||||
})
|
||||
}
|
||||
|
||||
// 创建或者更新敏感词
|
||||
export const createOrUpdate = async (data: any) => {
|
||||
return await request.post({
|
||||
url: '/chat/sensitive/createOrUpdate',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除敏感词
|
||||
export const delByIds = async (ids:any) => {
|
||||
return await request.delete({
|
||||
url: '/chat/sensitive/delByIds?ids=' + ids
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
|
||||
<el-button v-if="false" type="primary" plain @click="openForm('create')" v-hasPermi="['member:recent:create']">
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="操作" align="center" min-width="80px">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="openDetail(row.id)">
|
||||
详情
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination :total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
</ContentWrap>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { RecentApi, RecentVO } from '@/api/member/recent'
|
||||
|
||||
const message = useMessage()
|
||||
const { t } = useI18n()
|
||||
|
||||
const loading = ref(true)
|
||||
const list = ref<RecentVO[]>([])
|
||||
const total = ref(0)
|
||||
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
})
|
||||
|
||||
const queryFormRef = ref()
|
||||
const exportLoading = ref(false)
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await RecentApi.getRecentPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 打开会员详情 */
|
||||
const { push } = useRouter()
|
||||
const openDetail = (id: number) => {
|
||||
push({ name: 'MemberRecentDetail', params: { id } })
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await RecentApi.deleteRecent(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch { }
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="40%">
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="110px" v-loading="formLoading">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="敏感词" prop="content">
|
||||
<el-input v-model="formData.content" placeholder="请输入敏感词" class="!w-240px" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import * as sensitiveApi from "@/api/chat/sensitive"
|
||||
|
||||
defineOptions({ name: 'SensitiveForm' })
|
||||
|
||||
const { t } = useI18n()
|
||||
const message = useMessage()
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const formLoading = ref(false)
|
||||
const formType = ref('')
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
content: undefined,
|
||||
enabled: true,
|
||||
})
|
||||
const formRules = reactive({
|
||||
content: [{ required: true, message: '敏感词不能为空', trigger: 'blur' }],
|
||||
})
|
||||
const formRef = ref()
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await sensitiveApi.getInfo(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success'])
|
||||
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
if (!formRef) return
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) return
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value
|
||||
if (formType.value === 'create') {
|
||||
await sensitiveApi.createOrUpdate(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await sensitiveApi.createOrUpdate(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
content: undefined,
|
||||
enabled: true,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
@@ -0,0 +1,129 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
|
||||
<el-form-item label="敏感词" prop="content">
|
||||
<el-input v-model="queryParams.content" placeholder="请输入敏感词" clearable @keyup.enter="handleQuery"
|
||||
class="!w-240px" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery">
|
||||
<Icon icon="ep:search" class="mr-5px" /> 搜索
|
||||
</el-button>
|
||||
<el-button @click="resetQuery">
|
||||
<Icon icon="ep:refresh" class="mr-5px" /> 重置
|
||||
</el-button>
|
||||
<el-button type="primary" plain @click="openForm('create')">
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="敏感词" prop="content" align="center" min-width="120px" />
|
||||
<el-table-column label="状态" prop="enabled" align="center" min-width="120px">
|
||||
<template #default="{ row }">
|
||||
<el-switch v-model="row.enabled" active-text="启用" inactive-text="停用" @change="enabledChange(row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" width="180px" />
|
||||
<el-table-column label="操作" align="center" min-width="80px">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="openForm('update', row.id)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button link type="danger" @click="handleDelete(row.id)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
</ContentWrap>
|
||||
<sensitive-form ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
|
||||
import * as sensitiveApi from '@/api/chat/sensitive'
|
||||
|
||||
import SensitiveForm from './cmp/sensitive-form.vue'
|
||||
|
||||
const message = useMessage()
|
||||
const { t } = useI18n()
|
||||
|
||||
const loading = ref(true)
|
||||
const list = ref([])
|
||||
const total = ref(0)
|
||||
|
||||
const queryParams = reactive({
|
||||
content: '',
|
||||
enabled: null,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
})
|
||||
|
||||
const queryFormRef = ref()
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await sensitiveApi.page(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 启用/停用
|
||||
const enabledChange = async (row: any) => {
|
||||
try {
|
||||
await sensitiveApi.createOrUpdate(row)
|
||||
getList()
|
||||
message.success("操作成功")
|
||||
} catch (error) {
|
||||
console.log("|启用/停用|,意外的错误", error);
|
||||
}
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await sensitiveApi.delByIds([id])
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch { }
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
@@ -1,12 +1,6 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="800">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="110px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="110px" v-loading="formLoading">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="等级名称" prop="name">
|
||||
@@ -15,38 +9,21 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="等级" prop="level">
|
||||
<el-input-number
|
||||
v-model="formData.level"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
placeholder="请输入等级"
|
||||
class="!w-240px"
|
||||
/>
|
||||
<el-input-number v-model="formData.level" :min="0" :precision="0" placeholder="请输入等级" class="!w-240px" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="升级经验" prop="experience">
|
||||
<el-input-number
|
||||
v-model="formData.experience"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
placeholder="请输入升级经验"
|
||||
class="!w-240px"
|
||||
/>
|
||||
<el-input-number v-model="formData.experience" :min="0" :precision="0" placeholder="请输入升级经验"
|
||||
class="!w-240px" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="享受折扣(%)" prop="discountPercent">
|
||||
<el-input-number
|
||||
v-model="formData.discountPercent"
|
||||
:min="0"
|
||||
:max="100"
|
||||
:precision="0"
|
||||
placeholder="请输入享受折扣"
|
||||
class="!w-240px"
|
||||
/>
|
||||
<el-input-number v-model="formData.discountPercent" :min="0" :max="100" :precision="0" placeholder="请输入享受折扣"
|
||||
class="!w-240px" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -64,11 +41,7 @@
|
||||
</el-row>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="formData.status">
|
||||
<el-radio
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||
:key="dict.value"
|
||||
:value="dict.value"
|
||||
>
|
||||
<el-radio v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)" :key="dict.value" :value="dict.value">
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
|
||||
@@ -3,35 +3,24 @@
|
||||
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
|
||||
<el-form-item label="等级名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入等级名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
<el-input v-model="queryParams.name" placeholder="请输入等级名称" clearable @keyup.enter="handleQuery"
|
||||
class="!w-240px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable class="!w-240px">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)" :key="dict.value" :label="dict.label"
|
||||
:value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button @click="handleQuery">
|
||||
<Icon icon="ep:search" class="mr-5px" /> 搜索
|
||||
</el-button>
|
||||
<el-button @click="resetQuery">
|
||||
<Icon icon="ep:refresh" class="mr-5px" /> 重置
|
||||
</el-button>
|
||||
<el-button type="primary" @click="openForm('create')" v-hasPermi="['member:level:create']">
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
@@ -45,20 +34,13 @@
|
||||
<el-table-column label="编号" align="center" prop="id" min-width="60" />
|
||||
<el-table-column label="等级图标" align="center" prop="icon" min-width="80">
|
||||
<template #default="scope">
|
||||
<el-image
|
||||
:src="scope.row.icon"
|
||||
class="h-30px w-30px"
|
||||
:preview-src-list="[scope.row.icon]"
|
||||
/>
|
||||
<el-image :src="scope.row.icon" class="h-30px w-30px" :preview-src-list="[scope.row.icon]" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="等级背景图" align="center" prop="backgroundUrl" min-width="100">
|
||||
<template #default="scope">
|
||||
<el-image
|
||||
:src="scope.row.backgroundUrl"
|
||||
class="h-30px w-30px"
|
||||
:preview-src-list="[scope.row.backgroundUrl]"
|
||||
/>
|
||||
<el-image :src="scope.row.backgroundUrl" class="h-30px w-30px"
|
||||
:preview-src-list="[scope.row.backgroundUrl]" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="等级名称" align="center" prop="name" min-width="100" />
|
||||
@@ -70,29 +52,13 @@
|
||||
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
min-width="170"
|
||||
/>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" min-width="170" />
|
||||
<el-table-column label="操作" align="center" min-width="110px" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['member:level:update']"
|
||||
>
|
||||
<el-button link type="primary" @click="openForm('update', scope.row.id)" v-hasPermi="['member:level:update']">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['member:level:delete']"
|
||||
>
|
||||
<el-button link type="danger" @click="handleDelete(scope.row.id)" v-hasPermi="['member:level:delete']">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -161,7 +127,7 @@ const handleDelete = async (id: number) => {
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
} catch { }
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
|
||||
@@ -58,13 +58,13 @@
|
||||
</div>
|
||||
<div class="table-cell">
|
||||
<span>职业:</span>
|
||||
<span>{{ row.member.memberOcc || '未知' }}米</span>
|
||||
<span>{{ row.member.memberOcc || '未知' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-1">
|
||||
<div class="table-cell">
|
||||
<span>身高:</span>
|
||||
<span>{{ row.member.memberHeight || '未知' }}米</span>
|
||||
<span>{{ row.member.memberHeight || '未知' }}</span>
|
||||
</div>
|
||||
<div class="table-cell">
|
||||
<span>体重:</span>
|
||||
|
||||
Reference in new issue
Block a user