多租户商城-商户小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.6 KiB

2 years ago
  1. const NET = require('@/utils/request')
  2. const API = require('@/config/api')
  3. import {funMixin} from '../../config/mixin'
  4. export const commonMixin = {
  5. mixins: [funMixin],
  6. data() {
  7. return {
  8. appid: 'wx2b03c6e691cd7370',
  9. roomId: [], // 填写具体的房间号
  10. roomList: [],
  11. page: {
  12. page: 1,
  13. pageSize: 6,
  14. },
  15. }
  16. },
  17. props: {
  18. terminal: {
  19. type: Number,
  20. default: 4
  21. },
  22. typeId: {
  23. type: Number,
  24. default: 1
  25. },
  26. shopId: {
  27. type: Number,
  28. default: 0
  29. },
  30. componentContent: {
  31. type: Object
  32. }
  33. },
  34. created() {
  35. this.getLiveRooms()
  36. },
  37. methods: {
  38. // 获取直播间列表
  39. getLiveRooms () {
  40. NET.request(API.LiveRoomes, this.page, 'get').then(res => {
  41. console.log(res)
  42. this.roomList = res.data.list
  43. })
  44. },
  45. toLiveRoom (item) {
  46. this.roomId.push(item.roomid)
  47. if (!this.appid || !this.roomId.length) { return }
  48. // 路由参数
  49. let customParams = encodeURIComponent(JSON.stringify({ path: 'livePage/index', pid: 1 }))
  50. // let customParams
  51. // 开发者在直播间页面路径上携带自定义参数(如示例中的path和pid参数),后续可以在分享卡片链接和跳转至商详页时获取,详见【获取自定义参数】、【直播间到商详页面携带参数】章节(上限600个字符,超过部分会被截断)
  52. // #ifdef MP-WEIXIN
  53. wx.navigateTo({
  54. url: `plugin-private://${this.appid}/pages/live-player-plugin?room_id=${this.roomId}&custom_params=${customParams}`
  55. })
  56. // #endif
  57. }
  58. }
  59. }