Commit 2ded40f4 authored by 赵炳峰's avatar 赵炳峰

host.js

parent 52eb1640
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
import ossConfig from '@/assets/ossConfig.js' import ossConfig from '@/assets/ossConfig.js'
const isProd = process.env.NODE_ENV === 'production' 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 - 老平台文件域名 // 文件域名 - type [默认为 0]: 0 - OSS 业务文件域名,1 - OSS 静态文件域名,2 - 老平台图片域名,3 - 老平台文件域名
// 说明:传入域名和类型,根据类型返回拼接完整的域名,默认不传类型为 OSS 业务文件域名 // 说明:传入域名和类型,根据类型返回拼接完整的域名,默认不传类型为 OSS 业务文件域名
...@@ -20,7 +22,7 @@ export const getFileHost = (url, type = 0) => { ...@@ -20,7 +22,7 @@ export const getFileHost = (url, type = 0) => {
return ossConfig.staticResourcesFileBucket.domain + url return ossConfig.staticResourcesFileBucket.domain + url
} else if (type === 2) { } else if (type === 2) {
return isProd return isProd
? 'http://image.vschool100.cn' + url ? 'https://image.vschool100.cn' + url
: 'http://test.vschool100.com:8888' + url : 'http://test.vschool100.com:8888' + url
} else { } else {
return isProd return isProd
...@@ -77,7 +79,7 @@ export const getHeadImgDomain = url => { ...@@ -77,7 +79,7 @@ export const getHeadImgDomain = url => {
} else { } else {
// return `${ossConfig.bussinessFileBucket.domain}${url}` // return `${ossConfig.bussinessFileBucket.domain}${url}`
return isProd return isProd
? `http://image.vschool100.cn${url}` ? `https://image.vschool100.cn${url}`
: `http://test.vschool100.com:8888${url}` : `http://test.vschool100.com:8888${url}`
} }
} else { } else {
...@@ -86,3 +88,19 @@ export const getHeadImgDomain = url => { ...@@ -86,3 +88,19 @@ export const getHeadImgDomain = url => {
}/Common/head.png` }/Common/head.png`
} }
} }
// 获取文件预览地址
export const getFileOnlinePreview = (url, type = 0) => {
if (!url) {
return new Error('Invalid url')
}
return `${onlinePreviewHost}?url=${getFileHost(url, type)}`
}
// 获取微信二维码 传入tik
export const getWxQrcode = ticket => {
if (!ticket) {
return new Error('Invalid ticket')
}
return `${wxQrcodeHost}?ticket=${ticket}`
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment