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