|
@@ -12,9 +12,9 @@ export default {
|
|
|
name: "Applyreal",
|
|
|
data() {
|
|
|
return {
|
|
|
- url: "http://192.168.31.196:8080/qr.png",
|
|
|
- // url: "http://djweb.smcic.net/img/qr.png",
|
|
|
- load:{}
|
|
|
+ // url: "http://192.168.31.196:8080/qr.png",
|
|
|
+ url: "http://djweb.smcic.net/img/qr.png",
|
|
|
+ load: {},
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -24,28 +24,27 @@ export default {
|
|
|
methods: {
|
|
|
md() {
|
|
|
console.log("---");
|
|
|
- // sT = Date.now();
|
|
|
- // let s = window.setTimeout(() => {
|
|
|
- // window.clearInterval(s);
|
|
|
- // if (sT === 0) return;
|
|
|
- // this.downimg();
|
|
|
- // }, 1000);
|
|
|
- this.download({
|
|
|
- savePath: this.url,
|
|
|
- });
|
|
|
+ // this.download({
|
|
|
+ // savePath: this.url,
|
|
|
+ // });
|
|
|
+ this.downimg(this.url);
|
|
|
},
|
|
|
- downimg() {
|
|
|
- console.log("长按", window.cmp);
|
|
|
- window.cmp.dialog.actionSheet(
|
|
|
- [{ key: 1, name: "操作组item1" }],
|
|
|
- "取消",
|
|
|
- function selectedCallback() {
|
|
|
- //do something with result
|
|
|
- },
|
|
|
- function cancelCallback() {
|
|
|
- //do something with tap cancel button
|
|
|
- }
|
|
|
- );
|
|
|
+ downimg(url) {
|
|
|
+ let img = new Image();
|
|
|
+ img.src = url;
|
|
|
+ img.onload = function (ev) {
|
|
|
+ console.log(ev)
|
|
|
+
|
|
|
+ // 组装a标签
|
|
|
+ // let elink = document.createElement("a");
|
|
|
+ // // 设置下载文件名
|
|
|
+ // elink.download = Date.now() + ".png";
|
|
|
+ // elink.style.display = "none";
|
|
|
+ // elink.href = URL.createObjectURL(this.response);
|
|
|
+ // document.body.appendChild(elink);
|
|
|
+ // elink.click();
|
|
|
+ // document.body.removeChild(elink);
|
|
|
+ };
|
|
|
},
|
|
|
|
|
|
download(row) {
|
|
@@ -57,7 +56,7 @@ export default {
|
|
|
else xhttp = new window.ActiveXObject("Microsoft.XMLHTTP");
|
|
|
xhttp.responseType = "blob";
|
|
|
xhttp.open("GET", row.savePath, true);
|
|
|
- console.log(xhttp)
|
|
|
+ console.log(xhttp);
|
|
|
xhttp.send();
|
|
|
xhttp.addEventListener(
|
|
|
"progress",
|