index.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // pages/game/index.ts
  2. const app_game = getApp<IAppOption>()
  3. var mixins = require('../../utils/mixins')
  4. Page({
  5. mixins: [mixins],
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. url: '',
  11. roomId: '',
  12. gameLogId:''
  13. },
  14. onLoad(options) {
  15. let { roomId, gameLogId } = options
  16. this.setData({
  17. roomId,
  18. gameLogId
  19. })
  20. },
  21. onShow() {
  22. let token = wx.getStorageSync('token')
  23. this.setData({
  24. // @ts-ignore
  25. // url: `http://192.168.20.66:8081/index.html?m=1180&token=${token}&mgid=${app_game.globalData.userInfo.id}${this.data.gameLogId ? ('&gameLogId=' + this.data.gameLogId) : ''}${this.data.roomId ? ('&roomId=' + this.data.roomId) : ''}`
  26. url: `${this.data.API_BASE_URL}web/index.html?m=1180&token=${token}&mgid=${app_game.globalData.userInfo.id}${this.data.gameLogId ? ('&gameLogId=' + this.data.gameLogId) : ''}${this.data.roomId ? ('&roomId=' + this.data.roomId) : ''}`
  27. })
  28. },
  29. /**
  30. * 生命周期函数--监听页面初次渲染完成
  31. */
  32. onReady() {
  33. },
  34. /**
  35. * 生命周期函数--监听页面隐藏
  36. */
  37. onHide() {
  38. },
  39. /**
  40. * 生命周期函数--监听页面卸载
  41. */
  42. onUnload() {
  43. },
  44. /**
  45. * 页面相关事件处理函数--监听用户下拉动作
  46. */
  47. onPullDownRefresh() {
  48. },
  49. /**
  50. * 页面上拉触底事件的处理函数
  51. */
  52. onReachBottom() {
  53. },
  54. /**
  55. * 用户点击右上角分享
  56. */
  57. onShareAppMessage() {
  58. }
  59. })