jump.js 2.4 KB

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