const tl_rtc_app_module_setting_content_other = { props: { socket: { type: Object, default: null }, isMobile: { type: Boolean, default: false }, otherSetting: { type: Object, default: { turnServer: false, 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: [ 'turnServer', '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 */ getSettingFieldsData: function(){ let that = this let returnData = {} this.settingFields.forEach((item) => { returnData[item] = that.propsOtherSetting[item] }) if(returnData.turnServer){ window.localStorage.setItem("tl-rtc-app-use-turn", "true") }else{ window.localStorage.setItem("tl-rtc-app-use-turn", "false") } return returnData }, /** * 更新设置 */ updateOtherSetting(){ this.$emit('update-user-config-other', this.getSettingFieldsData()); }, }, 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() } }) }, updated() { window.form.render(); window.form.val('otherSettingContent', this.getSettingFieldsData()) }, template: `