消息管理

This commit is contained in:
du 2024-03-01 17:30:18 +08:00
parent eb93ce4810
commit 8718413202
5 changed files with 95 additions and 49 deletions

View File

@ -13,9 +13,11 @@ VITE_PROXY_API = /dev-api
# http://42.193.40.239:8017/doc.html//线上 http://192.168.110.186:8017/doc.html//本地 # http://42.193.40.239:8017/doc.html//线上 http://192.168.110.186:8017/doc.html//本地
# VITE_PROXY = [ ["/dev-api", "http://42.193.40.239:8017" ],["/dev-img-api", "http://file.sczysoft.com" ]] VITE_PROXY = [ ["/dev-api", "http://42.193.40.239:8017" ],["/dev-img-api", "http://file.sczysoft.com" ]]
VITE_PROXY = [ ["/dev-api", "http://192.168.110.186:8017" ],["/dev-img-api", "http://file.sczysoft.com" ]] # VITE_PROXY = [ ["/dev-api", "http://192.168.110.186:8017" ],["/dev-img-api", "http://file.sczysoft.com" ]]
# #
VITE_GLOB_UPLOAD_URL=/dev-api VITE_GLOB_UPLOAD_URL=/dev-api
VITE_UPLOAD_IMG_URL=/dev-img-api VITE_UPLOAD_IMG_URL=/dev-img-api
VITE_UPLOAD_URL = http://192.168.110.186 # VITE_UPLOAD_URL = http://192.168.110.186
VITE_UPLOAD_URL = http://42.193.40.239:8888

View File

@ -337,5 +337,25 @@ export function saveUser(data) {
data:params data:params
}); });
} }
/**
*-
*/
export function noticeDetail(params) {
return request({
url: `/admin/notice/noticeDetail/${params.govNoticeId}`,
method: "GET",
});
}
/**
*-
*/
export function noticeDel(params) {
return request({
url: `/admin/notice/noticeDel/${params.govNoticeId}`,
method: "POST",
});
}

View File

@ -25,8 +25,8 @@ const content = ref('')
const myQuillEditor = ref() const myQuillEditor = ref()
watch(() => props.value, (val) => { watch(() => props.value, (val) => {
// console.log(toRaw(myQuillEditor.value)) // console.log(toRaw(myQuillEditor.value))
// toRaw(myQuillEditor.value).setHTML(val) toRaw(myQuillEditor.value).setHTML(val)
content.value = val content.value = val;
}, { deep: true }) }, { deep: true })
const fileBtn = ref() const fileBtn = ref()
const data = reactive({ const data = reactive({

View File

@ -62,7 +62,7 @@ import useUserStore from "@/store/modules/user";
import { getYears, getUUID, FileType } from "@/utils/common"; import { getYears, getUUID, FileType } from "@/utils/common";
import { ElMessage, FormInstance, FormRules } from "element-plus"; import { ElMessage, FormInstance, FormRules } from "element-plus";
import { uploadFile, getFile, delFile } from "@/api/file"; import { uploadFile, getFile, delFile } from "@/api/file";
import { noticeAdd } from "@/api/Sys"; import { noticeAdd, noticeDetail } from "@/api/Sys";
const formRef = ref<FormInstance>(); const formRef = ref<FormInstance>();
const userStore = useUserStore(); const userStore = useUserStore();
@ -88,8 +88,10 @@ const props = defineProps({
const addMessageForm = ref<any>({ content: "",title:"" }); const addMessageForm = ref<any>({ content: "",title:"" });
const emits = defineEmits(["close", "onSubmit"]); const emits = defineEmits(["close", "onSubmit"]);
// //
const msgContent = ref('')
const getMsg = (val) => { const getMsg = (val) => {
addMessageForm.value.content = val; // addMessageForm.content = val;
msgContent.value = val;
}; };
//退 //退
@ -99,8 +101,9 @@ const handleSubmit = () => {
let params = { let params = {
...addMessageForm.value, ...addMessageForm.value,
coverImg:fileList.value[0].filepath, coverImg:fileList.value[0].filepath,
govNoticeId:addMessageForm.value.govNoticeId||uuid.value,
content : msgContent.value
} }
console.log(params,'params===>');
noticeAdd(params).then((res: any) => { noticeAdd(params).then((res: any) => {
if (res.code == 1) { if (res.code == 1) {
ElMessage.success({ ElMessage.success({
@ -126,31 +129,40 @@ const baseUrl = ref(import.meta.env.VITE_UPLOAD_URL);
}; };
// //
const getFiles = (FileType) => { const getFiles = (FileType) => {
console.log(FileType,'FileType==>');
console.log(addMessageForm.value.govNoticeId,'addMessageForm.value.govNoticeId===>');
getFile(addMessageForm.value.govNoticeId || uuid.value, FileType).then( getFile(addMessageForm.value.govNoticeId || uuid.value, FileType).then(
(res: any) => { (res: any) => {
console.log(res,'图片查询res==>');
fileList.value = res.data; fileList.value = res.data;
} }
); );
}; };
//
const getNoticeDetail = (id) =>{
let params = {
govNoticeId:id
}
noticeDetail(params).then(
(res: any) => {
addMessageForm.value = res.data;
getFiles(FileType.messageCover);
msgContent.value = res.data.content;
}
);
}
// //
const onclone = () => { const onclone = () => {
emits("close"); emits("close");
addMessageForm.value = {};
addMessageForm.value.content = "";
addMessageForm.value.title = "";
}; };
watch( watch(
() => props.visible, () => props.visible,
() => { () => {
uuid.value = getUUID(); uuid.value = getUUID();
addMessageForm.value = props.form; if (props.form.govNoticeId) {
console.log(addMessageForm.value,'addMessageForm===>'); getNoticeDetail(props.form.govNoticeId);
}
getFiles(FileType.messageCover);
} }
); );

View File

@ -41,7 +41,6 @@
v-loading="tableDataloading" v-loading="tableDataloading"
:data="tableData" :data="tableData"
header-row-class-name="el-one-header" header-row-class-name="el-one-header"
@selection-change="handleSelectionChange"
border border
> >
<el-table-column <el-table-column
@ -55,18 +54,22 @@
{{ scope.$index + 1 + (currentPage - 1) * pageSize }} {{ scope.$index + 1 + (currentPage - 1) * pageSize }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
prop="coverImg"
:resizable="true"
label="封面"
width="100"
align="center"
>
<template #default="scope">
<img class="coverImg" :src="baseUrl+scope.row.coverImg" alt="">
</template>
</el-table-column>
<el-table-column <el-table-column
prop="title" prop="title"
:resizable="true" :resizable="true"
label="标题" label="标题"
width="250"
>
</el-table-column>
<el-table-column
prop="content"
:resizable="true"
align="center" align="center"
label="内容"
> >
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -94,7 +97,7 @@
<svg-icon name="detail" class="icon"></svg-icon> <svg-icon name="detail" class="icon"></svg-icon>
<span class="detail">详情</span> <span class="detail">详情</span>
</span> </span>
<span class="operate" @click="clickDelete(scope.row.govNoticeId)"> <span class="operate" @click="del(scope.row.govNoticeId)">
<svg-icon name="delete" class="icon"></svg-icon> <svg-icon name="delete" class="icon"></svg-icon>
<span class="delete">删除</span> <span class="delete">删除</span>
</span> </span>
@ -127,7 +130,7 @@
<script lang='ts' setup> <script lang='ts' setup>
import { onMounted, reactive, ref } from "vue"; import { onMounted, reactive, ref } from "vue";
import { noticePage } from "@/api/Sys"; import { noticePage, noticeDel } from "@/api/Sys";
import { ElMessage, ElMessageBox } from "element-plus"; import { ElMessage, ElMessageBox } from "element-plus";
import AddModifyMessage from "./add-modify-message.vue"; import AddModifyMessage from "./add-modify-message.vue";
import useUserStore from "@/store/modules/user"; import useUserStore from "@/store/modules/user";
@ -135,6 +138,7 @@ const userStore = useUserStore();
const user = ref(JSON.parse(userStore.userInfo)); const user = ref(JSON.parse(userStore.userInfo));
const userId = ref(user.value.userId); const userId = ref(user.value.userId);
const baseUrl = ref(import.meta.env.VITE_UPLOAD_URL);
const search = ref(''); const search = ref('');
const tableData = ref([]); const tableData = ref([]);
const currentPage = ref(1); const currentPage = ref(1);
@ -162,27 +166,31 @@ const getList = () => {
tableDataloading.value = false; tableDataloading.value = false;
}); });
}; };
const clickDelete = (govNoticeId) => { //
// ElMessageBox.confirm("?", "", { const del = (id) => {
// confirmButtonText: "", ElMessageBox.confirm("是否确认删除?", "提示", {
// cancelButtonText: "", confirmButtonText: "是",
// type: "warning", cancelButtonText: "否",
// }).then(() => { type: "warning",
// delListperform(govNoticeId).then((res: any) => { }).then(() => {
// if (res.code == 1) { let params = {
// ElMessage.success({ govNoticeId:id
// message: "", }
// type: "success", noticeDel(params).then((res: any) => {
// }); if (res.code == 1) {
// } else { ElMessage.success({
// ElMessage.error({ message: "删除成功",
// message: res.message, type: "success",
// type: "error", });
// }); } else {
// } ElMessage.error({
// getList(); message: res.message,
// }); type: "error",
// }); });
}
getList();
});
});
}; };
// //
const onclone = () => { const onclone = () => {
@ -211,4 +219,8 @@ onMounted(() => {
margin-top: 16px; margin-top: 16px;
} }
} }
.coverImg {
width: 50px;
height: 50px;
}
</style> </style>