api put/pver

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-08 11:25:44 +07:00
parent 85632ec16c
commit dc2457d9ed
2 changed files with 34 additions and 5 deletions

View file

@ -60,6 +60,8 @@ export default {
detailOrder: (orderId: string) => `${order}/order/detail/${orderId}`,
deleteOrder: (orderId: string) => `${order}/order/${orderId}`,
typeOrder: () => `${order}/order/order-type`,
nextStep: (orderId: string) => `${order}/order/next/${orderId}`,
prevStep: (orderId: string) => `${order}/order/prev/${orderId}`,
createOrder: () => `${order}/order/detail`,
@ -93,7 +95,6 @@ export default {
attachmentOrderId: (orderId: string) =>
`${order}/order/attachment/order-file/${orderId}`,
attachmentFileId: (orderId: string) =>
`${order}/order/attachment/file/${orderId}`,

View file

@ -65,7 +65,12 @@ import { useRouter } from "vue-router";
import { ref, defineAsyncComponent, onMounted, onUnmounted } from "vue";
import type { QStepper } from "quasar";
import { useProbationDataStore } from "@/modules/05_placement/store";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
const route = useRoute();
const orderId_params = route.params.orderid;
const probationData = useProbationDataStore();
const { stepOrder, setStepOrder } = probationData;
@ -89,19 +94,38 @@ const step04 = defineAsyncComponent(
const router = useRouter();
const step = ref<number>(1);
const stepper = ref<QStepper>();
const orderId = ref<string>("");
onUnmounted(() => {
destroyLocalStorage();
});
const nextStep = () => {
const nextStep = async () => {
stepper.value!.next();
localStorage.setItem("currentStep", step.value.toString());
if (orderId.value) {
await http
.put(config.API.nextStep(orderId.value))
.then((res) => {
console.log(res);
})
.catch((e) => {
console.log(e);
});
}
};
const previousStep = () => {
const previousStep = async () => {
stepper.value!.previous();
localStorage.setItem("currentStep", step.value.toString());
if (orderId.value) {
await http
.put(config.API.prevStep(orderId.value))
.then((res) => {
console.log(res);
})
.catch((e) => {
console.log(e);
});
}
};
const destroyLocalStorage = () => {
localStorage.clear();
@ -111,6 +135,10 @@ onMounted(() => {
if (currentStep) {
step.value = Number(currentStep);
}
if (orderId_params !== undefined) {
orderId.value = orderId_params.toString();
console.log(orderId.value);
}
});
</script>
<style>