C端小程序
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.

86 regels
2.4 KiB

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