直播修改

This commit is contained in:
luyuan 2020-07-30 08:46:35 +08:00
parent 74fbd629d6
commit 519ec0abe8
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
2 changed files with 43 additions and 30 deletions

View File

@ -28,7 +28,7 @@
<!-- 标签的引入 --> <!-- 标签的引入 -->
<tap_tosign :fileListes="fileListes" @chuangjian="chuangjian" @qiehuan="qiehuan"></tap_tosign> <tap_tosign :fileListes="fileListes" @chuangjian="chuangjian" @qiehuan="qiehuan"></tap_tosign>
<view class="titles">直播封面图</view> <view class="titles">直播封面图</view>
<u-upload :form-data="{'name':'article_cover'}" action='https://dmmall.sdbairui.com/storeapi/Upload/uploadFile' name="article_cover" :max-count="1" :show-progress="false" @on-change="tupian" del-color="#ececec" upload-text="上传" del-bg-color="#fff"></u-upload> <u-upload :form-data="{'name':'article_cover'}" action='https://dmmall.sdbairui.com/storeapi/Upload/uploadFile' name="article_cover" :header="{'Authorization' : 'Bearer' + ' ' + token}" :max-count="1" :show-progress="false" @on-change="tupian" del-color="#ececec" upload-text="上传" del-bg-color="#fff"></u-upload>
</view> </view>
<view class="button-uview"> <view class="button-uview">
<u-button @click="kaibo">{{relerest}}</u-button> <u-button @click="kaibo">{{relerest}}</u-button>
@ -60,7 +60,8 @@
relerest: '开始直播', relerest: '开始直播',
fileListes:[], fileListes:[],
rSelect:[], rSelect:[],
image:"" image:"",
token:""
}; };
}, },
methods: { methods: {
@ -90,7 +91,7 @@
this.init() this.init()
}, },
tupian(a){ tupian(a){
console.log(JSON.parse(a.data).data) console.log(JSON.parse(a.data))
this.image = JSON.parse(a.data).data.file_name this.image = JSON.parse(a.data).data.file_name
}, },
navto(url){ navto(url){
@ -137,6 +138,14 @@
onLoad(){ onLoad(){
this.init() this.init()
uni.removeStorageSync('gouwudai') uni.removeStorageSync('gouwudai')
//
this.token = uni.getStorageSync('token');
var config = {
appkey: 'mgb7ka1',
debug:true
};
} }
}; };
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<live-pusher id='livePusher' ref="livePusher" class="livePusher" :url="url" <live-pusher id='livePusher' ref="livePusher" class="livePusher" :url="url"
mode="SD" :muted="true" :enable-camera="true" :auto-focus="true" :beauty="1" whiteness="2" mode="SD" :muted="false" :enable-camera="true" :auto-focus="true" :beauty="1" whiteness="2"
aspect="9:16" @statechange="statechange" @netstatus="netstatus" @error = "error" aspect="9:16" @statechange="statechange" @netstatus="netstatus" @error = "error"
:style="{'height':height + 'px'}" :style="{'height':height + 'px'}"
></live-pusher> ></live-pusher>
@ -166,7 +166,7 @@
} }
</style> </style>
<script> <script>
const RongIMLib = require('../../static/rongyun.js'); const RongIMLib = require('../../static/rongyun.js');
export default { export default {
data: { data: {
fil: true, fil: true,
@ -195,28 +195,29 @@ const RongIMLib = require('../../static/rongyun.js');
this.url = a.url.replace("*","&") this.url = a.url.replace("*","&")
let that = this let that = this
const token = uni.getStorageSync('token'); const token = uni.getStorageSync('token');
uni.request({ console.log('Bearer' + " " + token)
url:"https://dmmall.sdbairui.com//storeapi/Streaming/liveStreamList", // uni.request({
method:"POST", // url:"https://dmmall.sdbairui.com/storeapi/Streaming/liveStreamList",
headers:{ // method:"POST",
'Authorization' : 'Bearer' + " " + token // headers:{
}, // 'Authorization' : 'Bearer' + " " + token
success(res){ // },
console.log(res) // success(res){
that.list= res.data.data // console.log(res)
} // that.list= res.data.data
}) // }
uni.request({ // })
url:"https://dmmall.sdbairui.com/storeapi/member/memberInfo", // uni.request({
method:"POST", // url:"https://dmmall.sdbairui.com/storeapi/member/memberInfo",
headers:{ // method:"POST",
'Authorization' : 'Bearer' + " " + token // headers:{
}, // 'Authorization' : 'Bearer' + " " + token
success(res){ // },
console.log(res.data.data.memberInfo) // success(res){
that.info = res.data.data.memberInfo // console.log(res.data.data.memberInfo)
} // that.info = res.data.data.memberInfo
}) // }
// })
var config = { var config = {
appkey: 'mgb7ka1', appkey: 'mgb7ka1',
debug:true debug:true
@ -244,19 +245,22 @@ const RongIMLib = require('../../static/rongyun.js');
var user = { var user = {
token: uni.getStorageSync('rongyun') token: uni.getStorageSync('rongyun')
}; };
console.log(user,123)
im.connect(user).then(function(user) { im.connect(user).then(function(user) {
console.log('链接成功, 链接用户 id 为: ', user.id); console.log('链接成功, 链接用户 id 为: ', user.id);
}).catch(function(error) { }).catch(function(error) {
console.log('链接失败: ', error.code, error.msg); console.log('链接失败: ', error.code, error);
}); });
var chatRoom = im.ChatRoom.get({ var chatRoom = im.ChatRoom.get({
id: a.id id: a.id
}); })
chatRoom.join({ chatRoom.join({
count: 20 // 进入后, 自动拉取 20 条聊天室最新消息 count: 20 // 进入后, 自动拉取 20 条聊天室最新消息
}).then(function() { }).then(function() {
console.log('加入聊天室成功'); console.log('加入聊天室成功');
}); }).catch((err)=>{
console.log(err,262)
})
}, },
methods: { methods: {
statechange(e) { statechange(e) {