heyujie
2021-06-25 e8d850f8559ccd386689576961676fc924bc5421
src/pages/systemSettings/views/generalSettings.vue
@@ -94,7 +94,7 @@
            class="upload-demo"
            drag
            action="https://jsonplaceholder.typicode.com/posts/"
            multiple
              :http-request="uploadSound"
            v-show="showUpload"
          >
            <i class="el-icon-upload"></i>
@@ -103,12 +103,12 @@
              仅支持mp3/wma等格式
            </div>
          </el-upload>
          <div             v-show="!showUpload"
></div>
            <div v-show="!showUpload"></div>
          <div class="add-btn">
            <span class="icon iconfont" @click="showUpload=!showUpload">&#xe646;</span>
              <span class="icon iconfont" @click="showUpload = !showUpload"
                >&#xe646;</span
              >
          </div>
        </div>
        </div>
      </div>
@@ -118,6 +118,7 @@
<script>
import { saveAlarmConfig } from "@/api/system";
import { uploadSound,getSoundList } from "@/api/event";
import cloudNode from "../components/CloudNode";
import ipInput from "@/components/subComponents/IPInput";
@@ -126,18 +127,7 @@
export default {
  data() {
    const checkPwd = (rule, value, callback) => {
      if (!value) {
        return callback(new Error("密码不能为空"));
      }
      setTimeout(() => {
        if (value.length != 6) {
          callback(new Error("密码应为6位!"));
        } else {
          callback();
        }
      }, 1000);
    };
    return {
      isHighClass: false,
@@ -196,10 +186,35 @@
    ipInput,
    switchBar,
  },
  mounted() {},
  mounted() {
        this.getSounds()
  },
  beforeDestroy() {},
  props: ["barName"],
  methods: {
    getSounds() {
      getSoundList().then(res => {
        if (res.success) {
          this.soundList = res.data.list
        }
      }).catch(
        e => console.log(e)
      )
    },
    uploadSound(params){
      let param = new FormData();
      param.append("file", params.file);
      uploadSound(param).then((res) => {
        console.log(res.data);
      });
    },
    openRight(typ) {
      this.activePage = typ;
      if (typ=="sound") {
        this.getSounds()
      }
    },
    openRight(typ) {
      this.activePage = typ;
    },
@@ -354,7 +369,6 @@
    display: flex;
    flex-direction: column;
    justify-content: space-between;
      }
      .upload-demo {
        .el-upload-dragger {