|
@@ -18,9 +18,12 @@ export default <LibMixins>{
|
|
|
provide(){
|
|
|
return {
|
|
|
openUserInfo:(event,userInfo)=> this.openUserInfo(event,userInfo),
|
|
|
- applyForWheat:(index:number|undefined)=> this.applyForWheat(index),
|
|
|
+ applyForWheat:(index:number|undefined,host:boolean=false)=> this.applyForWheat(index,host),
|
|
|
exitForWheat:()=> this.exitForWheat(),
|
|
|
- cancelForWheat:()=> this.cancelForWheat()
|
|
|
+ cancelForWheat:()=> this.cancelForWheat(),
|
|
|
+ getRoomInfo: ()=> this.roomInfo,
|
|
|
+ getUseAgora:()=> this.useAgora || {},
|
|
|
+ lockForWheat:(index)=>this.lockForWheat(index)
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -28,15 +31,18 @@ export default <LibMixins>{
|
|
|
|
|
|
// 打开用户信息
|
|
|
openUserInfo(event,userInfo){
|
|
|
- popup.$popup.open(PopupExportComponent.user,{
|
|
|
- el:event,
|
|
|
- value:true,
|
|
|
- item:userInfo
|
|
|
- });
|
|
|
+ if (userInfo && userInfo.uid) {
|
|
|
+ popup.$popup.open(PopupExportComponent.user,{
|
|
|
+ el:event,
|
|
|
+ value:true,
|
|
|
+ item:userInfo
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
|
|
|
// 申请上麦
|
|
|
- applyForWheat(index:number|undefined){
|
|
|
+ applyForWheat(index:number|undefined,host:boolean=false){
|
|
|
|
|
|
if (this.wheat_status === RowWheat.queuing) {
|
|
|
return popup.$toast('正在排麦中');
|
|
@@ -44,7 +50,7 @@ export default <LibMixins>{
|
|
|
// 如果为管理员触发
|
|
|
if (this.isAdmin) {
|
|
|
return popup.$confirm({
|
|
|
- title: this.wheat_status === RowWheat.none ? '是否上麦?' :'是否切换麦位?',
|
|
|
+ title: host ? '是否上主持位?' : this.wheat_status === RowWheat.none ? '是否上麦?' :'是否切换麦位?',
|
|
|
successAsyncText:'上麦成功',
|
|
|
confirm:()=>{
|
|
|
|
|
@@ -53,7 +59,7 @@ export default <LibMixins>{
|
|
|
if (index != null) {
|
|
|
return new Promise<boolean>( (resolve, reject)=> {
|
|
|
return this.$request({
|
|
|
- url:'room/user_up_micro',
|
|
|
+ url:host ? 'room/host_up_micro' : 'room/user_up_micro',
|
|
|
data:{
|
|
|
rid: this.$params.rid,
|
|
|
micro_id:typeof index === 'number'?index:''
|
|
@@ -64,11 +70,18 @@ export default <LibMixins>{
|
|
|
message: InstructionsMessageType.other
|
|
|
}).then((data)=>{
|
|
|
if (data.isSuccess) {
|
|
|
- this.downMicro({
|
|
|
- index,
|
|
|
- user:user.user
|
|
|
- });
|
|
|
- return resolve(true);
|
|
|
+ resolve(true);
|
|
|
+
|
|
|
+ if (host) {
|
|
|
+ this.updateHostMicro(user.user);
|
|
|
+ } else {
|
|
|
+ this.downMicro({
|
|
|
+ index,
|
|
|
+ user:user.user
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
} else {
|
|
|
resolve(false);
|
|
|
}
|
|
@@ -100,7 +113,7 @@ export default <LibMixins>{
|
|
|
if (data.isSuccess) {
|
|
|
// 设置状态为排麦中
|
|
|
this.setMicroStatus(RowWheat.queuing);
|
|
|
- return resolve(true);
|
|
|
+ resolve(true);
|
|
|
} else {
|
|
|
resolve(false);
|
|
|
}
|
|
@@ -171,7 +184,42 @@ export default <LibMixins>{
|
|
|
}).then((data)=>{
|
|
|
if (data.isSuccess) {
|
|
|
this.setMicroStatus(RowWheat.none);
|
|
|
- return resolve(true);
|
|
|
+ resolve(true);
|
|
|
+ } else {
|
|
|
+ resolve(false);
|
|
|
+ }
|
|
|
+ }).catch(reject);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 是否锁麦
|
|
|
+ lockForWheat(index:number=0){
|
|
|
+
|
|
|
+ if (this.lockForWheatStatus) return;
|
|
|
+
|
|
|
+ if (index) {
|
|
|
+ popup.$confirm({
|
|
|
+ title: '是否锁麦?',
|
|
|
+ successAsyncText: '锁麦成功',
|
|
|
+ confirm:()=>{
|
|
|
+ return new Promise((resolve, reject)=>{
|
|
|
+ return this.$request({
|
|
|
+ url:'room/lock_room_micro',
|
|
|
+ data:{
|
|
|
+ rid: this.$params.rid,
|
|
|
+ micro_id:index
|
|
|
+ },
|
|
|
+ token:true,
|
|
|
+ failMessage:true,
|
|
|
+ next:({status})=> this.lockForWheatStatus = status,
|
|
|
+ message: InstructionsMessageType.other
|
|
|
+ }).then((data)=>{
|
|
|
+ if (data.isSuccess) {
|
|
|
+
|
|
|
+ resolve(true);
|
|
|
} else {
|
|
|
resolve(false);
|
|
|
}
|
|
@@ -180,6 +228,8 @@ export default <LibMixins>{
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|