fix 文件上传

master
管理员 1 year ago
parent 46f3f49e06
commit 854218aaad

@ -147,6 +147,21 @@ const mv = computed({
emit("change", value) emit("change", value)
} }
}) })
watch(mv, () => {
if (props.max == 1) {
data.value = []
if (mv.value) {
data.value = [{ url: mv.value ,ext: getExt(mv.value), name: getName(mv.value) }]
}
} else {
data.value = []
if (mv.value) {
data.value = mv.value.map(a => ({ url: a ,ext: getExt(a), name: getName(a)}))
}
}
})
const uploading = computed({ const uploading = computed({
get() { get() {
return props.uploading return props.uploading

@ -2,6 +2,7 @@ package com.ruoyi.common.utils.file;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.UUID; import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.utils.redis.RedisUtils; import com.ruoyi.common.utils.redis.RedisUtils;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ -57,6 +58,7 @@ public class FileUtils extends FileUtil {
/** /**
* *
*
* @param duration * @param duration
* @return * @return
*/ */
@ -68,6 +70,7 @@ public class FileUtils extends FileUtil {
/** /**
* ,30 * ,30
*
* @return * @return
*/ */
public static String getUploadKey() { public static String getUploadKey() {
@ -76,18 +79,26 @@ public class FileUtils extends FileUtil {
/** /**
* *
*
* @param key * @param key
* @return * @return
*/ */
public static boolean exitisUploadKey(String key){ public static boolean exitisUploadKey(String key) {
if (StrUtil.isBlank(key)) {
return false;
}
return RedisUtils.isExistsObject(UPLOAD_KEY_PREFIX + key); return RedisUtils.isExistsObject(UPLOAD_KEY_PREFIX + key);
} }
/** /**
* *
*
* @param key * @param key
*/ */
public static void removeUploadKey(String key){ public static void removeUploadKey(String key) {
if (StrUtil.isBlank(key)) {
return ;
}
RedisUtils.deleteObject(UPLOAD_KEY_PREFIX + key); RedisUtils.deleteObject(UPLOAD_KEY_PREFIX + key);
} }
} }

Loading…
Cancel
Save