C端小程序
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

98 Zeilen
3.1 KiB

  1. // pages/index/sw/index.js
  2. const Http = require("../../utils/HttpBasics");
  3. var config = require("../../config/config.js");
  4. let app = getApp();
  5. Component({
  6. properties: {
  7. gamedata: {
  8. type: Object,
  9. value: {}
  10. }
  11. },
  12. data: {
  13. flag: false,
  14. alphaData: null,
  15. gameUrl: ''
  16. },
  17. methods:{
  18. gotogame: function (e) {
  19. let that=this;
  20. Http.get({
  21. url: config.api.checkUserStatus,
  22. data: {
  23. token: app.globalData.token
  24. }
  25. }).then(res1 => {
  26. Http.get({
  27. url: config.api.checkPhoneStatus,
  28. data: {}
  29. }).then(res => {
  30. var data = {
  31. couponChannelId: "" + that.data.couponChannelId,
  32. couponId: "" + that.data.couponId
  33. };
  34. if (that.data.couponChannelId == null) {
  35. var data = {
  36. couponId: "" + that.data.couponId
  37. };
  38. }
  39. wx.redirectTo({
  40. url: '/pages/game/index?url=' + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId,
  41. })
  42. }).catch(err => {
  43. if (err.code == 11005) {
  44. // 用户手机未授权
  45. /**
  46. * 将值传到用户手机号授权的页面
  47. *
  48. */
  49. app.globalData.skipUrl = '/pages/game/index?url=' + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId,
  50. app.globalData.skip = 'redirectTo'
  51. wx.redirectTo({
  52. url: "/pages/getphoneInfo/index?path=index&url=" + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId,
  53. });
  54. } else if (err.code == 11006) {
  55. // 用户手机已加密
  56. wx.redirectTo({
  57. url: "/pages/phoneinput/phoneinput?path=index&url=" + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId,
  58. });
  59. } else {
  60. wx.showToast({
  61. title: err.message,
  62. icon: 'none',
  63. duration: 2000,
  64. mask: false
  65. });
  66. }
  67. })
  68. }).catch(err => {
  69. if (err.code == 11004) { //未授权微信
  70. app.globalData.type = 'gm'
  71. wx.redirectTo({
  72. url: "/pages/getuserinfo/index?path=index&url=" + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId,
  73. });
  74. } else {
  75. wx.showToast({
  76. title: err.message,
  77. icon: 'none',
  78. duration: 2000,
  79. mask: false
  80. });
  81. }
  82. })
  83. },
  84. a: function () {
  85. this.setData({ flag: false })
  86. },
  87. closeGame: function () {
  88. let that = this;
  89. var animation = wx.createAnimation({})
  90. // animation.opacity(0).step({ duration: 1000 })
  91. setTimeout(function () {
  92. that.setData({ flag: true })
  93. }, 500)
  94. animation.rotateZ(180).scale(0).opacity(0.5).step({ duration: 1000 })
  95. that.setData({ alphaData: animation.export() });
  96. },
  97. },
  98. });