jump.js 2.0 KB

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