Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
corporate-culture-qd
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王立鹏
corporate-culture-qd
Commits
155ec4c9
Commit
155ec4c9
authored
Nov 10, 2026
by
lijiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增OSS处理参数URL拼接工具函数
parent
c442debf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
index.ts
src/utils/index.ts
+1
-0
oss.ts
src/utils/oss.ts
+15
-0
No files found.
src/utils/index.ts
View file @
155ec4c9
export
*
from
'./app'
export
*
from
'./wxUtil'
export
*
from
'./excel'
export
*
from
'./oss'
src/utils/oss.ts
0 → 100644
View file @
155ec4c9
/**
* 给文件 URL 拼接 OSS 处理参数。
* 后端返回的 URL 可能已带 query(如 ?expires=...&sign=...),
* 此时必须用 & 连接,否则会出现双 ? 导致资源加载失败。
*/
export
const
withOssProcess
=
(
url
:
string
,
process
:
string
)
=>
{
if
(
!
url
)
return
url
return
`
${
url
}${
url
.
includes
(
'?'
)
?
'&'
:
'?'
}
x-oss-process=
${
process
}
`
}
/** 图片转 webp */
export
const
toWebpUrl
=
(
url
:
string
)
=>
withOssProcess
(
url
,
'image/format,webp'
)
/** 视频第 1 秒截帧作为封面 */
export
const
getVideoPosterUrl
=
(
url
:
string
)
=>
withOssProcess
(
url
,
'video/snapshot,t_1000,f_jpg'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment