feat : 一体机定位直到成功,其他环境循环2分钟定位, 上传加入文件校验

This commit is contained in:
2025-12-19 14:46:37 +08:00
parent fdd5577c85
commit 7e8bef0cb9
8 changed files with 343 additions and 263 deletions

View File

@@ -82,6 +82,7 @@ const { userInfo } = storeToRefs(useUserStore());
const { getUserResume } = useUserStore();
const { dictLabel, oneDictData } = useDictStore();
const openSelectPopup = inject('openSelectPopup');
import {FileValidator} from "@/utils/fileValidator" //文件校验
const percent = ref('0%');
const state = reactive({
@@ -278,8 +279,16 @@ function selectAvatar() {
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
count: 1,
success: ({ tempFilePaths, tempFiles }) => {
$api.uploadFile(tempFilePaths[0], true)
success: async(res) => {
const tempFilePaths = res.tempFilePaths;
const file = res.tempFiles[0];
const imageValidator = new FileValidator()
try {
await imageValidator.validate(file)
$api.uploadFile(tempFilePaths[0], true)
.then((res) => {
res = JSON.parse(res);
if (res.msg) fromValue.avatar = res.msg;
@@ -287,6 +296,9 @@ function selectAvatar() {
.catch((err) => {
$api.msg('上传失败');
});
} catch (error) {
$api.msg(error);
}
},
fail: (error) => {},
});