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.

78 regels
1.9 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. gameUrl: ''
  14. },
  15. methods:{
  16. gotogame: function (e) {
  17. let that=this;
  18. Http.post({
  19. url: config.api.checkPhoneStatus,
  20. data: {}
  21. })
  22. .then(res => {
  23. console.log(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"
  46. });
  47. } else if (err.code == 11006){
  48. // 用户手机已加密
  49. wx.redirectTo({
  50. url: "/pages/phoneinput/phoneinput?path=index"
  51. });
  52. }else {
  53. wx.showToast({
  54. title: err.message,
  55. image: "../../assets/img/fail.png",
  56. duration: 2000,
  57. mask: false
  58. });
  59. }
  60. })
  61. },
  62. a: function () {
  63. this.setData({ flag: false })
  64. },
  65. closeGame: function () {
  66. this.setData({ flag: true })
  67. },
  68. },
  69. onReady: function () {
  70. console.log(this.gamedata, 999999999)
  71. },
  72. onLoad: function (options) {
  73. console.log(this.gamedata, 999999999)
  74. },
  75. onShow: function () {
  76. console.log(this.gamedata, 999999999)
  77. }
  78. });