| | |
| | | |
| | | <div class="close iconfont" @click="close"></div> |
| | | |
| | | <el-form :model="ruleForm"> |
| | | <el-form :model="ruleForm" :rules="rules" ref="form"> |
| | | <div class="label">场景名称</div> |
| | | <el-form-item> |
| | | <el-form-item prop="scene_name"> |
| | | <el-input |
| | | class="h32" |
| | | v-model="ruleForm.scene_name" |
| | |
| | | </el-form-item> |
| | | |
| | | <div class="label">时间段</div> |
| | | <el-form-item> |
| | | <el-form-item prop="time_rule_id"> |
| | | <el-select |
| | | class="h32 left" |
| | | v-model="ruleForm.time_rule_id" |
| | |
| | | this.eventAudio.addEventListener("ended", () => { |
| | | this.togglePlay = true; |
| | | }); |
| | | if (this.editData.type) { |
| | | this.initEditData(); |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | value: 5, |
| | | }, |
| | | ], |
| | | rules: { |
| | | scene_name: [ |
| | | { required: true, message: "请输入场景名称", trigger: "blur" }, |
| | | ], |
| | | time_rule_id: [ |
| | | { required: true, message: "请选择时间段", trigger: "blur" }, |
| | | ], |
| | | }, |
| | | soundPath: "", |
| | | togglePlay: true, |
| | | eventAudio: new Audio(), |
| | |
| | | voiceId: this.editData.rule.voiceId, |
| | | index: this.editData.index, |
| | | }; |
| | | this.soundList.forEach((item) => { |
| | | if (item.id == this.editData.rule.voiceId) { |
| | | this.ruleForm.voiceId = item.id; |
| | | this.ruleForm.voice = item; |
| | | } |
| | | }); |
| | | }, |
| | | getSounds() { |
| | | let _this = this; |
| | |
| | | .then((res) => { |
| | | if (res.success) { |
| | | _this.soundList = [{ id: "", name: "空", path: "" }].concat( |
| | | res.data |
| | | res.data.voices |
| | | ); |
| | | if (_this.editData.type) { |
| | | _this.initEditData(); |
| | | } |
| | | } |
| | | }) |
| | | .catch((e) => console.log(e)); |
| | |
| | | this.$emit("close"); |
| | | }, |
| | | save() { |
| | | this.$emit("save", { |
| | | action: this.editData.type ? "edit" : "add", |
| | | data: this.ruleForm, |
| | | this.$refs["form"].validate((valid) => { |
| | | if (valid) { |
| | | this.$emit("save", { |
| | | action: this.editData.type ? "edit" : "add", |
| | | data: this.ruleForm, |
| | | }); |
| | | } else { |
| | | return false; |
| | | } |
| | | }); |
| | | }, |
| | | }, |
| | |
| | | background-color: #fff; |
| | | box-shadow: 0px 2px 16px 0px rgba(0, 43, 106, 0.25); |
| | | |
| | | z-index: 2; |
| | | z-index: 2002; |
| | | |
| | | .title { |
| | | box-sizing: border-box; |