fix: 模型上传loading
This commit is contained in:
@@ -31,8 +31,8 @@
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
<div style="text-align: right; margin-top: 20px;">
|
||||
<a-button style="margin-right: 10px;" @click="cancel">{{cancelText}}</a-button>
|
||||
<a-button type="primary" @click="ok">{{okText}}</a-button>
|
||||
<a-button :loading="stepLoading" style="margin-right: 10px;" @click="cancel">{{cancelText}}</a-button>
|
||||
<a-button :loading="stepLoading" type="primary" @click="ok">{{okText}}</a-button>
|
||||
</div>
|
||||
</a-modal>
|
||||
</template>
|
||||
@@ -76,6 +76,9 @@ const okText = computed(() => {
|
||||
return "下一步"
|
||||
})
|
||||
|
||||
const stepLoading = ref(false);
|
||||
|
||||
|
||||
const cancel = () => {
|
||||
if(step.value <= 0) {
|
||||
visible.value = false;
|
||||
@@ -154,7 +157,10 @@ const onCustomRequest = async (upload) => {
|
||||
reader.readAsArrayBuffer(upload.file);
|
||||
}
|
||||
|
||||
stepLoading.value = true;
|
||||
const data = await common.cosUpload3D(upload.file);
|
||||
stepLoading.value = false;
|
||||
|
||||
upload.onSuccess(data);
|
||||
}
|
||||
|
||||
@@ -176,6 +182,8 @@ const ok = async () => {
|
||||
|
||||
if(step.value >= 1) {
|
||||
|
||||
stepLoading.value = true;
|
||||
|
||||
if([THREE_D_TYPE.ENV_3D, THREE_D_TYPE.SHELF, THREE_D_TYPE.EXHIBITION_BOOTH, THREE_D_TYPE.WARE, THREE_D_TYPE.EMPTY_3D].includes(formData.value.type)){
|
||||
var blob = await viewerRef.value.snapshot();
|
||||
const data = await common.cosUpload3DCompress(blob);
|
||||
@@ -184,6 +192,9 @@ const ok = async () => {
|
||||
|
||||
const data = JSON.parse(JSON.stringify(formData.value));
|
||||
await createMaterialLibrary(buildData(data));
|
||||
|
||||
stepLoading.value = false;
|
||||
|
||||
visible.value = false;
|
||||
emit("complete");
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
<div style="text-align: right; margin-top: 20px;">
|
||||
<a-button style="margin-right: 10px;" @click="cancel">{{cancelText}}</a-button>
|
||||
<a-button type="primary" @click="ok">{{okText}}</a-button>
|
||||
<a-button :loading="stepLoading" style="margin-right: 10px;" @click="cancel">{{cancelText}}</a-button>
|
||||
<a-button :loading="stepLoading" type="primary" @click="ok">{{okText}}</a-button>
|
||||
</div>
|
||||
</a-modal>
|
||||
</template>
|
||||
@@ -95,6 +95,8 @@ const okText = computed(() => {
|
||||
return "下一步"
|
||||
})
|
||||
|
||||
const stepLoading = ref(false);
|
||||
|
||||
const cancel = () => {
|
||||
if(step.value <= 0) {
|
||||
visible.value = false;
|
||||
@@ -172,8 +174,9 @@ const onCustomRequest = async (upload) => {
|
||||
|
||||
reader.readAsArrayBuffer(upload.file);
|
||||
}
|
||||
|
||||
stepLoading.value = true;
|
||||
const data = await common.cosUpload3D(upload.file);
|
||||
stepLoading.value = false;
|
||||
upload.onSuccess(data);
|
||||
}
|
||||
|
||||
@@ -212,9 +215,12 @@ const ok = async () => {
|
||||
}
|
||||
|
||||
if([THREE_D_TYPE.SHELF].includes(formData.value.type)){
|
||||
|
||||
stepLoading.value = true;
|
||||
var blob = await viewerRef.value.snapshot();
|
||||
const data = await common.cosUpload3DCompress(blob);
|
||||
formData.value.cover = data.url;
|
||||
stepLoading.value = false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -232,8 +238,10 @@ const ok = async () => {
|
||||
message.warning("请上传货位");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
stepLoading.value = true;
|
||||
await createMaterialLibrary(data);
|
||||
stepLoading.value = false;
|
||||
visible.value = false;
|
||||
emit("complete");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user