lrf hace 2 años
padre
commit
09f7ad1d44

+ 2 - 2
public/index.html

@@ -4,8 +4,8 @@
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
-    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
-    <title><%= htmlWebpackPlugin.options.title %></title>
+    <link rel="icon" href="https://broadcast.waityou24.cn/files/point/indexModule/20221010124133.png">
+    <title>天恩活泉</title>
   </head>
   <body>
     <noscript>

+ 40 - 6
src/components/editor.vue

@@ -1,8 +1,8 @@
 <template>
   <div id="editor">
     <div style="border: 1px solid #ccc">
-      <Toolbar style="border-bottom: 1px solid #ccc" :editor="editor" :defaultConfig="toolbarConfig" :mode="mode" />
-      <Editor class="editor" :value="text" @input="toInput" :defaultConfig="ec" :mode="mode" @onCreated="onCreated" />
+      <Toolbar style="border-bottom: 1px solid #ccc" :editor="editor" :defaultConfig="tb" :mode="mode" />
+      <Editor class="editor" :style="{ height }" :value="text" @input="toInput" :defaultConfig="ec" :mode="mode" @onCreated="onCreated" />
     </div>
   </div>
 </template>
@@ -15,8 +15,8 @@ export default {
   props: {
     text: { type: String },
     mode: { type: String, default: 'default' }, // 或者simple
-    toolbarConfig: { type: Object, default: () => ({}) },
-    editorConfig: { type: Object, default: () => ({}) },
+    height: { type: String, default: '500px' },
+    url: { type: String },
   },
   model: {
     prop: 'text',
@@ -26,7 +26,13 @@ export default {
   data: function () {
     return {
       editor: null,
-      ec: { placeholder: '请输入内容...', ...this.editorConfig },
+      ec: {
+        placeholder: '请输入内容...',
+        MENU_CONF: { uploadImage: { server: this.url, customInsert: this.customPicInsert } },
+      },
+      tb: {
+        excludeKeys: ['insertImage', 'insertVideo', 'uploadVideo', 'video'],
+      },
     };
   },
   created() {},
@@ -37,19 +43,47 @@ export default {
     toInput(e) {
       this.$emit('input', e);
     },
+    /**
+     * 自定义上传处理
+     * @param {Object} result 上传结果
+     * @param {Function} insertFn 编辑器添加上传结果函数
+     * @prop {result} {
+     *  errcode,
+     *  errmsg,
+     *  id,
+     *  name,
+     *  uri:短地址
+     * }
+     */
+    customPicInsert(result, insertFn) {
+      const { errcode, uri, name } = result;
+      const url = `http://broadcast.waityou24.cn${uri}`;
+      if (errcode === 0) {
+        insertFn(url, name);
+      }
+    },
   },
   beforeDestroy() {
     const editor = this.editor;
     if (editor == null) return;
     editor.destroy(); // 组件销毁时,及时销毁编辑器
   },
+  watch: {
+    url: {
+      immediate: true,
+      handler(val) {
+        if (!val) return;
+        const MENU_CONF = { uploadImage: { server: val }, customInsert: this.customPicInsert };
+        // this.ec['MENU_CONF'] = MENU_CONF;
+      },
+    },
+  },
 };
 </script>
 
 <style src="@wangeditor/editor/dist/css/style.css"></style>
 <style lang="less" scoped>
 .editor {
-  height: 500px;
   overflow-y: hidden;
 }
 </style>

+ 1 - 0
src/layout/Header.vue

@@ -4,6 +4,7 @@
       <el-col :span="24" class="main header">
         <el-col :span="24" class="one">
           <el-col :span="8" class="left">
+            <el-image src="https://broadcast.waityou24.cn/files/point/indexModule/20221010124133.png" style="height: 32px; width: 32px"></el-image>
             <!-- <span @click="collapseChage">
               <i v-if="!collapse" class="el-icon-s-fold"></i>
               <i v-else class="el-icon-s-unfold"></i>

+ 1 - 1
src/router/module/system.js

@@ -26,7 +26,7 @@ export default [
   {
     path: '/system/goodsTags',
     name: 'system_goodsTags',
-    meta: { title: '平台管理-首页图标设置' },
+    meta: { title: '平台管理-商品标签设置' },
     component: () => import(/* webpackChunkName: "system_goodsTags" */ '@/views/system/goodsTags/index.vue'),
   },
   {

+ 1 - 1
src/views/system/banner/detail.vue

@@ -14,7 +14,7 @@
               <el-option v-for="i in statusList" :key="i.model" :label="i.label" :value="i.value"></el-option>
             </template>
             <template #content>
-              <editor v-model="form.content" />
+              <editor v-model="form.content" url="/files/point/banner/upload" />
             </template>
           </data-form>
         </el-col>