碧桂园
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
2.0 KiB

  1. // index.js
  2. // 获取应用实例
  3. const app = getApp()
  4. Page({
  5. data: {
  6. },
  7. onLoad(option) {
  8. console.log(option.id)
  9. let that = this
  10. if(option.id){ // 有ID则是通过分享链接进来的
  11. setTimeout(function(){
  12. that.inviteFun(option.id)
  13. },1000)
  14. }
  15. },
  16. // 判断是跳转游戏还是静态页
  17. panduanFun(){
  18. let that = this
  19. wx.request({
  20. url: getApp().globalData.httpurl + 'ar/game/getOne',
  21. method: "get",
  22. data: {},
  23. header: {
  24. Authorization: 'bearer '+ getApp().globalData.token
  25. },
  26. success(res) {
  27. console.log(res)
  28. if (res.data.code == 0) {
  29. let data = res.data.data
  30. if(data.miniType==0){
  31. getApp().globalData.gameurl=data.linkUrl
  32. console.log(getApp().globalData.gameurl)
  33. that.tabindex(data.linkUrl)
  34. }else{
  35. wx.navigateTo({
  36. url: '/pages/guodu/index'
  37. })
  38. }
  39. }else{
  40. wx.showToast({
  41. icon: 'none',
  42. title: res.data.msg
  43. })
  44. return ;
  45. }
  46. }
  47. })
  48. },
  49. inviteFun(id){
  50. let token = wx.getStorageSync('token')
  51. console.log(token)
  52. wx.request({
  53. url: getApp().globalData.httpurl + 'ar/user/bindNShareUserId?shareUserId='+ id,
  54. method: "get",
  55. data: {},
  56. header: {
  57. Authorization: 'bearer '+ token
  58. },
  59. success(res) {
  60. if (res.data.code == 0) {
  61. }else{
  62. wx.showToast({
  63. icon: 'none',
  64. title: res.data.msg
  65. })
  66. return ;
  67. }
  68. }
  69. })
  70. },
  71. tabindex(url) {
  72. let userInfo = getApp().globalData.userInfo
  73. console.log(userInfo)
  74. let id = 0
  75. if(userInfo.phone){
  76. id = userInfo.id
  77. }
  78. wx.navigateTo({
  79. url: '/pages/out/index?index=1&userid=' + id+ '&gameid=1&type=1&url='+url
  80. })
  81. },
  82. tabsaoma() {
  83. wx.navigateTo({
  84. url: '/pages/AR/index'
  85. })
  86. }
  87. })