jump.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. module.exports = {
  2. toChannelIndex: toChannelIndex,
  3. toAboutUs: toAboutUs,
  4. }
  5. ///选择指定频道
  6. function toChannelIndex(index, callback) {
  7. var pages = getCurrentPages();
  8. const route_util = require('../route_util');
  9. const route_constant = require('../route_constant');
  10. var isLogin = pages[0].getIsLogin();
  11. if (!isLogin) {
  12. route_util.jump(route_constant.login);
  13. return;
  14. }
  15. const strings = require('../strings');
  16. var actionIndex = pages[0].getActionIndex();
  17. if (strings.isEmpty(actionIndex)) {
  18. return;
  19. }
  20. if (index === actionIndex) {
  21. return;
  22. };
  23. var deviceList = pages[0].getDeviceList();
  24. var deviceListSelect = pages[0].getDeviceListSelect();
  25. if (deviceListSelect === null || deviceList.length <= deviceListSelect) {
  26. wx.showToast({
  27. title: '请选择设备',
  28. icon: "none"
  29. });
  30. return;
  31. };
  32. callback(index);
  33. const app = getApp();
  34. const lexin_util = require('../lexin/util');
  35. var channelData = pages[0].getChannelData();
  36. // `${deviceUid}`
  37. var deviceUid = app.globalData.userInfo.deviceUid;
  38. var timestamp = Math.round(new Date() / 1000);
  39. var channel_id = channelData[index].channelNum;
  40. var is_debug = app.globalData.is_debug;
  41. var deviceId = deviceList[deviceListSelect].deviceId;
  42. const other = {
  43. "url": "",
  44. "media_data": "",
  45. "user_id": deviceUid,
  46. "timestamp": timestamp,
  47. "channel_id": channel_id,
  48. "order": "",
  49. "resource_from": "",
  50. "songAlbumID": "",
  51. "version": 3,
  52. "is_debug": is_debug,
  53. };
  54. var deviceMacId = lexin_util.getDeviceMacId(deviceId);
  55. app.PubMsg({
  56. type: "play",
  57. DstDeviceName: deviceMacId,
  58. other
  59. });
  60. };
  61. ///关于我们
  62. function toAboutUs() {
  63. const route_util = require('../route_util');
  64. const route_constant = require('../route_constant');
  65. route_util.jump(route_constant.about);
  66. };