index.vue 1.51 KB
<template>
  <div class="content-box">
    <back-box>
      <template slot="title">
        <span>软件下载</span>
      </template>
    </back-box>
    <div class="down-box" v-loading="loading">
      <img class="logo" src="" alt="" />
      <div class="txt">
        <p class="p1">中天易教授课端 V1.3.4</p>
        <p class="p2">文件大小:35M</p>
        <p class="p2">最近更新:2022-12-03 13:30</p>
      </div>
      <el-button type="primary" @click="downCard">立即下载</el-button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      loading: false,
    };
  },
  methods: {
    async downCard() {
      if (this.loading == true) return;
      this.loading = true;
      const { data, status, info } = await this.$request.latestClickersApp();
      this.loading = false;
      if (status == 0) {
        const a = document.createElement("a");
        a.href = data.downloadUrl;
        a.download = data.appName;
        document.body.appendChild(a);
        a.click();
        a.remove();
      } else {
        this.$message.error(info);
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.content-box {
  width: 100%;
}

.down-box {
  padding:20px 50px;
  display: flex;
  align-items: center;
}
.logo {
  width: 145px;
  height: 85px;
  margin-right: 20px;
}
.txt {
  width: 300px;
  margin-right: 50px;
  .p1 {
    font-size: 18px;
    color: #333;
    font-weight: 600;
    padding-bottom: 16px;
  }
  .p2 {
    color: #7f7f7f;
    line-height: 20px;
  }
}
</style>