Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: fix |> 20055 直播频道,接口返回数据存在楼层无数据时,未做兼容处理,客户端展示空白页。 fix |> uat 环境 空字段崩溃 ref |> 启动性能优化2 ref |> 启动性能优化 ref |> log转换Logger
Showing
45 changed files
with
264 additions
and
122 deletions
| @@ -48,20 +48,26 @@ export class NetworkManager { | @@ -48,20 +48,26 @@ export class NetworkManager { | ||
| 48 | Logger.info(TAG, 'register success'); | 48 | Logger.info(TAG, 'register success'); |
| 49 | }) | 49 | }) |
| 50 | this.netCon.on('netAvailable', (data: connection.NetHandle) => { | 50 | this.netCon.on('netAvailable', (data: connection.NetHandle) => { |
| 51 | - Logger.info(TAG, 'netAvailable, data is: ' + JSON.stringify(data)) | 51 | + Logger.infoOptimize(TAG, () => { |
| 52 | + return 'netAvailable, data is: ' + JSON.stringify(data) | ||
| 53 | + }) | ||
| 52 | }) | 54 | }) |
| 53 | this.netCon.on('netBlockStatusChange', (data: connection.NetBlockStatusInfo) => { | 55 | this.netCon.on('netBlockStatusChange', (data: connection.NetBlockStatusInfo) => { |
| 54 | Logger.info(TAG, 'netBlockStatusChange, data is: ' + JSON.stringify(data)) | 56 | Logger.info(TAG, 'netBlockStatusChange, data is: ' + JSON.stringify(data)) |
| 55 | // TODO 网络阻塞,是否创建新的网络、提示 | 57 | // TODO 网络阻塞,是否创建新的网络、提示 |
| 56 | }) | 58 | }) |
| 57 | this.netCon.on('netCapabilitiesChange', (data: connection.NetCapabilityInfo) => { | 59 | this.netCon.on('netCapabilitiesChange', (data: connection.NetCapabilityInfo) => { |
| 58 | - Logger.info(TAG, 'netCapabilitiesChange, data is: ' + JSON.stringify(data)) | 60 | + Logger.infoOptimize(TAG, () => { |
| 61 | + return 'netCapabilitiesChange, data is: ' + JSON.stringify(data) | ||
| 62 | + }) | ||
| 59 | this.parseData(data) | 63 | this.parseData(data) |
| 60 | // 可能多次通知 | 64 | // 可能多次通知 |
| 61 | EmitterUtils.sendEvent(EmitterEventId.NETWORK_CONNECTED, JSON.stringify(this.networkType)) | 65 | EmitterUtils.sendEvent(EmitterEventId.NETWORK_CONNECTED, JSON.stringify(this.networkType)) |
| 62 | }) | 66 | }) |
| 63 | this.netCon.on('netConnectionPropertiesChange', (data: connection.NetConnectionPropertyInfo) => { | 67 | this.netCon.on('netConnectionPropertiesChange', (data: connection.NetConnectionPropertyInfo) => { |
| 64 | - Logger.info(TAG, 'netConnectionPropertiesChange, data is: ' + JSON.stringify(data)) | 68 | + Logger.infoOptimize(TAG, () => { |
| 69 | + return 'netConnectionPropertiesChange, data is: ' + JSON.stringify(data) | ||
| 70 | + }) | ||
| 65 | }) | 71 | }) |
| 66 | 72 | ||
| 67 | this.netCon.on('netUnavailable', ((data: void) => { | 73 | this.netCon.on('netUnavailable', ((data: void) => { |
| @@ -10,8 +10,21 @@ const TAG: string = 'AppUtils'; | @@ -10,8 +10,21 @@ const TAG: string = 'AppUtils'; | ||
| 10 | */ | 10 | */ |
| 11 | export class AppUtils { | 11 | export class AppUtils { |
| 12 | private static buildVersion: string = '' | 12 | private static buildVersion: string = '' |
| 13 | + private static buildProductName: string = '' | ||
| 14 | + private static buildBuildModeName: string = '' | ||
| 13 | static { | 15 | static { |
| 14 | AppUtils.buildVersion = BuildProfile.BUILD_VERSION; | 16 | AppUtils.buildVersion = BuildProfile.BUILD_VERSION; |
| 17 | + AppUtils.buildProductName = BuildProfile.PRODUCT_NAME; | ||
| 18 | + AppUtils.buildBuildModeName = BuildProfile.BUILD_MODE_NAME; | ||
| 19 | + | ||
| 20 | + Logger.isDebug = !AppUtils.isProductRELEASE() | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + public static isProductRELEASE() { | ||
| 24 | + if (AppUtils.buildProductName == "productRELEASE" && AppUtils.buildBuildModeName == "release") { | ||
| 25 | + return true | ||
| 26 | + } | ||
| 27 | + return false | ||
| 15 | } | 28 | } |
| 16 | 29 | ||
| 17 | // 全局应用context | 30 | // 全局应用context |
| @@ -20,7 +20,7 @@ export class KVStoreHelper { | @@ -20,7 +20,7 @@ export class KVStoreHelper { | ||
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | static init(context: Context) { | 22 | static init(context: Context) { |
| 23 | - Logger.error(TAG, 'init') | 23 | + Logger.debug(TAG, 'init') |
| 24 | KVStoreHelper._context = context; | 24 | KVStoreHelper._context = context; |
| 25 | KVStoreHelper.default.createKVManager() | 25 | KVStoreHelper.default.createKVManager() |
| 26 | KVStoreHelper.default.createKVStore() | 26 | KVStoreHelper.default.createKVStore() |
| @@ -118,7 +118,9 @@ export class KVStoreHelper { | @@ -118,7 +118,9 @@ export class KVStoreHelper { | ||
| 118 | return; | 118 | return; |
| 119 | } | 119 | } |
| 120 | success(data) | 120 | success(data) |
| 121 | - Logger.debug(TAG, `Succeeded in getting data. Data:${data}`); | 121 | + Logger.debugOptimize(TAG, () => { |
| 122 | + return `Succeeded in getting data. Data:${data}` | ||
| 123 | + }); | ||
| 122 | }); | 124 | }); |
| 123 | } catch (e) { | 125 | } catch (e) { |
| 124 | success(def) | 126 | success(def) |
| @@ -20,7 +20,7 @@ enum LogLevel { | @@ -20,7 +20,7 @@ enum LogLevel { | ||
| 20 | */ | 20 | */ |
| 21 | export class Logger { | 21 | export class Logger { |
| 22 | private static domain: number = 0xFF00; | 22 | private static domain: number = 0xFF00; |
| 23 | - private static prefix: string = 'SightApp'; | 23 | + private static prefix: string = 'RMRB'; |
| 24 | private static format: string = `%{public}s, %{public}s`; | 24 | private static format: string = `%{public}s, %{public}s`; |
| 25 | private static format_ext: string = `%{public}s`; | 25 | private static format_ext: string = `%{public}s`; |
| 26 | /** | 26 | /** |
| @@ -28,6 +28,7 @@ export class Logger { | @@ -28,6 +28,7 @@ export class Logger { | ||
| 28 | */ | 28 | */ |
| 29 | private static CHUNK_SIZE: number = 3500; | 29 | private static CHUNK_SIZE: number = 3500; |
| 30 | static isDebug: boolean = true; | 30 | static isDebug: boolean = true; |
| 31 | + static isCloseOptimzied: boolean = false; // 正常用false,打开是为了暴露性能问题 | ||
| 31 | 32 | ||
| 32 | /** | 33 | /** |
| 33 | * constructor. | 34 | * constructor. |
| @@ -35,7 +36,7 @@ export class Logger { | @@ -35,7 +36,7 @@ export class Logger { | ||
| 35 | * @param Prefix Identifies the log tag. | 36 | * @param Prefix Identifies the log tag. |
| 36 | * @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF. | 37 | * @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF. |
| 37 | */ | 38 | */ |
| 38 | - constructor(prefix: string = 'SightApp', domain: number = 0xFF00) { | 39 | + constructor(prefix: string = 'RMRB', domain: number = 0xFF00) { |
| 39 | Logger.prefix = prefix; | 40 | Logger.prefix = prefix; |
| 40 | Logger.domain = domain; | 41 | Logger.domain = domain; |
| 41 | } | 42 | } |
| @@ -47,6 +48,16 @@ export class Logger { | @@ -47,6 +48,16 @@ export class Logger { | ||
| 47 | Logger.logContent(LogLevel.DEBUG, ...args) | 48 | Logger.logContent(LogLevel.DEBUG, ...args) |
| 48 | } | 49 | } |
| 49 | 50 | ||
| 51 | + static debugOptimize(tag: string, func: () => string) { | ||
| 52 | + if (!Logger.isDebug || Logger.isCloseOptimzied) { | ||
| 53 | + return | ||
| 54 | + } | ||
| 55 | + let param: string[] = [] | ||
| 56 | + param.push(tag) | ||
| 57 | + param.push(func()) | ||
| 58 | + Logger.logContent(LogLevel.DEBUG, ...param) | ||
| 59 | + } | ||
| 60 | + | ||
| 50 | static info(...args: string[]) { | 61 | static info(...args: string[]) { |
| 51 | if (!Logger.isDebug) { | 62 | if (!Logger.isDebug) { |
| 52 | return | 63 | return |
| @@ -54,6 +65,16 @@ export class Logger { | @@ -54,6 +65,16 @@ export class Logger { | ||
| 54 | Logger.logContent(LogLevel.INFO, ...args) | 65 | Logger.logContent(LogLevel.INFO, ...args) |
| 55 | } | 66 | } |
| 56 | 67 | ||
| 68 | + static infoOptimize(tag: string, func: () => string) { | ||
| 69 | + if (!Logger.isDebug || Logger.isCloseOptimzied) { | ||
| 70 | + return | ||
| 71 | + } | ||
| 72 | + let param: string[] = [] | ||
| 73 | + param.push(tag) | ||
| 74 | + param.push(func()) | ||
| 75 | + Logger.logContent(LogLevel.INFO, ...param) | ||
| 76 | + } | ||
| 77 | + | ||
| 57 | static warn(...args: string[]) { | 78 | static warn(...args: string[]) { |
| 58 | if (!Logger.isDebug) { | 79 | if (!Logger.isDebug) { |
| 59 | return | 80 | return |
| @@ -61,13 +82,33 @@ export class Logger { | @@ -61,13 +82,33 @@ export class Logger { | ||
| 61 | Logger.logContent(LogLevel.WARN, ...args) | 82 | Logger.logContent(LogLevel.WARN, ...args) |
| 62 | } | 83 | } |
| 63 | 84 | ||
| 85 | + static warnOptimize(tag: string, func: () => string) { | ||
| 86 | + if (!Logger.isDebug || Logger.isCloseOptimzied) { | ||
| 87 | + return | ||
| 88 | + } | ||
| 89 | + let param: string[] = [] | ||
| 90 | + param.push(tag) | ||
| 91 | + param.push(func()) | ||
| 92 | + Logger.logContent(LogLevel.WARN, ...param) | ||
| 93 | + } | ||
| 94 | + | ||
| 64 | static error(...args: string[]) { | 95 | static error(...args: string[]) { |
| 65 | - if (!Logger.isDebug) { | 96 | + if (!Logger.isDebug || Logger.isCloseOptimzied) { |
| 66 | return | 97 | return |
| 67 | } | 98 | } |
| 68 | Logger.logContent(LogLevel.ERROR, ...args) | 99 | Logger.logContent(LogLevel.ERROR, ...args) |
| 69 | } | 100 | } |
| 70 | 101 | ||
| 102 | + static errorOptimize(tag: string, func: () => string) { | ||
| 103 | + if (!Logger.isDebug || Logger.isCloseOptimzied) { | ||
| 104 | + return | ||
| 105 | + } | ||
| 106 | + let param: string[] = [] | ||
| 107 | + param.push(tag) | ||
| 108 | + param.push(func()) | ||
| 109 | + Logger.logContent(LogLevel.ERROR, ...param) | ||
| 110 | + } | ||
| 111 | + | ||
| 71 | static fatal(...args: string[]) { | 112 | static fatal(...args: string[]) { |
| 72 | if (!Logger.isDebug) { | 113 | if (!Logger.isDebug) { |
| 73 | return | 114 | return |
| @@ -75,6 +116,16 @@ export class Logger { | @@ -75,6 +116,16 @@ export class Logger { | ||
| 75 | Logger.logContent(LogLevel.FATAL, ...args) | 116 | Logger.logContent(LogLevel.FATAL, ...args) |
| 76 | } | 117 | } |
| 77 | 118 | ||
| 119 | + static fatalOptimize(tag: string, func: () => string) { | ||
| 120 | + if (!Logger.isDebug || Logger.isCloseOptimzied) { | ||
| 121 | + return | ||
| 122 | + } | ||
| 123 | + let param: string[] = [] | ||
| 124 | + param.push(tag) | ||
| 125 | + param.push(func()) | ||
| 126 | + Logger.logContent(LogLevel.FATAL, ...param) | ||
| 127 | + } | ||
| 128 | + | ||
| 78 | static isLoggable(level: LogLevel) { | 129 | static isLoggable(level: LogLevel) { |
| 79 | if (!Logger.isDebug) { | 130 | if (!Logger.isDebug) { |
| 80 | return | 131 | return |
| @@ -103,7 +154,7 @@ export class Logger { | @@ -103,7 +154,7 @@ export class Logger { | ||
| 103 | 154 | ||
| 104 | let prefix = Logger.prefix | 155 | let prefix = Logger.prefix |
| 105 | if (tag) { | 156 | if (tag) { |
| 106 | - prefix = tag | 157 | + prefix += "-" + tag |
| 107 | } | 158 | } |
| 108 | 159 | ||
| 109 | switch (level) { | 160 | switch (level) { |
| @@ -129,7 +180,7 @@ export class Logger { | @@ -129,7 +180,7 @@ export class Logger { | ||
| 129 | 180 | ||
| 130 | let prefix = Logger.prefix | 181 | let prefix = Logger.prefix |
| 131 | if (tag) { | 182 | if (tag) { |
| 132 | - prefix = tag | 183 | + prefix += "-" + tag |
| 133 | } | 184 | } |
| 134 | 185 | ||
| 135 | switch (level) { | 186 | switch (level) { |
| @@ -30,6 +30,8 @@ const instance: AxiosInstance = axios.create({ | @@ -30,6 +30,8 @@ const instance: AxiosInstance = axios.create({ | ||
| 30 | // withCredentials: true | 30 | // withCredentials: true |
| 31 | }); | 31 | }); |
| 32 | 32 | ||
| 33 | +const TAG = "HttpRequest" | ||
| 34 | + | ||
| 33 | // 添加请求拦截器 | 35 | // 添加请求拦截器 |
| 34 | instance.interceptors.request.use( | 36 | instance.interceptors.request.use( |
| 35 | (config: InternalAxiosRequestConfig) => { | 37 | (config: InternalAxiosRequestConfig) => { |
| @@ -39,12 +41,14 @@ instance.interceptors.request.use( | @@ -39,12 +41,14 @@ instance.interceptors.request.use( | ||
| 39 | } | 41 | } |
| 40 | // 公共请求参数 | 42 | // 公共请求参数 |
| 41 | // config.params.key = key | 43 | // config.params.key = key |
| 42 | - Logger.debug('HttpRequest', 'request: ' + config.url) | 44 | + Logger.debugOptimize(TAG, () => { |
| 45 | + return 'request: ' + config.url | ||
| 46 | + }) | ||
| 43 | return config; | 47 | return config; |
| 44 | }, | 48 | }, |
| 45 | (error: AxiosError) => { | 49 | (error: AxiosError) => { |
| 46 | // 请求错误 | 50 | // 请求错误 |
| 47 | - console.log(`全局请求失败拦截,message:${error.message}`) | 51 | + Logger.error(`全局请求失败拦截,message:${error.message}`) |
| 48 | return Promise.reject(error); | 52 | return Promise.reject(error); |
| 49 | } | 53 | } |
| 50 | ); | 54 | ); |
| @@ -88,13 +92,15 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r | @@ -88,13 +92,15 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r | ||
| 88 | // } | 92 | // } |
| 89 | // const data: ResponseBean<any> = response.data | 93 | // const data: ResponseBean<any> = response.data |
| 90 | 94 | ||
| 91 | - Logger.debug('HttpRequest', 'response ==============start=================') | ||
| 92 | - Logger.debug('HttpRequest', 'response: ' + JSON.stringify(response.data)) | ||
| 93 | - Logger.debug('HttpRequest', 'response ==============end=================') | 95 | + Logger.debug(TAG, 'response ==============start=================') |
| 96 | + Logger.debugOptimize(TAG, () => { | ||
| 97 | + return 'response: ' + JSON.stringify(response.data) | ||
| 98 | + }) | ||
| 99 | + Logger.debug(TAG, 'response ==============end=================') | ||
| 94 | // 改造返回的数据,即将AxiosResponse的data返回,服务端返回的数据 | 100 | // 改造返回的数据,即将AxiosResponse的data返回,服务端返回的数据 |
| 95 | return response.data; | 101 | return response.data; |
| 96 | } else { | 102 | } else { |
| 97 | - console.log(`httpStatus:${response.status}-${response.status}!`) | 103 | + Logger.error(TAG, `httpStatus:${response.status}-${response.status}!`) |
| 98 | // return Promise.reject(error); | 104 | // return Promise.reject(error); |
| 99 | return response.data; | 105 | return response.data; |
| 100 | } | 106 | } |
| @@ -107,7 +113,7 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r | @@ -107,7 +113,7 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r | ||
| 107 | if (error != null && error.response != null) { | 113 | if (error != null && error.response != null) { |
| 108 | let message = buildErrorMsg(error.response.status); | 114 | let message = buildErrorMsg(error.response.status); |
| 109 | // 错误消息可以使用全局弹框展示出来 | 115 | // 错误消息可以使用全局弹框展示出来 |
| 110 | - console.log(`httpStatus:${error.response?.status}-${message},请检查网络或联系管理员!`) | 116 | + Logger.error(`httpStatus:${error.response?.status}-${message},请检查网络或联系管理员!`) |
| 111 | errorBean = buildError(error.response.status) | 117 | errorBean = buildError(error.response.status) |
| 112 | } | 118 | } |
| 113 | return Promise.reject(errorBean); | 119 | return Promise.reject(errorBean); |
| @@ -33,7 +33,9 @@ export class AppLinkingManager { | @@ -33,7 +33,9 @@ export class AppLinkingManager { | ||
| 33 | this.onNewWant(want, true) | 33 | this.onNewWant(want, true) |
| 34 | } | 34 | } |
| 35 | onNewWant(want: Want, startup: boolean = false) { | 35 | onNewWant(want: Want, startup: boolean = false) { |
| 36 | - Logger.debug(TAG, "want: " + JSON.stringify(want)) | 36 | + Logger.debugOptimize(TAG, () => { |
| 37 | + return "want: " + JSON.stringify(want) | ||
| 38 | + }) | ||
| 37 | let uri = want?.uri | 39 | let uri = want?.uri |
| 38 | if (!uri) { | 40 | if (!uri) { |
| 39 | return | 41 | return |
| @@ -9,6 +9,7 @@ import { uniformTypeDescriptor as utd } from '@kit.ArkData'; | @@ -9,6 +9,7 @@ import { uniformTypeDescriptor as utd } from '@kit.ArkData'; | ||
| 9 | import { JSON } from '@kit.ArkTS'; | 9 | import { JSON } from '@kit.ArkTS'; |
| 10 | import { image } from '@kit.ImageKit'; | 10 | import { image } from '@kit.ImageKit'; |
| 11 | import { WDShareBase } from '../WDShareBase'; | 11 | import { WDShareBase } from '../WDShareBase'; |
| 12 | +import { Logger } from 'wdKit'; | ||
| 12 | 13 | ||
| 13 | const TAG = "WDSystemShare" | 14 | const TAG = "WDSystemShare" |
| 14 | 15 | ||
| @@ -32,9 +33,9 @@ export class WDSystemShare implements WDShareInterface { | @@ -32,9 +33,9 @@ export class WDSystemShare implements WDShareInterface { | ||
| 32 | selectionMode: systemShare.SelectionMode.SINGLE | 33 | selectionMode: systemShare.SelectionMode.SINGLE |
| 33 | }); | 34 | }); |
| 34 | 35 | ||
| 35 | - console.log(TAG, "分享控制器调用完成") | 36 | + Logger.debug(TAG, "分享控制器调用完成") |
| 36 | } catch (e) { | 37 | } catch (e) { |
| 37 | - console.log(TAG, "异常1" + JSON.stringify(e)) | 38 | + Logger.error(TAG, "异常1" + JSON.stringify(e)) |
| 38 | fail(e) | 39 | fail(e) |
| 39 | } | 40 | } |
| 40 | }) | 41 | }) |
| @@ -45,7 +46,7 @@ export class WDSystemShare implements WDShareInterface { | @@ -45,7 +46,7 @@ export class WDSystemShare implements WDShareInterface { | ||
| 45 | 46 | ||
| 46 | if (contentType === ShareContentType.PrueText) { | 47 | if (contentType === ShareContentType.PrueText) { |
| 47 | let prueText = content as ShareContentText | 48 | let prueText = content as ShareContentText |
| 48 | - console.log(TAG, "分享纯文本") | 49 | + Logger.debug(TAG, "分享纯文本") |
| 49 | resolve(new systemShare.SharedData({ | 50 | resolve(new systemShare.SharedData({ |
| 50 | utd: utd.UniformDataType.PLAIN_TEXT, | 51 | utd: utd.UniformDataType.PLAIN_TEXT, |
| 51 | content: prueText.text | 52 | content: prueText.text |
| @@ -55,7 +56,7 @@ export class WDSystemShare implements WDShareInterface { | @@ -55,7 +56,7 @@ export class WDSystemShare implements WDShareInterface { | ||
| 55 | 56 | ||
| 56 | if (contentType === ShareContentType.ImageAndText) { | 57 | if (contentType === ShareContentType.ImageAndText) { |
| 57 | let imageAndText = content as ShareContentImageAndText | 58 | let imageAndText = content as ShareContentImageAndText |
| 58 | - console.log(TAG, "分享图片和文本") | 59 | + Logger.debug(TAG, "分享图片和文本") |
| 59 | let data: systemShare.SharedData = new systemShare.SharedData({ | 60 | let data: systemShare.SharedData = new systemShare.SharedData({ |
| 60 | utd: utd.UniformDataType.PLAIN_TEXT, | 61 | utd: utd.UniformDataType.PLAIN_TEXT, |
| 61 | content: imageAndText.title | 62 | content: imageAndText.title |
| @@ -68,11 +69,11 @@ export class WDSystemShare implements WDShareInterface { | @@ -68,11 +69,11 @@ export class WDSystemShare implements WDShareInterface { | ||
| 68 | return | 69 | return |
| 69 | } | 70 | } |
| 70 | 71 | ||
| 71 | - console.log(TAG, "分享链接和文本") | 72 | + Logger.debug(TAG, "分享链接和文本") |
| 72 | let link = content as ShareContentLink | 73 | let link = content as ShareContentLink |
| 73 | let posterImg: Uint8Array | undefined = undefined | 74 | let posterImg: Uint8Array | undefined = undefined |
| 74 | let shareLink = this.generateShareLink(link) | 75 | let shareLink = this.generateShareLink(link) |
| 75 | - console.log("TAG, 分享 shareLink ==> " + shareLink) | 76 | + Logger.debug("TAG, 分享 shareLink ==> " + shareLink) |
| 76 | 77 | ||
| 77 | if (!context || !link.posterImg) { | 78 | if (!context || !link.posterImg) { |
| 78 | let data: systemShare.SharedData = new systemShare.SharedData({ | 79 | let data: systemShare.SharedData = new systemShare.SharedData({ |
| @@ -100,7 +101,7 @@ export class WDSystemShare implements WDShareInterface { | @@ -100,7 +101,7 @@ export class WDSystemShare implements WDShareInterface { | ||
| 100 | resolve(data) | 101 | resolve(data) |
| 101 | }) | 102 | }) |
| 102 | .catch((e: Error) => { | 103 | .catch((e: Error) => { |
| 103 | - console.log(TAG, "异常" + JSON.stringify(e)) | 104 | + Logger.error(TAG, "异常" + JSON.stringify(e)) |
| 104 | fail(e) | 105 | fail(e) |
| 105 | }) | 106 | }) |
| 106 | }) | 107 | }) |
| @@ -70,7 +70,9 @@ export struct WdWebComponent { | @@ -70,7 +70,9 @@ export struct WdWebComponent { | ||
| 70 | for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) { | 70 | for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) { |
| 71 | let handleName = H5CallNativeType.JsCallTypeList[i]; | 71 | let handleName = H5CallNativeType.JsCallTypeList[i]; |
| 72 | let handle = (data: Message, f: Callback) => { | 72 | let handle = (data: Message, f: Callback) => { |
| 73 | - Logger.debug('registerHandlers handlerName: ' + JSON.stringify(data)) | 73 | + Logger.debugOptimize(TAG, () => { |
| 74 | + return 'recivedData: ' + JSON.stringify(data) | ||
| 75 | + }) | ||
| 74 | this.defaultPerformJSCallNative(data, f) | 76 | this.defaultPerformJSCallNative(data, f) |
| 75 | this.defaultGetReceiveSubjectData(data, f) | 77 | this.defaultGetReceiveSubjectData(data, f) |
| 76 | }; | 78 | }; |
| @@ -52,7 +52,9 @@ export class WebArticleEventHandler implements WebEvents { | @@ -52,7 +52,9 @@ export class WebArticleEventHandler implements WebEvents { | ||
| 52 | url = url.replace("%(?![0-9a-fA-F]{2})", "%25") | 52 | url = url.replace("%(?![0-9a-fA-F]{2})", "%25") |
| 53 | .replace("\\+", "%2B"); | 53 | .replace("\\+", "%2B"); |
| 54 | url = decodeURIComponent(url) | 54 | url = decodeURIComponent(url) |
| 55 | - Logger.debug(TAG, 'Web onLoadIntercept url: ' + url); | 55 | + Logger.debugOptimize(TAG, () => { |
| 56 | + return 'Web onLoadIntercept url: ' + url | ||
| 57 | + }); | ||
| 56 | if (url.startsWith(BridgeUtil.YY_RETURN_DATA)) { | 58 | if (url.startsWith(BridgeUtil.YY_RETURN_DATA)) { |
| 57 | this.webviewControl?.handlerReturnData(url) | 59 | this.webviewControl?.handlerReturnData(url) |
| 58 | return true | 60 | return true |
| @@ -70,7 +72,9 @@ export class WebArticleEventHandler implements WebEvents { | @@ -70,7 +72,9 @@ export class WebArticleEventHandler implements WebEvents { | ||
| 70 | for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) { | 72 | for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) { |
| 71 | let handleName = H5CallNativeType.JsCallTypeList[i]; | 73 | let handleName = H5CallNativeType.JsCallTypeList[i]; |
| 72 | let handle = (data: Message, f: Callback) => { | 74 | let handle = (data: Message, f: Callback) => { |
| 73 | - Logger.debug('registerHandlers handlerName: ' + JSON.stringify(data.data)) | 75 | + Logger.debugOptimize(TAG, () => { |
| 76 | + return 'receivedData: ' + JSON.stringify(data.data) | ||
| 77 | + }) | ||
| 74 | if (this.currentPageOperateBlock) { | 78 | if (this.currentPageOperateBlock) { |
| 75 | this.currentPageOperateBlock(data, f) | 79 | this.currentPageOperateBlock(data, f) |
| 76 | } | 80 | } |
| @@ -16,13 +16,14 @@ import { Card19Component } from './cardview/Card19Component'; | @@ -16,13 +16,14 @@ import { Card19Component } from './cardview/Card19Component'; | ||
| 16 | import { Card20Component } from './cardview/Card20Component'; | 16 | import { Card20Component } from './cardview/Card20Component'; |
| 17 | import { Card21Component } from './cardview/Card21Component'; | 17 | import { Card21Component } from './cardview/Card21Component'; |
| 18 | import { SearchContentComponent } from './cardview/SearchContentComponent'; | 18 | import { SearchContentComponent } from './cardview/SearchContentComponent'; |
| 19 | -import { DateTimeUtils } from 'wdKit/Index'; | 19 | +import { DateTimeUtils, Logger } from 'wdKit/Index'; |
| 20 | import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index'; | 20 | import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index'; |
| 21 | import { LiveBigImage02Component } from './cardview/LiveBigImage02Component'; | 21 | import { LiveBigImage02Component } from './cardview/LiveBigImage02Component'; |
| 22 | import { LiveBigImage01Component } from './cardview/LiveBigImage01Component'; | 22 | import { LiveBigImage01Component } from './cardview/LiveBigImage01Component'; |
| 23 | import { behindDivider } from './cardCommon/behindDivider' | 23 | import { behindDivider } from './cardCommon/behindDivider' |
| 24 | import PageModel from '../viewmodel/PageModel'; | 24 | import PageModel from '../viewmodel/PageModel'; |
| 25 | 25 | ||
| 26 | +const TAG = "CardParser" | ||
| 26 | /** | 27 | /** |
| 27 | * card适配器,卡片样式汇总,依据ContentDTO#appStyle | 28 | * card适配器,卡片样式汇总,依据ContentDTO#appStyle |
| 28 | * 卡片样式,最小单元样式布局 | 29 | * 卡片样式,最小单元样式布局 |
| @@ -42,7 +43,9 @@ export struct CardParser { | @@ -42,7 +43,9 @@ export struct CardParser { | ||
| 42 | isNeedDivider:boolean = true | 43 | isNeedDivider:boolean = true |
| 43 | 44 | ||
| 44 | aboutToAppear(): void { | 45 | aboutToAppear(): void { |
| 45 | - console.log('CardParser-', JSON.stringify(this.contentDTO)) | 46 | + Logger.debugOptimize(TAG, () => { |
| 47 | + return JSON.stringify(this.contentDTO) | ||
| 48 | + }) | ||
| 46 | } | 49 | } |
| 47 | 50 | ||
| 48 | onPageShow() { | 51 | onPageShow() { |
| @@ -43,7 +43,7 @@ export struct CarderInteraction { | @@ -43,7 +43,7 @@ export struct CarderInteraction { | ||
| 43 | this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + '' | 43 | this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + '' |
| 44 | this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' | 44 | this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' |
| 45 | this.contentDTO.shareFlag = this.contentDTO.shareFlag ? this.contentDTO.shareFlag : '1' | 45 | this.contentDTO.shareFlag = this.contentDTO.shareFlag ? this.contentDTO.shareFlag : '1' |
| 46 | - console.log('是否显示分享',this.contentDTO.shareFlag) | 46 | + Logger.debug(TAG, '是否显示分享',this.contentDTO.shareFlag) |
| 47 | // 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 47 | // 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 48 | this.likesStyle = this.contentDetailData.likesStyle | 48 | this.likesStyle = this.contentDetailData.likesStyle |
| 49 | this.openLikes = this.contentDetailData.openLikes == 1 ? true : false | 49 | this.openLikes = this.contentDetailData.openLikes == 1 ? true : false |
| @@ -27,6 +27,7 @@ import { | @@ -27,6 +27,7 @@ import { | ||
| 27 | import { LabelComponent } from './view/LabelComponent'; | 27 | import { LabelComponent } from './view/LabelComponent'; |
| 28 | import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'; | 28 | import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'; |
| 29 | import { behindDivider } from './cardCommon/behindDivider' | 29 | import { behindDivider } from './cardCommon/behindDivider' |
| 30 | +import { Logger } from 'wdKit'; | ||
| 30 | 31 | ||
| 31 | /** | 32 | /** |
| 32 | * comp适配器. | 33 | * comp适配器. |
| @@ -46,7 +47,9 @@ export struct CompParser { | @@ -46,7 +47,9 @@ export struct CompParser { | ||
| 46 | 47 | ||
| 47 | aboutToAppear(): void { | 48 | aboutToAppear(): void { |
| 48 | 49 | ||
| 49 | - console.log('CompParser', JSON.stringify(this.compDTO)) | 50 | + Logger.debugOptimize('CompParser', () => { |
| 51 | + return JSON.stringify(this.compDTO) | ||
| 52 | + }) | ||
| 50 | this.pageName = this.pageModel.pageInfo.name | 53 | this.pageName = this.pageModel.pageInfo.name |
| 51 | // 轮播图屏蔽音频类型稿件 | 54 | // 轮播图屏蔽音频类型稿件 |
| 52 | if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { | 55 | if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { |
| @@ -663,7 +663,7 @@ export struct DynamicDetailComponent { | @@ -663,7 +663,7 @@ export struct DynamicDetailComponent { | ||
| 663 | styleType: 1, | 663 | styleType: 1, |
| 664 | onCommentIconClick:()=>{ | 664 | onCommentIconClick:()=>{ |
| 665 | const info = componentUtils.getRectangleById('comment'); | 665 | const info = componentUtils.getRectangleById('comment'); |
| 666 | - console.log(JSON.stringify(info)) | 666 | + Logger.debug(TAG, JSON.stringify(info)) |
| 667 | 667 | ||
| 668 | if (!this.offsetY) { | 668 | if (!this.offsetY) { |
| 669 | this.offsetY = componentUtils.getRectangleById('comment').windowOffset.y | 669 | this.offsetY = componentUtils.getRectangleById('comment').windowOffset.y |
| @@ -861,7 +861,7 @@ export struct DynamicDetailComponent { | @@ -861,7 +861,7 @@ export struct DynamicDetailComponent { | ||
| 861 | this.newsStatusOfUser = data[0]; | 861 | this.newsStatusOfUser = data[0]; |
| 862 | // Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) | 862 | // Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) |
| 863 | } catch (exception) { | 863 | } catch (exception) { |
| 864 | - console.error(TAG, JSON.stringify(exception)) | 864 | + Logger.error(TAG, JSON.stringify(exception)) |
| 865 | } | 865 | } |
| 866 | } | 866 | } |
| 867 | 867 |
| @@ -360,7 +360,7 @@ export struct ImageAndTextPageComponent { | @@ -360,7 +360,7 @@ export struct ImageAndTextPageComponent { | ||
| 360 | this.getRecommend() | 360 | this.getRecommend() |
| 361 | } | 361 | } |
| 362 | if (this.contentDetailData?.openLikes === 1) { | 362 | if (this.contentDetailData?.openLikes === 1) { |
| 363 | - console.log(TAG, '点赞this.getInteractDataStatus()') | 363 | + Logger.debug(TAG, '点赞this.getInteractDataStatus()') |
| 364 | this.getInteractDataStatus() | 364 | this.getInteractDataStatus() |
| 365 | this.queryContentInteractCount() | 365 | this.queryContentInteractCount() |
| 366 | } | 366 | } |
| @@ -425,11 +425,11 @@ export struct ImageAndTextPageComponent { | @@ -425,11 +425,11 @@ export struct ImageAndTextPageComponent { | ||
| 425 | } | 425 | } |
| 426 | // console.log(TAG,'contentDetailData', JSON.stringify(params.contentList)) | 426 | // console.log(TAG,'contentDetailData', JSON.stringify(params.contentList)) |
| 427 | let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) | 427 | let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) |
| 428 | - console.log(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data)) | 428 | + Logger.debug(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data)) |
| 429 | this.newsStatusOfUser = data[0]; | 429 | this.newsStatusOfUser = data[0]; |
| 430 | // console.log(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) | 430 | // console.log(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) |
| 431 | } catch (exception) { | 431 | } catch (exception) { |
| 432 | - console.error(TAG,'exception', JSON.stringify(exception)) | 432 | + Logger.debug(TAG,'exception', JSON.stringify(exception)) |
| 433 | } | 433 | } |
| 434 | } | 434 | } |
| 435 | 435 |
| 1 | import { ContentDTO, joinPeopleNum } from 'wdBean/Index' | 1 | import { ContentDTO, joinPeopleNum } from 'wdBean/Index' |
| 2 | -import { DateTimeUtils } from 'wdKit/Index' | 2 | +import { DateTimeUtils, Logger } from 'wdKit/Index' |
| 3 | import { LottieView } from '../../components/lottie/LottieView'; | 3 | import { LottieView } from '../../components/lottie/LottieView'; |
| 4 | import { LiveModel } from '../../viewmodel/LiveModel' | 4 | import { LiveModel } from '../../viewmodel/LiveModel' |
| 5 | import font from '@ohos.font'; | 5 | import font from '@ohos.font'; |
| 6 | import text from '@ohos.graphics.text'; | 6 | import text from '@ohos.graphics.text'; |
| 7 | 7 | ||
| 8 | +const TAG = "CardMediaInfo" | ||
| 8 | /** | 9 | /** |
| 9 | * 这里是样式卡中,右下角显示的音视频信息 | 10 | * 这里是样式卡中,右下角显示的音视频信息 |
| 10 | * 目前已知: | 11 | * 目前已知: |
| @@ -86,11 +87,13 @@ export struct CardMediaInfo { | @@ -86,11 +87,13 @@ export struct CardMediaInfo { | ||
| 86 | */ | 87 | */ |
| 87 | async getJoinPeopleNum() { | 88 | async getJoinPeopleNum() { |
| 88 | if (this.contentDTO.objectType !== '2') return; | 89 | if (this.contentDTO.objectType !== '2') return; |
| 89 | - console.log('getJoinPeopleNum-ContentDTO', JSON.stringify(this.contentDTO.objectId)) | ||
| 90 | - let liveIdList: string = this.contentDTO.objectId | ||
| 91 | - let data: joinPeopleNum[] = await LiveModel.getJoinPeopleNum(liveIdList) | ||
| 92 | - this.joinPeopleNum = data[0].pv; | ||
| 93 | - console.log('getJoinPeopleNum ', this.joinPeopleNum) | 90 | + Logger.debugOptimize(TAG, () => { |
| 91 | + return 'getJoinPeopleNum-ContentDTO' + JSON.stringify(this.contentDTO.objectId) | ||
| 92 | + }) | ||
| 93 | + LiveModel.getJoinPeopleNum(this.contentDTO.objectId).then((data) => { | ||
| 94 | + this.joinPeopleNum = data[0].pv; | ||
| 95 | + Logger.debug(TAG, 'getJoinPeopleNum ' + this.joinPeopleNum) | ||
| 96 | + }) | ||
| 94 | } | 97 | } |
| 95 | 98 | ||
| 96 | build() { | 99 | build() { |
| @@ -6,6 +6,8 @@ import { SearchShowRed, textItem, titleInitRes } from '../../utils/searchShowRed | @@ -6,6 +6,8 @@ import { SearchShowRed, textItem, titleInitRes } from '../../utils/searchShowRed | ||
| 6 | import measure from '@ohos.measure' | 6 | import measure from '@ohos.measure' |
| 7 | import display from '@ohos.display'; | 7 | import display from '@ohos.display'; |
| 8 | 8 | ||
| 9 | +const TAG = "CardSourceInfo" | ||
| 10 | + | ||
| 9 | @Reusable | 11 | @Reusable |
| 10 | @Component | 12 | @Component |
| 11 | export struct CardSourceInfo { | 13 | export struct CardSourceInfo { |
| @@ -48,7 +50,7 @@ export struct CardSourceInfo { | @@ -48,7 +50,7 @@ export struct CardSourceInfo { | ||
| 48 | 50 | ||
| 49 | processText() { | 51 | processText() { |
| 50 | const sourceText = this.contentDTO.rmhPlatform === 1 ? this.contentDTO.rmhInfo?.rmhName : this.contentDTO.source; | 52 | const sourceText = this.contentDTO.rmhPlatform === 1 ? this.contentDTO.rmhInfo?.rmhName : this.contentDTO.source; |
| 51 | - if (this.isLimited() && sourceText.length > this.maxLength) { | 53 | + if (sourceText && this.isLimited() && sourceText.length > this.maxLength) { |
| 52 | this.displayText = sourceText.substring(0, this.maxLength) + '...'; | 54 | this.displayText = sourceText.substring(0, this.maxLength) + '...'; |
| 53 | this.isEllipsisActive = true; | 55 | this.isEllipsisActive = true; |
| 54 | } else { | 56 | } else { |
| @@ -171,25 +173,25 @@ export struct CardSourceInfo { | @@ -171,25 +173,25 @@ export struct CardSourceInfo { | ||
| 171 | 173 | ||
| 172 | calcContentSpace() { | 174 | calcContentSpace() { |
| 173 | 175 | ||
| 174 | - console.log('display-text ,', this.displayText) | 176 | + // Logger.debug(TAG, 'display-text ' + this.displayText) |
| 175 | if (this.isLimited()) return; | 177 | if (this.isLimited()) return; |
| 176 | 178 | ||
| 177 | const screenWidth = display.getDefaultDisplaySync().width | 179 | const screenWidth = display.getDefaultDisplaySync().width |
| 178 | let leftSpace = screenWidth; | 180 | let leftSpace = screenWidth; |
| 179 | - console.log('display-leftSpace ', leftSpace) | 181 | + // Logger.debug(TAG, 'display-leftSpace ' + leftSpace) |
| 180 | const souceSize = this.getContentSize(this.displayText, 12); | 182 | const souceSize = this.getContentSize(this.displayText, 12); |
| 181 | const dotSize = 11; | 183 | const dotSize = 11; |
| 182 | 184 | ||
| 183 | if (this.contentDTO.cornerMark || this.contentDTO.corner) { | 185 | if (this.contentDTO.cornerMark || this.contentDTO.corner) { |
| 184 | const cornerSize = this.getContentSize(this.contentDTO.cornerMark || this.contentDTO.corner, 12); | 186 | const cornerSize = this.getContentSize(this.contentDTO.cornerMark || this.contentDTO.corner, 12); |
| 185 | leftSpace = leftSpace - cornerSize | 187 | leftSpace = leftSpace - cornerSize |
| 186 | - console.log('display-cornerMark ', cornerSize) | 188 | + // Logger.debug(TAG, ('display-cornerMark ' + cornerSize) |
| 187 | } | 189 | } |
| 188 | 190 | ||
| 189 | if (this.showTime()) { | 191 | if (this.showTime()) { |
| 190 | const timeSize = this.getContentSize(this.handleTimeStr(), 12); | 192 | const timeSize = this.getContentSize(this.handleTimeStr(), 12); |
| 191 | leftSpace = leftSpace - dotSize - timeSize | 193 | leftSpace = leftSpace - dotSize - timeSize |
| 192 | - console.log('display-showtime') | 194 | + // Logger.debug(TAG, 'display-showtime') |
| 193 | } | 195 | } |
| 194 | 196 | ||
| 195 | if (!this.isEllipsisActive) { | 197 | if (!this.isEllipsisActive) { |
| @@ -199,14 +201,14 @@ export struct CardSourceInfo { | @@ -199,14 +201,14 @@ export struct CardSourceInfo { | ||
| 199 | commentSize = this.getContentSize(`${this.handlerNum(commentNum.toString())}评`, 12); | 201 | commentSize = this.getContentSize(`${this.handlerNum(commentNum.toString())}评`, 12); |
| 200 | } | 202 | } |
| 201 | leftSpace = leftSpace - dotSize - commentSize | 203 | leftSpace = leftSpace - dotSize - commentSize |
| 202 | - console.log('display-commentSize ', commentSize) | 204 | + // Logger.debug(TAG, 'display-commentSize ' + commentSize) |
| 203 | } | 205 | } |
| 204 | 206 | ||
| 205 | if (leftSpace < souceSize) { | 207 | if (leftSpace < souceSize) { |
| 206 | this.onlyShowCornerAndSource = true; | 208 | this.onlyShowCornerAndSource = true; |
| 207 | - console.log('display-size 1') | 209 | + // Logger.debug(TAG, 'display-size 1') |
| 208 | } | 210 | } |
| 209 | - console.log('display-size 2,', leftSpace, souceSize, this.onlyShowCornerAndSource) | 211 | + // Logger.debug(TAG, 'display-size 2,' + leftSpace + " " + souceSize + " " + this.onlyShowCornerAndSource) |
| 210 | } | 212 | } |
| 211 | 213 | ||
| 212 | build() { | 214 | build() { |
| @@ -18,6 +18,8 @@ import { InfomationCardClick } from '../../utils/infomationCardClick' | @@ -18,6 +18,8 @@ import { InfomationCardClick } from '../../utils/infomationCardClick' | ||
| 18 | import measure from '@ohos.measure' | 18 | import measure from '@ohos.measure' |
| 19 | import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel' | 19 | import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel' |
| 20 | 20 | ||
| 21 | +const TAG = "RmhTitle" | ||
| 22 | + | ||
| 21 | @Component | 23 | @Component |
| 22 | export struct RmhTitle { | 24 | export struct RmhTitle { |
| 23 | @State compDTO: CompDTO = new CompDTO() | 25 | @State compDTO: CompDTO = new CompDTO() |
| @@ -57,7 +59,7 @@ export struct RmhTitle { | @@ -57,7 +59,7 @@ export struct RmhTitle { | ||
| 57 | status: this.followStatus == '0' ? 1 : 0, | 59 | status: this.followStatus == '0' ? 1 : 0, |
| 58 | } | 60 | } |
| 59 | ContentDetailRequest.postInteractAccentionOperate(params2).then(res => { | 61 | ContentDetailRequest.postInteractAccentionOperate(params2).then(res => { |
| 60 | - console.log('rmhTitle-data', JSON.stringify(res.data)) | 62 | + Logger.debug(TAG, 'rmhTitle-data' + JSON.stringify(res.data)) |
| 61 | 63 | ||
| 62 | InfomationCardClick.track( | 64 | InfomationCardClick.track( |
| 63 | this.compDTO, | 65 | this.compDTO, |
| @@ -74,7 +76,7 @@ export struct RmhTitle { | @@ -74,7 +76,7 @@ export struct RmhTitle { | ||
| 74 | this.followStatus = '1' | 76 | this.followStatus = '1' |
| 75 | // 弹窗样式与何时调用待确认 | 77 | // 弹窗样式与何时调用待确认 |
| 76 | ContentDetailRequest.postPointLevelOperate({ operateType: 6 }).then((res) => { | 78 | ContentDetailRequest.postPointLevelOperate({ operateType: 6 }).then((res) => { |
| 77 | - console.log('关注号主获取积分==', JSON.stringify(res.data)) | 79 | + Logger.debug(TAG, '关注号主获取积分==', JSON.stringify(res.data)) |
| 78 | if (res.data?.showToast) { | 80 | if (res.data?.showToast) { |
| 79 | // ToastUtils.showToast(res.data.ruleName + '+' + res.data.rulePoint + '积分', 1000); | 81 | // ToastUtils.showToast(res.data.ruleName + '+' + res.data.rulePoint + '积分', 1000); |
| 80 | } | 82 | } |
| @@ -29,8 +29,10 @@ export struct Card6Component { | @@ -29,8 +29,10 @@ export struct Card6Component { | ||
| 29 | @State contentDTO: ContentDTO = new ContentDTO(); | 29 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 30 | @State compIndex: number = 0; | 30 | @State compIndex: number = 0; |
| 31 | 31 | ||
| 32 | - async aboutToAppear(): Promise<void> { | ||
| 33 | - console.log('Card6Component', JSON.stringify(this.contentDTO)) | 32 | + aboutToAppear() { |
| 33 | + Logger.debugOptimize(TAG, () => { | ||
| 34 | + return 'Card6Component' + JSON.stringify(this.contentDTO) | ||
| 35 | + }) | ||
| 34 | this.titleInit(); | 36 | this.titleInit(); |
| 35 | const curRouter = router.getState().name; | 37 | const curRouter = router.getState().name; |
| 36 | this.clicked = hasClicked(this.contentDTO.objectId, curRouter) | 38 | this.clicked = hasClicked(this.contentDTO.objectId, curRouter) |
| 1 | import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource, | 1 | import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource, |
| 2 | + Logger, | ||
| 2 | PublicDialogManager, | 3 | PublicDialogManager, |
| 3 | StringUtils } from 'wdKit/Index'; | 4 | StringUtils } from 'wdKit/Index'; |
| 4 | import { CommentItemCustomType, commentItemModel, WDPublicUserType } from '../model/CommentModel'; | 5 | import { CommentItemCustomType, commentItemModel, WDPublicUserType } from '../model/CommentModel'; |
| @@ -325,8 +326,9 @@ export struct CommentComponent { | @@ -325,8 +326,9 @@ export struct CommentComponent { | ||
| 325 | ,this.publishCommentModel.targetType | 326 | ,this.publishCommentModel.targetType |
| 326 | ,this.firstPageHotIds) | 327 | ,this.firstPageHotIds) |
| 327 | .then(commentListModel => { | 328 | .then(commentListModel => { |
| 328 | - console.log('评论:', JSON.stringify(commentListModel.list)) | ||
| 329 | - | 329 | + Logger.debugOptimize('Comment', () => { |
| 330 | + return '评论:' + JSON.stringify(commentListModel.list) | ||
| 331 | + }) | ||
| 330 | if (pageIndex == 1) { | 332 | if (pageIndex == 1) { |
| 331 | // 保存第一页热门评论ids | 333 | // 保存第一页热门评论ids |
| 332 | if (commentListModel.hotIds.length > 0) { | 334 | if (commentListModel.hotIds.length > 0) { |
| @@ -160,10 +160,9 @@ export struct CommentCustomDialog { | @@ -160,10 +160,9 @@ export struct CommentCustomDialog { | ||
| 160 | // this.textInputController.stopEditing() | 160 | // this.textInputController.stopEditing() |
| 161 | inputMethod.getController().hideTextInput((err: BusinessError) => { | 161 | inputMethod.getController().hideTextInput((err: BusinessError) => { |
| 162 | if (err) { | 162 | if (err) { |
| 163 | - console.error(`Failed to hideTextInput: ${JSON.stringify(err)}`); | 163 | + Logger.error(TAG, `Failed to hideTextInput: ${JSON.stringify(err)}`); |
| 164 | return; | 164 | return; |
| 165 | } | 165 | } |
| 166 | - // console.log('Succeeded in hiding text input.'); | ||
| 167 | }) | 166 | }) |
| 168 | // this.showKeyboardOnFocus = false | 167 | // this.showKeyboardOnFocus = false |
| 169 | // focusControl.requestFocus("textAreaId") // 弹起键盘 | 168 | // focusControl.requestFocus("textAreaId") // 弹起键盘 |
| @@ -188,7 +187,7 @@ export struct CommentCustomDialog { | @@ -188,7 +187,7 @@ export struct CommentCustomDialog { | ||
| 188 | // this.textInputController.stopEditing() | 187 | // this.textInputController.stopEditing() |
| 189 | inputMethod.getController().hideTextInput((err: BusinessError) => { | 188 | inputMethod.getController().hideTextInput((err: BusinessError) => { |
| 190 | if (err) { | 189 | if (err) { |
| 191 | - console.error(`Failed to hideTextInput: ${JSON.stringify(err)}`); | 190 | + Logger.debug(TAG, `Failed to hideTextInput: ${JSON.stringify(err)}`); |
| 192 | return; | 191 | return; |
| 193 | } | 192 | } |
| 194 | // console.log('Succeeded in hiding text input.'); | 193 | // console.log('Succeeded in hiding text input.'); |
| @@ -50,7 +50,7 @@ export struct ZhSingleRow03 { | @@ -50,7 +50,7 @@ export struct ZhSingleRow03 { | ||
| 50 | @State compIndex: number = 0; | 50 | @State compIndex: number = 0; |
| 51 | 51 | ||
| 52 | resetMoreTips() { | 52 | resetMoreTips() { |
| 53 | - console.log('resetMoreTips', this.moreWidth, this.initMoreWidth) | 53 | + Logger.debug(TAG, 'resetMoreTips' + this.moreWidth + ' ' + this.initMoreWidth) |
| 54 | if (this.moreWidth < this.initMoreWidth * 2) { | 54 | if (this.moreWidth < this.initMoreWidth * 2) { |
| 55 | this.moreTips = '查看更多'; | 55 | this.moreTips = '查看更多'; |
| 56 | } | 56 | } |
| @@ -184,7 +184,7 @@ export struct PageComponent { | @@ -184,7 +184,7 @@ export struct PageComponent { | ||
| 184 | // 挂角广告 | 184 | // 挂角广告 |
| 185 | this.pageHornAd() | 185 | this.pageHornAd() |
| 186 | 186 | ||
| 187 | - } | 187 | + }.layoutWeight(1) |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | @Builder | 190 | @Builder |
| @@ -301,7 +301,7 @@ export struct PageComponent { | @@ -301,7 +301,7 @@ export struct PageComponent { | ||
| 301 | 301 | ||
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | - async aboutToAppear() { | 304 | + aboutToAppear() { |
| 305 | // 选中tab,才请求数据。拦截大量接口请求 | 305 | // 选中tab,才请求数据。拦截大量接口请求 |
| 306 | if (this.navIndex === this.currentTopNavSelectedIndex) { | 306 | if (this.navIndex === this.currentTopNavSelectedIndex) { |
| 307 | this.getData(); | 307 | this.getData(); |
| @@ -364,7 +364,7 @@ export struct PageComponent { | @@ -364,7 +364,7 @@ export struct PageComponent { | ||
| 364 | autoRefresh(this.pageModel, this.pageAdvModel) | 364 | autoRefresh(this.pageModel, this.pageAdvModel) |
| 365 | } | 365 | } |
| 366 | 366 | ||
| 367 | - async getData() { | 367 | + getData() { |
| 368 | if (this.timer) { | 368 | if (this.timer) { |
| 369 | clearTimeout(this.timer) | 369 | clearTimeout(this.timer) |
| 370 | } | 370 | } |
| @@ -20,7 +20,7 @@ export struct FirstTabTopSearchComponent { | @@ -20,7 +20,7 @@ export struct FirstTabTopSearchComponent { | ||
| 20 | private swiperController: SwiperController = new SwiperController() | 20 | private swiperController: SwiperController = new SwiperController() |
| 21 | navItem: BottomNavDTO = {} as BottomNavDTO | 21 | navItem: BottomNavDTO = {} as BottomNavDTO |
| 22 | 22 | ||
| 23 | - async aboutToAppear() { | 23 | + aboutToAppear() { |
| 24 | this.getSearchHint() | 24 | this.getSearchHint() |
| 25 | } | 25 | } |
| 26 | 26 |
| 1 | import router from '@ohos.router' | 1 | import router from '@ohos.router' |
| 2 | import { Params } from 'wdBean'; | 2 | import { Params } from 'wdBean'; |
| 3 | -import { DateTimeUtils, NetworkUtil, NumberFormatterUtils, StringUtils } from 'wdKit'; | 3 | +import { DateTimeUtils, Logger, NetworkUtil, NumberFormatterUtils, StringUtils } from 'wdKit'; |
| 4 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 4 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 5 | import { TrackingPageBrowse, TrackConstants, ParamType, Tracking } from 'wdTracking/Index'; | 5 | import { TrackingPageBrowse, TrackConstants, ParamType, Tracking } from 'wdTracking/Index'; |
| 6 | import { OtherHomePageBottomCommentComponent } from '../components/mine/home/OtherHomePageBottomCommentComponent'; | 6 | import { OtherHomePageBottomCommentComponent } from '../components/mine/home/OtherHomePageBottomCommentComponent'; |
| @@ -422,7 +422,7 @@ struct OtherNormalUserHomePage { | @@ -422,7 +422,7 @@ struct OtherNormalUserHomePage { | ||
| 422 | } | 422 | } |
| 423 | this.getUserLevel() | 423 | this.getUserLevel() |
| 424 | }).catch((err:Error)=>{ | 424 | }).catch((err:Error)=>{ |
| 425 | - console.log(TAG,JSON.stringify(err)) | 425 | + Logger.error(TAG, JSON.stringify(err)) |
| 426 | }) | 426 | }) |
| 427 | } | 427 | } |
| 428 | getUserLevel(){ | 428 | getUserLevel(){ |
| @@ -440,7 +440,7 @@ struct OtherNormalUserHomePage { | @@ -440,7 +440,7 @@ struct OtherNormalUserHomePage { | ||
| 440 | this.levelId = value[0].level | 440 | this.levelId = value[0].level |
| 441 | } | 441 | } |
| 442 | }).catch((err:Error)=>{ | 442 | }).catch((err:Error)=>{ |
| 443 | - console.log(TAG,JSON.stringify(err)) | 443 | + Logger.error(TAG,JSON.stringify(err)) |
| 444 | }) | 444 | }) |
| 445 | } | 445 | } |
| 446 | 446 |
| @@ -2,7 +2,7 @@ import { Params } from 'wdBean/Index'; | @@ -2,7 +2,7 @@ import { Params } from 'wdBean/Index'; | ||
| 2 | import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; | 2 | import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; |
| 3 | import { router } from '@kit.ArkUI'; | 3 | import { router } from '@kit.ArkUI'; |
| 4 | import { FollowListDetailItem } from '../viewmodel/FollowListDetailItem'; | 4 | import { FollowListDetailItem } from '../viewmodel/FollowListDetailItem'; |
| 5 | -import { LazyDataSource, SPHelper, StringUtils } from 'wdKit/Index'; | 5 | +import { LazyDataSource, Logger, SPHelper, StringUtils } from 'wdKit/Index'; |
| 6 | import SearcherAboutDataModel from '../model/SearcherAboutDataModel'; | 6 | import SearcherAboutDataModel from '../model/SearcherAboutDataModel'; |
| 7 | import { CreatorDetailRequestItem } from '../viewmodel/CreatorDetailRequestItem'; | 7 | import { CreatorDetailRequestItem } from '../viewmodel/CreatorDetailRequestItem'; |
| 8 | import { FollowListStatusRequestItem } from '../viewmodel/FollowListStatusRequestItem'; | 8 | import { FollowListStatusRequestItem } from '../viewmodel/FollowListStatusRequestItem'; |
| @@ -133,7 +133,7 @@ struct SearchCreatorPage { | @@ -133,7 +133,7 @@ struct SearchCreatorPage { | ||
| 133 | 133 | ||
| 134 | this.isLoading = false | 134 | this.isLoading = false |
| 135 | }).catch((err:Error)=>{ | 135 | }).catch((err:Error)=>{ |
| 136 | - console.log(TAG,"请求失败") | 136 | + Logger.error(TAG,"请求失败" + JSON.stringify(err)) |
| 137 | this.isLoading = false | 137 | this.isLoading = false |
| 138 | this.count = this.count===-1?0:this.count | 138 | this.count = this.count===-1?0:this.count |
| 139 | }) | 139 | }) |
| @@ -190,7 +190,7 @@ struct SearchCreatorPage { | @@ -190,7 +190,7 @@ struct SearchCreatorPage { | ||
| 190 | .layoutWeight(1) | 190 | .layoutWeight(1) |
| 191 | .scrollBar(BarState.Off) | 191 | .scrollBar(BarState.Off) |
| 192 | .onReachEnd(()=>{ | 192 | .onReachEnd(()=>{ |
| 193 | - console.log(TAG,"触底了"); | 193 | + Logger.debug(TAG,"触底了"); |
| 194 | if(!this.isLoading){ | 194 | if(!this.isLoading){ |
| 195 | this.isLoading = true | 195 | this.isLoading = true |
| 196 | //加载分页数据 | 196 | //加载分页数据 |
| 1 | import { TAG } from '@ohos/hypium/src/main/Constant'; | 1 | import { TAG } from '@ohos/hypium/src/main/Constant'; |
| 2 | import { ContentDTO } from 'wdBean/Index'; | 2 | import { ContentDTO } from 'wdBean/Index'; |
| 3 | import { SpConstants } from 'wdConstant/Index' | 3 | import { SpConstants } from 'wdConstant/Index' |
| 4 | -import { DateTimeUtils, LazyDataSource, NetworkUtil, SPHelper, StringUtils} from 'wdKit/Index' | 4 | +import { DateTimeUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, StringUtils} from 'wdKit/Index' |
| 5 | import { ProcessUtils } from 'wdRouter/Index'; | 5 | import { ProcessUtils } from 'wdRouter/Index'; |
| 6 | import { VisitorCommentComponent } from '../components/mine/home/VisitorCommentComponent'; | 6 | import { VisitorCommentComponent } from '../components/mine/home/VisitorCommentComponent'; |
| 7 | import { CustomPullToRefresh } from '../components/reusable/CustomPullToRefresh'; | 7 | import { CustomPullToRefresh } from '../components/reusable/CustomPullToRefresh'; |
| @@ -176,7 +176,7 @@ struct VisitorCommentPage { | @@ -176,7 +176,7 @@ struct VisitorCommentPage { | ||
| 176 | this.isGetRequest = true | 176 | this.isGetRequest = true |
| 177 | this.isLoading = false | 177 | this.isLoading = false |
| 178 | }).catch((err: Error) => { | 178 | }).catch((err: Error) => { |
| 179 | - console.log(TAG, JSON.stringify(err)) | 179 | + Logger.error(TAG, "get " + JSON.stringify(err)) |
| 180 | this.isGetRequest = true | 180 | this.isGetRequest = true |
| 181 | this.isLoading = false | 181 | this.isLoading = false |
| 182 | }) | 182 | }) |
| 1 | import { TrackingContent, TrackConstants, ParamType } from 'wdTracking'; | 1 | import { TrackingContent, TrackConstants, ParamType } from 'wdTracking'; |
| 2 | import { CompDTO, ContentDTO } from 'wdBean'; | 2 | import { CompDTO, ContentDTO } from 'wdBean'; |
| 3 | +import { Logger } from 'wdKit'; | ||
| 3 | 4 | ||
| 4 | export class InfomationCardClick { | 5 | export class InfomationCardClick { |
| 5 | 6 | ||
| @@ -95,7 +96,7 @@ export class InfomationCardClick { | @@ -95,7 +96,7 @@ export class InfomationCardClick { | ||
| 95 | } else if (contentDTO.source) { | 96 | } else if (contentDTO.source) { |
| 96 | extParams['saAuthorName'] = contentDTO.source; | 97 | extParams['saAuthorName'] = contentDTO.source; |
| 97 | } | 98 | } |
| 98 | - console.log('InfomationCardClick-params:', JSON.stringify(extParams)) | 99 | + Logger.debug('InfomationCardClick-params:', JSON.stringify(extParams)) |
| 99 | if (action === 'detailPageShow') { | 100 | if (action === 'detailPageShow') { |
| 100 | TrackingContent.common(TrackConstants.EventType.Click, pageId, pageName, extParams); | 101 | TrackingContent.common(TrackConstants.EventType.Click, pageId, pageName, extParams); |
| 101 | } else if (action === 'like') { | 102 | } else if (action === 'like') { |
| @@ -106,7 +107,7 @@ export class InfomationCardClick { | @@ -106,7 +107,7 @@ export class InfomationCardClick { | ||
| 106 | TrackingContent.follow(bl, followUserId, followUserName, pageId, pageName, extParams) | 107 | TrackingContent.follow(bl, followUserId, followUserName, pageId, pageName, extParams) |
| 107 | } | 108 | } |
| 108 | } catch (err) { | 109 | } catch (err) { |
| 109 | - console.log('InfomationCardClick-err', JSON.stringify(err)) | 110 | + Logger.error('InfomationCardClick-err', JSON.stringify(err)) |
| 110 | } | 111 | } |
| 111 | } | 112 | } |
| 112 | } | 113 | } |
| 1 | +import { Logger } from "wdKit"; | ||
| 2 | + | ||
| 1 | export interface textItem { | 3 | export interface textItem { |
| 2 | content: string, | 4 | content: string, |
| 3 | isRed: boolean | 5 | isRed: boolean |
| @@ -8,6 +10,8 @@ export interface titleInitRes { | @@ -8,6 +10,8 @@ export interface titleInitRes { | ||
| 8 | textArr: textItem[] | 10 | textArr: textItem[] |
| 9 | } | 11 | } |
| 10 | 12 | ||
| 13 | +const TAG = "SearchShowRed" | ||
| 14 | + | ||
| 11 | export class SearchShowRed { | 15 | export class SearchShowRed { |
| 12 | // title: this.contentDTO.title | 16 | // title: this.contentDTO.title |
| 13 | static titleInit(title: string) { | 17 | static titleInit(title: string) { |
| @@ -27,7 +31,9 @@ export class SearchShowRed { | @@ -27,7 +31,9 @@ export class SearchShowRed { | ||
| 27 | res.push(content); | 31 | res.push(content); |
| 28 | } | 32 | } |
| 29 | 33 | ||
| 30 | - console.log('SearchShowRed-res', JSON.stringify(res)) | 34 | + Logger.debugOptimize(TAG, () => { |
| 35 | + return 'SearchShowRed-res' + JSON.stringify(res) | ||
| 36 | + }) | ||
| 31 | 37 | ||
| 32 | SearchShowRed.formatTitle( | 38 | SearchShowRed.formatTitle( |
| 33 | html.replaceAll('<em>', '').replaceAll('</em>', ''), | 39 | html.replaceAll('<em>', '').replaceAll('</em>', ''), |
| @@ -41,7 +47,9 @@ export class SearchShowRed { | @@ -41,7 +47,9 @@ export class SearchShowRed { | ||
| 41 | titleMarked, | 47 | titleMarked, |
| 42 | textArr | 48 | textArr |
| 43 | } | 49 | } |
| 44 | - console.log('SearchShowRed-titleInitRes', JSON.stringify(titleInitRes)) | 50 | + Logger.debugOptimize(TAG, () => { |
| 51 | + return 'SearchShowRed-titleInitRes ' + JSON.stringify(titleInitRes) | ||
| 52 | + }) | ||
| 45 | return titleInitRes | 53 | return titleInitRes |
| 46 | } | 54 | } |
| 47 | 55 |
| 1 | +import { Logger } from 'wdKit'; | ||
| 1 | import { HttpUtils } from 'wdNetwork/Index'; | 2 | import { HttpUtils } from 'wdNetwork/Index'; |
| 2 | 3 | ||
| 3 | export interface mournsInfoModel{ | 4 | export interface mournsInfoModel{ |
| @@ -80,7 +81,7 @@ export class GrayManageModel { | @@ -80,7 +81,7 @@ export class GrayManageModel { | ||
| 80 | this.videoList = mourns.videoList | 81 | this.videoList = mourns.videoList |
| 81 | this.serverList = mourns.serverList | 82 | this.serverList = mourns.serverList |
| 82 | this.grayUserList = mourns.greyUserList | 83 | this.grayUserList = mourns.greyUserList |
| 83 | - console.log(TAG, 'LaunchDataModel.mourns', JSON.stringify(mourns)) | 84 | + Logger.debug(TAG, 'LaunchDataModel.mourns', JSON.stringify(mourns)) |
| 84 | } | 85 | } |
| 85 | 86 | ||
| 86 | // 国殇模式开启 | 87 | // 国殇模式开启 |
| @@ -118,7 +118,7 @@ export class LiveModel { | @@ -118,7 +118,7 @@ export class LiveModel { | ||
| 118 | fail(data.message) | 118 | fail(data.message) |
| 119 | return | 119 | return |
| 120 | } | 120 | } |
| 121 | - console.log('LiveLikeComponent data.data', data.data) | 121 | + Logger.debug(TAG, 'LiveLikeComponent data.data ' + data.data) |
| 122 | success(data.data) | 122 | success(data.data) |
| 123 | }, (error: Error) => { | 123 | }, (error: Error) => { |
| 124 | fail(error.message) | 124 | fail(error.message) |
| @@ -810,7 +810,9 @@ export class PageHelper { | @@ -810,7 +810,9 @@ export class PageHelper { | ||
| 810 | 810 | ||
| 811 | } | 811 | } |
| 812 | }).catch((err: string | Resource) => { | 812 | }).catch((err: string | Resource) => { |
| 813 | - promptAction.showToast({ message: err }); | 813 | + if(err != "resDTO is empty"){ |
| 814 | + promptAction.showToast({ message: err }); | ||
| 815 | + } | ||
| 814 | this.loadMoreEnd(pageModel) | 816 | this.loadMoreEnd(pageModel) |
| 815 | }) | 817 | }) |
| 816 | } | 818 | } |
| @@ -53,7 +53,9 @@ export class PlayViewModel { | @@ -53,7 +53,9 @@ export class PlayViewModel { | ||
| 53 | return | 53 | return |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | - Logger.info(TAG, JSON.stringify(data)) | 56 | + Logger.infoOptimize(TAG, () => { |
| 57 | + return JSON.stringify(data) | ||
| 58 | + }) | ||
| 57 | this.newsTitle = data.newsTitle | 59 | this.newsTitle = data.newsTitle |
| 58 | this.editorName = data.editorName | 60 | this.editorName = data.editorName |
| 59 | this.newsSummary = data.newsSummary | 61 | this.newsSummary = data.newsSummary |
| @@ -87,7 +89,9 @@ export class PlayViewModel { | @@ -87,7 +89,9 @@ export class PlayViewModel { | ||
| 87 | } | 89 | } |
| 88 | 90 | ||
| 89 | let contentDetailDTO: ContentDetailDTO = resDTO.data[0] | 91 | let contentDetailDTO: ContentDetailDTO = resDTO.data[0] |
| 90 | - Logger.info(TAG, JSON.stringify(contentDetailDTO)) | 92 | + Logger.infoOptimize(TAG, () => { |
| 93 | + return JSON.stringify(contentDetailDTO) | ||
| 94 | + }) | ||
| 91 | this.newsTitle = contentDetailDTO.newsTitle | 95 | this.newsTitle = contentDetailDTO.newsTitle |
| 92 | this.editorName = contentDetailDTO.editorName | 96 | this.editorName = contentDetailDTO.editorName |
| 93 | this.newsSummary = contentDetailDTO.newsSummary | 97 | this.newsSummary = contentDetailDTO.newsSummary |
| @@ -146,7 +146,9 @@ export class GetuiPush { | @@ -146,7 +146,9 @@ export class GetuiPush { | ||
| 146 | }, | 146 | }, |
| 147 | //命令相应回复 | 147 | //命令相应回复 |
| 148 | onReceiveCommandResult: (result: GTCmdMessage) => { | 148 | onReceiveCommandResult: (result: GTCmdMessage) => { |
| 149 | - Logger.debug(TAG, "推送 Cmd Message = " + JSON.stringify(result)) | 149 | + Logger.debugOptimize(TAG, () => { |
| 150 | + return "推送 Cmd Message = " + JSON.stringify(result) | ||
| 151 | + }) | ||
| 150 | this.dealWithCmdMessage(result) | 152 | this.dealWithCmdMessage(result) |
| 151 | }, | 153 | }, |
| 152 | //sdk 收到透传消息 | 154 | //sdk 收到透传消息 |
| @@ -198,7 +200,9 @@ export class GetuiPush { | @@ -198,7 +200,9 @@ export class GetuiPush { | ||
| 198 | this.onNewWant(want, true) | 200 | this.onNewWant(want, true) |
| 199 | } | 201 | } |
| 200 | onNewWant(want: Want, startup: boolean = false) { | 202 | onNewWant(want: Want, startup: boolean = false) { |
| 201 | - Logger.debug(TAG, "want: " + JSON.stringify(want)) | 203 | + Logger.debugOptimize(TAG, () => { |
| 204 | + return "want: " + JSON.stringify(want) | ||
| 205 | + }) | ||
| 202 | 206 | ||
| 203 | this.lastPushContent = undefined | 207 | this.lastPushContent = undefined |
| 204 | let pushContent = PushContentParser.getPushLinkFromWant(want) | 208 | let pushContent = PushContentParser.getPushLinkFromWant(want) |
| @@ -441,7 +445,7 @@ export class GetuiPush { | @@ -441,7 +445,7 @@ export class GetuiPush { | ||
| 441 | bean["appVersion"] = AppUtils.getAppVersionName() | 445 | bean["appVersion"] = AppUtils.getAppVersionName() |
| 442 | bean["platform"] = 3 | 446 | bean["platform"] = 3 |
| 443 | HttpBizUtil.post<ResponseDTO<string>>(url, bean).then((data) => { | 447 | HttpBizUtil.post<ResponseDTO<string>>(url, bean).then((data) => { |
| 444 | - Logger.debug(TAG, "上传cid成功" + JSON.stringify(data)) | 448 | + Logger.debug(TAG, "上传cid成功") |
| 445 | }).catch((e: BusinessError) => { | 449 | }).catch((e: BusinessError) => { |
| 446 | Logger.debug(TAG, "上传cid失败" + JSON.stringify(e)) | 450 | Logger.debug(TAG, "上传cid失败" + JSON.stringify(e)) |
| 447 | }) | 451 | }) |
| @@ -5,6 +5,7 @@ import { SpConstants } from 'wdConstant/Index'; | @@ -5,6 +5,7 @@ import { SpConstants } from 'wdConstant/Index'; | ||
| 5 | import { EmitterEventId, EmitterUtils, Logger, PermissionUtils, ResourcesUtils, SPHelper } from 'wdKit/Index'; | 5 | import { EmitterEventId, EmitterUtils, Logger, PermissionUtils, ResourcesUtils, SPHelper } from 'wdKit/Index'; |
| 6 | import { ResponseDTO } from 'wdNetwork/Index'; | 6 | import { ResponseDTO } from 'wdNetwork/Index'; |
| 7 | 7 | ||
| 8 | +const TAG = "HWLocationUtils" | ||
| 8 | /** | 9 | /** |
| 9 | * 系统定位服务实现 | 10 | * 系统定位服务实现 |
| 10 | * */ | 11 | * */ |
| @@ -21,7 +22,7 @@ export class HWLocationUtils { | @@ -21,7 +22,7 @@ export class HWLocationUtils { | ||
| 21 | maxAccuracy: 0 | 22 | maxAccuracy: 0 |
| 22 | }; | 23 | }; |
| 23 | geoLocationManager.on('locationChange', requestInfo, (data) => { | 24 | geoLocationManager.on('locationChange', requestInfo, (data) => { |
| 24 | - Logger.debug('location :' + JSON.stringify(data)) | 25 | + Logger.debug(TAG, JSON.stringify(data)) |
| 25 | }) | 26 | }) |
| 26 | } | 27 | } |
| 27 | 28 | ||
| @@ -35,7 +36,7 @@ export class HWLocationUtils { | @@ -35,7 +36,7 @@ export class HWLocationUtils { | ||
| 35 | maxAccuracy: 0 | 36 | maxAccuracy: 0 |
| 36 | }; | 37 | }; |
| 37 | geoLocationManager.on('locationChange', requestInfo, (data) => { | 38 | geoLocationManager.on('locationChange', requestInfo, (data) => { |
| 38 | - Logger.debug('location :' + JSON.stringify(data)) //{"latitude":31.86870096,"longitude":117.3015341,"altitude":0,"accuracy":5000,"speed":0,"timeStamp":1713332445643,"direction":0,"timeSinceBoot":589519570869240,"additions":"","additionSize":0} | 39 | + Logger.debug(TAG, JSON.stringify(data)) //{"latitude":31.86870096,"longitude":117.3015341,"altitude":0,"accuracy":5000,"speed":0,"timeStamp":1713332445643,"direction":0,"timeSinceBoot":589519570869240,"additions":"","additionSize":0} |
| 39 | let record: Record<string, string | number> = {}; | 40 | let record: Record<string, string | number> = {}; |
| 40 | record['latitude'] = data.latitude | 41 | record['latitude'] = data.latitude |
| 41 | record['longitude'] = data.longitude | 42 | record['longitude'] = data.longitude |
| @@ -75,13 +76,16 @@ export class HWLocationUtils { | @@ -75,13 +76,16 @@ export class HWLocationUtils { | ||
| 75 | try { | 76 | try { |
| 76 | geoLocationManager.getCurrentLocation(requestInfo).then((result) => { | 77 | geoLocationManager.getCurrentLocation(requestInfo).then((result) => { |
| 77 | //{"latitude":31.8687047,"longitude":117.30152005,"altitude":0,"accuracy":5000,"speed":0,"timeStamp":1713331875766,"direction":0,"timeSinceBoot":588949694096931,"additions":"","additionSize":0} | 78 | //{"latitude":31.8687047,"longitude":117.30152005,"altitude":0,"accuracy":5000,"speed":0,"timeStamp":1713331875766,"direction":0,"timeSinceBoot":588949694096931,"additions":"","additionSize":0} |
| 78 | - Logger.debug('location' + JSON.stringify(result)) | 79 | + Logger.debugOptimize('location', () => { |
| 80 | + return JSON.stringify(result) | ||
| 81 | + }) | ||
| 79 | HWLocationUtils.getReverseGeoCodeRequest(result.latitude, result.longitude) | 82 | HWLocationUtils.getReverseGeoCodeRequest(result.latitude, result.longitude) |
| 80 | }) | 83 | }) |
| 81 | .catch((error: number) => { | 84 | .catch((error: number) => { |
| 82 | - Logger.debug('location' + JSON.stringify(error)) | 85 | + Logger.error(TAG, JSON.stringify(error)) |
| 83 | }); | 86 | }); |
| 84 | } catch (err) { | 87 | } catch (err) { |
| 88 | + Logger.error(TAG, JSON.stringify(err)) | ||
| 85 | } | 89 | } |
| 86 | } | 90 | } |
| 87 | 91 | ||
| @@ -89,7 +93,7 @@ export class HWLocationUtils { | @@ -89,7 +93,7 @@ export class HWLocationUtils { | ||
| 89 | let requestInfo: geoLocationManager.GeoCodeRequest = { 'description': description }; | 93 | let requestInfo: geoLocationManager.GeoCodeRequest = { 'description': description }; |
| 90 | geoLocationManager.getAddressesFromLocationName(requestInfo, (error, data) => { | 94 | geoLocationManager.getAddressesFromLocationName(requestInfo, (error, data) => { |
| 91 | if (data) { | 95 | if (data) { |
| 92 | - Logger.debug('location :' + JSON.stringify(data)) | 96 | + Logger.debug(TAG, JSON.stringify(data)) |
| 93 | } | 97 | } |
| 94 | //[{"latitude":31.898204927828598,"longitude":117.29702564819466,"locale":"zh","placeName":"安徽省合肥市瑶海区白龙路与北二环路辅路交叉口南20米","countryCode":"CN","countryName":"中国","administrativeArea":"安徽省","subAdministrativeArea":"合肥市","locality":"合肥市","subLocality":"瑶海区","roadName":"白龙路与北二环路辅路","subRoadName":"20","premises":"20","postalCode":"","phoneNumber":"18756071597","addressUrl":"","descriptionsSize":0,"isFromMock":false}] | 98 | //[{"latitude":31.898204927828598,"longitude":117.29702564819466,"locale":"zh","placeName":"安徽省合肥市瑶海区白龙路与北二环路辅路交叉口南20米","countryCode":"CN","countryName":"中国","administrativeArea":"安徽省","subAdministrativeArea":"合肥市","locality":"合肥市","subLocality":"瑶海区","roadName":"白龙路与北二环路辅路","subRoadName":"20","premises":"20","postalCode":"","phoneNumber":"18756071597","addressUrl":"","descriptionsSize":0,"isFromMock":false}] |
| 95 | }) | 99 | }) |
| @@ -103,10 +107,12 @@ export class HWLocationUtils { | @@ -103,10 +107,12 @@ export class HWLocationUtils { | ||
| 103 | }; | 107 | }; |
| 104 | geoLocationManager.getAddressesFromLocation(requestInfo, async (error, data) => { | 108 | geoLocationManager.getAddressesFromLocation(requestInfo, async (error, data) => { |
| 105 | if (error) { | 109 | if (error) { |
| 106 | - Logger.debug('location :' + JSON.stringify(error)) | 110 | + Logger.error(TAG, JSON.stringify(error)) |
| 107 | } | 111 | } |
| 108 | if (data) { | 112 | if (data) { |
| 109 | - Logger.debug('location :' + JSON.stringify(data)) | 113 | + Logger.debugOptimize(TAG, () => { |
| 114 | + return JSON.stringify(data) | ||
| 115 | + }) | ||
| 110 | if (data[0] && data[0].administrativeArea && data[0].subAdministrativeArea) { | 116 | if (data[0] && data[0].administrativeArea && data[0].subAdministrativeArea) { |
| 111 | let cityName = data[0].subAdministrativeArea; | 117 | let cityName = data[0].subAdministrativeArea; |
| 112 | let name = await SPHelper.default.get(SpConstants.LOCATION_CITY_NAME, '') as string | 118 | let name = await SPHelper.default.get(SpConstants.LOCATION_CITY_NAME, '') as string |
| @@ -136,7 +142,7 @@ export class HWLocationUtils { | @@ -136,7 +142,7 @@ export class HWLocationUtils { | ||
| 136 | // geoLocationManager.off('locationChange') | 142 | // geoLocationManager.off('locationChange') |
| 137 | return new Promise<boolean>((success, fail) => { | 143 | return new Promise<boolean>((success, fail) => { |
| 138 | geoLocationManager.off("locationChange", (data) => { | 144 | geoLocationManager.off("locationChange", (data) => { |
| 139 | - Logger.debug('location :' + JSON.stringify(data)) | 145 | + Logger.debug(TAG, JSON.stringify(data)) |
| 140 | success(true) | 146 | success(true) |
| 141 | }) | 147 | }) |
| 142 | }) | 148 | }) |
| @@ -256,7 +256,9 @@ export class VoiceRecoginizer { | @@ -256,7 +256,9 @@ export class VoiceRecoginizer { | ||
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | async AsrInit(path:string, filePath:string): Promise<number> { | 258 | async AsrInit(path:string, filePath:string): Promise<number> { |
| 259 | - //console.log("AsrInit this is " + JSON.stringify(this)) | 259 | + Logger.debugOptimize(TAG, () => { |
| 260 | + return "AsrInit this is " + JSON.stringify(this) | ||
| 261 | + }) | ||
| 260 | // console.info("AsrInit path: " + path); | 262 | // console.info("AsrInit path: " + path); |
| 261 | //获取工作路径, 这里获得当前nuisdk.aar中assets路径 | 263 | //获取工作路径, 这里获得当前nuisdk.aar中assets路径 |
| 262 | 264 |
| @@ -41,11 +41,12 @@ export class LoginModule { | @@ -41,11 +41,12 @@ export class LoginModule { | ||
| 41 | 41 | ||
| 42 | HuaweiAuth.sharedInstance().registerEvents() | 42 | HuaweiAuth.sharedInstance().registerEvents() |
| 43 | 43 | ||
| 44 | - AccountManagerUtils.isLogin().then((login) => { | ||
| 45 | - if (!login) { | ||
| 46 | - HuaweiAuth.sharedInstance().rePrefetchAnonymousPhone() | ||
| 47 | - } | ||
| 48 | - }) | 44 | + // 这里启动不在预先取匿名手机号 |
| 45 | + // AccountManagerUtils.isLogin().then((login) => { | ||
| 46 | + // if (!login) { | ||
| 47 | + // HuaweiAuth.sharedInstance().rePrefetchAnonymousPhone() | ||
| 48 | + // } | ||
| 49 | + // }) | ||
| 49 | RouterJumpInterceptor.register(WDRouterPage.loginPage, new LoginJumpHandler()) | 50 | RouterJumpInterceptor.register(WDRouterPage.loginPage, new LoginJumpHandler()) |
| 50 | } | 51 | } |
| 51 | 52 |
| @@ -63,7 +63,9 @@ export default class HuaweiAuth { | @@ -63,7 +63,9 @@ export default class HuaweiAuth { | ||
| 63 | controller.executeRequest(authRequest).then((response: authentication.AuthorizationWithHuaweiIDResponse) => { | 63 | controller.executeRequest(authRequest).then((response: authentication.AuthorizationWithHuaweiIDResponse) => { |
| 64 | let anonymousPhone = response.data?.extraInfo?.quickLoginAnonymousPhone; | 64 | let anonymousPhone = response.data?.extraInfo?.quickLoginAnonymousPhone; |
| 65 | if (anonymousPhone) { | 65 | if (anonymousPhone) { |
| 66 | - Logger.info(TAG, 'get anonymousPhone, ' + JSON.stringify(response)); | 66 | + Logger.infoOptimize(TAG, () => { |
| 67 | + return 'get anonymousPhone, ' + JSON.stringify(response) | ||
| 68 | + }) | ||
| 67 | this._anonymousPhone = anonymousPhone as string | 69 | this._anonymousPhone = anonymousPhone as string |
| 68 | resolve(this._anonymousPhone) | 70 | resolve(this._anonymousPhone) |
| 69 | return; | 71 | return; |
| @@ -157,7 +157,7 @@ export class WDAliPlayerController { | @@ -157,7 +157,7 @@ export class WDAliPlayerController { | ||
| 157 | 157 | ||
| 158 | 158 | ||
| 159 | if (this.pageParam) { | 159 | if (this.pageParam) { |
| 160 | - console.log('播放视频pageParam', JSON.stringify(this.pageParam)) | 160 | + Logger.debug(TAG, '播放视频pageParam', JSON.stringify(this.pageParam)) |
| 161 | // 播放埋点 | 161 | // 播放埋点 |
| 162 | TrackingPlay.videoPositivePlay(Math.floor((DateTimeUtils.getTimeStamp() - this.creatStartTime) / 1000), | 162 | TrackingPlay.videoPositivePlay(Math.floor((DateTimeUtils.getTimeStamp() - this.creatStartTime) / 1000), |
| 163 | this.pageName, this.pageName, this.pageParam) | 163 | this.pageName, this.pageName, this.pageParam) |
| @@ -172,7 +172,7 @@ export class WDAliPlayerController { | @@ -172,7 +172,7 @@ export class WDAliPlayerController { | ||
| 172 | if (this.pageParam) { | 172 | if (this.pageParam) { |
| 173 | let initDuration = Math.floor(Number(this.duration) / 1000) | 173 | let initDuration = Math.floor(Number(this.duration) / 1000) |
| 174 | let currentPlayTime: number = Math.floor((DateTimeUtils.getTimeStamp() - this.creatStartTime) / 1000) //当前播放时间 | 174 | let currentPlayTime: number = Math.floor((DateTimeUtils.getTimeStamp() - this.creatStartTime) / 1000) //当前播放时间 |
| 175 | - console.log('播放结束') | 175 | + Logger.debug(TAG, '播放结束') |
| 176 | // 播放结束埋点 | 176 | // 播放结束埋点 |
| 177 | TrackingPlay.videoPlayEnd(currentPlayTime, initDuration, currentPlayTime, this.pageName, this.pageName, | 177 | TrackingPlay.videoPlayEnd(currentPlayTime, initDuration, currentPlayTime, this.pageName, this.pageName, |
| 178 | this.pageParam) | 178 | this.pageParam) |
| @@ -279,7 +279,7 @@ export class WDAliPlayerController { | @@ -279,7 +279,7 @@ export class WDAliPlayerController { | ||
| 279 | this.status = PlayerConstants.STATUS_ERROR; | 279 | this.status = PlayerConstants.STATUS_ERROR; |
| 280 | this.watchStatus(); | 280 | this.watchStatus(); |
| 281 | 281 | ||
| 282 | - console.log('播放错误',JSON.stringify(error)) | 282 | + Logger.error(TAG, '播放错误',JSON.stringify(error)) |
| 283 | TrackingPlay.videoPlayError(errorInfo.getMsg(), this.pageName, this.pageName, this.pageParam) | 283 | TrackingPlay.videoPlayError(errorInfo.getMsg(), this.pageName, this.pageName, this.pageParam) |
| 284 | } | 284 | } |
| 285 | }); | 285 | }); |
| 1 | import componentUtils from '@ohos.arkui.componentUtils'; | 1 | import componentUtils from '@ohos.arkui.componentUtils'; |
| 2 | import { WDPlayerController } from '../controller/WDPlayerController' | 2 | import { WDPlayerController } from '../controller/WDPlayerController' |
| 3 | -import { WindowModel } from 'wdKit'; | ||
| 4 | -import { Logger } from '../utils/Logger'; | 3 | +import { WindowModel, Logger } from 'wdKit'; |
| 5 | import { enableAliPlayer } from '../utils/GlobalSetting'; | 4 | import { enableAliPlayer } from '../utils/GlobalSetting'; |
| 6 | import { WDAliPlayerController } from '../controller/WDAliPlayerController'; | 5 | import { WDAliPlayerController } from '../controller/WDAliPlayerController'; |
| 7 | 6 | ||
| @@ -24,11 +23,11 @@ class MGPlayRenderViewIns { | @@ -24,11 +23,11 @@ class MGPlayRenderViewIns { | ||
| 24 | static add() { | 23 | static add() { |
| 25 | MGPlayRenderViewIns.intCount++; | 24 | MGPlayRenderViewIns.intCount++; |
| 26 | WindowModel.shared.setWindowKeepScreenOn(true); | 25 | WindowModel.shared.setWindowKeepScreenOn(true); |
| 27 | - console.log("add-- +1") | 26 | + Logger.debug(TAG, "add-- +1") |
| 28 | } | 27 | } |
| 29 | 28 | ||
| 30 | static del() { | 29 | static del() { |
| 31 | - console.log("del-- -1") | 30 | + Logger.debug(TAG, "del-- -1") |
| 32 | MGPlayRenderViewIns.intCount--; | 31 | MGPlayRenderViewIns.intCount--; |
| 33 | if (MGPlayRenderViewIns.intCount <= 0) { | 32 | if (MGPlayRenderViewIns.intCount <= 0) { |
| 34 | WindowModel.shared.setWindowKeepScreenOn(false); | 33 | WindowModel.shared.setWindowKeepScreenOn(false); |
| 1 | import componentUtils from '@ohos.arkui.componentUtils'; | 1 | import componentUtils from '@ohos.arkui.componentUtils'; |
| 2 | -import { WindowModel } from 'wdKit'; | ||
| 3 | -import { Logger } from '../utils/Logger'; | 2 | +import { WindowModel, Logger } from 'wdKit'; |
| 4 | import { enableAliPlayer } from '../utils/GlobalSetting'; | 3 | import { enableAliPlayer } from '../utils/GlobalSetting'; |
| 5 | import { WDAliPlayerController } from '../controller/WDAliPlayerController'; | 4 | import { WDAliPlayerController } from '../controller/WDAliPlayerController'; |
| 6 | 5 | ||
| @@ -23,11 +22,11 @@ class MGPlayRenderViewIns { | @@ -23,11 +22,11 @@ class MGPlayRenderViewIns { | ||
| 23 | static add() { | 22 | static add() { |
| 24 | MGPlayRenderViewIns.intCount++; | 23 | MGPlayRenderViewIns.intCount++; |
| 25 | WindowModel.shared.setWindowKeepScreenOn(true); | 24 | WindowModel.shared.setWindowKeepScreenOn(true); |
| 26 | - console.log("add-- +1") | 25 | + Logger.debug(TAG, "add-- +1") |
| 27 | } | 26 | } |
| 28 | 27 | ||
| 29 | static del() { | 28 | static del() { |
| 30 | - console.log("del-- -1") | 29 | + Logger.debug(TAG, "del-- -1") |
| 31 | MGPlayRenderViewIns.intCount--; | 30 | MGPlayRenderViewIns.intCount--; |
| 32 | if (MGPlayRenderViewIns.intCount <= 0) { | 31 | if (MGPlayRenderViewIns.intCount <= 0) { |
| 33 | WindowModel.shared.setWindowKeepScreenOn(false); | 32 | WindowModel.shared.setWindowKeepScreenOn(false); |
| @@ -24,11 +24,11 @@ class MGPlayRenderViewIns { | @@ -24,11 +24,11 @@ class MGPlayRenderViewIns { | ||
| 24 | static add() { | 24 | static add() { |
| 25 | MGPlayRenderViewIns.intCount++; | 25 | MGPlayRenderViewIns.intCount++; |
| 26 | WindowModel.shared.setWindowKeepScreenOn(true); | 26 | WindowModel.shared.setWindowKeepScreenOn(true); |
| 27 | - console.log("add-- +1") | 27 | + Logger.debug(TAG, "add-- +1") |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | static del() { | 30 | static del() { |
| 31 | - console.log("del-- -1") | 31 | + Logger.debug(TAG, "del-- -1") |
| 32 | MGPlayRenderViewIns.intCount--; | 32 | MGPlayRenderViewIns.intCount--; |
| 33 | if (MGPlayRenderViewIns.intCount <= 0) { | 33 | if (MGPlayRenderViewIns.intCount <= 0) { |
| 34 | WindowModel.shared.setWindowKeepScreenOn(false); | 34 | WindowModel.shared.setWindowKeepScreenOn(false); |
| @@ -24,11 +24,11 @@ class MGPlayRenderViewIns { | @@ -24,11 +24,11 @@ class MGPlayRenderViewIns { | ||
| 24 | static add() { | 24 | static add() { |
| 25 | MGPlayRenderViewIns.intCount++; | 25 | MGPlayRenderViewIns.intCount++; |
| 26 | WindowModel.shared.setWindowKeepScreenOn(true); | 26 | WindowModel.shared.setWindowKeepScreenOn(true); |
| 27 | - console.log("add-- +1") | 27 | + Logger.debug(TAG, "add-- +1") |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | static del() { | 30 | static del() { |
| 31 | - console.log("del-- -1") | 31 | + Logger.debug(TAG, "del-- -1") |
| 32 | MGPlayRenderViewIns.intCount--; | 32 | MGPlayRenderViewIns.intCount--; |
| 33 | if (MGPlayRenderViewIns.intCount <= 0) { | 33 | if (MGPlayRenderViewIns.intCount <= 0) { |
| 34 | WindowModel.shared.setWindowKeepScreenOn(false); | 34 | WindowModel.shared.setWindowKeepScreenOn(false); |
| @@ -66,7 +66,6 @@ export struct WDPlayerRenderView { | @@ -66,7 +66,6 @@ export struct WDPlayerRenderView { | ||
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | this.playerController.onVideoSizeChange = (width: number, height: number) => { | 68 | this.playerController.onVideoSizeChange = (width: number, height: number) => { |
| 69 | - console.log(`WDPlayerRenderView onVideoSizeChange width:${width} videoTop:${height}`) | ||
| 70 | Logger.info(TAG, ` onVideoSizeChange width:${width} height:${height}`) | 69 | Logger.info(TAG, ` onVideoSizeChange width:${width} height:${height}`) |
| 71 | this.videoWidth = width; | 70 | this.videoWidth = width; |
| 72 | this.videoHeight = height; | 71 | this.videoHeight = height; |
| @@ -16,6 +16,7 @@ import { LaunchPageModel } from './viewModel/LaunchPageModel'; | @@ -16,6 +16,7 @@ import { LaunchPageModel } from './viewModel/LaunchPageModel'; | ||
| 16 | import { JSON } from '@kit.ArkTS'; | 16 | import { JSON } from '@kit.ArkTS'; |
| 17 | import { WebArticleEventHandler, WebPoolManager } from 'wdWebComponent'; | 17 | import { WebArticleEventHandler, WebPoolManager } from 'wdWebComponent'; |
| 18 | import { BridgeWebViewControl } from 'wdJsBridge'; | 18 | import { BridgeWebViewControl } from 'wdJsBridge'; |
| 19 | +import { webview } from '@kit.ArkWeb'; | ||
| 19 | 20 | ||
| 20 | const TAG = 'MainPage'; | 21 | const TAG = 'MainPage'; |
| 21 | 22 | ||
| @@ -40,8 +41,6 @@ struct MainPage { | @@ -40,8 +41,6 @@ struct MainPage { | ||
| 40 | 41 | ||
| 41 | aboutToAppear() { | 42 | aboutToAppear() { |
| 42 | 43 | ||
| 43 | - StartupManager.sharedInstance().appReachMainPage() | ||
| 44 | - | ||
| 45 | this.breakpointSystem.register() | 44 | this.breakpointSystem.register() |
| 46 | 45 | ||
| 47 | // Logger.info(TAG, `aboutToAppear `); | 46 | // Logger.info(TAG, `aboutToAppear `); |
| @@ -64,7 +63,14 @@ struct MainPage { | @@ -64,7 +63,14 @@ struct MainPage { | ||
| 64 | } | 63 | } |
| 65 | 64 | ||
| 66 | setTimeout(() => { | 65 | setTimeout(() => { |
| 66 | + // 这里延后,因为有可能是换端进入H5页面 | ||
| 67 | + setTimeout(() => { | ||
| 68 | + StartupManager.sharedInstance().appReachMainPage() | ||
| 69 | + }, 200) | ||
| 70 | + | ||
| 71 | + webview.WebviewController.initializeWebEngine() | ||
| 67 | ComponentModule.preInitArticleWebTemplate(this.getUIContext()) | 72 | ComponentModule.preInitArticleWebTemplate(this.getUIContext()) |
| 73 | + | ||
| 68 | }, 500) | 74 | }, 500) |
| 69 | } | 75 | } |
| 70 | 76 |
| @@ -49,7 +49,9 @@ export class StartupManager { | @@ -49,7 +49,9 @@ export class StartupManager { | ||
| 49 | 49 | ||
| 50 | // App启动 | 50 | // App启动 |
| 51 | appOnCreate(want: Want, launchParam: AbilityConstant.LaunchParam, context: common.UIAbilityContext) { | 51 | appOnCreate(want: Want, launchParam: AbilityConstant.LaunchParam, context: common.UIAbilityContext) { |
| 52 | - Logger.debug(TAG, "App onCreate: " + `\nwant: ${want}\nlaunchParam: ${launchParam}`) | 52 | + Logger.debugOptimize(TAG, () => { |
| 53 | + return "App onCreate: " + `\nwant: ${want}\nlaunchParam: ${launchParam}` | ||
| 54 | + }) | ||
| 53 | this.context = context | 55 | this.context = context |
| 54 | // 设置图片文件数据缓存上限为200MB (200MB=200*1024*1024B=209715200B) | 56 | // 设置图片文件数据缓存上限为200MB (200MB=200*1024*1024B=209715200B) |
| 55 | app.setImageFileCacheSize(209715200) | 57 | app.setImageFileCacheSize(209715200) |
| @@ -124,9 +126,11 @@ export class StartupManager { | @@ -124,9 +126,11 @@ export class StartupManager { | ||
| 124 | 126 | ||
| 125 | this.initSensorData() | 127 | this.initSensorData() |
| 126 | 128 | ||
| 127 | - this.initTingyun() | 129 | + setTimeout(() => { |
| 130 | + this.initTingyun() | ||
| 128 | 131 | ||
| 129 | - this.initGeTuiPush() | 132 | + this.initGeTuiPush() |
| 133 | + }, 1000) | ||
| 130 | 134 | ||
| 131 | this.initUmengStat() | 135 | this.initUmengStat() |
| 132 | 136 | ||
| @@ -161,7 +165,7 @@ export class StartupManager { | @@ -161,7 +165,7 @@ export class StartupManager { | ||
| 161 | 165 | ||
| 162 | //TODO: | 166 | //TODO: |
| 163 | // 提前初始化webview | 167 | // 提前初始化webview |
| 164 | - webview.WebviewController.initializeWebEngine() | 168 | + // webview.WebviewController.initializeWebEngine() |
| 165 | 169 | ||
| 166 | initGlobalPlayerSettings(this.context!) | 170 | initGlobalPlayerSettings(this.context!) |
| 167 | 171 |
-
Please register or login to post a comment