From 288e8b6fd1fc7b104c3f25fe3082c7943639f63a Mon Sep 17 00:00:00 2001 From: mehaotian <490272692@qq.com> Date: Wed, 13 Nov 2024 16:24:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=9F=E8=AE=A1=E6=9A=82=E6=97=B6?= =?UTF-8?q?=E5=85=B3=E9=97=AD=EF=BC=8C=E5=88=A0=E9=99=A4=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=97=A0=E7=94=A8=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.uvue | 70 +++++++++---------- main.uts | 28 ++++---- uni_modules/uni-stat/plugin.uts | 20 ++---- .../uni-stat/utssdk/common/utils/pageInfo.uts | 1 - 4 files changed, 55 insertions(+), 64 deletions(-) diff --git a/App.uvue b/App.uvue index 3e3bdc42..e5f89232 100644 --- a/App.uvue +++ b/App.uvue @@ -49,15 +49,15 @@ // 统计上报 - 应用启动 // #ifdef APP-ANDROID || APP-IOS || WEB - uni.report({ - name: 'uni-app-launch', - options: res, - success(res_data) { - console.log(res_data); - }, fail(err) { - console.log(err); - } - }) + // uni.report({ + // name: 'uni-app-launch', + // options: res, + // success(res_data) { + // console.log(res_data); + // }, fail(err) { + // console.log(err); + // } + // }) // #endif // #ifdef APP if (process.env.NODE_ENV !== 'development') { //真机运行可以注释此条件 @@ -90,14 +90,14 @@ // #ifdef APP-ANDROID || APP-IOS || WEB // 统计上报 - 应用显示 - uni.report({ - name: 'uni-app-show', - success(res_data) { - console.log(res_data); - }, fail(err) { - console.log(err); - } - }) + // uni.report({ + // name: 'uni-app-show', + // success(res_data) { + // console.log(res_data); + // }, fail(err) { + // console.log(err); + // } + // }) // #endif }, onHide: function () { @@ -107,14 +107,14 @@ // #ifdef APP-ANDROID || APP-IOS || WEB // 统计上报 - 应用进入后台 - uni.report({ - name: 'uni-app-hide', - success(res) { - console.log(res); - }, fail(err) { - console.log(err); - } - }) + // uni.report({ + // name: 'uni-app-hide', + // success(res) { + // console.log(res); + // }, fail(err) { + // console.log(err); + // } + // }) // #endif }, // #ifdef APP-ANDROID @@ -141,18 +141,18 @@ }, // #endif onError(err : any) { - console.log('App onError', err) + // console.log('App onError', err) // #ifdef APP-ANDROID || APP-IOS || WEB // 统计上报 - 应用发生错误 - uni.report({ - name: 'uni-app-error', - options: err, - success(res) { - console.log(res); - }, fail(err) { - console.log(err); - } - }) + // uni.report({ + // name: 'uni-app-error', + // options: err, + // success(res) { + // console.log(res); + // }, fail(err) { + // console.log(err); + // } + // }) // #endif }, methods: { diff --git a/main.uts b/main.uts index 3c691bc4..03df6e0b 100644 --- a/main.uts +++ b/main.uts @@ -1,27 +1,27 @@ // 仅测试 console.log 时机问题 import './test-main-console.uts' -// #ifdef APP-ANDROID || APP-IOS || WEB -import { uniStat } from '@/uni_modules/uni-stat/plugin.uts' -// #endif +// // #ifdef APP-ANDROID || APP-IOS || WEB +// import { uniStat } from '@/uni_modules/uni-stat/plugin.uts' +// // #endif import App from './App.uvue' import { createSSRApp } from 'vue' -// 统计配置 -const uniStatcollectItems = { - uniStatPageLog: true -} +// // 统计配置 +// const uniStatcollectItems = { +// uniStatPageLog: true +// } -const uniStatOptions = { - debug: true, - collectItems: uniStatcollectItems, -} +// const uniStatOptions = { +// debug: true, +// collectItems: uniStatcollectItems, +// } export function createApp() { const app = createSSRApp(App) - // #ifdef APP-ANDROID || APP-IOS || WEB - app.use(uniStat, uniStatOptions) - // #endif + // // #ifdef APP-ANDROID || APP-IOS || WEB + // app.use(uniStat, uniStatOptions) + // // #endif // app.mixin({ // onReady() { // setTimeout(() => { diff --git a/uni_modules/uni-stat/plugin.uts b/uni_modules/uni-stat/plugin.uts index b856d2f6..809870c2 100644 --- a/uni_modules/uni-stat/plugin.uts +++ b/uni_modules/uni-stat/plugin.uts @@ -8,27 +8,19 @@ const lifecycle = defineMixin({ // onLaunch(options : OnLaunchOptions) { stat_instance.onLaunch(options, this) }, // @ts-ignore onLoad() { - if (this instanceof Page) { - stat_instance.onLoad(this) - } + stat_instance.onLoad(this) }, // @ts-ignore - onShow() { - if (this instanceof Page) { - stat_instance.onShow(this) - } + onPageShow() { + stat_instance.onShow(this) }, // @ts-ignore - onHide() { - if (this instanceof Page) { - stat_instance.onHide(this) - } + onPageHide() { + stat_instance.onHide(this) }, // @ts-ignore onUnload() { - if (this instanceof Page) { - stat_instance.onUnload(this) - } + stat_instance.onUnload(this) }, // onError(error : string) { stat_instance.onError(error) } }) diff --git a/uni_modules/uni-stat/utssdk/common/utils/pageInfo.uts b/uni_modules/uni-stat/utssdk/common/utils/pageInfo.uts index 02d926e0..365a2afc 100644 --- a/uni_modules/uni-stat/utssdk/common/utils/pageInfo.uts +++ b/uni_modules/uni-stat/utssdk/common/utils/pageInfo.uts @@ -414,7 +414,6 @@ export const uni_cloud_config = () : UniCloudInitOptions | null => { export const get_space = (config : UniCloudInitOptions) : UniCloudInitOptions | null => { const uniCloudConfig = uni_cloud_config() if (uniCloudConfig == null) { - console.log(config); // #ifdef APP-ANDROID if (config.spaceId != '') { return config -- GitLab