소스 검색

feat: 拓客端时间戳参数校验,提示

zhanghui 2 년 전
부모
커밋
6cae4330d3
1개의 변경된 파일29개의 추가작업 그리고 9개의 파일을 삭제
  1. 29 9
      App.vue

+ 29 - 9
App.vue

@@ -35,16 +35,36 @@
                         //拓客端或者技师端扫码用户绑定
                         let expandParam = uni.getStorageSync('expandParam')
                         if (expandParam) {
-                            //用户扫码拓客端进入小程序
-                            that.$api.userBindMember(
-                                {
-                                    ...expandParam,
-                                    memberId: res.data.data.userInfo.id
-                                }
-                            ).then(res1 => {
-                                console.log('拓客端推广用户绑定成功!')
+
+                            console.log('获取到的拓客端参数',expandParam)
+                            if (new Date().getTime() <= expandParam.timestamp){
+
+                                //用户扫码拓客端进入小程序
+                                that.$api.userBindMember(
+                                    {
+                                        ...expandParam,
+                                        memberId: res.data.data.userInfo.id
+                                    }
+                                ).then(res1 => {
+                                    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('用户点击取消');
+                                        }
+                                    }
+                                });
                                 uni.removeStorageSync('expandParam');
-                            })
+                            }
+
                         }
 
                         //用户扫码技师端进入小程序 暂无操作