Blame view

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