xbx #166

Merged
theluyuan merged 2 commits from xbx into master 2020-11-27 06:56:16 +00:00
4 changed files with 7 additions and 4 deletions
Showing only changes of commit ae1ba85e2c - Show all commits

View File

@ -33,7 +33,7 @@ function join() {
$('#header-roomId').html('房间号: ' + $('#roomId').val()); $('#header-roomId').html('房间号: ' + $('#roomId').val());
$('#member-me') $('#member-me')
.find('.member-id') .find('.member-id')
.html($('#userId').val() + '(我)'); .html(window.uname + '(我)');
} }
function leave() { function leave() {

View File

@ -82,6 +82,7 @@ function formatDateTime (inputTime) {
}); });
tim.on(TIM.EVENT.GROUP_LIST_UPDATED, function(event) { tim.on(TIM.EVENT.GROUP_LIST_UPDATED, function(event) {
console.log(event.data)
// 收到群组列表更新通知,可通过遍历 event.data 获取群组列表数据并渲染到页面 // 收到群组列表更新通知,可通过遍历 event.data 获取群组列表数据并渲染到页面
// event.name - TIM.EVENT.GROUP_LIST_UPDATED // event.name - TIM.EVENT.GROUP_LIST_UPDATED
// event.data - 存储 Group 对象的数组 - [Group] // event.data - 存储 Group 对象的数组 - [Group]
@ -142,7 +143,7 @@ function formatDateTime (inputTime) {
}) })
tim.on(TIM.EVENT.SDK_READY, function (){ tim.on(TIM.EVENT.SDK_READY, function (){
tim.updateMyProfile({ tim.updateMyProfile({
nick: '我的昵称' nick: window.uname
}); });
const promise = tim.createGroup({ const promise = tim.createGroup({
type: TIM.TYPES.GRP_AVCHATROOM, type: TIM.TYPES.GRP_AVCHATROOM,
@ -207,7 +208,7 @@ function formatDateTime (inputTime) {
const list = $("#liaotianliebiao") const list = $("#liaotianliebiao")
const html = ` <div> const html = ` <div>
<p>${formatDateTime(imResponse.data.message.time)}</p> <p>${formatDateTime(imResponse.data.message.time)}</p>
<p><span>${imResponse.data.message.nick}:</span>${imResponse.data.message.payload.text}</p> <p><span>${window.uname}:</span>${imResponse.data.message.payload.text}</p>
</div>` </div>`
console.log(html) console.log(html)
list.append(html) list.append(html)

View File

@ -411,6 +411,7 @@
const urldata = GetRequest('roomid') const urldata = GetRequest('roomid')
window.roomid = urldata.roomid window.roomid = urldata.roomid
window.mid = urldata.memberid window.mid = urldata.memberid
window.uname = urldata.name
</script> </script>

View File

@ -6,6 +6,7 @@
</style> </style>
<script lang="ts"> <script lang="ts">
import { getliveinfo } from '@/api'; import { getliveinfo } from '@/api';
import store from '@/store';
import { defineComponent, ref } from 'vue'; import { defineComponent, ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -16,7 +17,7 @@ export default defineComponent({
const url = ref<string>() const url = ref<string>()
if(id && typeof id == 'string'){ if(id && typeof id == 'string'){
getliveinfo(parseInt(id)).then((res: any)=>{ getliveinfo(parseInt(id)).then((res: any)=>{
url.value = `/zhibo.html?roomid=${res.roomid}&memberid=${res.memberid}` url.value = `/zhibo.html?roomid=${res.roomid}&memberid=${res.memberid}&name=${escape(store.state.userinfo.name)}`
}) })
} }