QQPlayer.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. const LoginApi = require('./LoginApi');
  2. // const ShareAction = require('../utils/ShareAction');
  3. // const AlertManager = require('../utils/AlertManager');
  4. // const SkillApi = require("../net/SkillApi");
  5. class QQPlayer {
  6. static qqLogin(cb) {
  7. if (typeof GameStatusInfo != undefined && GameStatusInfo != undefined) {
  8. let openId = GameStatusInfo.openId; //获取当前用户的唯一标识
  9. let accessToken = GameStatusInfo.accessToken;
  10. console.log('gamestatusInfo' + GameStatusInfo);
  11. BK.QQ.fetchOpenKey(function (errCode, cmd, data) {
  12. if (errCode == 0) {
  13. let openKey = data.openKey;
  14. console.log('qq openKey' + openKey);
  15. console.log('qq openId' + openId);
  16. let gender = data.sex;
  17. // 1 男 2 女
  18. if (gender == 2) {
  19. gender = 0;
  20. }
  21. if (gender == undefined) {
  22. gender = -1;
  23. }
  24. LoginApi.qqLogin(openId, openKey, gender, cb);
  25. } else {
  26. console.log('login fail');
  27. }
  28. });
  29. } else {
  30. // LoginApi.qqLogin('oadDi5C3mWabn5c5cUjWEa1HAecwqq', 'oadDi5C3mWabn5c5cUjWEa1HAecwqq', 1);
  31. console.log('GameStatusInfo is undefined');
  32. }
  33. // //Test
  34. // PLATFORM.authQQ(0, 0, 0);
  35. }
  36. static shareObjcts = [
  37. {'title': '猜猜他是谁?', 'icon': 'share_3.png'},
  38. {'title': '猜猜他是谁?', 'icon': 'share_4.png'},
  39. {'title': '看到这位明星了吗,签下这份合同,她就是你的人了~', 'icon': 'share_5.png'},
  40. {'title': '就、就算你是大明星,签约了你也是我的人!', 'icon': 'share_6.png'},
  41. {'title': '老板跟着小姨子跑路啦!本公司签约女团低价转让!', 'icon': 'share_7.png'},
  42. {'title': '你,还有你,我钦定你们两个。。。组CP!', 'icon': 'share_8.png'},
  43. {'title': '猜猜他是谁?', 'icon': 'share_9.png'},
  44. {'title': '猜猜他是谁?', 'icon': 'share_10.png'},
  45. {'title': '猜猜她是谁?', 'icon': 'share_11.png'}
  46. ]
  47. }
  48. module.exports = QQPlayer;