瀏覽代碼

feat: 分销二维码

xiansin 2 年之前
父節點
當前提交
278960a9f7
共有 2 個文件被更改,包括 6 次插入4 次删除
  1. 1 1
      mini/api/share/index.js
  2. 5 3
      mini/pages/index/index.vue

+ 1 - 1
mini/api/share/index.js

xqd
@@ -26,7 +26,7 @@ export function setting() {
 }
 
 export function generateQrcode() {
-  return request.get(
+  return request.post(
     'share/generate/qrcode'
   )
 }

+ 5 - 3
mini/pages/index/index.vue

xqd xqd xqd
@@ -65,7 +65,8 @@ export default {
         4: 'rank'
       },
       homeColumn: [],
-      parent_id: 0
+      parent_id: 0,
+      scene_code: ''
     }
   },
   computed: {
@@ -79,8 +80,9 @@ export default {
   onLoad(options) {
     console.log('-->index data', options)
     this.isLogin && this.getHomeColumn()
+    this.scene_code = typeof options.user_id !== 'undefined' ? options.scene : ''
     this.parent_id = typeof options.user_id !== 'undefined' ? options.user_id : 0
-    if (this.parent_id && !this.userInfo.parent_id) {
+    if ((this.parent_id || this.scene_code) && !this.userInfo.parent_id) {
       this.isLogin && this.bindParent()
     }
   },
@@ -106,7 +108,7 @@ export default {
       })
     },
     bindParent() {
-      this.$api.user.bind(this.parent_id).then(res => {
+      this.$api.user.bind(this.parent_id ? this.parent_id : this.scene_code).then(res => {
         console.log('-->bind success')
         this.$store.dispatch('user/info', res.data)
       })