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.

76 line
2.2 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. var data = {
  25. couponChannelId: "" + that.data.couponChannelId,
  26. couponId: "" + that.data.couponId
  27. };
  28. if (that.data.couponChannelId == null) {
  29. var data = {
  30. couponId: "" + that.data.couponId
  31. };
  32. }
  33. wx.navigateTo({
  34. url: '/pages/game/index?url=' + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId,
  35. })
  36. })
  37. .catch(err => {
  38. if (err.code == 11005) {
  39. // 用户手机未授权
  40. /**
  41. * 将值传到用户手机号授权的页面
  42. *
  43. */
  44. wx.redirectTo({
  45. url: "/pages/getphoneInfo/index?path=index&url=" + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId
  46. });
  47. } else if (err.code == 11006){
  48. // 用户手机已加密
  49. wx.redirectTo({
  50. url: "/pages/phoneinput/phoneinput?path=index&url=" + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId
  51. });
  52. }else {
  53. wx.showToast({
  54. title: err.errMsg,
  55. icon: 'none',
  56. duration: 2000,
  57. mask: false
  58. });
  59. }
  60. })
  61. },
  62. a: function () {
  63. this.setData({ flag: false })
  64. },
  65. closeGame: function () {
  66. let that = this;
  67. var animation = wx.createAnimation({})
  68. // animation.opacity(0).step({ duration: 1000 })
  69. setTimeout(function () {
  70. that.setData({ flag: true })
  71. }, 500)
  72. animation.rotateZ(180).scale(0).opacity(0.5).step({ duration: 1000 })
  73. that.setData({ alphaData: animation.export() });
  74. },
  75. },
  76. });