浏览代码

Merge branch 'refs/heads/dev-2.19.0' into dev

Lita-Tako 4 月之前
父节点
当前提交
4fc17380d1
共有 2 个文件被更改,包括 8 次插入14 次删除
  1. 2 2
      src/components/video/Live.vue
  2. 6 12
      src/utils/systemUtils.js

+ 2 - 2
src/components/video/Live.vue

@@ -380,11 +380,11 @@
380 380
 						<a-button type="primary" class="btn">中止轮巡</a-button>
381 381
 					</div>
382 382
 					<div class="row">
383
-						<a-button type="primary" class="mr-5 btn" @click="captureOne">窗口抓图</a-button>
383
+						<a-button type="primary" class="mr-5 btn" @click="captureOne(null)">窗口抓图</a-button>
384 384
 						<a-button type="primary" class="btn" @click="stopPlay">窗口关闭</a-button>
385 385
 					</div>
386 386
 					<div class="row">
387
-						<a-button type="primary" class="mr-5 btn" @click="captureAll">全部抓图</a-button>
387
+						<a-button type="primary" class="mr-5 btn" @click="captureAll()">全部抓图</a-button>
388 388
 						<a-button type="primary" class="btn" @click="stopAllPlay">全部关闭</a-button>
389 389
 					</div>
390 390
 					<div v-if="hasPerm(['controlCloud'])" class="flex flex-col">

+ 6 - 12
src/utils/systemUtils.js

@@ -186,16 +186,10 @@ export const getQueryParams = (name) => {
186 186
 }
187 187
 
188 188
 export const downloadLink = (url) => {
189
-	const iframe = document.createElement('iframe')
190
-	iframe.style.display = 'none' // 防止影响页面
191
-	iframe.style.height = 0 // 防止影响页面
192
-	iframe.src = url
193
-	document.body.appendChild(iframe) // 这一行必须,iframe挂在到dom树上才会发请求
194
-	// 5分钟之后删除(onload方法对于下载链接不起作用,就先抠脚一下吧)
195
-	setTimeout(
196
-		function () {
197
-			iframe.remove()
198
-		},
199
-		5 * 60 * 1000
200
-	)
189
+	const a = document.createElement('a')
190
+	a.href = url
191
+	a.download = fileName || 'download'
192
+	document.body.appendChild(a)
193
+	a.click()
194
+	document.body.removeChild(a)
201 195
 }