From bf4598fe524453aa97ebab8b3d3443c6f03c55f3 Mon Sep 17 00:00:00 2001 From: air <30444667+sszdot@users.noreply.github.com> Date: Mon, 30 Jun 2025 17:55:08 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=B1=BB=20=20=E5=9E=8B=E3=80=91?= =?UTF-8?q?=EF=BC=9Afix=20=E3=80=90=E5=8E=9F=20=20=E5=9B=A0=E3=80=91?= =?UTF-8?q?=EF=BC=9A=E5=90=8E=E7=AB=AF=E5=88=9B=E5=BB=BA=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E7=A0=81=20=E6=94=B9=E4=B8=BA=E5=8D=95=E4=B8=80?= =?UTF-8?q?=E5=8F=82=E6=95=B0=20scene=20=20=E4=B8=80=E4=B8=AA=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=86=85=E5=89=8D16=E4=BD=8D=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=BA=97=E9=93=BAid=20=E5=90=8E=E9=9D=A2=E7=9A=84=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E7=AB=99=E7=82=B9id=20=E3=80=90=E8=BF=87=20=20?= =?UTF-8?q?=E7=A8=8B=E3=80=91=EF=BC=9A=E5=8F=96scene=20=E5=88=86=E5=89=B2?= =?UTF-8?q?=E5=87=BA=E5=8F=82=E6=95=B0=20=E3=80=90=E5=BD=B1=20=20=E5=93=8D?= =?UTF-8?q?=E3=80=91=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动 --- App.vue | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/App.vue b/App.vue index e3ba390..fdc290c 100644 --- a/App.vue +++ b/App.vue @@ -2,15 +2,25 @@ export default { // 数据初始化 onLaunch: function(options) { - //从二维码获取站点id 单位id - // 获取参数,如果不存在则使用默认值 - const shopId = options?.query?.s || '2dc23dcfecc05fb1' - const siteId = options?.query?.z || '13' + /* 从二维码获取地块id 单位id 获取参数,如果不存在则使用默认值 */ + // 1. 获取 scene 参数 + const scene = options.query.scene // 示例值: "9egr2wqjwy03ddcc20"前16位shop_id + // 2. 解析 scene 字符串 + let shopId = '2dc23dcfecc05fb1' // 默认值 + let siteId = '13' // 默认值 + if (scene) { + shopId = scene.slice(0, 16) + siteId = scene.slice(16) + } + console.log(shopId) + console.log(siteId) + // 3. 存储到 Vuex this.$store.commit('setShopId', String(shopId)) this.$store.commit('setSiteId', String(siteId)) - //异步加载单位信息 + + /*异步加载单位信息*/ this.$store.dispatch('fetchShopCon') - //异步加载站点列表 + //异步加载地块列表 this.$store.dispatch('fetchSiteList') //异步加载分类列表 this.$store.dispatch('fetchMenuList')