Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
6f77d014
U
uni-app
项目概览
DCloud
/
uni-app
3 个月 前同步成功
通知
725
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6f77d014
编写于
8月 24, 2022
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' into alpha
上级
8080ecf1
f5e886ba
变更
13
展开全部
显示空白变更内容
内联
并排
Showing
13 changed file
with
286 addition
and
86 deletion
+286
-86
packages/uni-stat/dist/uni-cloud-stat.cjs.js
packages/uni-stat/dist/uni-cloud-stat.cjs.js
+14
-3
packages/uni-stat/dist/uni-cloud-stat.es.js
packages/uni-stat/dist/uni-cloud-stat.es.js
+14
-3
packages/uni-stat/dist/uni-stat.cjs.js
packages/uni-stat/dist/uni-stat.cjs.js
+14
-3
packages/uni-stat/dist/uni-stat.es.js
packages/uni-stat/dist/uni-stat.es.js
+14
-3
packages/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js
packages/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js
+1
-1
packages/vue-cli-plugin-uni/packages/uni-push/dist/uni-push.es.js
.../vue-cli-plugin-uni/packages/uni-push/dist/uni-push.es.js
+32
-0
packages/vue-cli-plugin-uni/packages/uni-push/dist/uni-push.plus.es.js
...cli-plugin-uni/packages/uni-push/dist/uni-push.plus.es.js
+53
-7
src/core/service/api/plugin/push.js
src/core/service/api/plugin/push.js
+28
-1
src/platforms/app-plus/view/components/cover-view/index.vue
src/platforms/app-plus/view/components/cover-view/index.vue
+13
-0
src/platforms/h5/components/app/customTabBar.vue
src/platforms/h5/components/app/customTabBar.vue
+39
-37
src/platforms/mp-toutiao/runtime/wrapper/component-parser.js
src/platforms/mp-toutiao/runtime/wrapper/component-parser.js
+34
-13
src/platforms/mp-toutiao/runtime/wrapper/page-parser.js
src/platforms/mp-toutiao/runtime/wrapper/page-parser.js
+28
-14
src/platforms/mp-toutiao/runtime/wrapper/util.js
src/platforms/mp-toutiao/runtime/wrapper/util.js
+2
-1
未找到文件。
packages/uni-stat/dist/uni-cloud-stat.cjs.js
浏览文件 @
6f77d014
...
...
@@ -474,7 +474,6 @@ const is_debug = debug;
* @param {*} data
*/
const
log
=
(
data
,
type
)
=>
{
let
msg_type
=
''
;
switch
(
data
.
lt
)
{
case
'
1
'
:
...
...
@@ -500,7 +499,7 @@ const log = (data, type) => {
// #ifdef APP
// 在 app 中,日志转为 字符串
if
(
typeof
data
===
'
object
'
)
{
if
(
typeof
data
===
'
object
'
)
{
data
=
JSON
.
stringify
(
data
);
}
// #endif
...
...
@@ -534,6 +533,17 @@ const get_report_Interval = (defaultTime) => {
return
Number
(
time
)
};
/**
* 获取隐私协议配置
*/
const
is_push_clientid
=
()
=>
{
if
(
uniStatisticsConfig
.
collectItems
)
{
const
ClientID
=
uniStatisticsConfig
.
collectItems
.
uniPushClientID
;
return
typeof
ClientID
===
'
boolean
'
?
ClientID
:
false
}
return
false
};
const
appid
=
process
.
env
.
UNI_APP_ID
;
// 做应用隔离
const
dbSet
=
(
name
,
value
)
=>
{
let
data
=
uni
.
getStorageSync
(
'
$$STAT__DBDATA:
'
+
appid
)
||
{};
...
...
@@ -1304,7 +1314,8 @@ class Stat extends Report {
* 获取推送id
*/
pushEvent
(
options
)
{
if
(
uni
.
getPushClientId
)
{
const
ClientID
=
is_push_clientid
();
if
(
uni
.
getPushClientId
&&
ClientID
)
{
uni
.
getPushClientId
({
success
:
(
res
)
=>
{
const
cid
=
res
.
cid
||
false
;
...
...
packages/uni-stat/dist/uni-cloud-stat.es.js
浏览文件 @
6f77d014
...
...
@@ -472,7 +472,6 @@ const is_debug = debug;
* @param {*} data
*/
const
log
=
(
data
,
type
)
=>
{
let
msg_type
=
''
;
switch
(
data
.
lt
)
{
case
'
1
'
:
...
...
@@ -498,7 +497,7 @@ const log = (data, type) => {
// #ifdef APP
// 在 app 中,日志转为 字符串
if
(
typeof
data
===
'
object
'
)
{
if
(
typeof
data
===
'
object
'
)
{
data
=
JSON
.
stringify
(
data
);
}
// #endif
...
...
@@ -532,6 +531,17 @@ const get_report_Interval = (defaultTime) => {
return
Number
(
time
)
};
/**
* 获取隐私协议配置
*/
const
is_push_clientid
=
()
=>
{
if
(
uniStatisticsConfig
.
collectItems
)
{
const
ClientID
=
uniStatisticsConfig
.
collectItems
.
uniPushClientID
;
return
typeof
ClientID
===
'
boolean
'
?
ClientID
:
false
}
return
false
};
const
appid
=
process
.
env
.
UNI_APP_ID
;
// 做应用隔离
const
dbSet
=
(
name
,
value
)
=>
{
let
data
=
uni
.
getStorageSync
(
'
$$STAT__DBDATA:
'
+
appid
)
||
{};
...
...
@@ -1302,7 +1312,8 @@ class Stat extends Report {
* 获取推送id
*/
pushEvent
(
options
)
{
if
(
uni
.
getPushClientId
)
{
const
ClientID
=
is_push_clientid
();
if
(
uni
.
getPushClientId
&&
ClientID
)
{
uni
.
getPushClientId
({
success
:
(
res
)
=>
{
const
cid
=
res
.
cid
||
false
;
...
...
packages/uni-stat/dist/uni-stat.cjs.js
浏览文件 @
6f77d014
...
...
@@ -453,7 +453,6 @@ const is_debug = debug;
* @param {*} data
*/
const
log
=
(
data
,
type
)
=>
{
let
msg_type
=
''
;
switch
(
data
.
lt
)
{
case
'
1
'
:
...
...
@@ -479,7 +478,7 @@ const log = (data, type) => {
// #ifdef APP
// 在 app 中,日志转为 字符串
if
(
typeof
data
===
'
object
'
)
{
if
(
typeof
data
===
'
object
'
)
{
data
=
JSON
.
stringify
(
data
);
}
// #endif
...
...
@@ -513,6 +512,17 @@ const get_report_Interval = (defaultTime) => {
return
Number
(
time
)
};
/**
* 获取隐私协议配置
*/
const
is_push_clientid
=
()
=>
{
if
(
uniStatisticsConfig
.
collectItems
)
{
const
ClientID
=
uniStatisticsConfig
.
collectItems
.
uniPushClientID
;
return
typeof
ClientID
===
'
boolean
'
?
ClientID
:
false
}
return
false
};
const
appid
=
process
.
env
.
UNI_APP_ID
;
// 做应用隔离
const
dbSet
=
(
name
,
value
)
=>
{
let
data
=
uni
.
getStorageSync
(
'
$$STAT__DBDATA:
'
+
appid
)
||
{};
...
...
@@ -1268,7 +1278,8 @@ class Stat extends Report {
* 获取推送id
*/
pushEvent
(
options
)
{
if
(
uni
.
getPushClientId
)
{
const
ClientID
=
is_push_clientid
();
if
(
uni
.
getPushClientId
&&
ClientID
)
{
uni
.
getPushClientId
({
success
:
(
res
)
=>
{
const
cid
=
res
.
cid
||
false
;
...
...
packages/uni-stat/dist/uni-stat.es.js
浏览文件 @
6f77d014
...
...
@@ -451,7 +451,6 @@ const is_debug = debug;
* @param {*} data
*/
const
log
=
(
data
,
type
)
=>
{
let
msg_type
=
''
;
switch
(
data
.
lt
)
{
case
'
1
'
:
...
...
@@ -477,7 +476,7 @@ const log = (data, type) => {
// #ifdef APP
// 在 app 中,日志转为 字符串
if
(
typeof
data
===
'
object
'
)
{
if
(
typeof
data
===
'
object
'
)
{
data
=
JSON
.
stringify
(
data
);
}
// #endif
...
...
@@ -511,6 +510,17 @@ const get_report_Interval = (defaultTime) => {
return
Number
(
time
)
};
/**
* 获取隐私协议配置
*/
const
is_push_clientid
=
()
=>
{
if
(
uniStatisticsConfig
.
collectItems
)
{
const
ClientID
=
uniStatisticsConfig
.
collectItems
.
uniPushClientID
;
return
typeof
ClientID
===
'
boolean
'
?
ClientID
:
false
}
return
false
};
const
appid
=
process
.
env
.
UNI_APP_ID
;
// 做应用隔离
const
dbSet
=
(
name
,
value
)
=>
{
let
data
=
uni
.
getStorageSync
(
'
$$STAT__DBDATA:
'
+
appid
)
||
{};
...
...
@@ -1266,7 +1276,8 @@ class Stat extends Report {
* 获取推送id
*/
pushEvent
(
options
)
{
if
(
uni
.
getPushClientId
)
{
const
ClientID
=
is_push_clientid
();
if
(
uni
.
getPushClientId
&&
ClientID
)
{
uni
.
getPushClientId
({
success
:
(
res
)
=>
{
const
cid
=
res
.
cid
||
false
;
...
...
packages/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js
浏览文件 @
6f77d014
此差异已折叠。
点击以展开。
packages/vue-cli-plugin-uni/packages/uni-push/dist/uni-push.es.js
浏览文件 @
6f77d014
...
...
@@ -103,6 +103,36 @@ var GtPush = /*@__PURE__*/getDefaultExportFromCjs(gtpushMin);
function
initPushNotification
()
{
// 仅 App 端
if
(
typeof
plus
!==
'
undefined
'
&&
plus
.
push
)
{
plus
.
globalEvent
.
addEventListener
(
'
newPath
'
,
({
path
})
=>
{
if
(
!
path
)
{
return
;
}
// 指定的页面为当前页面
const
pages
=
getCurrentPages
();
const
currentPage
=
pages
[
pages
.
length
-
1
];
if
(
currentPage
&&
currentPage
.
$page
&&
currentPage
.
$page
.
fullPath
===
path
)
{
return
;
}
// 简单起见,先尝试 navigateTo 跳转,失败后,再尝试 tabBar 跳转
uni
.
navigateTo
({
url
:
path
,
fail
(
res
)
{
if
(
res
.
errMsg
.
indexOf
(
'
tabbar
'
)
>
-
1
)
{
uni
.
switchTab
({
url
:
path
,
fail
(
res
)
{
console
.
error
(
res
.
errMsg
);
},
});
}
else
{
console
.
error
(
res
.
errMsg
);
}
},
});
});
plus
.
push
.
addEventListener
(
'
click
'
,
(
result
)
=>
{
// @ts-expect-error
uni
.
invokePushCallback
({
...
...
@@ -141,7 +171,9 @@ if (!appid) {
});
}
else
{
// #ifdef APP
initPushNotification
();
// #endif
GtPush
.
init
({
appid
,
onError
:
(
res
)
=>
{
...
...
packages/vue-cli-plugin-uni/packages/uni-push/dist/uni-push.plus.es.js
浏览文件 @
6f77d014
// @ts-expect-error
uni
.
invokePushCallback
({
type
:
'
enabled
'
,
offline
:
true
,
});
Promise
.
resolve
().
then
(()
=>
{
plus
.
push
.
setAutoNotification
&&
plus
.
push
.
setAutoNotification
(
false
);
function
initPushNotification
()
{
// 仅 App 端
if
(
typeof
plus
!==
'
undefined
'
&&
plus
.
push
)
{
plus
.
globalEvent
.
addEventListener
(
'
newPath
'
,
({
path
})
=>
{
if
(
!
path
)
{
return
;
}
// 指定的页面为当前页面
const
pages
=
getCurrentPages
();
const
currentPage
=
pages
[
pages
.
length
-
1
];
if
(
currentPage
&&
currentPage
.
$page
&&
currentPage
.
$page
.
fullPath
===
path
)
{
return
;
}
// 简单起见,先尝试 navigateTo 跳转,失败后,再尝试 tabBar 跳转
uni
.
navigateTo
({
url
:
path
,
fail
(
res
)
{
if
(
res
.
errMsg
.
indexOf
(
'
tabbar
'
)
>
-
1
)
{
uni
.
switchTab
({
url
:
path
,
fail
(
res
)
{
console
.
error
(
res
.
errMsg
);
},
});
}
else
{
console
.
error
(
res
.
errMsg
);
}
},
});
});
plus
.
push
.
addEventListener
(
'
click
'
,
(
result
)
=>
{
// @ts-expect-error
uni
.
invokePushCallback
({
...
...
@@ -12,6 +38,26 @@ Promise.resolve().then(() => {
message
:
result
,
});
});
uni
.
onPushMessage
((
res
)
=>
{
if
(
res
.
type
===
'
receive
'
&&
res
.
data
&&
res
.
data
.
force_notification
)
{
// 创建通知栏
uni
.
createPushMessage
(
res
.
data
);
res
.
stopped
=
true
;
}
});
}
}
// @ts-expect-error
uni
.
invokePushCallback
({
type
:
'
enabled
'
,
offline
:
true
,
});
Promise
.
resolve
().
then
(()
=>
{
initPushNotification
();
plus
.
push
.
setAutoNotification
&&
plus
.
push
.
setAutoNotification
(
false
);
plus
.
push
.
addEventListener
(
'
receive
'
,
(
result
)
=>
{
// @ts-expect-error
uni
.
invokePushCallback
({
...
...
src/core/service/api/plugin/push.js
浏览文件 @
6f77d014
...
...
@@ -9,6 +9,7 @@ import {
let
cid
let
cidErrMsg
let
enabled
let
offline
function
normalizePushMessage
(
message
)
{
try
{
...
...
@@ -22,6 +23,9 @@ export function invokePushCallback (
)
{
if
(
args
.
type
===
'
enabled
'
)
{
enabled
=
true
if
(
__PLATFORM__
===
'
app
'
)
{
offline
=
args
.
offline
}
}
else
if
(
args
.
type
===
'
clientId
'
)
{
cid
=
args
.
cid
cidErrMsg
=
args
.
errMsg
...
...
@@ -70,11 +74,34 @@ export function getPushClientId (args) {
const
hasSuccess
=
isFn
(
success
)
const
hasFail
=
isFn
(
fail
)
const
hasComplete
=
isFn
(
complete
)
// App 端且启用离线时,使用 getClientInfoAsync 来调用
if
(
__PLATFORM__
===
'
app
'
&&
offline
)
{
plus
.
push
.
getClientInfoAsync
(
(
info
)
=>
{
const
res
=
{
errMsg
:
'
getPushClientId:ok
'
,
cid
}
hasSuccess
&&
success
(
res
)
hasComplete
&&
complete
(
res
)
},
(
res
)
=>
{
res
=
{
errMsg
:
'
getPushClientId:fail
'
+
(
res
.
code
+
'
:
'
+
res
.
message
)
}
hasFail
&&
fail
(
res
)
hasComplete
&&
complete
(
res
)
}
)
return
}
Promise
.
resolve
().
then
(()
=>
{
if
(
typeof
enabled
===
'
undefined
'
)
{
enabled
=
false
cid
=
''
cidErrMsg
=
'
uni
p
ush is not enabled
'
cidErrMsg
=
'
uni
P
ush is not enabled
'
}
getPushCidCallbacks
.
push
((
cid
,
errMsg
)
=>
{
let
res
...
...
src/platforms/app-plus/view/components/cover-view/index.vue
浏览文件 @
6f77d014
...
...
@@ -54,5 +54,18 @@ uni-cover-view .uni-cover-view {
width
:
100%
;
height
:
100%
;
visibility
:
hidden
;
text-overflow
:
inherit
;
overflow
:
hidden
;
white-space
:
inherit
;
-webkit-align-items
:
inherit
;
align-items
:
inherit
;
-webkit-justify-content
:
inherit
;
justify-content
:
inherit
;
-webkit-flex-direction
:
inherit
;
flex-direction
:
inherit
;
-webkit-flex-wrap
:
inherit
;
flex-wrap
:
inherit
;
display
:
inherit
;
overflow
:
inherit
;
}
</
style
>
src/platforms/h5/components/app/customTabBar.vue
浏览文件 @
6f77d014
...
...
@@ -7,8 +7,9 @@
:style=
"
{'flex-direction':direction==='vertical'?'column':'row',backgroundColor:tabBarOptions.backgroundColor}"
class="uni-tabbar"
>
<template
v-for=
"(item,index) in tabBarOptions.list"
>
<div
v-for=
"(item,index) in tabBarOptions.list"
v-if=
"item.visible !== false"
:key=
"item.pagePath"
class=
"uni-tabbar__item"
@
click=
"_switchTab(item,index)"
...
...
@@ -44,6 +45,7 @@
</div>
</div>
</div>
</
template
>
</div>
</uni-tabbar>
</template>
...
...
src/platforms/mp-toutiao/runtime/wrapper/component-parser.js
浏览文件 @
6f77d014
import
{
isPage
,
initRelation
,
handleLink
handleLink
,
components
}
from
'
./util
'
import
{
...
...
@@ -11,17 +12,26 @@ import {
import
parseBaseComponent
from
'
../../../mp-weixin/runtime/wrapper/component-base-parser
'
const
components
=
[]
function
currentComponents
(
mpInstance
,
callback
)
{
const
webviewId
=
mpInstance
.
__webviewId__
const
currentComponents
=
components
[
webviewId
]
if
(
currentComponents
)
{
callback
(
currentComponents
)
}
}
export
default
function
parseComponent
(
vueOptions
)
{
const
[
componentOptions
,
VueComponent
]
=
parseBaseComponent
(
vueOptions
)
const
lifetimes
=
componentOptions
.
lifetimes
// 基础库 2.0 以上 attached 顺序错乱,按照 created 顺序强制纠正
componentOptions
.
lifetimes
.
created
=
function
created
()
{
lifetimes
.
created
=
function
created
()
{
currentComponents
(
this
,
components
=>
{
components
.
push
(
this
)
})
}
componentOptions
.
lifetimes
.
attached
=
function
attached
()
{
lifetimes
.
attached
=
function
attached
()
{
this
.
__lifetimes_attached
=
function
()
{
const
properties
=
this
.
properties
...
...
@@ -48,6 +58,7 @@ export default function parseComponent (vueOptions) {
// 触发首次 setData
this
.
$vm
.
$mount
()
}
currentComponents
(
this
,
components
=>
{
let
component
=
this
while
(
component
&&
component
.
__lifetimes_attached
&&
components
[
0
]
&&
component
===
components
[
0
])
{
components
.
shift
()
...
...
@@ -55,10 +66,20 @@ export default function parseComponent (vueOptions) {
delete
component
.
__lifetimes_attached
component
=
components
[
0
]
}
})
}
lifetimes
.
detached
=
function
detached
()
{
currentComponents
(
this
,
components
=>
{
const
index
=
components
.
indexOf
(
this
)
if
(
index
>=
0
)
{
components
.
splice
(
index
,
1
)
}
})
}
// ready 比 handleLink 还早,初始化逻辑放到 handleLink 中
delete
componentOptions
.
lifetimes
.
ready
delete
lifetimes
.
ready
componentOptions
.
methods
.
__l
=
handleLink
...
...
src/platforms/mp-toutiao/runtime/wrapper/page-parser.js
浏览文件 @
6f77d014
import
{
isPage
,
instances
,
components
,
initRelation
}
from
'
./util
'
...
...
@@ -11,8 +12,17 @@ export default function parsePage (vuePageOptions) {
isPage
,
initRelation
})
const
lifetimes
=
pageOptions
.
lifetimes
const
oldCreated
=
lifetimes
.
created
lifetimes
.
created
=
function
created
()
{
const
webviewId
=
this
.
__webviewId__
components
[
webviewId
]
=
[]
if
(
typeof
oldCreated
===
'
function
'
)
{
oldCreated
.
call
(
this
)
}
}
// 页面需要在 ready 中触发,其他组件是在 handleLink 中触发
pageOptions
.
lifetimes
.
ready
=
function
ready
()
{
lifetimes
.
ready
=
function
ready
()
{
if
(
this
.
$vm
&&
this
.
$vm
.
mpType
===
'
page
'
)
{
this
.
$vm
.
__call_hook
(
'
created
'
)
this
.
$vm
.
__call_hook
(
'
beforeMount
'
)
...
...
@@ -23,8 +33,11 @@ export default function parsePage (vuePageOptions) {
this
.
is
&&
console
.
warn
(
this
.
is
+
'
is not ready
'
)
}
}
pageOptions
.
lifetimes
.
detached
=
function
detached
()
{
const
oldDetached
=
lifetimes
.
detached
lifetimes
.
detached
=
function
detached
()
{
if
(
typeof
oldDetached
===
'
function
'
)
{
oldDetached
.
call
(
this
)
}
this
.
$vm
&&
this
.
$vm
.
$destroy
()
// 清理
const
webviewId
=
this
.
__webviewId__
...
...
@@ -33,6 +46,7 @@ export default function parsePage (vuePageOptions) {
delete
instances
[
key
]
}
})
delete
components
[
webviewId
]
}
return
pageOptions
...
...
src/platforms/mp-toutiao/runtime/wrapper/util.js
浏览文件 @
6f77d014
...
...
@@ -52,6 +52,7 @@ export function initRefs (vm) {
}
export
const
instances
=
Object
.
create
(
null
)
export
const
components
=
Object
.
create
(
null
)
export
function
initRelation
({
vuePid
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录