【类 型】:fix
【原 因】:后端创建小程序码 改为单一参数 scene 一个参数内前16位记录店铺id 后面的记录站点id 【过 程】:取scene 分割出参数 【影 响】: # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
This commit is contained in:
parent
f704e809e8
commit
bf4598fe52
22
App.vue
22
App.vue
@ -2,15 +2,25 @@
|
|||||||
export default {
|
export default {
|
||||||
// 数据初始化
|
// 数据初始化
|
||||||
onLaunch: function(options) {
|
onLaunch: function(options) {
|
||||||
//从二维码获取站点id 单位id
|
/* 从二维码获取地块id 单位id 获取参数,如果不存在则使用默认值 */
|
||||||
// 获取参数,如果不存在则使用默认值
|
// 1. 获取 scene 参数
|
||||||
const shopId = options?.query?.s || '2dc23dcfecc05fb1'
|
const scene = options.query.scene // 示例值: "9egr2wqjwy03ddcc20"前16位shop_id
|
||||||
const siteId = options?.query?.z || '13'
|
// 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('setShopId', String(shopId))
|
||||||
this.$store.commit('setSiteId', String(siteId))
|
this.$store.commit('setSiteId', String(siteId))
|
||||||
//异步加载单位信息
|
|
||||||
|
/*异步加载单位信息*/
|
||||||
this.$store.dispatch('fetchShopCon')
|
this.$store.dispatch('fetchShopCon')
|
||||||
//异步加载站点列表
|
//异步加载地块列表
|
||||||
this.$store.dispatch('fetchSiteList')
|
this.$store.dispatch('fetchSiteList')
|
||||||
//异步加载分类列表
|
//异步加载分类列表
|
||||||
this.$store.dispatch('fetchMenuList')
|
this.$store.dispatch('fetchMenuList')
|
||||||
|
Loading…
Reference in New Issue
Block a user