Commit 922d4b30 authored by 赵炳峰's avatar 赵炳峰

master

parent 7b2a9c12
...@@ -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
...@@ -69,18 +71,23 @@ export const getObjectKey = (url, key = 'objectKey') => { ...@@ -69,18 +71,23 @@ export const getObjectKey = (url, key = 'objectKey') => {
} }
} }
// 获取老平台头像
export const getHeadImgDomain = url => { export const getHeadImgDomain = url => {
if (url) { return url ? getFileHost(url, 2) : getFileHost('/Common/head.png', 1)
const imgReg = /^https?:\/\/|^blob:|^data:/ }
if (imgReg.test(url)) {
return url // 获取文件预览地址
} else { export const getFileOnlinePreview = (url, type = 0) => {
// return `${ossConfig.bussinessFileBucket.domain}${url}` if (!url) {
return isProd return new Error('Invalid url')
? `http://image.vschool100.cn${url}`
: `http://test.vschool100.com:8888${url}`
} }
} else { return `${onlinePreviewHost}?url=${getFileHost(url, type)}`
return `${ossConfig.staticResourcesFileBucket.domain}/Common/head.png` }
// 获取微信二维码 传入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