Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
V
VS_OUTSOURCE
Project
Project
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
赵炳峰
VS_OUTSOURCE
Commits
922d4b30
Commit
922d4b30
authored
Dec 01, 2020
by
赵炳峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
master
parent
7b2a9c12
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
13 deletions
+20
-13
host.js
VSSCMP_WEIXIN/teacher/src/assets/utils/host.js
+20
-13
No files found.
VSSCMP_WEIXIN/teacher/src/assets/utils/host.js
View file @
922d4b30
...
...
@@ -2,6 +2,8 @@
import
ossConfig
from
'@/assets/ossConfig.js'
const
isProd
=
process
.
env
.
NODE_ENV
===
'production'
const
onlinePreviewHost
=
'http://onlinepreview.vschool100.cn/onlinePreview'
const
wxQrcodeHost
=
'https://mp.weixin.qq.com/cgi-bin/showqrcode'
// 文件域名 - type [默认为 0]: 0 - OSS 业务文件域名,1 - OSS 静态文件域名,2 - 老平台图片域名,3 - 老平台文件域名
// 说明:传入域名和类型,根据类型返回拼接完整的域名,默认不传类型为 OSS 业务文件域名
...
...
@@ -20,7 +22,7 @@ export const getFileHost = (url, type = 0) => {
return
ossConfig
.
staticResourcesFileBucket
.
domain
+
url
}
else
if
(
type
===
2
)
{
return
isProd
?
'http://image.vschool100.cn'
+
url
?
'http
s
://image.vschool100.cn'
+
url
:
'http://test.vschool100.com:8888'
+
url
}
else
{
return
isProd
...
...
@@ -69,18 +71,23 @@ export const getObjectKey = (url, key = 'objectKey') => {
}
}
// 获取老平台头像
export
const
getHeadImgDomain
=
url
=>
{
if
(
url
)
{
const
imgReg
=
/^https
?
:
\/\/
|^blob:|^data:/
if
(
imgReg
.
test
(
url
))
{
return
url
}
else
{
// return `${ossConfig.bussinessFileBucket.domain}${url}`
return
isProd
?
`http://image.vschool100.cn
${
url
}
`
:
`http://test.vschool100.com:8888
${
url
}
`
return
url
?
getFileHost
(
url
,
2
)
:
getFileHost
(
'/Common/head.png'
,
1
)
}
// 获取文件预览地址
export
const
getFileOnlinePreview
=
(
url
,
type
=
0
)
=>
{
if
(
!
url
)
{
return
new
Error
(
'Invalid url'
)
}
}
else
{
return
`
${
ossConfig
.
staticResourcesFileBucket
.
domain
}
/Common/head.png`
return
`
${
onlinePreviewHost
}
?url=
${
getFileHost
(
url
,
type
)}
`
}
// 获取微信二维码 传入tik
export
const
getWxQrcode
=
ticket
=>
{
if
(
!
ticket
)
{
return
new
Error
(
'Invalid ticket'
)
}
return
`
${
wxQrcodeHost
}
?ticket=
${
ticket
}
`
}
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