diff --git a/components.d.ts b/components.d.ts index 77ea662..b62f245 100644 --- a/components.d.ts +++ b/components.d.ts @@ -13,6 +13,7 @@ declare module 'vue' { ABreadcrumbItem: typeof import('ant-design-vue/es')['BreadcrumbItem'] AButton: typeof import('ant-design-vue/es')['Button'] ACard: typeof import('ant-design-vue/es')['Card'] + ACarousel: typeof import('ant-design-vue/es')['Carousel'] ACol: typeof import('ant-design-vue/es')['Col'] AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider'] ADatePicker: typeof import('ant-design-vue/es')['DatePicker'] @@ -53,6 +54,7 @@ declare module 'vue' { ATag: typeof import('ant-design-vue/es')['Tag'] ATextarea: typeof import('ant-design-vue/es')['Textarea'] AUpload: typeof import('ant-design-vue/es')['Upload'] + AUploadDragger: typeof import('ant-design-vue/es')['UploadDragger'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] } diff --git a/dist8月15日.zip b/dist8月15日.zip new file mode 100644 index 0000000..d0961cc Binary files /dev/null and b/dist8月15日.zip differ diff --git a/src/layout/manage/ManageSidebar.vue b/src/layout/manage/ManageSidebar.vue index e81d059..042f072 100644 --- a/src/layout/manage/ManageSidebar.vue +++ b/src/layout/manage/ManageSidebar.vue @@ -52,6 +52,7 @@ 课程管理 课程订单 + 课程购买须知 @@ -86,6 +87,10 @@ 员工申请须知 + + + 轮播图管理 + diff --git a/src/router/index.ts b/src/router/index.ts index a6d9f67..7f8dfb8 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,11 +1,11 @@ import {createRouter, createWebHashHistory} from "vue-router"; import {routes} from "./routes"; -// 创建路由实例并传递 `routes` 配置 + const router = createRouter({ - // 4. 内部提供了 history 模式的实现。为了简单起见,我们在这里使用 hash 模式。 + history: createWebHashHistory(), - routes, // `routes: routes` 的缩写 + routes, }) export default router \ No newline at end of file diff --git a/src/router/routes.ts b/src/router/routes.ts index a311555..a9b7fa5 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -1,6 +1,6 @@ -// 将路由规则 routes 导出 + export const routes = [ - // 全局路由(无需嵌套上左右整体布局) + { path: '/', name: 'Login', @@ -11,12 +11,12 @@ export const routes = [ name: '全局测试页面', component: () => import("../view/Test.vue"), }, - // 管理端 + { path: '/manage', component: () => import("../layout/ManageLayout.vue"), children: [ - // 首页 + { path: '/index', name: '首页', @@ -182,6 +182,16 @@ export const routes = [ name:'员工申请须知', component: ()=> import("../view/employeeApplication/applicationInstructions.vue") }, + { + path:'/coursePurchaseNotice', + name:'课程购买须知', + component: ()=> import("../view/course/coursePurchaseNotice.vue") + }, + { + path:'/carouselManagement', + name:'轮播图管理', + component: ()=> import("../view/carousel/carouselManagement.vue") + }, ] }, ] \ No newline at end of file diff --git a/src/view/carousel/carouselManagement.vue b/src/view/carousel/carouselManagement.vue new file mode 100644 index 0000000..2f4ec89 --- /dev/null +++ b/src/view/carousel/carouselManagement.vue @@ -0,0 +1,510 @@ + + + + + \ No newline at end of file diff --git a/src/view/components/RichTextEditor.vue b/src/view/components/RichTextEditor.vue index d723f00..514ecc2 100644 --- a/src/view/components/RichTextEditor.vue +++ b/src/view/components/RichTextEditor.vue @@ -70,7 +70,7 @@ const editorConfig = { }) if (res.code === 1) { - // 拼接完整 URL 地址再插入到富文本中 + const imageUrl = 'https://www.chenxinzhi.top/file/download/' + res.data insertFn(imageUrl) } else { @@ -119,6 +119,20 @@ onBeforeUnmount(() => { editorRef.value.destroy() } }) + + +// 添加清空方法 +const clearContent = () => { + if (editorRef.value) { + editorRef.value.setHtml(''); + valueHtml.value = ''; + } +}; + +// 暴露清空方法给父组件 +defineExpose({ + clearContent +}); \ No newline at end of file diff --git a/src/view/employeeApplication/applicationInstructions.vue b/src/view/employeeApplication/applicationInstructions.vue index 91f414e..0aa019e 100644 --- a/src/view/employeeApplication/applicationInstructions.vue +++ b/src/view/employeeApplication/applicationInstructions.vue @@ -33,7 +33,7 @@ import RichTextEditor from '../components/RichTextEditor.vue'; import '@vueup/vue-quill/dist/vue-quill.snow.css'; import myAxios from "../../api/myAxios.ts"; -// 定义表单数据结构 + interface NoticeForm { templateString: string; } @@ -44,14 +44,14 @@ const formData = reactive({ const editorRef = ref | null>(null); const errorMessage = ref(''); -const editorContent = ref(''); // 单独管理编辑器内容 +const editorContent = ref(''); // 增强Base64编码方法 const encode64 = (text: string): string => { if (!text.trim()) return ''; try { - // 使用更健壮的Base64编码 + return btoa(unescape(encodeURIComponent(text))); } catch (error) { console.error('Base64编码失败:', error); @@ -59,25 +59,23 @@ const encode64 = (text: string): string => { } }; -// 处理编辑器内容变化 + const handleEditorChange = (html: string) => { formData.templateString = html; editorContent.value = html; }; -// 检查内容是否为空(去除所有HTML标签) + const isContentEmpty = (html: string): boolean => { if (!html) return true; try { - // 创建临时元素解析HTML + const tempDiv = document.createElement('div'); tempDiv.innerHTML = html; - // 获取纯文本内容 const plainText = tempDiv.textContent || ''; - // 检查是否有实际内容 return plainText.trim() === ''; } catch (error) { console.error('内容解析失败:', error); @@ -90,7 +88,6 @@ const handleSubmit = async () => { await nextTick(); const storedToken = localStorage.getItem('token'); - // 检查内容是否为空 if (isContentEmpty(formData.templateString)) { errorMessage.value = '须知内容不能为空'; return; @@ -98,7 +95,7 @@ const handleSubmit = async () => { const encryptedContent = encode64(formData.templateString); - // 检查加密结果是否有效 + if (!encryptedContent) { errorMessage.value = '内容加密失败,请检查输入内容'; return; @@ -124,6 +121,10 @@ const handleSubmit = async () => { console.log(res) if (res.code === 1) { alert('须知保存成功!'); + + if (editorRef.value) { + editorRef.value.clearContent(); + } formData.templateString = ''; editorContent.value = ''; errorMessage.value = ''; @@ -135,13 +136,13 @@ const handleSubmit = async () => { let detailedError = '提交失败:'; if (error.response) { - // 优先显示后端返回的错误信息 + const serverMessage = error.response.data?.message || error.response.data?.error || '无详细错误信息'; detailedError += `服务器响应错误 (${error.response.status}): ${serverMessage}`; - // 特殊处理40000错误(空字符串错误) + if (error.response.data?.code === 40000) { detailedError = '须知内容不能为空'; } @@ -162,7 +163,7 @@ onMounted(() => {