|  |  |  | 
|---|
|  |  |  | let isProduction = process.env.NODE_ENV === "production" | 
|---|
|  |  |  | let configObj = window.getServerJson | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 生产环境请求地址 | 
|---|
|  |  |  | export const baseUrl = configObj.managePath | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 是否是生产环境,打包的时候值会是true, 开发的时候值是false | 
|---|
|  |  |  | export const IS_PRODUCTION = isProduction | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // @/common/until/wsCache 加密使用的盐 | 
|---|
|  |  |  | export const LOCAL_ENCRYPTED_KEY = configObj.localEncryptedKey | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 接口上下文 | 
|---|
|  |  |  | export const manageContextPath = configObj.manageContextPath | 
|---|
|  |  |  | export function dateFormat(fmt, date) { | 
|---|
|  |  |  | let ret = "" | 
|---|
|  |  |  | date = new Date(date) | 
|---|
|  |  |  | const opt = { | 
|---|
|  |  |  | "Y+": date.getFullYear().toString(), // 年 | 
|---|
|  |  |  | "m+": (date.getMonth() + 1).toString(), // 月 | 
|---|
|  |  |  | "d+": date.getDate().toString(), // 日 | 
|---|
|  |  |  | "H+": date.getHours().toString(), // 时 | 
|---|
|  |  |  | "M+": date.getMinutes().toString(), // 分 | 
|---|
|  |  |  | "S+": date.getSeconds().toString() // 秒 | 
|---|
|  |  |  | // 有其他格式化字符需求可以继续添加,必须转化成字符串 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (let k in opt) { | 
|---|
|  |  |  | ret = new RegExp("(" + k + ")").exec(fmt) | 
|---|
|  |  |  | if (ret) { | 
|---|
|  |  |  | fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0")) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return fmt | 
|---|
|  |  |  | } | 
|---|