// index.js // 获取应用实例 const app = getApp() Page({ data: { }, onLoad(option) { console.log(option.id) let that = this if(option.id){ // 有ID则是通过分享链接进来的 setTimeout(function(){ that.inviteFun(option.id) },1000) } }, panduanFun(){ let that = this wx.request({ url: 'http://192.168.31.104:9998/ar/game/getOne', // url: 'https://cktest.2weisou.com/meta/ar/game/getOne', method: "get", data: {}, header: { Authorization: 'bearer '+ getApp().globalData.token }, success(res) { console.log(res) if (res.data.code == 0) { let data = res.data.data if(data.miniType==0){ getApp().globalData.gameurl=data.linkUrl console.log(getApp().globalData.gameurl) that.tabindex(data.linkUrl) }else{ wx.navigateTo({ url: '/pages/guodu/index' }) } }else{ wx.showToast({ icon: 'none', title: res.data.msg }) return ; } } }) }, inviteFun(id){ let token = wx.getStorageSync('token') console.log(token) wx.request({ url: 'https://cktest.2weisou.com/meta/ar/user/bindNShareUserId?shareUserId='+ id, method: "get", data: {}, header: { Authorization: 'bearer '+ token }, success(res) { if (res.data.code == 0) { }else{ wx.showToast({ icon: 'none', title: res.data.msg }) return ; } } }) }, tabindex(url) { let userInfo = getApp().globalData.userInfo console.log(userInfo) let id = 0 if(userInfo.phone){ id = userInfo.id } wx.navigateTo({ url: '/pages/out/index?index=1&userid=' + id+ '&gameid=1&type=1&url='+url }) }, tabsaoma() { wx.navigateTo({ url: '/pages/AR/index' }) } })