代码块
axios({ method: “get”, url: “http://192.168.199.203:8022/api/services/Admin/ApplicationResignSign/GetSign“, headers: { access_token: this.$store.state.user.token }, params: { Appid: this.formValidate.Appid, Appkey: this.formValidate.Appkey, type: this.formValidate.type, tenantId: this.$store.state.user.tenantId, isGateWay: this.formValidate.isGateWay, gateWay: this.formValidate.gateWay }, responseType: “blob” }) .then(res => { const blob = new Blob([res.data], { type: “application/zip” }); const url = window.URL || window.webkitURL || window.moxURL; let a = document.createElement(“a”); a.download = “证书”; a.href = url.createObjectURL(blob); a.click(); a.remove(); }) .catch(error => { this.$Message.error(“请求错误,请重试”); });
参数 | 功能描述 |
method | 请求方式 |
url | 请求地址 |
headers | 请求头 |
params | 请求参数 |
responseType | 响应数据类型 |
需要注释mock,否则下载下来的压缩包会出现无法解压的情况