haiwei-module-admin 1.1.4 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": 0,
|
|
3
3
|
"name": "haiwei-module-admin",
|
|
4
4
|
"code": "admin",
|
|
5
|
-
"version": "1.1.
|
|
5
|
+
"version": "1.1.6",
|
|
6
6
|
"description": "haiwei前端Admin模块组件",
|
|
7
7
|
"author": "Eric",
|
|
8
8
|
"license": "ISC",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"pub": "cd ./script && npm_publish.bat"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"haiwei-skins-classics": "^1.0.
|
|
22
|
-
"haiwei-ui": "^1.
|
|
21
|
+
"haiwei-skins-classics": "^1.0.7",
|
|
22
|
+
"haiwei-ui": "^1.2.4"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@vue/cli-plugin-babel": "^4.4.4",
|
|
@@ -41,6 +41,6 @@
|
|
|
41
41
|
},
|
|
42
42
|
"repository": {
|
|
43
43
|
"type": "git",
|
|
44
|
-
"url": "https://github.com/
|
|
44
|
+
"url": "https://github.com/iamEric/haiwei"
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -64,7 +64,7 @@ export default {
|
|
|
64
64
|
isAbsoluteUrl(path) {
|
|
65
65
|
return /^(https?:)?\/\//.test(path)
|
|
66
66
|
},
|
|
67
|
-
|
|
67
|
+
|
|
68
68
|
// 规范化路径拼接
|
|
69
69
|
normalizePath(base, path) {
|
|
70
70
|
// 如果 path 已经是绝对 URL,直接返回
|
|
@@ -76,21 +76,24 @@ export default {
|
|
|
76
76
|
let fullPath = path.startsWith('/') ? path.slice(1) : path
|
|
77
77
|
return `${baseUrl}/${fullPath}`
|
|
78
78
|
},
|
|
79
|
-
|
|
79
|
+
|
|
80
80
|
updatePreviewUrl() {
|
|
81
81
|
// 重置内部状态
|
|
82
82
|
this.url_ = this.url
|
|
83
|
-
|
|
83
|
+
|
|
84
84
|
// 优先使用 fullPath
|
|
85
85
|
if (this.fullPath) {
|
|
86
86
|
if (this.private) {
|
|
87
87
|
// 私有图片,调用预览接口
|
|
88
|
-
$api.admin.file
|
|
89
|
-
this.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
$api.admin.file
|
|
89
|
+
.preview(this.fullPath)
|
|
90
|
+
.then(url => {
|
|
91
|
+
this.url__ = url
|
|
92
|
+
})
|
|
93
|
+
.catch(() => {
|
|
94
|
+
// 如果接口调用失败,使用原始路径
|
|
95
|
+
this.url__ = this.fullPath
|
|
96
|
+
})
|
|
94
97
|
} else {
|
|
95
98
|
// 公有图片,拼接 OSS 路径
|
|
96
99
|
if (this.isAbsoluteUrl(this.fullPath)) {
|
|
@@ -100,7 +103,7 @@ export default {
|
|
|
100
103
|
// 拼接 OSS 路径
|
|
101
104
|
// 移除 fullPath 开头的斜杠(如果有)
|
|
102
105
|
const cleanPath = this.fullPath.startsWith('/') ? this.fullPath.slice(1) : this.fullPath
|
|
103
|
-
|
|
106
|
+
|
|
104
107
|
// OSS 图片使用特定的 baseUrl(去掉 /api 部分)
|
|
105
108
|
let ossBaseUrl = this.baseUrl
|
|
106
109
|
// 如果 baseUrl 以 /api/ 结尾,去掉 /api
|
|
@@ -109,18 +112,21 @@ export default {
|
|
|
109
112
|
} else if (ossBaseUrl.endsWith('/api')) {
|
|
110
113
|
ossBaseUrl = ossBaseUrl.slice(0, -4) // 去掉 '/api'
|
|
111
114
|
}
|
|
112
|
-
|
|
115
|
+
|
|
113
116
|
this.url__ = this.normalizePath(ossBaseUrl, 'oss/o/' + cleanPath)
|
|
114
117
|
}
|
|
115
118
|
}
|
|
116
119
|
} else if (this.url) {
|
|
117
120
|
// 原有逻辑
|
|
118
121
|
if (this.private) {
|
|
119
|
-
$api.admin.file
|
|
120
|
-
this.
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
$api.admin.file
|
|
123
|
+
.preview(this.url)
|
|
124
|
+
.then(url => {
|
|
125
|
+
this.url__ = url
|
|
126
|
+
})
|
|
127
|
+
.catch(() => {
|
|
128
|
+
this.url__ = this.url
|
|
129
|
+
})
|
|
124
130
|
} else {
|
|
125
131
|
this.url__ = this.url
|
|
126
132
|
}
|