Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qianlong66
uni-app
提交
9821edb3
U
uni-app
项目概览
qianlong66
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9821edb3
编写于
3月 31, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore(stat): build
上级
752dc8cc
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
2422 addition
and
1758 deletion
+2422
-1758
packages/uni-stat/dist/uni-cloud-stat.cjs.js
packages/uni-stat/dist/uni-cloud-stat.cjs.js
+23
-34
packages/uni-stat/dist/uni-cloud-stat.es.js
packages/uni-stat/dist/uni-cloud-stat.es.js
+23
-34
packages/uni-stat/dist/uni-stat.cjs.js
packages/uni-stat/dist/uni-stat.cjs.js
+1187
-842
packages/uni-stat/dist/uni-stat.es.js
packages/uni-stat/dist/uni-stat.es.js
+1183
-842
packages/uni-stat/src/config.ts
packages/uni-stat/src/config.ts
+6
-6
未找到文件。
packages/uni-stat/dist/uni-cloud-stat.cjs.js
浏览文件 @
9821edb3
...
...
@@ -18,8 +18,7 @@ const STAT_H5_URL = 'https://tongji.dcloud.io/uni/stat.gif';
const
PAGE_PVER_TIME
=
1800
;
// 页面在前台无操作结束访问时间 单位s
const
APP_PVER_TIME
=
300
;
// 应用在后台结束访问时间 单位s
const
OPERATING_TIME
=
10
;
// 数据上报时间 单位s
const
DIFF_TIME
=
60
*
1000
*
60
*
24
;
const
DEBUG
=
true
;
const
DIFF_TIME
=
60
*
1000
*
60
*
24
;
let
statConfig
=
{
appid
:
''
...
...
@@ -1037,14 +1036,7 @@ class Report {
* @param {Object} optionsData 需要上报的数据
*/
sendRequest
(
optionsData
)
{
if
(
DEBUG
)
{
console
.
log
(
'
----- 数据上报开始 -----
'
);
console
.
log
(
'
上报数据:
'
,
optionsData
);
console
.
log
(
'
----- 数据上报结束 -----
'
);
}
{
console
.
log
(
'
-- callFunction 上报
'
);
if
(
!
uniCloud
.
config
)
{
console
.
error
(
'
当前尚未绑定服务空间.
'
);
return
...
...
@@ -1052,12 +1044,8 @@ class Report {
uniCloud
.
callFunction
({
name
:
'
uni-stat-report
'
,
data
:
optionsData
,
success
:
(
res
)
=>
{
console
.
log
(
res
);
},
fail
:
(
err
)
=>
{
console
.
log
(
err
);
}
success
:
(
res
)
=>
{},
fail
:
(
err
)
=>
{}
});
}
}
...
...
@@ -1248,17 +1236,17 @@ const lifecycle = {
function
main
()
{
console
.
log
(
'
--- 统计开启
'
);
//
if (process.env.NODE_ENV === 'development') {
// uni.report = function(type, options) {}
//
} else {
// console.log('--- 统计开启')
if
(
process
.
env
.
NODE_ENV
===
'
development
'
)
{
uni
.
report
=
function
(
type
,
options
)
{};
}
else
{
// #ifdef VUE3
//
uni.onCreateVueApp((app) => {
// app.mixin(lifecycle)
//
uni.report = function(type, options) {
// stat.sendEvent(type, options)
// }
// })
uni
.
onCreateVueApp
((
app
)
=>
{
app
.
mixin
(
lifecycle
);
uni
.
report
=
function
(
type
,
options
)
{
stat
.
sendEvent
(
type
,
options
);
};
});
uni
.
onAppLaunch
((
options
)
=>
{
stat
.
launch
(
options
);
// 小程序平台此时也无法获取getApp,统一在options中传递一个app mixin对象
...
...
@@ -1266,15 +1254,15 @@ function main() {
uni
.
report
=
function
(
type
,
options
)
{
stat
.
sendEvent
(
type
,
options
);
};
});
if
(
get_platform_name
()
!==
'
h5
'
&&
get_platform_name
()
!==
'
n
'
)
{
uni
.
onAppHide
(()
=>
{
stat
.
appHide
(
get_page_vm
());
});
uni
.
onAppShow
(()
=>
{
stat
.
appShow
(
get_page_vm
());
});
});
if
(
get_platform_name
()
!==
'
h5
'
&&
get_platform_name
()
!==
'
n
'
)
{
uni
.
onAppHide
(()
=>
{
stat
.
appHide
(
get_page_vm
());
});
uni
.
onAppShow
(()
=>
{
stat
.
appShow
(
get_page_vm
());
});
}
// #endif
...
...
@@ -1285,6 +1273,7 @@ function main() {
stat
.
sendEvent
(
type
,
options
);
};
// #endif
}
}
main
();
packages/uni-stat/dist/uni-cloud-stat.es.js
浏览文件 @
9821edb3
...
...
@@ -12,8 +12,7 @@ const STAT_H5_URL = 'https://tongji.dcloud.io/uni/stat.gif';
const
PAGE_PVER_TIME
=
1800
;
// 页面在前台无操作结束访问时间 单位s
const
APP_PVER_TIME
=
300
;
// 应用在后台结束访问时间 单位s
const
OPERATING_TIME
=
10
;
// 数据上报时间 单位s
const
DIFF_TIME
=
60
*
1000
*
60
*
24
;
const
DEBUG
=
true
;
const
DIFF_TIME
=
60
*
1000
*
60
*
24
;
let
statConfig
=
{
appid
:
''
...
...
@@ -1031,14 +1030,7 @@ class Report {
* @param {Object} optionsData 需要上报的数据
*/
sendRequest
(
optionsData
)
{
if
(
DEBUG
)
{
console
.
log
(
'
----- 数据上报开始 -----
'
);
console
.
log
(
'
上报数据:
'
,
optionsData
);
console
.
log
(
'
----- 数据上报结束 -----
'
);
}
{
console
.
log
(
'
-- callFunction 上报
'
);
if
(
!
uniCloud
.
config
)
{
console
.
error
(
'
当前尚未绑定服务空间.
'
);
return
...
...
@@ -1046,12 +1038,8 @@ class Report {
uniCloud
.
callFunction
({
name
:
'
uni-stat-report
'
,
data
:
optionsData
,
success
:
(
res
)
=>
{
console
.
log
(
res
);
},
fail
:
(
err
)
=>
{
console
.
log
(
err
);
}
success
:
(
res
)
=>
{},
fail
:
(
err
)
=>
{}
});
}
}
...
...
@@ -1242,17 +1230,17 @@ const lifecycle = {
function
main
()
{
console
.
log
(
'
--- 统计开启
'
);
//
if (process.env.NODE_ENV === 'development') {
// uni.report = function(type, options) {}
//
} else {
// console.log('--- 统计开启')
if
(
process
.
env
.
NODE_ENV
===
'
development
'
)
{
uni
.
report
=
function
(
type
,
options
)
{};
}
else
{
// #ifdef VUE3
//
uni.onCreateVueApp((app) => {
// app.mixin(lifecycle)
//
uni.report = function(type, options) {
// stat.sendEvent(type, options)
// }
// })
uni
.
onCreateVueApp
((
app
)
=>
{
app
.
mixin
(
lifecycle
);
uni
.
report
=
function
(
type
,
options
)
{
stat
.
sendEvent
(
type
,
options
);
};
});
uni
.
onAppLaunch
((
options
)
=>
{
stat
.
launch
(
options
);
// 小程序平台此时也无法获取getApp,统一在options中传递一个app mixin对象
...
...
@@ -1260,15 +1248,15 @@ function main() {
uni
.
report
=
function
(
type
,
options
)
{
stat
.
sendEvent
(
type
,
options
);
};
});
if
(
get_platform_name
()
!==
'
h5
'
&&
get_platform_name
()
!==
'
n
'
)
{
uni
.
onAppHide
(()
=>
{
stat
.
appHide
(
get_page_vm
());
});
uni
.
onAppShow
(()
=>
{
stat
.
appShow
(
get_page_vm
());
});
});
if
(
get_platform_name
()
!==
'
h5
'
&&
get_platform_name
()
!==
'
n
'
)
{
uni
.
onAppHide
(()
=>
{
stat
.
appHide
(
get_page_vm
());
});
uni
.
onAppShow
(()
=>
{
stat
.
appShow
(
get_page_vm
());
});
}
// #endif
...
...
@@ -1279,6 +1267,7 @@ function main() {
stat
.
sendEvent
(
type
,
options
);
};
// #endif
}
}
main
();
packages/uni-stat/dist/uni-stat.cjs.js
浏览文件 @
9821edb3
此差异已折叠。
点击以展开。
packages/uni-stat/dist/uni-stat.es.js
浏览文件 @
9821edb3
此差异已折叠。
点击以展开。
packages/uni-stat/src/config.ts
浏览文件 @
9821edb3
// 访问开始即启动小程序,访问结束结分为:进入后台超过5min、在前台无任何操作超过30min、在新的来源打开小程序;
export
const
STAT_VERSION
=
'
0.0.1
'
// 访问开始即启动小程序,访问结束结分为:进入后台超过5min、在前台无任何操作超过30min、在新的来源打开小程序;
export
const
STAT_VERSION
=
'
0.0.1
'
export
const
STAT_URL
=
'
https://tongji.dcloud.io/uni/stat
'
export
const
STAT_H5_URL
=
'
https://tongji.dcloud.io/uni/stat.gif
'
export
const
STAT_KEY
=
'
qkTHEIegZGcL5iy3
'
export
const
PAGE_PVER_TIME
=
1800
// 页面在前台无操作结束访问时间 单位s
export
const
APP_PVER_TIME
=
300
// 应用在后台结束访问时间 单位s
export
const
OPERATING_TIME
=
10
// 数据上报时间 单位s
export
const
STAT_KEY
=
'
qkTHEIegZGcL5iy3
'
export
const
PAGE_PVER_TIME
=
1800
// 页面在前台无操作结束访问时间 单位s
export
const
APP_PVER_TIME
=
300
// 应用在后台结束访问时间 单位s
export
const
OPERATING_TIME
=
10
// 数据上报时间 单位s
export
const
DIFF_TIME
=
60
*
1000
*
60
*
24
export
const
DEBUG
=
true
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录