|
@@ -7,7 +7,7 @@
|
|
|
<p>惠州市就业驿站系统</p>
|
|
|
</div>
|
|
|
<div class="content-box">
|
|
|
- <p>APP下载</p>
|
|
|
+ <p @click="downLoadApk">APP下载</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
</ion-content>
|
|
@@ -15,7 +15,28 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
+import axios from "axios";
|
|
|
|
|
|
+function downLoadApk() {
|
|
|
+ axios.get("/api/system/file/downloadApk", {
|
|
|
+ responseType: 'blob'
|
|
|
+ }).then((res) => {
|
|
|
+ //创建一个a标签元素
|
|
|
+ const link = document.createElement('a');
|
|
|
+ //获取到blob
|
|
|
+ const blob = new Blob([res.data], {type: "application/octet-stream"});
|
|
|
+ const _fileName = "惠州市就业驿站管理系统.apk";
|
|
|
+ link.style.display = 'none';
|
|
|
+ // 兼容不同浏览器的URL对象
|
|
|
+ const url = window.URL || window.webkitURL;
|
|
|
+ link.href = url.createObjectURL(blob);
|
|
|
+ link.setAttribute('download', _fileName.substring(_fileName.lastIndexOf('_') + 1));
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ document.body.removeChild(link);
|
|
|
+ url.revokeObjectURL(link.href);//销毁url对象
|
|
|
+ })
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|