🎈 perf: 优化全局变量

This commit is contained in:
czm 2022-12-08 22:37:43 +08:00
parent af3eeaf9a1
commit 3e0fd03638
6 changed files with 16 additions and 5 deletions

View File

@ -1,5 +1,5 @@
{
"miniprogramRoot": "./",
"miniprogramRoot": "",
"projectname": "Mall-lymarket",
"description": "项目配置文件详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"appid": "wx64fe67f111d52457",
@ -31,7 +31,8 @@
},
"disableUseStrict": false,
"useCompilerPlugins": false,
"minifyWXML": true
"minifyWXML": true,
"ignoreUploadUnusedFiles": true
},
"compileType": "miniprogram",
"libVersion": "2.24.5",

View File

@ -6,6 +6,9 @@ module.exports = {
},
defineConstants: {
CURRENT_BASE_URL: '"https://test.zzfzyc.com/lymarket"',
CURRENT_CAP_HTML_TO_IMAGE_BASE_URL: '"https://test.zzfzyc.com"',
CURRENT_PAY_H5_CODE_URL: '"https://test.zzfzyc.com/cashier"',
CURRENT_IMG_CND_Prefix: '"https://test.cdn.zzfzyc.com"',
},
mini: {
// optimizeMainPackage: {

View File

@ -9,6 +9,7 @@ module.exports = {
CURRENT_BASE_URL: '"https://pre.zzfzyc.com/lymarket"',
CURRENT_CAP_HTML_TO_IMAGE_BASE_URL: '"https://pre.zzfzyc.com"',
CURRENT_PAY_H5_CODE_URL: '"https://pre.zzfzyc.com/cashier"',
CURRENT_IMG_CND_Prefix: '"https://test.cdn.zzfzyc.com"',
},
mini: {
optimizeMainPackage: {

View File

@ -7,6 +7,9 @@ module.exports = {
outputRoot: 'build',
defineConstants: {
CURRENT_BASE_URL: '"https://www.zzfzyc.com/lymarket"',
CURRENT_CAP_HTML_TO_IMAGE_BASE_URL: '"https://www.zzfzyc.com"',
CURRENT_PAY_H5_CODE_URL: '"https://www.zzfzyc.com/cashier"',
CURRENT_IMG_CND_Prefix: '"https://cdn.zzfzyc.com"',
},
mini: {
optimizeMainPackage: {

3
global.d.ts vendored
View File

@ -21,3 +21,6 @@ declare const CURRENT_VERSION: string
declare const CURRENT_GITHASH: string
declare const CURRENT_ENV: string
declare const CURRENT_BASE_URL: string
declare const CURRENT_CAP_HTML_TO_IMAGE_BASE_URL: string
declare const CURRENT_PAY_H5_CODE_URL: string
declare const CURRENT_IMG_CND_Prefix: string

View File

@ -23,10 +23,10 @@ export const GET_UPLOAD_SIGN = '/upyun/getsign' // 请求签名 url
export const UPLOAD_CDN_URL = 'https://v0.api.upyun.com/'
// cdn
export const IMG_CND_Prefix = CURRENT_ENV.includes('production') ? 'https://cdn.zzfzyc.com' : 'https://test.cdn.zzfzyc.com'
export const IMG_CND_Prefix = CURRENT_IMG_CND_Prefix
// 在线支付图片baseUrl
export const CAP_HTML_TO_IMAGE_BASE_URL = CURRENT_ENV.includes('production') ? 'https://www.zzfzyc.com' : 'https://test.zzfzyc.com'
export const CAP_HTML_TO_IMAGE_BASE_URL = CURRENT_CAP_HTML_TO_IMAGE_BASE_URL
// 上传图片视频
export const CDN_UPLOAD_IMG = `${UPLOAD_CDN_URL || ''}`
@ -48,4 +48,4 @@ export const SCENE = {
SearchScene: 0, // 商城面料搜索
}
// 支付码单跳转链接
export const PAY_H5_CODE_URL = CURRENT_ENV.includes('production') ? 'https://www.zzfzyc.com/cashier' : 'https://test.zzfzyc.com/cashier'
export const PAY_H5_CODE_URL = CURRENT_PAY_H5_CODE_URL