Blame view

src/views/personal/down/index.vue 2.18 KB
77ebf04d   梁保满   个人版
1
2
3
4
5
6
7
8
9
10
  <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">
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
11
12
13
14
15
          <p class="p1">
            {{ `${info.appName || ""} ${info.versionName || ""}` }}
          </p>
          <p class="p2">文件大小:{{ `${info.fileSize}` }}M</p>
          <p class="p2">最近更新:{{ info.modifiedTime }}</p>
77ebf04d   梁保满   个人版
16
17
18
19
20
21
22
23
24
25
26
        </div>
        <el-button type="primary" @click="downCard">立即下载</el-button>
      </div>
    </div>
  </template>
  
  <script>
  export default {
    data() {
      return {
        loading: false,
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
27
28
29
30
31
32
33
34
        info: {
          id:"",
          appName: "",
          appImage: "",
          versionName: "",
          fileSize: "",
          modifiedTime: "",
        },
77ebf04d   梁保满   个人版
35
36
      };
    },
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
37
38
39
    created() {
      this.latestVersion();
    },
77ebf04d   梁保满   个人版
40
    methods: {
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
41
42
43
44
45
46
47
48
49
50
51
52
      async latestVersion() {
        const { data, status, info } = await this.$request.pLatestVersion();
        if (status == 0) {
          this.info = { ...data };
          this.info.fileSize =
            (this.info.fileSize &&
              (this.info.fileSize / 1024 / 1024).toFixed(2)) ||
            "--";
        } else {
          this.$message.error(info);
        }
      },
77ebf04d   梁保满   个人版
53
54
55
      async downCard() {
        if (this.loading == true) return;
        this.loading = true;
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
56
57
58
        const { data, status, info } = await this.$request.pGetAppDownloadUrl({
          versionId:this.info.id
        });
77ebf04d   梁保满   个人版
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
        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 {
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
81
    padding: 20px 50px;
77ebf04d   梁保满   个人版
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
    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>