mirror of
https://github.com/TangSengDaoDao/TangSengDaoDaoManager
synced 2025-06-06 09:08:23 +00:00
feat: ✨新增违禁词
This commit is contained in:
parent
d814cf1263
commit
914bdcea67
@ -44,6 +44,22 @@ export function messageProhibitWordsGet(params: any) {
|
|||||||
params
|
params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// 新增违禁词
|
||||||
|
export function messageProhibitWordsPost(params: any) {
|
||||||
|
return request({
|
||||||
|
url: '/manager/message/prohibit_words',
|
||||||
|
method: 'post',
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 删除违禁词
|
||||||
|
export function messageProhibitWordsDelete(params: any) {
|
||||||
|
return request({
|
||||||
|
url: '/manager/message/prohibit_words',
|
||||||
|
method: 'delete',
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 单聊天消息
|
// 单聊天消息
|
||||||
export function messageRecordpersonalGet(params: any) {
|
export function messageRecordpersonalGet(params: any) {
|
||||||
|
82
src/components/BdProhitWords/index.vue
Normal file
82
src/components/BdProhitWords/index.vue
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
:model-value="value"
|
||||||
|
:width="600"
|
||||||
|
:align-center="true"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:close-on-press-escape="false"
|
||||||
|
:draggable="true"
|
||||||
|
:z-index="99"
|
||||||
|
title="添加违禁词"
|
||||||
|
@close="onClose"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<el-input v-model="content" :rows="6" type="textarea" placeholder="请输入违禁词" />
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<el-space>
|
||||||
|
<el-button @click="onClose">取消</el-button>
|
||||||
|
<el-button type="primary" :loading="loaging" @click="onSend">发送</el-button>
|
||||||
|
</el-space>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" name="BdProhitWords" setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { ElMessage } from 'element-plus';
|
||||||
|
// API 接口
|
||||||
|
import { messageProhibitWordsPost } from '@/api/message';
|
||||||
|
interface IProps {
|
||||||
|
value: boolean;
|
||||||
|
}
|
||||||
|
const props = withDefaults(defineProps<IProps>(), {
|
||||||
|
value: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const content = ref('');
|
||||||
|
const loaging = ref<boolean>(false);
|
||||||
|
|
||||||
|
const emits = defineEmits<{
|
||||||
|
(e: 'update:value', item: boolean): void;
|
||||||
|
(e: 'ok', item: any): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.value,
|
||||||
|
(n, _o) => {
|
||||||
|
console.log(props.value);
|
||||||
|
props.value = n;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
// 取消
|
||||||
|
const onClose = () => {
|
||||||
|
emits('update:value', false);
|
||||||
|
};
|
||||||
|
// 发送
|
||||||
|
const onSend = () => {
|
||||||
|
if (!content.value) {
|
||||||
|
return ElMessage.info('请输入违禁词!');
|
||||||
|
}
|
||||||
|
const fromData = {
|
||||||
|
content: content.value
|
||||||
|
};
|
||||||
|
loaging.value = true;
|
||||||
|
messageProhibitWordsPost(fromData)
|
||||||
|
.then((res: any) => {
|
||||||
|
loaging.value = false;
|
||||||
|
if (res.status == 200) {
|
||||||
|
ElMessage.success('发送成功!');
|
||||||
|
content.value = '';
|
||||||
|
onClose();
|
||||||
|
emits('ok', true);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
loaging.value = false;
|
||||||
|
if (err.status == 400) {
|
||||||
|
ElMessage.error(err.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
@ -13,7 +13,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item class="mb-0 !mr-0">
|
<el-form-item class="mb-0 !mr-0">
|
||||||
<el-button type="primary" @click="getTableList">查询</el-button>
|
<el-button type="primary" @click="getTableList">查询</el-button>
|
||||||
<el-button type="primary">新增违禁词</el-button>
|
<el-button type="primary" @click="onAddProhitWords">新增违禁词</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
@ -54,6 +54,8 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 新增违禁词 -->
|
||||||
|
<bd-prohit-words v-model:value="prohitWordsValue" @ok="okSand" />
|
||||||
</bd-page>
|
</bd-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -64,9 +66,9 @@ meta:
|
|||||||
</route>
|
</route>
|
||||||
|
|
||||||
<script lang="tsx" setup>
|
<script lang="tsx" setup>
|
||||||
import { ElButton, ElSpace } from 'element-plus';
|
import { ElButton, ElSpace, ElText, ElMessage, ElMessageBox } from 'element-plus';
|
||||||
// API 接口
|
// API 接口
|
||||||
import { messageProhibitWordsGet } from '@/api/message';
|
import { messageProhibitWordsGet, messageProhibitWordsDelete } from '@/api/message';
|
||||||
/**
|
/**
|
||||||
* 表格
|
* 表格
|
||||||
*/
|
*/
|
||||||
@ -79,8 +81,9 @@ const column = reactive<Column.ColumnOptions[]>([
|
|||||||
prop: 'is_deleted',
|
prop: 'is_deleted',
|
||||||
label: '是否删除',
|
label: '是否删除',
|
||||||
width: 160,
|
width: 160,
|
||||||
formatter(row: any) {
|
render: (scope: any) => {
|
||||||
return row['is_deleted'] === 1 ? '是' : '否';
|
const type = scope.row['is_deleted'] === 1 ? 'danger' : '';
|
||||||
|
return <ElText type={type}> {scope.row['is_deleted'] === 1 ? '是' : '否'}</ElText>;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -95,10 +98,11 @@ const column = reactive<Column.ColumnOptions[]>([
|
|||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
width: 120,
|
width: 120,
|
||||||
render: (scope: any) => {
|
render: (scope: any) => {
|
||||||
|
const type = scope.row['is_deleted'] === 0 ? 'danger' : 'warning';
|
||||||
return (
|
return (
|
||||||
<ElSpace>
|
<ElSpace>
|
||||||
<ElButton type="primary" onClick={() => aa(scope.row)}>
|
<ElButton type={type} onClick={() => onDel(scope.row)}>
|
||||||
删除
|
{scope.row['is_deleted'] == 0 ? '删除' : '恢复'}
|
||||||
</ElButton>
|
</ElButton>
|
||||||
</ElSpace>
|
</ElSpace>
|
||||||
);
|
);
|
||||||
@ -138,8 +142,54 @@ const onCurrentChange = (current: number) => {
|
|||||||
getTableList();
|
getTableList();
|
||||||
};
|
};
|
||||||
|
|
||||||
const aa = (a: any) => {
|
// 新增违禁词
|
||||||
console.log(a);
|
const prohitWordsValue = ref<boolean>(false);
|
||||||
|
const onAddProhitWords = () => {
|
||||||
|
prohitWordsValue.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 确定新增违禁词
|
||||||
|
const okSand = () => {
|
||||||
|
getTableList();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 删除违禁词
|
||||||
|
const prohitWordsDel = (item: any) => {
|
||||||
|
console.log(item);
|
||||||
|
const formData = {
|
||||||
|
is_deleted: item.is_deleted == 1 ? 0 : 1,
|
||||||
|
id: item.id
|
||||||
|
};
|
||||||
|
const msg = item.is_deleted === 0 ? '删除违禁词成功!' : '恢复违禁词成功!';
|
||||||
|
messageProhibitWordsDelete(formData).then((res: any) => {
|
||||||
|
if (res.status == 200) {
|
||||||
|
getTableList();
|
||||||
|
ElMessage({
|
||||||
|
type: 'success',
|
||||||
|
message: msg
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
// 确定删除违禁词
|
||||||
|
const onDel = (item: any) => {
|
||||||
|
const title = item.is_deleted === 0 ? '删除违禁词' : '恢复违禁词';
|
||||||
|
const content = item.is_deleted === 0 ? `确定要删除违禁词[${item.content}]吗` : `确定要恢复违禁词[${item.content}]吗`;
|
||||||
|
ElMessageBox.confirm(content, title, {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
closeOnClickModal: false,
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
prohitWordsDel(item);
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
ElMessage({
|
||||||
|
type: 'info',
|
||||||
|
message: '取消成功!'
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 初始化
|
// 初始化
|
||||||
|
1
src/types/components.d.ts
vendored
1
src/types/components.d.ts
vendored
@ -11,6 +11,7 @@ declare module 'vue' {
|
|||||||
Approver: typeof import('./../components/bdWorkflow/nodes/approver.vue')['default']
|
Approver: typeof import('./../components/bdWorkflow/nodes/approver.vue')['default']
|
||||||
BdMsg: typeof import('./../components/BdMsg/index.vue')['default']
|
BdMsg: typeof import('./../components/BdMsg/index.vue')['default']
|
||||||
BdPage: typeof import('./../components/BdPage/index.vue')['default']
|
BdPage: typeof import('./../components/BdPage/index.vue')['default']
|
||||||
|
BdProhitWords: typeof import('./../components/BdProhitWords/index.vue')['default']
|
||||||
BdSandAllMsg: typeof import('./../components/BdSandAllMsg/index.vue')['default']
|
BdSandAllMsg: typeof import('./../components/BdSandAllMsg/index.vue')['default']
|
||||||
BdSendMsg: typeof import('./../components/BdSendMsg/index.vue')['default']
|
BdSendMsg: typeof import('./../components/BdSendMsg/index.vue')['default']
|
||||||
BdStatistic: typeof import('./../components/BdStatistic/index.vue')['default']
|
BdStatistic: typeof import('./../components/BdStatistic/index.vue')['default']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user