浏览代码

修改新闻管理和资讯管理的富文本

lcmxs 1 年之前
父节点
当前提交
73f67be247
共有 3 个文件被更改,包括 45 次插入37 次删除
  1. 3 3
      src/views/COUNSELINGMESSAGE/edit.vue
  2. 31 28
      src/views/COUNSELINGMESSAGE/task/index.vue
  3. 11 6
      src/views/news/task/index.vue

+ 3 - 3
src/views/COUNSELINGMESSAGE/edit.vue

@@ -4,9 +4,9 @@
       <el-form-item label="标题" prop="title">
         <el-input v-model="form.title" placeholder="请输入标题"></el-input>
       </el-form-item>
-      <el-form-item label="图片上传">
-        <cropper v-model="form.fileUrl" :fixed_number="[4, 2]"></cropper>
-      </el-form-item>
+<!--      <el-form-item label="图片上传">-->
+<!--        <cropper v-model="form.fileUrl" :fixed_number="[4, 2]"></cropper>-->
+<!--      </el-form-item>-->
       <el-form-item label="内容" prop="content">
         <editor v-model="form.content" />
       </el-form-item>

+ 31 - 28
src/views/COUNSELINGMESSAGE/task/index.vue

@@ -20,33 +20,36 @@
 
         <el-form ref="form" :model="taskList" label-width="80px" style="margin-top: 20px">
           <el-form-item label="标题" prop="title">{{ taskList.formobj.title }}</el-form-item>
-          <el-form-item label="图片" prop="fileUrl" disabled>
-            <el-upload
-              action="#"
-              list-type="picture-card"
-              :limit="1"
-              :auto-upload="false"
-              :file-list="fileList"
-              :disabled="true"
-            >
-              <i slot="default" class="el-icon-plus"></i>
-              <div slot="file" slot-scope="{ file }">
-                <img class="el-upload-list__item-thumbnail" :src="file.url" />
+<!--          <el-form-item label="图片" prop="fileUrl" disabled>-->
+<!--            <el-upload-->
+<!--              action="#"-->
+<!--              list-type="picture-card"-->
+<!--              :limit="1"-->
+<!--              :auto-upload="false"-->
+<!--              :file-list="fileList"-->
+<!--              :disabled="true"-->
+<!--            >-->
+<!--              <i slot="default" class="el-icon-plus"></i>-->
+<!--              <div slot="file" slot-scope="{ file }">-->
+<!--                <img class="el-upload-list__item-thumbnail" :src="file.url" />-->
 
-                <!-- 放大预览 -->
-                <span class="el-upload-list__item-actions">
-                  <span
-                    class="el-upload-list__item-preview"
-                    @click="handlePictureCardPreview(file)"
-                  >
-                    <i class="el-icon-zoom-in"></i>
-                  </span>
-                </span>
-              </div>
-            </el-upload>
-          </el-form-item>
-          <el-form-item label="新闻内容" prop="content">
-            <editor v-model="taskList.formobj.content" :min-height="192" :readOnly="true" />
+<!--                &lt;!&ndash; 放大预览 &ndash;&gt;-->
+<!--                <span class="el-upload-list__item-actions">-->
+<!--                  <span-->
+<!--                    class="el-upload-list__item-preview"-->
+<!--                    @click="handlePictureCardPreview(file)"-->
+<!--                  >-->
+<!--                    <i class="el-icon-zoom-in"></i>-->
+<!--                  </span>-->
+<!--                </span>-->
+<!--              </div>-->
+<!--            </el-upload>-->
+<!--          </el-form-item>-->
+<!--          <el-form-item label="新闻内容" prop="content">-->
+<!--            <editor v-model="taskList.formobj.content" :min-height="192" :readOnly="true" />-->
+<!--          </el-form-item>-->
+          <el-form-item label="内容" prop="content">
+            <editor v-model="taskList.formobj.content"/>
           </el-form-item>
         </el-form>
 
@@ -85,14 +88,14 @@ export default {
         name: "xxx",
       });
     }
-    console.log('1231132',this.taskList.formobj);
   },
   watch: {
     taskList(curVal, oldVal) {
       if (curVal) {
+        curVal.formobj.content = curVal.formobj.content.replace(new RegExp('/profile/upload/', 'g'), this.baseUrl + '/profile/upload/');
         this.fileList.pop();
         this.fileList.push({
-          url: this.baseURL + curVal.formobj.fileUrl,
+          url: this.baseUrl + curVal.formobj.fileUrl,
           name: "xxx",
         });
       }

+ 11 - 6
src/views/news/task/index.vue

@@ -82,8 +82,6 @@
           <el-form-item label="新闻内容" prop="content">
             <editor
               v-model="taskList.formobj.content"
-              :min-height="192"
-              :readOnly="true"
             />
           </el-form-item>
         </el-form>
@@ -147,15 +145,22 @@ export default {
       //   console.log('下载转换后:',this.fileList[0])
       // });
     }
+    //this.taskList.form.content = this.taskList.form.content.replace(new RegExp('/profile/upload/', 'g'), this.baseUrl + '/profile/upload/');
   },
   watch: {
     taskList(curVal, oldVal) {
+
+
       if (curVal) {
+        curVal.formobj.content = curVal.formobj.content.replace(new RegExp('/profile/upload/', 'g'), this.baseUrl + '/profile/upload/');
         this.fileList.pop();
-        this.fileList.push({
-          url: this.baseURL + curVal.formobj.picture,
-          name: "xxx",
-        });
+        if(curVal.formobj.picture){
+          this.fileList.push({
+            url: this.baseUrl + curVal.formobj.picture,
+            name: "xxx",
+          });
+        }
+
         // downloadpic(curVal.formobj.picture).then((res) => {
         //   this.fileList.push({
         //     url: window.URL.createObjectURL(res),