Переглянути джерело

feat:不删除拓客端传过来的参数,打上使用标记

zhanghui 3 місяців тому
батько
коміт
65540f75c0
2 змінених файлів з 41 додано та 63 видалено
  1. 35 61
      App.vue
  2. 6 2
      pages/index/index.vue

+ 35 - 61
App.vue

@@ -37,71 +37,45 @@
                         let expandParam = uni.getStorageSync('expandParam')
                         if (expandParam) {
 
-
+                          if (expandParam.isUse != 1){
                             console.log('获取到的拓客端参数',expandParam)
                             if (new Date().getTime() <= expandParam.timestamp){
-                                if (isNew){
-                                  //登录成功,且是新用户,触发首页的自定义事件
-                                  uni.$emit("loginSuccess")
-                                    //用户扫码拓客端进入小程序
-                                    // that.$api.userBindMember(
-                                    //     {
-                                    //         ...expandParam,
-                                    //         memberId: res.data.data.userInfo.id
-                                    //     }
-                                    // ).then(res1 => {
-                                    //     console.log('拓客端推广用户绑定成功!')
-                                    //
-                                    //     that.$api.addRecordForAttach({
-                                    //         ...expandParam,
-                                    //         isNew:1,
-                                    //         isBindSuccess:1,
-                                    //     }).then(res=>{
-                                    //         console.log('+++++++++新用户,扫码推广成功记录!++++++++++++++++')
-                                    //     })
-                                    //
-                                    //     uni.removeStorageSync('expandParam');
-                                    // }).catch(err=>{
-                                    //
-                                    //     that.$api.addRecordForAttach({
-                                    //         ...expandParam,
-                                    //         isNew:1,
-                                    //         isBindSuccess:0,
-                                    //     }).then(res=>{
-                                    //         console.log('+++++++++新用户,扫码推广失败记录!++++++++++++++++')
-                                    //     })
-                                    //
-                                    //     uni.removeStorageSync('expandParam');
-                                    // })
-                                }else {
-
-                                    that.$api.addRecordForAttach({
-                                        ...expandParam,
-                                        isNew:0,
-                                        isBindSuccess:0,
-                                    }).then(res=>{
-                                        console.log('+++++++++老用户,扫码推广失败记录!++++++++++++++++')
-                                    })
-
-                                    uni.removeStorageSync('expandParam');
+                              if (isNew){
+                                //登录成功,且是新用户,触发首页的自定义事件
+                                uni.$emit("loginSuccess")
+                              }else {
+
+                                that.$api.addRecordForAttach({
+                                  ...expandParam,
+                                  isNew:0,
+                                  isBindSuccess:0,
+                                }).then(res=>{
+                                  expandParam.isUse = 1
+                                  uni.setStorageSync('expandParam', expandParam)
+                                  console.log('+++++++++老用户,扫码推广失败记录!++++++++++++++++')
+                                })
+
+                                // uni.removeStorageSync('expandParam');
+                              }
+
+                            }else {
+                              uni.showModal({
+                                title: '温馨提示',
+                                content: ' 当前二维码已过期,请重新扫码',
+                                showCancel:false,
+                                success: function (res) {
+                                  if (res.confirm) {
+                                    console.log('用户点击确定');
+                                  } else if (res.cancel) {
+                                    console.log('用户点击取消');
+                                  }
                                 }
-
-                             }else {
-                                uni.showModal({
-                                    title: '温馨提示',
-                                    content: ' 当前二维码已过期,请重新扫码',
-                                    showCancel:false,
-                                    success: function (res) {
-                                        if (res.confirm) {
-                                            console.log('用户点击确定');
-                                        } else if (res.cancel) {
-                                            console.log('用户点击取消');
-                                        }
-                                    }
-                                });
-                                uni.removeStorageSync('expandParam');
+                              });
+                              expandParam.isUse = 1
+                              uni.setStorageSync('expandParam', expandParam)
+                              // uni.removeStorageSync('expandParam');
                             }
-
+                          }
                         }
 
                         //用户扫码技师端进入小程序,携带的参数。 暂无操作

+ 6 - 2
pages/index/index.vue

@@ -596,9 +596,11 @@ export default {
         isNew: 1,
         isBindSuccess: 0,
       }).then(res => {
+        expandParam.isUse = 1
+        uni.setStorageSync('expandParam', expandParam)
         console.log('+++++++++新用户,扫码推广失败记录!++++++++++++++++')
       })
-      uni.removeStorageSync('expandParam');
+      // uni.removeStorageSync('expandParam');
     },
 
     userBindMember() {
@@ -655,7 +657,9 @@ export default {
           }).then(res => {
             console.log('+++++++++新用户,扫码推广成功记录!++++++++++++++++')
           })
-          uni.removeStorageSync('expandParam');
+          expandParam.isUse = 1
+          uni.setStorageSync('expandParam', expandParam)
+          // uni.removeStorageSync('expandParam');
         })
 
       }).catch(errors => {