adjust colors
This commit is contained in:
parent
6e406c7047
commit
964d8f3483
14
index.js
14
index.js
@ -22,27 +22,27 @@ export default {
|
|||||||
cclog(...args) {
|
cclog(...args) {
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
const pageName = this.thisPage()?.route || 'VueApp'
|
const pageName = this.thisPage()?.route || 'VueApp'
|
||||||
console.log('%c '+JSON.stringify({time:new Date().toJSON(), page:pageName}), 'color:skyblue', ...args)
|
console.log('%c '+JSON.stringify({time:new Date().toJSON(), page:pageName}), 'background:skyblue', ...args)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ccinfo(...args) {
|
ccinfo(...args) {
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
const pageName = this.thisPage()?.route || 'VueApp'
|
const pageName = this.thisPage()?.route || 'VueApp'
|
||||||
console.info('%c '+JSON.stringify({time:new Date().toJSON(), page:pageName}), 'color:green', ...args)
|
console.info('%c '+JSON.stringify({time:new Date().toJSON(), page:pageName}), 'background:lightgreen', ...args)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ccwarn(...args) {
|
ccwarn(...args) {
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
const pageName = this.thisPage().route || 'VueApp'
|
const pageName = this.thisPage().route || 'VueApp'
|
||||||
console.warn('%c '+JSON.stringify({time:new Date().toJSON(), page:pageName}), 'color:yellow', ...args)
|
console.warn('%c '+JSON.stringify({time:new Date().toJSON(), page:pageName}), 'background:orange', ...args)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ccerr(...args) {
|
ccerr(...args) {
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
const pageName = this.thisPage()?.route || 'App'
|
const pageName = this.thisPage()?.route || 'App'
|
||||||
console.error('%c '+JSON.stringify({time:new Date().toJSON(), page:pageName}), 'color:red', ...args)
|
console.error('%c '+JSON.stringify({time:new Date().toJSON(), page:pageName}), 'background:red', ...args)
|
||||||
}
|
}
|
||||||
},
|
},,
|
||||||
|
|
||||||
localizeText(i18nText) {
|
localizeText(i18nText) {
|
||||||
const pageNow = this?.$store ? this // 对于组件内定义的 i18nText,要使用 this 来获得组建内的 i18nText,而不是 getCurrentPages[...] 去访问全局页面的 i18nText。
|
const pageNow = this?.$store ? this // 对于组件内定义的 i18nText,要使用 this 来获得组建内的 i18nText,而不是 getCurrentPages[...] 去访问全局页面的 i18nText。
|
||||||
@ -144,7 +144,7 @@ export default {
|
|||||||
**/
|
**/
|
||||||
async callBackend({ backend = this.BACKEND, httpMethod = 'POST', apiVersion = 'api', apiWho, apiTodo, apiWhat = {} }) {
|
async callBackend({ backend = this.BACKEND, httpMethod = 'POST', apiVersion = 'api', apiWho, apiTodo, apiWhat = {} }) {
|
||||||
process.env.NODE_ENV === 'production'
|
process.env.NODE_ENV === 'production'
|
||||||
|| console.log('%c '+JSON.stringify({time:new Date().toJSON(), page:this.thisPage()?.route || 'VueApp'}) + ' %c '+ JSON.stringify({ backend, apiWho, apiTodo, apiWhat }), 'color:skyblue', 'background:skyblue')
|
|| console.log('%c '+JSON.stringify({time:new Date().toJSON(), page:this.thisPage()?.route || 'VueApp'}) + ' %c '+ JSON.stringify({ backend, apiWho, apiTodo, apiWhat }), 'background:skyblue', 'background:skyblue')
|
||||||
let result = {}
|
let result = {}
|
||||||
if (backend === 'UNICLOUD') {
|
if (backend === 'UNICLOUD') {
|
||||||
let { /* success, header, requestedId, */ result: resultCloud = {} } = await uniCloud
|
let { /* success, header, requestedId, */ result: resultCloud = {} } = await uniCloud
|
||||||
@ -198,7 +198,7 @@ export default {
|
|||||||
// 注意1,resultServer 和 resultCloud 推荐遵循同样的格式 { _state, error | data },这样方便前端做统一判断。
|
// 注意1,resultServer 和 resultCloud 推荐遵循同样的格式 { _state, error | data },这样方便前端做统一判断。
|
||||||
// 注意2,虽然预设了 resultServer 和 resultCloud = {},但如果后台返回了 null,那么 resultServer/resultCloud 也是 null。
|
// 注意2,虽然预设了 resultServer 和 resultCloud = {},但如果后台返回了 null,那么 resultServer/resultCloud 也是 null。
|
||||||
process.env.NODE_ENV === 'production'
|
process.env.NODE_ENV === 'production'
|
||||||
|| console.info(' %c '+JSON.stringify({time:new Date().toJSON(), page:this.thisPage()?.route || 'VueApp'}) + '%c '+ JSON.stringify(result), 'color:pink', 'background:pink') // 不知为何,直接用 result 会输出一个奇怪的对象,要主动添加 JSON.stringify 才按照期望输出。
|
|| console.info(' %c '+JSON.stringify({time:new Date().toJSON(), page:this.thisPage()?.route || 'VueApp'}) + '%c '+ JSON.stringify(result), 'background:cyan', 'background:cyan') // 不知为何,直接用 result 会输出一个奇怪的对象,要主动添加 JSON.stringify 才按照期望输出。
|
||||||
return result
|
return result
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user