jump.js 1.9 KB

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