const tl_rtc_app_module_setting_content_other = { props: { socket: { type: Object, default: null }, isMobile: { type: Boolean, default: false }, otherSetting: { type: Object, default: { customWss: '', } }, leftModule: { type: String, default: '' }, rightModule: { type: String, default: '' } }, computed: { propsSocket(){ return this.socket; }, propsIsMobile(){ return this.isMobile; }, propsOtherSetting(){ return this.otherSetting; }, disableCustomWss(){ return this.propsOtherSetting.customWss === this.customWss }, propsLeftModule() { return this.leftModule; }, propsRightModule() { return this.rightModule; }, }, data : function(){ return { settingFields: [ 'customWss', ] } }, watch: { leftModule: function (val) { }, rightModule: function (val) { } }, methods: { /** * 事件触发,向上传递 * @param {*} event */ leftModuleChange: function(event){ this.$emit('left-module-change', event) }, /** * 事件触发,向上传递 * @param {*} event */ rightModuleChange: function(event){ this.$emit('right-module-change', event) }, /** * 获取设置字段数据 * @returns */ getUpdateSettingFieldsData: function(){ let that = this let returnData = {} this.settingFields.forEach((item) => { returnData[item] = that.propsOtherSetting[item] }) return returnData }, /** * 获取设置字段数据 * @returns */ getSettingFieldsData: function(){ let that = this let returnData = {} this.settingFields.forEach((item) => { returnData[item] = that.propsOtherSetting[item] }) // 是否使用中继服务器 returnData.turnServer = window.localStorage.getItem("tl-rtc-app-use-turn") === 'true' // 是否使用请求缓存 returnData.apiCache = window.localStorage.getItem("tl-rtc-app-api-cache") === 'true' return returnData }, /** * 更新设置 */ updateOtherSetting(){ this.$emit('update-user-config-other', this.getUpdateSettingFieldsData()); }, mouseEnter: function (event, title) { tl_rtc_app_comm.mouseEnterTips({ id: event.target.id, text: title, position: 'top', time: 3000 }); }, mouseLeave: function () { tl_rtc_app_comm.mouseLeaveTips(); }, /** * 打开设备调试弹窗 */ openDeviceDebugger: function() { this.emitSubModuleEvent({ event: 'component-media-device-select', data: { mode: 'debug' } }) }, }, mounted() { let that = this window.form.render(); window.form.val('otherSettingContent', this.getSettingFieldsData()) window.form.on('switch', function(data){ if(that.settingFields.includes(data.elem.name)){ that.propsOtherSetting[data.elem.name] = data.elem.checked that.updateOtherSetting() } if(data.elem.name === 'turnServer'){ window.localStorage.setItem("tl-rtc-app-use-turn", data.elem.checked) that.popSuccessMsg(data.elem.checked ? '已开启中继转发' : '已关闭中继转发') } if(data.elem.name === 'apiCache'){ window.localStorage.setItem("tl-rtc-app-api-cache", data.elem.checked) that.popSuccessMsg(data.elem.checked ? '已开启请求缓存' : '已关闭请求缓存') } }) }, updated() { window.form.render(); window.form.val('otherSettingContent', this.getSettingFieldsData()) }, template: `