jump.js 2.0 KB

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