提交 e22605f3 编写于 作者: fxy060608's avatar fxy060608

chore: cdn

上级 a5a45741
...@@ -17,7 +17,26 @@ function getShadowCss () { ...@@ -17,7 +17,26 @@ function getShadowCss () {
if (process.env.UNI_PLATFORM === 'h5') { if (process.env.UNI_PLATFORM === 'h5') {
tagName = 'body' tagName = 'body'
} }
return `${tagName}::after{position:fixed;content:'';left:-1000px;top:-1000px;-webkit-animation:shadow-preload .1s;-webkit-animation-delay:3s;animation:shadow-preload .1s;animation-delay:3s}@-webkit-keyframes shadow-preload{0%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}100%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}}@keyframes shadow-preload{0%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}100%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}}` const cdn = getShadowCdn()
return `${tagName}::after{position:fixed;content:'';left:-1000px;top:-1000px;-webkit-animation:shadow-preload .1s;-webkit-animation-delay:3s;animation:shadow-preload .1s;animation-delay:3s}@-webkit-keyframes shadow-preload{0%{background-image:url(${cdn}/img/shadow-grey.png)}100%{background-image:url(${cdn}/img/shadow-grey.png)}}@keyframes shadow-preload{0%{background-image:url(${cdn}/img/shadow-grey.png)}100%{background-image:url(${cdn}/img/shadow-grey.png)}}`
}
const cdns = {
'mp-weixin': 1,
'mp-alipay': 2,
'mp-baidu': 3,
'mp-toutiao': 4,
'mp-qq': 5,
'mp-360': 7,
'mp-dingtalk': 8,
'mp-kuaishou': 9,
'mp-lark': 10,
'quickapp-webview-huawei': 200,
'quickapp-webview-union': 201
}
function getShadowCdn () {
const index = cdns[process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM] || ''
return `https://cdn${index}.dcloud.net.cn`
} }
// 解决 vue-cli-service lint 时 UNI_PLATFORM 不存在 // 解决 vue-cli-service lint 时 UNI_PLATFORM 不存在
...@@ -34,7 +53,8 @@ module.exports = { ...@@ -34,7 +53,8 @@ module.exports = {
normalizeNodeModules, normalizeNodeModules,
isInHBuilderX, isInHBuilderX,
isInHBuilderXAlpha, isInHBuilderXAlpha,
runByHBuilderX: isInHBuilderX || fs.existsSync(path.resolve(process.env.UNI_HBUILDERX_PLUGINS || '', 'weapp-tools')), runByHBuilderX: isInHBuilderX || fs.existsSync(path.resolve(process.env.UNI_HBUILDERX_PLUGINS || '',
'weapp-tools')),
getFlexDirection (json) { getFlexDirection (json) {
let flexDir = 'column' let flexDir = 'column'
if (json && json.nvue && json.nvue['flex-direction']) { if (json && json.nvue && json.nvue['flex-direction']) {
...@@ -129,7 +149,7 @@ module.exports = { ...@@ -129,7 +149,7 @@ module.exports = {
if (process.env.UNI_PLATFORM === 'mp-toutiao' || process.env.UNI_PLATFORM === 'mp-lark') { if (process.env.UNI_PLATFORM === 'mp-toutiao' || process.env.UNI_PLATFORM === 'mp-lark') {
tagName = 'image' tagName = 'image'
} }
return `<${tagName} src="https://cdn.dcloud.net.cn/img/shadow-${colorType}.png" style="z-index:998;position:fixed;left:0;top:0;width:100%;height:3px;"/>` return `<${tagName} src="${getShadowCdn()}/img/shadow-${colorType}.png" style="z-index:998;position:fixed;left:0;top:0;width:100%;height:3px;"/>`
}, },
getPlatformScss () { getPlatformScss () {
return SCSS return SCSS
...@@ -141,7 +161,9 @@ module.exports = { ...@@ -141,7 +161,9 @@ module.exports = {
return { return {
sourceType: 'module', sourceType: 'module',
plugins: [ plugins: [
['pipelineOperator', { proposal: 'minimal' }], ['pipelineOperator', {
proposal: 'minimal'
}],
'doExpressions', 'doExpressions',
'optionalChaining', 'optionalChaining',
'typescript', 'typescript',
...@@ -152,4 +174,4 @@ module.exports = { ...@@ -152,4 +174,4 @@ module.exports = {
] ]
} }
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册