From 0d2a5fc482ba7ffaaefa6276e2475727e7160753 Mon Sep 17 00:00:00 2001
From: zhizhijie <zhizhijie@users.noreply.gitee.com>
Date: 星期三, 16 九月 2026 11:31:35 +0800
Subject: [PATCH] fix(cors): 放行内网网段来源,修复局域网 IP 访问时登录 403
---
traffic-audit-web/src/views/DataImport.vue | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/traffic-audit-web/src/views/DataImport.vue b/traffic-audit-web/src/views/DataImport.vue
index b9c83e7..f7f6638 100644
--- a/traffic-audit-web/src/views/DataImport.vue
+++ b/traffic-audit-web/src/views/DataImport.vue
@@ -1,3 +1,4 @@
+<template>
<el-container direction="vertical">
<app-header title="浜ら�氱粺璁℃姤琛ㄥ鏍哥郴缁� - 鏁版嵁瀵煎叆"></app-header>
<el-container>
@@ -333,7 +334,20 @@
typeLabel(t) { return TYPE_LABELS[t] || t },
downloadTemplate() {
if (!this.templateUrl) return
- window.open('/api/templates/' + this.templateUrl)
+ const name = this.templateUrl.split('/').pop()
+ api.get('/templates/' + this.templateUrl, { responseType: 'blob' })
+ .then(res => {
+ const blob = res instanceof Blob ? res : new Blob([res])
+ const url = window.URL.createObjectURL(blob)
+ const a = document.createElement('a')
+ a.href = url
+ a.download = name
+ document.body.appendChild(a)
+ a.click()
+ window.URL.revokeObjectURL(url)
+ document.body.removeChild(a)
+ })
+ .catch(() => this.$message.error('妯℃澘涓嬭浇澶辫触锛岃绋嶅悗閲嶈瘯'))
},
onModuleChange(key) {
this.importType = this.moduleSel[key] || ''
--
Gitblit v1.9.1