|
@@ -1,7 +1,7 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import { onMounted, ref } from 'vue';
|
|
import { onMounted, ref } from 'vue';
|
|
|
|
+import { message } from 'ant-design-vue';
|
|
|
|
|
|
-import { useRequest } from '@/hooks/request';
|
|
|
|
import { uploadUserProtocol } from '@/api';
|
|
import { uploadUserProtocol } from '@/api';
|
|
import { waitTime } from '@/utils';
|
|
import { waitTime } from '@/utils';
|
|
|
|
|
|
@@ -9,20 +9,25 @@ import type { SetupProtocolForm, UseGuideStepItemProps } from '@/types';
|
|
|
|
|
|
const props = defineProps<UseGuideStepItemProps<SetupProtocolForm>>();
|
|
const props = defineProps<UseGuideStepItemProps<SetupProtocolForm>>();
|
|
|
|
|
|
-const { handleRequest } = useRequest();
|
|
|
|
const remainingSeconds = ref(90);
|
|
const remainingSeconds = ref(90);
|
|
const currentPercent = ref(0);
|
|
const currentPercent = ref(0);
|
|
|
|
|
|
-onMounted(() => {
|
|
|
|
- handleRequest(async () => {
|
|
|
|
|
|
+onMounted(async () => {
|
|
|
|
+ await waitTime(2000);
|
|
|
|
+ remainingSeconds.value = 0;
|
|
|
|
+ currentPercent.value = 100;
|
|
|
|
+
|
|
|
|
+ try {
|
|
const { protocolType, protocolFile } = props.form;
|
|
const { protocolType, protocolFile } = props.form;
|
|
const file = protocolFile?.[0].originFileObj;
|
|
const file = protocolFile?.[0].originFileObj;
|
|
const data = await uploadUserProtocol(protocolType as string, file as File);
|
|
const data = await uploadUserProtocol(protocolType as string, file as File);
|
|
Object.assign(props.form.protocolInfo, data);
|
|
Object.assign(props.form.protocolInfo, data);
|
|
-
|
|
|
|
- await waitTime(1000);
|
|
|
|
- currentPercent.value = 100;
|
|
|
|
- });
|
|
|
|
|
|
+ props.goToStep(props.stepIndex + 1);
|
|
|
|
+ } catch (err) {
|
|
|
|
+ props.goToStep(props.stepIndex - 1);
|
|
|
|
+ message.error((err as Error).message);
|
|
|
|
+ console.error(err);
|
|
|
|
+ }
|
|
});
|
|
});
|
|
</script>
|
|
</script>
|
|
|
|
|