1 line
3.1 KiB
Plaintext
1 line
3.1 KiB
Plaintext
{"version":3,"file":"index.js","sources":["../../../../../src/pages/h5mall/index.vue","../../../../../uniPage:/cGFnZXMvaDVtYWxsL2luZGV4LnZ1ZQ"],"sourcesContent":["<route lang=\"json5\" type=\"page\">\r\n{\r\n layout: 'default',\r\n style: {\r\n navigationBarTitleText: '宠物商城',\r\n },\r\n}\r\n</route>\r\n\r\n<template>\r\n <view class=\"mall-root\">\r\n <!-- 当 webviewSrc 有值时才渲染 WebView -->\r\n <web-view v-if=\"webviewSrc\" id=\"mall-webview\" :src=\"webviewSrc\"></web-view>\r\n <view v-else class=\"loading\">\r\n <text>加载中...</text>\r\n </view>\r\n </view>\r\n</template>\r\n\r\n<script lang=\"js\" setup>\r\nimport { ref } from 'vue'\r\nimport { toast } from '@/utils/commUtils'\r\nimport { httpPost } from '@/utils/http'\r\nimport { useUserStore } from '@/store'\r\n\r\nconst webviewSrc = ref('')\r\nconst shopUserData = ref({})\r\n\r\nconst userStore = useUserStore()\r\nconst shopUserInfo = async () => {\r\n if (userStore.userInfo.shopLoginUser) {\r\n shopUserData.value = userStore.userInfo.shopLoginUser\r\n webviewSrc.value = `http://localhost:3000/?token=${shopUserData.value.accessToken}&refresh-token=${shopUserData.value.refreshToken}`\r\n return\r\n }\r\n try {\r\n const shopUser = await httpPost('/shopLogin')\r\n if (shopUser && shopUser.code === 200) {\r\n // 成功获取用户信息后,设置 WebView 的 src\r\n webviewSrc.value = `http://localhost:3000/?token=${shopUserData.value.accessToken}&refresh-token=${shopUserData.value.refreshToken}`\r\n shopUserData.value = shopUser.data\r\n userStore.setUserInfo({ shopLoginUser: shopUserData.value })\r\n onWebViewLoad()\r\n } else {\r\n // 获取用户信息失败,显示提示信息\r\n toast(shopUser.message || '获取商城用户信息失败, 无法跳转到商城, 请联系管理员!')\r\n }\r\n } catch (e) {\r\n // 捕获并显示错误信息\r\n toast(e.data.message || '发生错误,请稍后重试!')\r\n }\r\n}\r\n\r\n// 在组件挂载时调用 shopUserInfo 方法\r\nonLoad(async () => {\r\n await shopUserInfo()\r\n})\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.loading {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n height: 100vh;\r\n}\r\n</style>\r\n","import MiniProgramPage from 'D:/App/Work/addr/acdr-ui/src/pages/h5mall/index.vue'\nwx.createPage(MiniProgramPage)"],"names":["ref","useUserStore","httpPost","toast","onLoad"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,UAAA,aAAAA,cAAA,IAAA,EAAA;AACA,UAAA,eAAAA,cAAA,IAAA,EAAA;AAEA,UAAA,YAAAC,WAAAA,aAAA;AACA,UAAA,eAAA,MAAA;AACA,UAAA,UAAA,SAAA,eAAA;AACA,qBAAA,QAAA,UAAA,SAAA;AACA,mBAAA,QAAA,gCAAA,aAAA,MAAA,WAAA,kBAAA,aAAA,MAAA,YAAA;AACA;AAAA,MACA;AACA,UAAA;AACA,cAAA,WAAA,MAAAC,WAAA,SAAA,YAAA;AACA,YAAA,YAAA,SAAA,SAAA,KAAA;AAEA,qBAAA,QAAA,gCAAA,aAAA,MAAA,WAAA,kBAAA,aAAA,MAAA,YAAA;AACA,uBAAA,QAAA,SAAA;AACA,oBAAA,YAAA,EAAA,eAAA,aAAA,MAAA,CAAA;AACA,wBAAA;AAAA,QACA,OAAA;AAEAC,gCAAA,SAAA,WAAA,8BAAA;AAAA,QACA;AAAA,MACA,SAAA,GAAA;AAEAA,wBAAAA,MAAA,EAAA,KAAA,WAAA,aAAA;AAAA,MACA;AAAA,IACA;AAGAC,kBAAAA,OAAA,MAAA;AACA,YAAA,aAAA;AAAA,IACA,EAAA;;;;;;;;;;;ACvDA,GAAG,WAAW,eAAe;"} |