Browse Source

修改资讯管理的图片上传

lcmxs 1 year ago
parent
commit
d28558e56b
1 changed files with 48 additions and 42 deletions
  1. 48 42
      src/views/COUNSELINGMESSAGE/edit.vue

+ 48 - 42
src/views/COUNSELINGMESSAGE/edit.vue

@@ -4,25 +4,29 @@
       <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"></cropper>
+      </el-form-item>
       <el-form-item label="内容" prop="content">
         <editor v-model="form.content" />
       </el-form-item>
-      <el-form-item label="图片上传">
-        <el-upload action="#" list-type="picture-card" :limit="1" :auto-upload="true" :http-request="httprequest" :before-upload="beforeupload" :file-list="fileList">
-          <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 v-if="!disabled" class="el-upload-list__item-delete" @click="handleRemove(file)">
-                  <i class="el-icon-delete"></i>
-                </span>
-              </span>
-          </div>
-        </el-upload>
-      </el-form-item>
+
+<!--      <el-form-item label="图片上传">-->
+<!--        <el-upload action="#" list-type="picture-card" :limit="1" :auto-upload="true" :http-request="httprequest" :before-upload="beforeupload" :file-list="fileList">-->
+<!--          <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 v-if="!disabled" class="el-upload-list__item-delete" @click="handleRemove(file)">-->
+<!--                  <i class="el-icon-delete"></i>-->
+<!--                </span>-->
+<!--              </span>-->
+<!--          </div>-->
+<!--        </el-upload>-->
+<!--      </el-form-item>-->
     </el-form>
 
     <div slot="footer" class="mfooter">
@@ -43,6 +47,7 @@ export default {
   name: 'edit.vue',
   data(){
     return{
+      baseUrl: process.env.VUE_APP_BASE_API,
       dialogVisible:false,
       disabled: false,
       fileList: [],
@@ -61,9 +66,9 @@ export default {
     if (this.param.id) {
       getCOUNSELINGMESSAGE(this.param.id).then(response => {
         this.form = response.data;
-        if (this.form.fileUrl != null){
-          this.fileList.push({ name: 'xxx', url: this.form.fileUrl });
-        }
+        // if (this.form.fileUrl != null){
+        //   this.fileList.push({ name: 'xxx', url: this.form.fileUrl });
+        // }
         this.form.content = response.data.content.replace(new RegExp('/profile/upload/', 'g'), this.baseUrl + '/profile/upload/');
       });
     }
@@ -80,6 +85,7 @@ export default {
     }
   },
   methods:{
+    //旧的图片上传
     httprequest() {},
     /** 上传附件 */
     beforeupload(file) {
@@ -139,29 +145,29 @@ export default {
         }
       });
     },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
-    },
-    // 表单重置
-    reset() {
-      this.form = {
-        id: null,
-        delFlag: null,
-        deptId: null,
-        title: null,
-        content: null,
-        fileUrl: null,
-        picture: null,
-        status: '0',
-        auditTime: null,
-        reportDate: null,
-        releaseDate: null
-      };
-      this.resetForm('form');
-      this.fileList = [];
-    },
+    // // 取消按钮
+    // cancel() {
+    //   this.open = false;
+    //   this.reset();
+    // },
+    // // 表单重置
+    // reset() {
+    //   this.form = {
+    //     id: null,
+    //     delFlag: null,
+    //     deptId: null,
+    //     title: null,
+    //     content: null,
+    //     fileUrl: null,
+    //     picture: null,
+    //     status: '0',
+    //     auditTime: null,
+    //     reportDate: null,
+    //     releaseDate: null
+    //   };
+    //   this.resetForm('form');
+    //   this.fileList = [];
+    // },
   },
   created() {