jump.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. console.log("gadsfadsfadsfa==222==");
  12. if (!isLogin) {
  13. route_util.jump(route_constant.login);
  14. return;
  15. }
  16. console.log("gadsfadsfadsfa==333==");
  17. var actionIndex = pages[0].getActionIndex();
  18. if (actionIndex != null && index == actionIndex) {
  19. return;
  20. };
  21. console.log("gadsfadsfadsfa==444==");
  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. console.log("gadsfadsfadsfa==555==");
  32. callback(index);
  33. console.log("gadsfadsfadsfa==666==");
  34. const app = getApp();
  35. const lexin_util = require('../lexin/util');
  36. var channelData = pages[0].getChannelData();
  37. // `${deviceUid}`
  38. var deviceUid = `${app.globalData.userInfo.deviceUid}`;
  39. var timestamp = Math.round(new Date() / 1000);
  40. var channel_id = channelData[index].channelNum;
  41. var is_debug = app.globalData.is_debug;
  42. var deviceId = deviceList[deviceListSelect].deviceId;
  43. const other = {
  44. "url": "",
  45. "media_data": "",
  46. "user_id": deviceUid,
  47. "timestamp": timestamp,
  48. "channel_id": channel_id,
  49. "order": "",
  50. "resource_from": "",
  51. "songAlbumID": "",
  52. "version": 3,
  53. "is_debug": is_debug,
  54. };
  55. //other: {"url":"","media_data":"","user_id":1,"timestamp":1734423952,"channel_id":4,"order":"","resource_from":"","songAlbumID":"","version":3,"is_debug":2}
  56. //deviceMacId: AIrSMArT_7cdfa1fd3af0
  57. var deviceMacId = lexin_util.getDeviceMacId(deviceId);
  58. console.log("gadsfadsfadsfa==777==" + deviceMacId);
  59. console.log("gadsfadsfadsfa==888==" + JSON.stringify(other));
  60. app.PubMsg({
  61. type: "play",
  62. DstDeviceName: deviceMacId,
  63. other
  64. });
  65. };
  66. ///关于我们
  67. function toAboutUs() {
  68. const route_util = require('../route_util');
  69. const route_constant = require('../route_constant');
  70. route_util.jump(route_constant.about);
  71. };