Global.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Learn cc.Class:
  2. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
  3. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
  4. // Learn Attribute:
  5. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
  6. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
  7. // Learn life-cycle callbacks:
  8. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
  9. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html
  10. if (CC_WECHATGAME) {
  11. window.Global = {
  12. //Urls
  13. loginUrl: 'https://api-touhu.duowan.com/auth/loginByGame.do',
  14. userReport: 'https://api-touhu.duowan.com/user/report.do',
  15. totalRank: 'https://api-touhu.duowan.com/user/getAllRank.do',
  16. //SystemInfo
  17. ver: 100,
  18. os: 1,
  19. channel: "wexin",
  20. //userInfo
  21. user: null,
  22. // user = {
  23. // token:data.token,
  24. // uid:user.id,
  25. // openId:user.openId,
  26. // nick:userInfo.nickName,
  27. // avatarUrl:userInfo.avatarUrl,
  28. // gender:userInfo.gender,
  29. // gold:user.coin,
  30. // score:user.score,
  31. // revivedCount:0
  32. // };
  33. showLoginPage: true
  34. };
  35. // wx.onShow(res => {
  36. // wx.checkSession({
  37. // success: function () {
  38. // //session_key 未过期,并且在本生命周期一直有效
  39. // },
  40. // fail: function () {
  41. // // session_key 已经失效,需要重新执行登录流程
  42. // Global.showLoginPage = true;
  43. // cc.director.loadScene("GameScene");
  44. // }
  45. // })
  46. // });
  47. }