Browse Source

文件位置移动

Xiao_123 9 months ago
parent
commit
a3ebfe606a

+ 1 - 1
components.d.ts

@@ -31,7 +31,7 @@ declare module 'vue' {
     HeadSearch: typeof import('./src/components/headSearch/index.vue')['default']
     HotPromoted: typeof import('./src/components/Enterprise/hotPromoted.vue')['default']
     Img: typeof import('./src/components/Upload/img.vue')['default']
-    ImgCropper: typeof import('./src/components/Upload/ImgCropper.vue')['default']
+    ImgCropper: typeof import('./src/components/ImgCropper/index.vue')['default']
     'Index copy': typeof import('./src/components/CtForm/index copy.vue')['default']
     IndustryTypeCard: typeof import('./src/components/industryTypeCard/index.vue')['default']
     Info: typeof import('./src/components/Enterprise/info.vue')['default']

+ 11 - 5
src/components/Upload/ImgCropper.vue → src/components/ImgCropper/index.vue

@@ -6,7 +6,7 @@
     title="图片裁剪"
     :footer="true"
     submitText="裁剪"
-    @close="isShowModal = false; cancel"
+    @close="cancel"
     @submit="getResult"
   >
     <!-- <div class="text-end"> -->
@@ -101,7 +101,7 @@ const corpPresetMode = computed(() => {
     ...props.presetMode
   }
 })
-const emits = defineEmits(["close"])
+const emits = defineEmits(["close", 'submit'])
 
 watch(() => props.visible, (val) => {
   isShowModal.value = val
@@ -119,7 +119,7 @@ watch(() => props.image, (val) => {
 
 const isShowModal = ref(false)
 const pic = ref('')
-const result = reactive({
+let result = reactive({
   dataURL: '',
   blobURL: '',
 })
@@ -146,12 +146,12 @@ async function getResult() {
       const r = new FileReader()
       r.readAsDataURL(f)
       r.onload = function () {
-        emits("close", { result, file: f })
+        emits("submit", { result, file: f })
       }
     });
   } else {
     // console.log("crop")
-    emits("close", { result, file })
+    emits("submit", { result, file })
   }
 }
 
@@ -179,6 +179,12 @@ function ready() {
 }
 
 function cancel() {
+  isShowModal.value = false
+  pic.value = ''
+  result = {
+    dataURL: '',
+    blobURL: ''
+  }
   emits("close")
 }
 </script>

+ 1 - 1
src/views/recruit/enterprise/informationSetting/index.vue

@@ -22,7 +22,7 @@
   </v-card>
 
   <Loading :visible="overlay"></Loading>
-  <ImgCropper :visible="isShowCopper" :image="selectPic" :cropBoxResizable="true" @close="handleHideCopper" :aspectRatio="1 / 1"></ImgCropper>
+  <ImgCropper :visible="isShowCopper" :image="selectPic" :cropBoxResizable="true" @submit="handleHideCopper" :aspectRatio="1 / 1" @close="isShowCopper = false"></ImgCropper>
 </template>
 
 <script setup>

+ 1 - 1
src/views/recruit/personal/remuse/components/basicInfo.vue

@@ -101,7 +101,7 @@
   </div>
   
   <Loading :visible="overlay"></Loading>
-  <!-- <ImgCropper :visible="isShowCopper" :image="selectPic" :cropBoxResizable="true" @close="handleHideCopper" :aspectRatio="1 / 1"></ImgCropper> -->
+  <!-- <ImgCropper :visible="isShowCopper" :image="selectPic" :cropBoxResizable="true" @submit="handleHideCopper" :aspectRatio="1 / 1" @close="isShowCopper = false"></ImgCropper> -->
 </template>
 
 <script setup>