引入融云
This commit is contained in:
parent
7b8ddc734c
commit
49e80c48c0
@ -69,6 +69,7 @@
|
|||||||
}else{
|
}else{
|
||||||
uni.setStorageSync("token",res.data.token)
|
uni.setStorageSync("token",res.data.token)
|
||||||
uni.setStorageSync("userinfo",res.data)
|
uni.setStorageSync("userinfo",res.data)
|
||||||
|
uni.setStorageSync('rongyun',res.data.rongcloud_token)
|
||||||
this.$u.route({
|
this.$u.route({
|
||||||
url:"/pages/index/index",
|
url:"/pages/index/index",
|
||||||
type:"switchTab"
|
type:"switchTab"
|
||||||
|
@ -110,7 +110,8 @@
|
|||||||
this.$u.route({
|
this.$u.route({
|
||||||
url:"/pages/release/zhibo",
|
url:"/pages/release/zhibo",
|
||||||
params:{
|
params:{
|
||||||
url:res.data.url.replace("&","*")
|
url:res.data.url.replace("&","*"),
|
||||||
|
id:res.data.chat_id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -35,7 +35,15 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="user">
|
||||||
|
</div>
|
||||||
|
<div style="position: fixed;top: 60rpx;left: 30rpx;flex-direction: row;align-items:center">
|
||||||
|
<image class="userhead" :src="info.member_avatar"></image>
|
||||||
|
<div class="userinfo">
|
||||||
|
<text class="username">{{info.member_name}}</text>
|
||||||
|
<text class="username" style="font-size:20rpx">asdasdsa | sadasdas</text>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<!-- <button class="btn" @click="start">开始推流1</button>
|
<!-- <button class="btn" @click="start">开始推流1</button>
|
||||||
<button class="btn" @click="pause">暂停推流</button>
|
<button class="btn" @click="pause">暂停推流</button>
|
||||||
<button class="btn" @click="resume">resume</button>
|
<button class="btn" @click="resume">resume</button>
|
||||||
@ -48,6 +56,38 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.username{
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #fff;
|
||||||
|
lines:1;
|
||||||
|
text-overflow:ellipsis
|
||||||
|
}
|
||||||
|
.userinfo{
|
||||||
|
height: 60rpx;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 200rpx;
|
||||||
|
}
|
||||||
|
.userhead{
|
||||||
|
width: 70rpx;
|
||||||
|
height: 70rpx;
|
||||||
|
// position: fixed;
|
||||||
|
// top: 60rpx;
|
||||||
|
// left: 30rpx;
|
||||||
|
border-radius: 35rpx;
|
||||||
|
}
|
||||||
|
.user{
|
||||||
|
width: 308rpx;
|
||||||
|
height: 70rpx;
|
||||||
|
border-radius: 35rpx;
|
||||||
|
background-color: #000;
|
||||||
|
opacity:0.2;
|
||||||
|
position: fixed;
|
||||||
|
top: 60rpx;
|
||||||
|
left: 30rpx;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
.info{
|
.info{
|
||||||
height: 160rpx;
|
height: 160rpx;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@ -126,13 +166,16 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
|
const RongIMLib = require('../../static/rongyun.js');
|
||||||
export default {
|
export default {
|
||||||
data: {
|
data: {
|
||||||
fil: true,
|
fil: true,
|
||||||
url:'',
|
url:'',
|
||||||
height:0,
|
height:0,
|
||||||
show:true,
|
show:true,
|
||||||
list:[]
|
list:[],
|
||||||
|
info:{},
|
||||||
|
im:{}
|
||||||
},
|
},
|
||||||
onReady() {
|
onReady() {
|
||||||
// 注意:需要在onReady中 或 onLoad 延时
|
// 注意:需要在onReady中 或 onLoad 延时
|
||||||
@ -163,6 +206,57 @@
|
|||||||
that.list= res.data.data
|
that.list= res.data.data
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
uni.request({
|
||||||
|
url:"https://dmmall.sdbairui.com/storeapi/member/memberInfo",
|
||||||
|
method:"POST",
|
||||||
|
headers:{
|
||||||
|
'Authorization' : 'Bearer' + " " + token
|
||||||
|
},
|
||||||
|
success(res){
|
||||||
|
console.log(res.data.data.memberInfo)
|
||||||
|
that.info = res.data.data.memberInfo
|
||||||
|
}
|
||||||
|
})
|
||||||
|
var config = {
|
||||||
|
appkey: 'mgb7ka1',
|
||||||
|
debug:true
|
||||||
|
};
|
||||||
|
var im = RongIMLib.init(config);
|
||||||
|
var conversationList = []; // 当前已存在的会话列表
|
||||||
|
im.watch({
|
||||||
|
conversation: function(event){
|
||||||
|
var updatedConversationList = event.updatedConversationList; // 更新的会话列表
|
||||||
|
console.log('更新会话汇总:', updatedConversationList);
|
||||||
|
console.log('最新会话列表:', im.Conversation.merge({
|
||||||
|
conversationList,
|
||||||
|
updatedConversationList
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
message: function(event){
|
||||||
|
var message = event.message;
|
||||||
|
console.log('收到新消息:', message);
|
||||||
|
},
|
||||||
|
status: function(event){
|
||||||
|
var status = event.status;
|
||||||
|
console.log('连接状态码:', status);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var user = {
|
||||||
|
token: uni.getStorageSync('rongyun')
|
||||||
|
};
|
||||||
|
im.connect(user).then(function(user) {
|
||||||
|
console.log('链接成功, 链接用户 id 为: ', user.id);
|
||||||
|
}).catch(function(error) {
|
||||||
|
console.log('链接失败: ', error.code, error.msg);
|
||||||
|
});
|
||||||
|
var chatRoom = im.ChatRoom.get({
|
||||||
|
id: a.id
|
||||||
|
});
|
||||||
|
chatRoom.join({
|
||||||
|
count: 20 // 进入后, 自动拉取 20 条聊天室最新消息
|
||||||
|
}).then(function() {
|
||||||
|
console.log('加入聊天室成功');
|
||||||
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
statechange(e) {
|
statechange(e) {
|
||||||
|
10571
static/rongyun.js
Normal file
10571
static/rongyun.js
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user