Blame view

src/views/personal/down/index.vue 1.51 KB
77ebf04d   梁保满   个人版
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
  <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>