File tree 2 files changed +28
-2
lines changed
src/components/selectImage
2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 33
33
"sortablejs" : " ^1.15.2" ,
34
34
"spark-md5" : " ^3.0.2" ,
35
35
"tailwindcss" : " ^3.3.3" ,
36
+ "vite-auto-import-svg" : " ^1.0.0" ,
36
37
"vue" : " ^3.4.21" ,
37
38
"vue-echarts" : " ^6.7.2" ,
38
39
"vue-router" : " ^4.3.2" ,
Original file line number Diff line number Diff line change 62
62
:key =" key"
63
63
class =" w-40"
64
64
>
65
- <div class =" w-40 h-40 border rounded overflow-hidden border-dashed border-gray-300 cursor-pointer" >
65
+ <div class =" w-40 h-40 border rounded overflow-hidden border-dashed border-gray-300 cursor-pointer relative group " >
66
66
<el-image
67
67
:key =" key"
68
68
:src =" getUrl(item.url)"
98
98
</div >
99
99
</template >
100
100
</el-image >
101
+ <div class =" absolute -right-1 top-1 w-8 h-8 group-hover:inline-block hidden" @click =" deleteCheck(item)" >
102
+ <el-icon :size =" 16" ><CircleClose /></el-icon >
103
+ </div >
101
104
</div >
102
105
<div
103
106
class =" overflow-hidden text-nowrap overflow-ellipsis text-center w-full"
124
127
125
128
import { getUrl , isVideoExt } from ' @/utils/image'
126
129
import { onMounted , ref } from ' vue'
127
- import { getFileList , editFileName } from ' @/api/fileUploadAndDownload'
130
+ import { getFileList , editFileName , deleteFile } from ' @/api/fileUploadAndDownload'
128
131
import UploadImage from ' @/components/upload/image.vue'
129
132
import UploadCommon from ' @/components/upload/common.vue'
130
133
import WarningBar from ' @/components/warningBar/warningBar.vue'
@@ -256,5 +259,27 @@ const getImageList = async() => {
256
259
}
257
260
}
258
261
262
+ const deleteCheck = (item )=> {
263
+ ElMessageBox .confirm (' 是否删除该文件' , ' 提示' , {
264
+ confirmButtonText: ' 确定' ,
265
+ cancelButtonText: ' 取消' ,
266
+ type: ' warning'
267
+ }).then (async () => {
268
+ const res = await deleteFile (item)
269
+ if (res .code === 0 ) {
270
+ ElMessage ({
271
+ type: ' success' ,
272
+ message: ' 删除成功!' ,
273
+ })
274
+ getImageList ()
275
+ }
276
+ }).catch (() => {
277
+ ElMessage ({
278
+ type: ' info' ,
279
+ message: ' 已取消删除'
280
+ })
281
+ })
282
+ }
283
+
259
284
</script >
260
285
You can’t perform that action at this time.
0 commit comments