jump.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. module.exports = {
  2. toChannelIndex: toChannelIndex,
  3. toAboutUs: toAboutUs,
  4. }
  5. ///选择指定频道
  6. function toChannelIndex(index, callback) {
  7. var pages = getCurrentPages();
  8. const routeUtil = require('../routeUtil');
  9. const routePath = require('../routePath');
  10. var isLogin = pages[0].getIsLogin();
  11. if (!isLogin) {
  12. routeUtil.jump(routePath.loginIndex);
  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 userId = `${app.globalData.userInfo.userId}`;
  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. console.log("gadfadsfqewrq==111=" + userId);
  40. console.log("gadfadsfqewrq==222=" + JSON.stringify(app.globalData.userInfo));
  41. const other = {
  42. "url": "",
  43. "media_data": "",
  44. "user_id": userId,
  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. // {"url":"","media_data":"","user_id":"1","timestamp":1739514803,"channel_id":2,"order":"","resource_from":"","songAlbumID":"","version":3,"is_debug":1}
  54. // 发送设备数据:true,/AIrSMArT_210052356337/user/sub_control, {"DstDeviceName":"AIrSMArT_210052356337","SrcDeviceName":"ALY_933625_Android","type":"play",
  55. // "user_id":"933625","other"{"url":"","media_data":"","user_id":"933625","timestamp":"1726129883",
  56. // "channel_id":9,"resource_from":"","categoryId":"","sort":0,"order":"2","version":3,"is_debug":1}}
  57. //deviceMacId: AIrSMArT_7cdfa1fd3af0
  58. var deviceMacId = lexin_util.getDeviceMacId(deviceId);
  59. app.PubMsg({
  60. type: "play",
  61. DstDeviceName: deviceMacId,
  62. other: other
  63. });
  64. };
  65. ///关于我们
  66. function toAboutUs() {
  67. const routeUtil = require('../routeUtil');
  68. const routePath = require('../routePath');
  69. routeUtil.jump(routePath.aboutIndex);
  70. };