showSet.vue 2.95 KB
<template>
  <div class="contentBox minHeight">
    <el-col :span="12">
      <el-form label-position="left" label-width="80px" :model="formLabelAlign">
        <el-form-item label="视频1">
          <el-input v-model="formLabelAlign.video1"></el-input>
        </el-form-item>
        <el-form-item label="视频2">
          <el-input v-model="formLabelAlign.video2"></el-input>
        </el-form-item>
        <el-form-item label="视频3">
          <el-input v-model="formLabelAlign.video3"></el-input>
        </el-form-item>
        <el-form-item label="视频4">
          <el-input v-model="formLabelAlign.video4"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">提交</el-button>
        </el-form-item>
      </el-form>
    </el-col>
  </div>
</template>
<script>
export default {
  data() {
    return {
      activeName: "first",
      height: "",
      vchan_conf_unid: "",
      formLabelAlign: {
        video1: "",
        video2: "",
        video3: "",
        video4: ""
      }
    };
  },

  mounted() {},
  methods: {
    handleClick(tab, event) {},
    getshow() {
      this.$api.show.getShowUrl().then(res => {
        if (res.length > 0 && res[0].conf.length > 0) {
          this.formLabelAlign = {
            video1: res[0].conf[0].url,
            video2: res[0].conf[1].url,
            video3: res[0].conf[2].url,
            video4: res[0].conf[3].url
          };
          this.vchan_conf_unid = res[0].vchan_conf_unid;
        }
      });
    },
    onSubmit() {
      let data = {
        conf: [
          {
            name: "1",
            url: this.formLabelAlign.video1,
            isActive: true
          },
          {
            name: "1",
            url: this.formLabelAlign.video2,
            isActive: true
          },
          {
            name: "1",
            url: this.formLabelAlign.video3,
            isActive: true
          },
          {
            name: "1",
            url: this.formLabelAlign.video4,
            isActive: true
          }
        ]
      };
      if (this.vchan_conf_unid) {
        this.$api.show.editShowUrl(data, this.vchan_conf_unid).then(res => {
          console.log(res);
          if (res.ecode == 200) {
            this.$message({
              type: "success",
              message: "设置成功!"
            });
          } else {
            this.$message({
              type: "error",
              message: "设置失败!"
            });
          }
        });
      } else {
        this.$api.show.addShowUrl(data).then(res => {
          if (res.ecode == 200) {
            this.$message({
              type: "success",
              message: "设置成功!"
            });
          } else {
            this.$message({
              type: "error",
              message: "设置失败!"
            });
          }
        });
      }
    }
  },
  created() {
    this.getshow();
  }
};
</script>
<style lang="scss" scoped></style>