mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-student.git
synced 2025-12-14 13:26:48 +08:00
feat:合并
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
* @Author: lixg lixg@dongwu-inc.com
|
* @Author: lixg lixg@dongwu-inc.com
|
||||||
* @Date: 2022-12-11 16:57:58
|
* @Date: 2022-12-11 16:57:58
|
||||||
* @LastEditors: lixg lixg@dongwu-inc.com
|
* @LastEditors: lixg lixg@dongwu-inc.com
|
||||||
* @LastEditTime: 2022-12-15 10:56:54
|
* @LastEditTime: 2022-12-17 14:59:41
|
||||||
* @FilePath: /fe-stu/src/api/api.js
|
* @FilePath: /fe-stu/src/api/api.js
|
||||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export async function request(_url, params) {
|
|||||||
}
|
}
|
||||||
return response
|
return response
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
console.log(e)
|
console.log('eeeee', e)
|
||||||
// router.push({path: '/login'})
|
// router.push({path: '/login'})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: lixg lixg@dongwu-inc.com
|
||||||
|
* @Date: 2022-12-11 16:57:58
|
||||||
|
* @LastEditors: lixg lixg@dongwu-inc.com
|
||||||
|
* @LastEditTime: 2022-12-17 14:51:44
|
||||||
|
* @FilePath: /fe-stu/src/components/img/UploadImg.vue
|
||||||
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||||
|
-->
|
||||||
<template>
|
<template>
|
||||||
<el-upload
|
<el-upload
|
||||||
:file-list="files"
|
:file-list="files"
|
||||||
@@ -19,48 +27,52 @@ import {FILE_UPLOAD} from "@/api/api";
|
|||||||
import { defineProps, ref } from "vue";
|
import { defineProps, ref } from "vue";
|
||||||
|
|
||||||
const { modelValue = [] } = defineProps({
|
const { modelValue = [] } = defineProps({
|
||||||
modelValue: []
|
modelValue: [],
|
||||||
})
|
});
|
||||||
|
|
||||||
const emit = defineEmits()
|
const emit = defineEmits();
|
||||||
|
|
||||||
const files = ref(modelValue)
|
const files = ref(modelValue);
|
||||||
const imageRef = ref()
|
const imageRef = ref();
|
||||||
|
|
||||||
function handleChange(e) {
|
function handleChange(e) {
|
||||||
console.log(e)
|
console.log("上传", e);
|
||||||
if (e.response && e.response.code === 200) {
|
if (e.response && e.response.code === 200) {
|
||||||
e.url = e.response.data
|
e.url = e.response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
const index = files.value.findIndex(f => f.uid === e.uid)
|
const index = files.value.findIndex((f) => f.uid === e.uid);
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
files.value.unshift(e)
|
files.value.unshift(e);
|
||||||
} else {
|
} else {
|
||||||
files.value[index] = e
|
files.value[index] = e;
|
||||||
}
|
}
|
||||||
emit('update:modelValue', files)
|
emit("update:modelValue", files);
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove(i) {
|
function remove(i) {
|
||||||
files.value.splice(i, 1)
|
files.value.splice(i, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function reUpload(i) {
|
function reUpload(i) {
|
||||||
if (files.value[i].status === 'ready' || files.value[i].status === 'uploading') {
|
if (
|
||||||
imageRef.value.abort(files.value[i].raw)
|
files.value[i].status === "ready" ||
|
||||||
files.value[i].status = 'abort';
|
files.value[i].status === "uploading"
|
||||||
} else if (files.value[i].status === 'fail'||files.value[i].status === 'abort') {
|
) {
|
||||||
imageRef.value.handleStart(files.value[i].raw)
|
imageRef.value.abort(files.value[i].raw);
|
||||||
imageRef.value.submit()
|
files.value[i].status = "abort";
|
||||||
|
} else if (
|
||||||
|
files.value[i].status === "fail" ||
|
||||||
|
files.value[i].status === "abort"
|
||||||
|
) {
|
||||||
|
imageRef.value.handleStart(files.value[i].raw);
|
||||||
|
imageRef.value.submit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function abort(i) {
|
function abort(i) {
|
||||||
imageRef.value.abort(files.value[i].raw)
|
imageRef.value.abort(files.value[i].raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defineExpose({ reUpload, remove });
|
||||||
defineExpose({reUpload, remove})
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user