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.
63 lines
1.6 KiB
63 lines
1.6 KiB
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) => {
|
|
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
|
|
},
|
|
},
|
|
}
|