内容管理

main
wangxia 2 years ago
parent ceb985e65a
commit 0ef39610bf

@ -184,16 +184,16 @@
var desp = ""; var desp = "";
console.log(); console.log();
// editor.setDocument("text/lake", ""); // editor.setDocument("text/lake", "");
window.addEventListener( window.addEventListener(
"message", "message",
function (event) { function (event) {
// debugger // debugger
// editor.setDocument("text/lake", ' '); // editor.setDocument("text/lake", ' ');
console.log("event", event); console.log("event", event);
var data = event.data; var data = event.data;
// 然后就可以获得vue传过来的数据 // 然后就可以获得vue传过来的数据
console.log("从vue中获得的数据", data); console.log("从vue中获得的数据", data);
editor.setDocument("text/lake", data); editor.setDocument("text/lake", data);
@ -202,12 +202,24 @@
}, },
"*" "*"
); );
editor.setDocument("text/lake", desp || ""); editor.setDocument("text/lake", desp || "");
// 监听内容变动 // 监听内容变动
let timer = null;
editor.on("contentchange", (e) => { editor.on("contentchange", (e) => {
var editorObj = { lake: editor.getDocument("text/lake"), html: editor.getDocument("text/html") }; var editorObj = { lake: editor.getDocument("text/lake"), html: editor.getDocument("text/html"),remake: editor.getDocument("text/plain") };
window.parent.postMessage(editorObj, "*");
console.log(editor.getDocument("text/lake")); // if (!timer) {
// clearTimeout(colorMark.value);
// timer = null;
clearTimeout(timer)
timer = setTimeout(() => {
// console.log(e);
window.parent.postMessage(editorObj, "*");
}, 500);
// }
// window.parent.postMessage(editorObj, "*");
// console.log(editor.getDocument("text/lake"));
// window.parent.postMessage(editor.getDocument("text/lake"), "*"); // window.parent.postMessage(editor.getDocument("text/lake"), "*");
}); });
editor.on("focusstatuschange", ({ focused }) => { editor.on("focusstatuschange", ({ focused }) => {

@ -0,0 +1,73 @@
import request from "../../utils/request";
import qs from "qs";
let setqs = function (data) {
return qs.stringify(data);
};
// 保存内容
export function saveMessageApi (data) {
console.log(data);
return request({
url: `/admin/cms/save`,
method: "POST",
data,
});
}
// 获取内容列表
export function getMessageListApi (data) {
return request({
url: `/admin/cms/${data.page}/${data.limit}`,
method: "get",
params: {
status: data.status,
keyword: data.keyword
}
// data,
});
}
// 获取内容
export function getMessageDetailApi (id) {
return request({
url: `/admin/cms/get/${id}`,
method: "get",
// data,
});
}
// 导入股权结构文件
export function importStockModelApi (data) {
return request({
url: `/admin/stock/structure/import`,
method: "post",
headers: {
"Content-Type": 'multipart/form-data',
},
data: setqs(data)
});
}
// 获取股权结构列表
export function getStockInfoListApi (data) {
return request({
url: `/admin/stock/structure/list`,
method: "get",
});
}
// 获取股权结构列表
export function getStockMoreListApi (data) {
return request({
url: `/admin/stock/change/list`,
method: "get",
});
}
// 删除用户
export function delUserApi (data) {
return request({
url: `/admin/user/remove/${data}`,
method: "DELETE",
});
}

@ -17,12 +17,12 @@ router.onError((error) => {
const err = /Failed to fetch dynamically/g; const err = /Failed to fetch dynamically/g;
const isChunkLoadFailed = error.message.match(pattern); const isChunkLoadFailed = error.message.match(pattern);
const isChunkLoadFailedErr = error.message.match(err); const isChunkLoadFailedErr = error.message.match(err);
if (isChunkLoadFailed || isChunkLoadFailedErr) { // if (isChunkLoadFailed || isChunkLoadFailedErr) {
message.error('系统已升级,正在刷新本地存储,请稍候...'); // message.error('系统已升级,正在刷新本地存储,请稍候...');
setTimeout(()=>{ // setTimeout(()=>{
location.reload(); // location.reload();
},2000) // },2000)
} // }
}); });
const app = createApp(App) const app = createApp(App)
app.config.globalProperties.G = G app.config.globalProperties.G = G

@ -1,22 +1,35 @@
<template> <template>
<div class="g_flex_row_center"> <div class="g_flex_row_center">
<div class="m-job-detail g_pt_24" style="width: 780px"> <div class="m-job-detail g_pt_24" style="width: 880px">
<div class="g_flex_row_center flex_center g_mb_16"> <a-form :model="currentInfo" class="main_container" @finish="submitInfo" :labelCol="{ span: 3 }" :wrapperCol="{ span: 20 }">
<div class="g_fs_14">标题</div> <a-form-item class="g_mb_12" label="标题" name="title" :rules="[{ required: true, message: '请输入标题' }]">
<div class="g_mt_0 g_br_6 g_flex_1" style="border: 1px solid #d9d9d9"> <a-input v-model:value="currentInfo.title" placeholder="请输入标题"></a-input>
<a-input v-model:value="currentInfo.title"></a-input> </a-form-item>
</div> <a-form-item class="g_mb_12" label="发布时间" name="publishTimeStr" :rules="[{ required: false, message: '请选择发布时间' }]">
</div> <a-date-picker v-model:value="currentInfo.publishTimeStr" placeholder="请选择发布时间" :minuteStep="30" format="YYYY-MM-DD HH:mm" :show-time="{ defaultValue: dayjs(currentTime, 'HH:mm:ss') }" style="width: 100%" />
<div class="g_flex_row_center"> </a-form-item>
<a-form-item class="g_mb_12" label="内容" :rules="[{ required: true, message: '请输入内容' }]" name="content">
<iframe src="../../../public/static/editor.html" class="g_border_d" width="100%" height="500px" frameborder="0" ref="iframeDom" style="border-radius: 6px"></iframe>
</a-form-item>
<!-- <div class="g_flex_row_center">
<div class="g_fs_14">内容</div>
<div class="g_mt_0 g_br_6 g_flex_1" style="border: 1px solid #d9d9d9"></div>
</div> -->
<a-form-item class="g_mb_12">
<div class="g_flex_row_start g_mt_24 g_ml_110">
<a-button class="g_mr_16" @click="cancel"></a-button>
<a-button class="g_mr_16" @click="subType = 0" html-type="submit">存草稿</a-button>
<a-button type="primary" @click="subType = 1" html-type="submit">发布</a-button>
</div>
</a-form-item>
</a-form>
<!-- <div class="g_flex_row_center">
<div class="g_fs_14">内容</div> <div class="g_fs_14">内容</div>
<div class="g_mt_0 g_br_6 g_flex_1" style="border: 1px solid #d9d9d9"> <div class="g_mt_0 g_br_6 g_flex_1" style="border: 1px solid #d9d9d9">
<iframe src="../../../public/static/editor.html" width="100%" height="500px" frameborder="0" ref="iframeDom" style="border-top-left-radius: 6px"></iframe> <iframe src="../../../public/static/editor.html" width="100%" height="500px" frameborder="0" ref="iframeDom" style="border-top-left-radius: 6px"></iframe>
</div> </div>
</div> </div> -->
<div class="g_flex_row_start g_mt_24 g_ml_42">
<a-button class="g_mr_16" @click="cancel"></a-button>
<a-button type="primary">发布</a-button>
</div>
</div> </div>
</div> </div>
</template> </template>
@ -27,7 +40,14 @@ const commonJS = getCurrentInstance().appContext.app.config.globalProperties.G;
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
const router = useRouter(); // const router = useRouter(); //
const route = useRoute(); const route = useRoute();
import dayjs from "dayjs";
import { saveMessageApi } from "../../api/messageConfig/message";
import { message } from "ant-design-vue";
import { useStore } from "@/stores/counter"; import { useStore } from "@/stores/counter";
//
const currentTime = ref(dayjs().format("HH") + ":00" + ":00");
// console.log('currentTime.value',currentTime.value);
const storeJS = useStore(); const storeJS = useStore();
let currentInfo = ref({}); let currentInfo = ref({});
onMounted(() => { onMounted(() => {
@ -49,8 +69,10 @@ const iframeDom = ref();
window.addEventListener("message", (val) => { window.addEventListener("message", (val) => {
// console.log(val.data); // console.log(val.data);
if (val.data.lake) { if (val.data.lake) {
currentInfo.value.desc_yq = val.data.lake; currentInfo.value.contentYuque = val.data.lake;
currentInfo.value.desc = val.data.html; currentInfo.value.content = val.data.html;
currentInfo.value.remake = val.data.remake;
console.log(currentInfo.value);
} }
}); });
const initData = () => { const initData = () => {
@ -65,9 +87,27 @@ const initData = () => {
} }
}; };
}; };
const cancel = ()=>{ const cancel = () => {
router.back() router.back();
} };
const subType = ref(0);
const submitInfo = () => {
console.log(subType.value);
console.log(currentInfo.value);
// console.log(dayjs(currentInfo.value.publishTimeStr).format("YYYY-MM-DD HH:mm"));
let obj = {
title: currentInfo.value.title,
content: currentInfo.value.content,
remake: currentInfo.value.remake,
contentYuque: currentInfo.value.contentYuque,
publishTimeStr: dayjs(currentInfo.value.publishTimeStr).format("YYYY-MM-DD HH:mm") + ":00",
status: subType.value,
};
saveMessageApi(obj).then((res) => {
router.back();
});
};
</script> </script>
<style lang="less" scoped></style> <style lang="less" scoped></style>

@ -6,6 +6,10 @@
<div class="g_w_320 g-search-btn g_mr_16"> <div class="g_w_320 g-search-btn g_mr_16">
<a-input-search v-model:value="tableData.keyword" placeholder="请输入关键字" @search="searchList" @change="handleChangeSearch" allowClear /> <a-input-search v-model:value="tableData.keyword" placeholder="请输入关键字" @search="searchList" @change="handleChangeSearch" allowClear />
</div> </div>
<a-radio-group v-model:value="infoType" @change="handleUpdateStatus">
<a-radio-button class="g_minw_80 g_p_0 g_text_c" :value="1">已发布</a-radio-button>
<a-radio-button class="g_minw_80 g_p_0 g_text_c" :value="0">草稿</a-radio-button>
</a-radio-group>
</div> </div>
<div> <div>
<!-- @click="openAdd" --> <!-- @click="openAdd" -->
@ -41,10 +45,13 @@
<template v-if="column.key === 'price'"> <template v-if="column.key === 'price'">
<!-- <div v-html="record.price"></div> --> <!-- <div v-html="record.price"></div> -->
</template> </template>
<template v-if="column.key === 'content'">
<!-- <div v-html="record.content"></div> -->
</template>
<template v-if="column.key === 'status'"> <template v-if="column.key === 'status'">
<a-switch @change="(e) => handleStatus(e, record)" :checked="record.status == 1 ? true : false" checked-children="" un-checked-children="" /> <a-switch @change="(e) => handleStatus(e, record)" :checked="record.status == 1 ? true : false" checked-children="" un-checked-children="" />
</template> </template>
<template v-if="column.key === 'state'"> <template v-if="column.key === 'state'">
<div class="g_flex_row_between"> <div class="g_flex_row_between">
<!-- <div <!-- <div
@ -145,6 +152,8 @@ import { PlusOutlined, EllipsisOutlined, UploadOutlined, DownOutlined } from "@a
import { Modal, message } from "ant-design-vue"; import { Modal, message } from "ant-design-vue";
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import { getUserListApi, updateUserStatusApi, addUserApi, delUserApi, updateUserApi } from "../../api/userList/userList"; import { getUserListApi, updateUserStatusApi, addUserApi, delUserApi, updateUserApi } from "../../api/userList/userList";
import { getMessageListApi } from "../../api/messageConfig/message";
import { DownloadOutlined } from "@ant-design/icons-vue"; import { DownloadOutlined } from "@ant-design/icons-vue";
import idCardPanel from "../components/upload/image.vue"; import idCardPanel from "../components/upload/image.vue";
@ -153,7 +162,9 @@ const router = useRouter(); // 应用路由
const route = useRoute(); const route = useRoute();
const commonJS = getCurrentInstance().appContext.app.config.globalProperties.G; const commonJS = getCurrentInstance().appContext.app.config.globalProperties.G;
const speed = ref(0); const speed = ref(0);
const showAdd = ref(0); const showAdd = ref(false);
const infoType = ref(1);
onMounted(() => { onMounted(() => {
getTable(); getTable();
}); });
@ -273,38 +284,40 @@ const tableData = ref({
jobType2Num: "-", jobType2Num: "-",
jobType1Num: "-", jobType1Num: "-",
}); });
const handleUpdateStatus = (e) => {
console.log(e);
getTable();
};
const getTable = () => { const getTable = () => {
console.log(tableData.value); console.log(tableData.value);
tableData.value.loading = true; tableData.value.loading = true;
getUserListApi({ limit: tableData.value.limit, page: tableData.value.page, keyword: tableData.value.keyword }).then((res) => { getMessageListApi({ limit: tableData.value.limit, page: tableData.value.page, keyword: tableData.value.keyword, status: infoType.value }).then((res) => {
console.log(res); console.log(res);
tableData.value = { ...res.data, keyword: tableData.value.keyword, page: res.data.current, limit: res.data.size }; tableData.value = { ...res.data, keyword: tableData.value.keyword, page: res.data.current, limit: res.data.size };
tableData.value.records.forEach((item, index) => { tableData.value.records.forEach((item, index) => {
item.rank = index + 1; item.rank = index + 1;
item.title = "常用发票主体信息"; // item.title = "";
item.content = "默认主体:郑州伯才科技有限公司 单位名称:郑州伯才科技有限公司 纳税人识别号91410100MA9L4HDT0L 地址:河南自贸试验区郑州"; // item.content = " 91410100MA9L4HDT0L ";
item.time = "2024-03-11 13:04:24"; // item.time = "2024-03-11 13:04:24";
}); });
}); });
}; };
const openAdd = (_type,_record) => { const openAdd = (_type, _record) => {
if(_type == 'add'){ if (_type == "add") {
router.push({ router.push({
path: "messageAdd", path: "messageAdd",
// query: { // query: {
// type: "add", // type: "add",
// }, // },
}); });
} else { } else {
router.push({ router.push({
path: "messageEdit", path: "messageEdit",
query: { query: {
id: _record.rank, id: _record.rank,
}, },
}); });
}
}
}; };
const columns = ref([ const columns = ref([
{ {

Loading…
Cancel
Save