| | |
| | | import { onLoad } from "@dcloudio/uni-app"; |
| | | import ProductCard from "@/components/product_card/index.vue"; |
| | | import TwistApi from "@/api/product/twist"; |
| | | import { getPrepareId, setPrepareId } from "@/utils/cache"; |
| | | import { getPrepareId, setPrepareId, clearPrepareId } from "@/utils/cache"; |
| | | import HomeApi from "@/api/home"; |
| | | |
| | | const paramsId = ref(); |
| | |
| | | const { data } = await HomeApi.getIndex(); |
| | | if (data && data.prepareId) { |
| | | setPrepareId(data.prepareId); |
| | | } else { |
| | | // 如果没有 prepareId,清空缓存 |
| | | clearPrepareId(); |
| | | } |
| | | } catch (error) { |
| | | console.error("获取生产准备ID失败:", error); |
| | | // 获取失败时也清空缓存 |
| | | clearPrepareId(); |
| | | } |
| | | }; |
| | | |