فهرست منبع

优化老师头像上传到一半

1
mo 3 سال پیش
والد
کامیت
41ac65addd
1فایلهای تغییر یافته به همراه15 افزوده شده و 3 حذف شده
  1. 15 3
      src/views/teacherManager/teacherOperation/components/teacherOperation.vue

+ 15 - 3
src/views/teacherManager/teacherOperation/components/teacherOperation.vue

@@ -399,7 +399,7 @@
           <img v-if="topForm.avatar" key="avatar" :src="topForm.avatar" alt />
           <img v-else key="avatar" src="@/assets/images/base/woman.png" alt />
         </div>
-        <el-upload
+        <!-- <el-upload
           class="ivu-upload"
           :show-upload-list="false"
           :show-file-list="false"
@@ -409,7 +409,8 @@
           :max-size="2048"
           multiple
           action="/api-web/uploadFile"
-        >
+        >  -->
+           <image-cropper :options="cropperOptions" :imgSize="2" showSize :imageUrl="topForm.avatar" @crop-upload-success="handleSuccess" />
           <el-button icon="ios-cloud-upload-outline">修改头像</el-button>
           <!--
                v-if="pageType != 'create'"
@@ -546,8 +547,19 @@ export default {
             : false;
         },
       },
+      cropperOptions: {
+        autoCrop: true, //是否默认生成截图框
+        autoCropWidth: 300, //默认生成截图框宽度
+        autoCropHeight: 300, //默认生成截图框高度
+        fixedBox: true, //是否固定截图框大小 不允许改变
+        previewsCircle: false, //预览图是否是圆形
+        title: "老师头像", //模态框上显示的标题
+      },
     };
   },
+  // components:{
+  //   imageCropper
+  // },
   created() {},
   mounted() {
     this.pageType = this.$route.query.type;
@@ -877,7 +889,7 @@ export default {
     text-align: center;
   }
   .alert {
-    margin:  0 0 20px 120px;
+    margin: 0 0 20px 120px;
     width: 855px;
   }
 }