From 95f9e1942989d0b0dd9e18abbaa86d49defe49dc Mon Sep 17 00:00:00 2001 From: corala <18339694416@163.com> Date: Sun, 1 May 2022 20:25:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BC=A0=E5=8F=82useid?= =?UTF-8?q?=E4=B8=BAopenid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.js | 16 ++++++++-------- pages/login/index.js | 2 +- pages/out/index.js | 10 +--------- pages/share/index.js | 8 +++----- 4 files changed, 13 insertions(+), 23 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index 79922cb..c1f3759 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -5,12 +5,12 @@ Page({ data: { token: '', userInfo: null, - paramsid: ''// 邀请人ID + shareid: ''// 邀请人ID }, onLoad(option) { console.log(option.id) this.setData({ - paramsid: option.id + shareid: option.id }) this.loginGettoken() }, @@ -29,7 +29,7 @@ Page({ if (res.data.code == 0) { let data = res.data.data // gameVersion为指定发版,和后台是否保持一致,方便提审通过,后续只需更改1为2,3,4,5... - if(data.miniType==0&&data.gameVersion==2){ + if(data.miniType==0&&data.gameVersion==3){ getApp().globalData.gameurl = data.linkUrl that.tabindex(data.linkUrl) }else{ @@ -73,12 +73,12 @@ Page({ }) }, tabindex(url) { - let id = 0 + let openid = 0 if(this.data.userInfo.phone){ - id = this.data.userInfo.id + openid = this.data.userInfo.openid } wx.navigateTo({ - url: '/pages/out/index?index=1&userid=' + id+ '&gameid=1&type=1&url='+url + url: '/pages/out/index?index=1&openid=' + openid+ '&gameid=1&type=1&url='+url }) }, saoma() { @@ -107,8 +107,8 @@ Page({ token: res1.data.access_token, userInfo: res1.data.user_info }) - if(that.data.paramsid){ // 有ID则是通过分享链接进来的 - that.inviteFun(that.data.paramsid) + if(that.data.shareid){ // 有ID则是通过分享链接进来的 + that.inviteFun(that.data.shareid) } getApp().globalData.token = res1.data.access_token getApp().globalData.userInfo = res1.data.user_info diff --git a/pages/login/index.js b/pages/login/index.js index c333c07..e45c89d 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -83,7 +83,7 @@ Page({ }, leave(){ wx.navigateTo({ - url: '/pages/out/index?index=1&userid='+ this.data.userid+'&gameid=1'+'&type=2&url=' + getApp().globalData.gameurl, + url: '/pages/out/index?index=1&openid='+ this.data.userInfo.openid+'&gameid=1'+'&type=2&url=' + getApp().globalData.gameurl, }) }, // 绑定用户头像信息 diff --git a/pages/out/index.js b/pages/out/index.js index b705b56..ca6aa39 100644 --- a/pages/out/index.js +++ b/pages/out/index.js @@ -1,9 +1,4 @@ -// pages/out/index.js Page({ - - /** - * 页面的初始数据 - */ data: { web:null, index:0, @@ -12,9 +7,6 @@ Page({ type: 1, allurl: "" }, - /** - * 生命周期函数--监听页面加载 - */ onLoad: function (options) { console.log(options); this.setData({ @@ -23,7 +15,7 @@ Page({ userid: options.userid, gameid: options.gameid, type: options.type, - allurl: options.url +`?userid=${options.userid||0}&gameid=${options.gameid||0}&type=${options.type==2?2:1}` + allurl: options.url +`?openid=${options.openid||0}&gameid=${options.gameid||0}&type=${options.type==2?2:1}` }) console.log(this.data.web) console.log(this.data.index) diff --git a/pages/share/index.js b/pages/share/index.js index 37478a9..fe72395 100644 --- a/pages/share/index.js +++ b/pages/share/index.js @@ -1,7 +1,5 @@ - Page({ - /** * 页面的初始数据 */ @@ -18,7 +16,7 @@ Page({ let userInfo = getApp().globalData.userInfo console.log(userInfo) wx.navigateTo({ - url: `/pages/out/index?index=1&userid=${userInfo.id}&gameid=1&type=2&url=`+ getApp().globalData.gameurl + url: `/pages/out/index?index=1&openid=${userInfo.openid}&gameid=1&type=2&url=`+ getApp().globalData.gameurl }) }, /** @@ -67,12 +65,12 @@ Page({ * 用户点击右上角分享 */ onShareAppMessage: function (e) { - // console.log(getApp().globalData.userInfo.id) + // console.log(getApp().globalData.userInfo.) this.shareFun() return { title: '万套房源5折起,iPhone13 Pro Max免费赢!速来!', imageUrl: 'https://static.quhouse.com/468340e3a1374decb4fa51a172aa4f52.png', - path: '/pages/index/index?id=' + getApp().globalData.userInfo.id + path: '/pages/index/index?openid=' + getApp().globalData.userInfo.openid } }, shareFun(){