|
@@ -1,90 +1,109 @@
|
|
import { defineComponent } from "vue";
|
|
import { defineComponent } from "vue";
|
|
import { ElButton } from "element-plus";
|
|
import { ElButton } from "element-plus";
|
|
-import runtime, * as RuntimeUtils from '/src/components/live-broadcast/runtime'
|
|
|
|
-import styles from './message.module.less';
|
|
|
|
-import { state } from '/src/state'
|
|
|
|
-import request from '/src/helpers/request'
|
|
|
|
|
|
+import runtime, * as RuntimeUtils from "/src/components/live-broadcast/runtime";
|
|
|
|
+import styles from "./message.module.less";
|
|
|
|
+import { state } from "/src/state";
|
|
|
|
+import request from "/src/helpers/request";
|
|
|
|
|
|
-
|
|
|
|
-type optionsType = 'ALL' | 'JOIN'
|
|
|
|
|
|
+type optionsType = "ALL" | "JOIN";
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
- name: 'message',
|
|
|
|
|
|
+ name: "message",
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- options: 'ALL' as optionsType,
|
|
|
|
- }
|
|
|
|
|
|
+ options: "ALL" as optionsType,
|
|
|
|
+ };
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
- const config = state.user?.roomConfig ? JSON.parse(state.user?.roomConfig) : {}
|
|
|
|
- runtime.allowChatCtrl = config.whether_chat === 0
|
|
|
|
- runtime.allowSeatsCtrl = config.whether_mic === 0
|
|
|
|
|
|
+ const config = state.user?.roomConfig
|
|
|
|
+ ? JSON.parse(state.user?.roomConfig)
|
|
|
|
+ : {};
|
|
|
|
+ runtime.allowChatCtrl = config.whether_chat === 0;
|
|
|
|
+ runtime.allowSeatsCtrl = config.whether_mic === 0;
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
async SeatsCtrl() {
|
|
async SeatsCtrl() {
|
|
try {
|
|
try {
|
|
- const users = state.user
|
|
|
|
- const roomConfig = users?.roomConfig ? JSON.parse(users?.roomConfig) : {}
|
|
|
|
- await request.post('/api-web/imLiveBroadcastRoom/update', {
|
|
|
|
- requestType: 'json',
|
|
|
|
|
|
+ const users = state.user;
|
|
|
|
+ const roomConfig = users?.roomConfig
|
|
|
|
+ ? JSON.parse(users?.roomConfig)
|
|
|
|
+ : {};
|
|
|
|
+ await request.post("/api-web/imLiveBroadcastRoom/update", {
|
|
|
|
+ requestType: "json",
|
|
data: {
|
|
data: {
|
|
id: users.id,
|
|
id: users.id,
|
|
liveRemark: users.liveRemark,
|
|
liveRemark: users.liveRemark,
|
|
liveStartTime: users.liveStartTime,
|
|
liveStartTime: users.liveStartTime,
|
|
preTemplate: users.preTemplate,
|
|
preTemplate: users.preTemplate,
|
|
|
|
+ popularizeType: users.popularizeType,
|
|
roomConfig: {
|
|
roomConfig: {
|
|
whether_chat: roomConfig.whether_chat,
|
|
whether_chat: roomConfig.whether_chat,
|
|
whether_like: roomConfig.whether_like,
|
|
whether_like: roomConfig.whether_like,
|
|
whether_mic: runtime.allowSeatsCtrl ? 1 : 0,
|
|
whether_mic: runtime.allowSeatsCtrl ? 1 : 0,
|
|
- whether_video: roomConfig.whether_video
|
|
|
|
|
|
+ whether_video: roomConfig.whether_video,
|
|
},
|
|
},
|
|
roomTitle: users.roomTitle,
|
|
roomTitle: users.roomTitle,
|
|
speakerId: users.speakerId,
|
|
speakerId: users.speakerId,
|
|
- tenantId: users.tenantId
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ tenantId: users.tenantId,
|
|
|
|
+ },
|
|
|
|
+ });
|
|
state.user.roomConfig = JSON.stringify({
|
|
state.user.roomConfig = JSON.stringify({
|
|
whether_chat: roomConfig.whether_chat,
|
|
whether_chat: roomConfig.whether_chat,
|
|
whether_like: roomConfig.whether_like,
|
|
whether_like: roomConfig.whether_like,
|
|
whether_mic: runtime.allowSeatsCtrl ? 1 : 0,
|
|
whether_mic: runtime.allowSeatsCtrl ? 1 : 0,
|
|
- whether_video: roomConfig.whether_video
|
|
|
|
- })
|
|
|
|
|
|
+ whether_video: roomConfig.whether_video,
|
|
|
|
+ });
|
|
|
|
|
|
- await RuntimeUtils.sendMessage({ seatBan: runtime.allowSeatsCtrl, ...RuntimeUtils.getSendMessageUser() }, 'SeatsCtrl')
|
|
|
|
- runtime.allowSeatsCtrl = !runtime.allowSeatsCtrl
|
|
|
|
|
|
+ await RuntimeUtils.sendMessage(
|
|
|
|
+ {
|
|
|
|
+ seatBan: runtime.allowSeatsCtrl,
|
|
|
|
+ ...RuntimeUtils.getSendMessageUser(),
|
|
|
|
+ },
|
|
|
|
+ "SeatsCtrl"
|
|
|
|
+ );
|
|
|
|
+ runtime.allowSeatsCtrl = !runtime.allowSeatsCtrl;
|
|
} catch {
|
|
} catch {
|
|
//
|
|
//
|
|
}
|
|
}
|
|
},
|
|
},
|
|
async ChatBan() {
|
|
async ChatBan() {
|
|
try {
|
|
try {
|
|
- const users = state.user
|
|
|
|
- const roomConfig = users?.roomConfig ? JSON.parse(users?.roomConfig) : {}
|
|
|
|
- await request.post('/api-web/imLiveBroadcastRoom/update', {
|
|
|
|
- requestType: 'json',
|
|
|
|
|
|
+ const users = state.user;
|
|
|
|
+ const roomConfig = users?.roomConfig
|
|
|
|
+ ? JSON.parse(users?.roomConfig)
|
|
|
|
+ : {};
|
|
|
|
+ await request.post("/api-web/imLiveBroadcastRoom/update", {
|
|
|
|
+ requestType: "json",
|
|
data: {
|
|
data: {
|
|
id: users.id,
|
|
id: users.id,
|
|
liveRemark: users.liveRemark,
|
|
liveRemark: users.liveRemark,
|
|
liveStartTime: users.liveStartTime,
|
|
liveStartTime: users.liveStartTime,
|
|
preTemplate: users.preTemplate,
|
|
preTemplate: users.preTemplate,
|
|
|
|
+ popularizeType: users.popularizeType,
|
|
roomConfig: {
|
|
roomConfig: {
|
|
whether_chat: runtime.allowChatCtrl ? 1 : 0,
|
|
whether_chat: runtime.allowChatCtrl ? 1 : 0,
|
|
whether_like: roomConfig.whether_like,
|
|
whether_like: roomConfig.whether_like,
|
|
whether_video: roomConfig.whether_video,
|
|
whether_video: roomConfig.whether_video,
|
|
- whether_mic: roomConfig.whether_mic
|
|
|
|
|
|
+ whether_mic: roomConfig.whether_mic,
|
|
},
|
|
},
|
|
roomTitle: users.roomTitle,
|
|
roomTitle: users.roomTitle,
|
|
speakerId: users.speakerId,
|
|
speakerId: users.speakerId,
|
|
- tenantId: users.tenantId
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ tenantId: users.tenantId,
|
|
|
|
+ },
|
|
|
|
+ });
|
|
state.user.roomConfig = JSON.stringify({
|
|
state.user.roomConfig = JSON.stringify({
|
|
whether_chat: runtime.allowChatCtrl ? 1 : 0,
|
|
whether_chat: runtime.allowChatCtrl ? 1 : 0,
|
|
whether_like: roomConfig.whether_like,
|
|
whether_like: roomConfig.whether_like,
|
|
whether_video: roomConfig.whether_video,
|
|
whether_video: roomConfig.whether_video,
|
|
- whether_mic: roomConfig.whether_mic
|
|
|
|
- })
|
|
|
|
- await RuntimeUtils.sendMessage({ chatBan: runtime.allowChatCtrl, ...RuntimeUtils.getSendMessageUser() }, 'ChatBan')
|
|
|
|
- runtime.allowChatCtrl = !runtime.allowChatCtrl
|
|
|
|
|
|
+ whether_mic: roomConfig.whether_mic,
|
|
|
|
+ });
|
|
|
|
+ await RuntimeUtils.sendMessage(
|
|
|
|
+ {
|
|
|
|
+ chatBan: runtime.allowChatCtrl,
|
|
|
|
+ ...RuntimeUtils.getSendMessageUser(),
|
|
|
|
+ },
|
|
|
|
+ "ChatBan"
|
|
|
|
+ );
|
|
|
|
+ runtime.allowChatCtrl = !runtime.allowChatCtrl;
|
|
} catch {
|
|
} catch {
|
|
//
|
|
//
|
|
}
|
|
}
|
|
@@ -95,10 +114,20 @@ export default defineComponent({
|
|
<div class={styles.message}>
|
|
<div class={styles.message}>
|
|
<div class={styles.buttonGroup}>
|
|
<div class={styles.buttonGroup}>
|
|
{/* {this.whetherChat ? <ElButton type={!runtime.allowChatCtrl ? 'primary' : 'info'} onClick={this.ChatBan} >{runtime.allowChatCtrl ? '全体禁言' : '关闭全体禁言'}</ElButton> : null} */}
|
|
{/* {this.whetherChat ? <ElButton type={!runtime.allowChatCtrl ? 'primary' : 'info'} onClick={this.ChatBan} >{runtime.allowChatCtrl ? '全体禁言' : '关闭全体禁言'}</ElButton> : null} */}
|
|
- <ElButton type={!runtime.allowChatCtrl ? 'primary' : 'info'} onClick={this.ChatBan} >{runtime.allowChatCtrl ? '关闭聊天' : '开启聊天'}</ElButton>
|
|
|
|
- <ElButton type={!runtime.allowSeatsCtrl ? 'primary' : 'info'} onClick={this.SeatsCtrl}>{runtime.allowSeatsCtrl ? '关闭连麦' : '开启连麦'}</ElButton>
|
|
|
|
|
|
+ <ElButton
|
|
|
|
+ type={!runtime.allowChatCtrl ? "primary" : "info"}
|
|
|
|
+ onClick={this.ChatBan}
|
|
|
|
+ >
|
|
|
|
+ {runtime.allowChatCtrl ? "关闭聊天" : "开启聊天"}
|
|
|
|
+ </ElButton>
|
|
|
|
+ <ElButton
|
|
|
|
+ type={!runtime.allowSeatsCtrl ? "primary" : "info"}
|
|
|
|
+ onClick={this.SeatsCtrl}
|
|
|
|
+ >
|
|
|
|
+ {runtime.allowSeatsCtrl ? "关闭连麦" : "开启连麦"}
|
|
|
|
+ </ElButton>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- )
|
|
|
|
- }
|
|
|
|
-})
|
|
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+});
|