Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
tomleePHP
uni-app
提交
e5551fd7
U
uni-app
项目概览
tomleePHP
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e5551fd7
编写于
7月 23, 2019
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
nvue service
上级
f7ce3bf8
变更
19
显示空白变更内容
内联
并排
Showing
19 changed file
with
308 addition
and
575 deletion
+308
-575
packages/uni-app-plus-nvue/dist/index.js
packages/uni-app-plus-nvue/dist/index.js
+11
-5
packages/uni-app-plus-nvue/dist/index.legacy.js
packages/uni-app-plus-nvue/dist/index.legacy.js
+228
-219
packages/uni-app-plus-nvue/dist/uni.js
packages/uni-app-plus-nvue/dist/uni.js
+27
-153
src/platforms/app-plus-nvue/service/api.js
src/platforms/app-plus-nvue/service/api.js
+4
-0
src/platforms/app-plus-nvue/service/api/context/live-pusher.js
...latforms/app-plus-nvue/service/api/context/live-pusher.js
+2
-2
src/platforms/app-plus-nvue/service/api/context/map.js
src/platforms/app-plus-nvue/service/api/context/map.js
+2
-2
src/platforms/app-plus-nvue/service/api/context/video.js
src/platforms/app-plus-nvue/service/api/context/video.js
+2
-2
src/platforms/app-plus-nvue/service/api/index.js
src/platforms/app-plus-nvue/service/api/index.js
+3
-0
src/platforms/app-plus-nvue/service/api/util.js
src/platforms/app-plus-nvue/service/api/util.js
+0
-5
src/platforms/app-plus-nvue/services/README.md
src/platforms/app-plus-nvue/services/README.md
+0
-18
src/platforms/app-plus-nvue/services/api/legacy/api.js
src/platforms/app-plus-nvue/services/api/legacy/api.js
+3
-3
src/platforms/app-plus-nvue/services/api/legacy/index.js
src/platforms/app-plus-nvue/services/api/legacy/index.js
+2
-5
src/platforms/app-plus-nvue/services/api/post-message.js
src/platforms/app-plus-nvue/services/api/post-message.js
+0
-12
src/platforms/app-plus-nvue/services/api/sub-nvue.js
src/platforms/app-plus-nvue/services/api/sub-nvue.js
+21
-14
src/platforms/app-plus-nvue/services/api/title-nview.js
src/platforms/app-plus-nvue/services/api/title-nview.js
+2
-3
src/platforms/app-plus/service/api/context/map.js
src/platforms/app-plus/service/api/context/map.js
+0
-90
src/platforms/app-plus/service/api/context/video.js
src/platforms/app-plus/service/api/context/video.js
+0
-39
src/platforms/app-plus/service/api/index.js
src/platforms/app-plus/service/api/index.js
+0
-2
src/platforms/app-plus/service/uni.js
src/platforms/app-plus/service/uni.js
+1
-1
未找到文件。
packages/uni-app-plus-nvue/dist/index.js
浏览文件 @
e5551fd7
...
@@ -42,7 +42,9 @@ function initGlobalListeners ({
...
@@ -42,7 +42,9 @@ function initGlobalListeners ({
const
emit
=
UniServiceJSBridge
.
emit
;
const
emit
=
UniServiceJSBridge
.
emit
;
plus
.
key
.
addEventListener
(
'
backbutton
'
,
()
=>
{
plus
.
key
.
addEventListener
(
'
backbutton
'
,
()
=>
{
uni
.
navigateBack
();
uni
.
navigateBack
({
from
:
'
backbutton
'
});
});
});
plus
.
globalEvent
.
addEventListener
(
'
pause
'
,
()
=>
{
plus
.
globalEvent
.
addEventListener
(
'
pause
'
,
()
=>
{
...
@@ -341,6 +343,7 @@ function getCurrentPages () {
...
@@ -341,6 +343,7 @@ function getCurrentPages () {
*
*
*
*
*/
*/
/**
/**
* 首页需要主动registerPage,二级页面路由跳转时registerPage
* 首页需要主动registerPage,二级页面路由跳转时registerPage
*/
*/
...
@@ -361,6 +364,9 @@ function registerPage ({
...
@@ -361,6 +364,9 @@ function registerPage ({
initWebview
(
webview
,
instanceContext
,
webview
.
id
===
'
1
'
&&
routeOptions
);
initWebview
(
webview
,
instanceContext
,
webview
.
id
===
'
1
'
&&
routeOptions
);
const
route
=
path
.
slice
(
1
);
const
route
=
path
.
slice
(
1
);
webview
.
__uniapp_route
=
route
;
pages
.
push
({
pages
.
push
({
route
,
route
,
$getAppWebview
()
{
$getAppWebview
()
{
...
...
packages/uni-app-plus-nvue/dist/index.legacy.js
浏览文件 @
e5551fd7
...
@@ -174,118 +174,13 @@ function promisify (name, api) {
...
@@ -174,118 +174,13 @@ function promisify (name, api) {
}
}
}
}
const
SUCCESS
=
'
success
'
;
const
FAIL
=
'
fail
'
;
const
COMPLETE
=
'
complete
'
;
const
CALLBACKS
=
[
SUCCESS
,
FAIL
,
COMPLETE
];
const
UNIAPP_SERVICE_NVUE_ID
=
'
__uniapp__service
'
;
const
UNIAPP_SERVICE_NVUE_ID
=
'
__uniapp__service
'
;
function
noop
()
{
function
initPostMessage
(
nvue
)
{
const
plus
=
nvue
.
requireModule
(
'
plus
'
);
}
return
{
/**
postMessage
(
data
)
{
* 调用无参数,或仅一个参数且为 callback 的 API
plus
.
postMessage
(
data
,
UNIAPP_SERVICE_NVUE_ID
);
* @param {Object} vm
* @param {Object} method
* @param {Object} args
* @param {Object} extras
*/
function
invokeVmMethodWithoutArgs
(
vm
,
method
,
args
,
extras
)
{
if
(
!
vm
)
{
return
}
if
(
typeof
args
===
'
undefined
'
)
{
return
vm
[
method
]()
}
const
[,
callbacks
]
=
normalizeArgs
(
args
,
extras
);
if
(
!
Object
.
keys
(
callbacks
).
length
)
{
return
vm
[
method
]()
}
return
vm
[
method
](
normalizeCallback
(
method
,
callbacks
))
}
/**
* 调用两个参数(第一个入参为普通参数,第二个入参为 callback) API
* @param {Object} vm
* @param {Object} method
* @param {Object} args
* @param {Object} extras
*/
function
invokeVmMethod
(
vm
,
method
,
args
,
extras
)
{
if
(
!
vm
)
{
return
}
const
[
pureArgs
,
callbacks
]
=
normalizeArgs
(
args
,
extras
);
if
(
!
Object
.
keys
(
callbacks
).
length
)
{
return
vm
[
method
](
pureArgs
)
}
return
vm
[
method
](
pureArgs
,
normalizeCallback
(
method
,
callbacks
))
}
function
findRefById
(
id
,
vm
)
{
return
findRefByVNode
(
id
,
vm
.
_vnode
)
}
function
findRefByVNode
(
id
,
vnode
)
{
if
(
!
id
||
!
vnode
)
{
return
}
if
(
vnode
.
data
&&
vnode
.
data
.
ref
&&
vnode
.
data
.
attrs
&&
vnode
.
data
.
attrs
.
id
===
id
)
{
return
vnode
.
data
.
ref
}
const
children
=
vnode
.
children
;
if
(
!
children
)
{
return
}
for
(
let
i
=
0
,
len
=
children
.
length
;
i
<
len
;
i
++
)
{
const
ref
=
findRefByVNode
(
id
,
children
[
i
]);
if
(
ref
)
{
return
ref
}
}
}
function
normalizeArgs
(
args
=
{},
extras
)
{
const
callbacks
=
Object
.
create
(
null
);
const
iterator
=
function
iterator
(
name
)
{
const
callback
=
args
[
name
];
if
(
isFn
(
callback
))
{
callbacks
[
name
]
=
callback
;
delete
args
[
name
];
}
};
CALLBACKS
.
forEach
(
iterator
);
extras
&&
extras
.
forEach
(
iterator
);
return
[
args
,
callbacks
]
}
function
normalizeCallback
(
method
,
callbacks
)
{
return
function
weexCallback
(
ret
)
{
const
type
=
ret
.
type
;
delete
ret
.
type
;
const
callback
=
callbacks
[
type
];
if
(
type
===
SUCCESS
)
{
ret
.
errMsg
=
`
${
method
}
:ok`
;
}
else
if
(
type
===
FAIL
)
{
ret
.
errMsg
=
method
+
'
:fail
'
+
(
ret
.
msg
?
(
'
'
+
ret
.
msg
)
:
''
);
}
delete
ret
.
code
;
delete
ret
.
msg
;
isFn
(
callback
)
&&
callback
(
ret
);
if
(
type
===
SUCCESS
||
type
===
FAIL
)
{
const
complete
=
callbacks
[
'
complete
'
];
isFn
(
complete
)
&&
complete
(
ret
);
}
}
}
}
}
}
...
@@ -398,14 +293,7 @@ function initSubNVue (nvue, plus, BroadcastChannel) {
...
@@ -398,14 +293,7 @@ function initSubNVue (nvue, plus, BroadcastChannel) {
}
}
}
}
function
initPostMessage
(
nvue
)
{
function
noop
()
{}
const
plus
=
nvue
.
requireModule
(
'
plus
'
);
return
{
postMessage
(
data
)
{
plus
.
postMessage
(
data
,
UNIAPP_SERVICE_NVUE_ID
);
}
}
}
function
initTitleNView
(
nvue
)
{
function
initTitleNView
(
nvue
)
{
const
eventMaps
=
{
const
eventMaps
=
{
...
@@ -485,6 +373,118 @@ function initEventBus (getGlobalEmitter) {
...
@@ -485,6 +373,118 @@ function initEventBus (getGlobalEmitter) {
getEmitter
=
getGlobalEmitter
;
getEmitter
=
getGlobalEmitter
;
}
}
const
SUCCESS
=
'
success
'
;
const
FAIL
=
'
fail
'
;
const
COMPLETE
=
'
complete
'
;
const
CALLBACKS
=
[
SUCCESS
,
FAIL
,
COMPLETE
];
/**
* 调用无参数,或仅一个参数且为 callback 的 API
* @param {Object} vm
* @param {Object} method
* @param {Object} args
* @param {Object} extras
*/
function
invokeVmMethodWithoutArgs
(
vm
,
method
,
args
,
extras
)
{
if
(
!
vm
)
{
return
}
if
(
typeof
args
===
'
undefined
'
)
{
return
vm
[
method
]()
}
const
[,
callbacks
]
=
normalizeArgs
(
args
,
extras
);
if
(
!
Object
.
keys
(
callbacks
).
length
)
{
return
vm
[
method
]()
}
return
vm
[
method
](
normalizeCallback
(
method
,
callbacks
))
}
/**
* 调用两个参数(第一个入参为普通参数,第二个入参为 callback) API
* @param {Object} vm
* @param {Object} method
* @param {Object} args
* @param {Object} extras
*/
function
invokeVmMethod
(
vm
,
method
,
args
,
extras
)
{
if
(
!
vm
)
{
return
}
const
[
pureArgs
,
callbacks
]
=
normalizeArgs
(
args
,
extras
);
if
(
!
Object
.
keys
(
callbacks
).
length
)
{
return
vm
[
method
](
pureArgs
)
}
return
vm
[
method
](
pureArgs
,
normalizeCallback
(
method
,
callbacks
))
}
function
findElmById
(
id
,
vm
)
{
return
findElmByVNode
(
id
,
vm
.
_vnode
)
}
function
findElmByVNode
(
id
,
vnode
)
{
if
(
!
id
||
!
vnode
)
{
return
}
if
(
vnode
.
data
&&
vnode
.
data
.
attrs
&&
vnode
.
data
.
attrs
.
id
===
id
)
{
return
vnode
.
elm
}
const
children
=
vnode
.
children
;
if
(
!
children
)
{
return
}
for
(
let
i
=
0
,
len
=
children
.
length
;
i
<
len
;
i
++
)
{
const
elm
=
findElmByVNode
(
id
,
children
[
i
]);
if
(
elm
)
{
return
elm
}
}
}
function
normalizeArgs
(
args
=
{},
extras
)
{
const
callbacks
=
Object
.
create
(
null
);
const
iterator
=
function
iterator
(
name
)
{
const
callback
=
args
[
name
];
if
(
isFn
(
callback
))
{
callbacks
[
name
]
=
callback
;
delete
args
[
name
];
}
};
CALLBACKS
.
forEach
(
iterator
);
extras
&&
extras
.
forEach
(
iterator
);
return
[
args
,
callbacks
]
}
function
normalizeCallback
(
method
,
callbacks
)
{
return
function
weexCallback
(
ret
)
{
const
type
=
ret
.
type
;
delete
ret
.
type
;
const
callback
=
callbacks
[
type
];
if
(
type
===
SUCCESS
)
{
ret
.
errMsg
=
`
${
method
}
:ok`
;
}
else
if
(
type
===
FAIL
)
{
ret
.
errMsg
=
method
+
'
:fail
'
+
(
ret
.
msg
?
(
'
'
+
ret
.
msg
)
:
''
);
}
delete
ret
.
code
;
delete
ret
.
msg
;
isFn
(
callback
)
&&
callback
(
ret
);
if
(
type
===
SUCCESS
||
type
===
FAIL
)
{
const
complete
=
callbacks
[
'
complete
'
];
isFn
(
complete
)
&&
complete
(
ret
);
}
}
}
class
MapContext
{
class
MapContext
{
constructor
(
id
,
ctx
)
{
constructor
(
id
,
ctx
)
{
this
.
id
=
id
;
this
.
id
=
id
;
...
@@ -517,11 +517,14 @@ class MapContext {
...
@@ -517,11 +517,14 @@ class MapContext {
}
}
function
createMapContext
(
id
,
vm
)
{
function
createMapContext
(
id
,
vm
)
{
const
ref
=
findRefById
(
id
,
vm
);
if
(
!
vm
)
{
if
(
!
ref
)
{
return
global
.
nativeLog
(
'
uni.createMapContext 必须传入第二个参数,即当前 vm 对象(this)
'
,
'
__WARN
'
)
global
.
nativeLog
(
'
Can not find `
'
+
id
+
'
`
'
,
'
__WARN
'
);
}
const
elm
=
findElmById
(
id
,
vm
);
if
(
!
elm
)
{
return
global
.
nativeLog
(
'
Can not find `
'
+
id
+
'
`
'
,
'
__WARN
'
)
}
}
return
new
MapContext
(
id
,
vm
.
$refs
[
ref
]
)
return
new
MapContext
(
id
,
elm
)
}
}
class
VideoContext
{
class
VideoContext
{
...
@@ -572,11 +575,14 @@ class VideoContext {
...
@@ -572,11 +575,14 @@ class VideoContext {
}
}
function
createVideoContext
(
id
,
vm
)
{
function
createVideoContext
(
id
,
vm
)
{
const
ref
=
findRefById
(
id
,
vm
);
if
(
!
vm
)
{
if
(
!
ref
)
{
return
global
.
nativeLog
(
'
uni.createVideoContext 必须传入第二个参数,即当前 vm 对象(this)
'
,
'
__WARN
'
)
global
.
nativeLog
(
'
Can not find `
'
+
id
+
'
`
'
,
'
__WARN
'
);
}
}
return
new
VideoContext
(
id
,
vm
.
$refs
[
ref
])
const
elm
=
findElmById
(
id
,
vm
);
if
(
!
elm
)
{
return
global
.
nativeLog
(
'
Can not find `
'
+
id
+
'
`
'
,
'
__WARN
'
)
}
return
new
VideoContext
(
id
,
elm
)
}
}
class
LivePusherContext
{
class
LivePusherContext
{
...
@@ -643,11 +649,14 @@ class LivePusherContext {
...
@@ -643,11 +649,14 @@ class LivePusherContext {
}
}
function
createLivePusherContext
(
id
,
vm
)
{
function
createLivePusherContext
(
id
,
vm
)
{
const
ref
=
findRefById
(
id
,
vm
);
if
(
!
vm
)
{
if
(
!
ref
)
{
return
global
.
nativeLog
(
'
uni.createLivePusherContext 必须传入第二个参数,即当前 vm 对象(this)
'
,
'
__WARN
'
)
global
.
nativeLog
(
'
Can not find `
'
+
id
+
'
`
'
,
'
__WARN
'
);
}
const
elm
=
findElmById
(
id
,
vm
);
if
(
!
elm
)
{
return
global
.
nativeLog
(
'
Can not find `
'
+
id
+
'
`
'
,
'
__WARN
'
)
}
}
return
new
LivePusherContext
(
id
,
vm
.
$refs
[
ref
]
)
return
new
LivePusherContext
(
id
,
elm
)
}
}
...
...
packages/uni-app-plus-nvue/dist/uni.js
浏览文件 @
e5551fd7
...
@@ -2588,6 +2588,14 @@ const outOfChina = function (lng, lat) {
...
@@ -2588,6 +2588,14 @@ const outOfChina = function (lng, lat) {
return
(
lng
<
72.004
||
lng
>
137.8347
)
||
((
lat
<
0.8293
||
lat
>
55.8271
)
||
false
)
return
(
lng
<
72.004
||
lng
>
137.8347
)
||
((
lat
<
0.8293
||
lat
>
55.8271
)
||
false
)
};
};
function
requireNativePlugin
(
name
)
{
return
uni
.
requireNativePlugin
(
name
)
}
function
unpack
(
args
)
{
return
args
}
function
invoke
(...
args
)
{
function
invoke
(...
args
)
{
return
UniServiceJSBridge
.
invoke
(...
args
)
return
UniServiceJSBridge
.
invoke
(...
args
)
}
}
...
@@ -2911,133 +2919,6 @@ function getBackgroundAudioState () {
...
@@ -2911,133 +2919,6 @@ function getBackgroundAudioState () {
return
data
return
data
}
}
function
getMapCenterLocation
({
mapId
}
=
{},
callbackId
)
{
const
nativeMap
=
plus
.
maps
.
getMapById
(
mapId
+
''
);
if
(
nativeMap
)
{
nativeMap
.
getCurrentCenter
((
state
,
{
latitude
,
longitude
}
=
{})
=>
{
if
(
state
===
0
)
{
invoke
(
callbackId
,
{
latitude
,
longitude
,
errMsg
:
'
getMapCenterLocation:ok
'
});
}
else
{
invoke
(
callbackId
,
{
errMsg
:
'
getMapCenterLocation:fail:state[
'
+
state
+
'
]
'
});
}
});
}
else
{
return
{
errMsg
:
'
getMapCenterLocation:fail:地图[
'
+
mapId
+
'
]不存在
'
}
}
}
function
moveToMapLocation
({
mapId
}
=
{})
{
const
nativeMap
=
plus
.
maps
.
getMapById
(
mapId
+
''
);
if
(
nativeMap
)
{
nativeMap
.
getUserLocation
((
state
,
{
latitude
,
longitude
}
=
{})
=>
{
if
(
state
===
0
)
{
nativeMap
.
setCenter
(
new
plus
.
maps
.
Point
(
longitude
,
latitude
));
}
});
}
return
{
errMsg
:
'
moveToMapLocation:ok
'
}
}
function
getMapScale
({
mapId
}
=
{})
{
const
nativeMap
=
plus
.
maps
.
getMapById
(
mapId
+
''
);
if
(
nativeMap
)
{
return
{
scale
:
nativeMap
.
getZoom
(),
errMsg
:
'
getMapScale:ok
'
}
}
return
{
errMsg
:
'
getMapScale:fail:地图[
'
+
mapId
+
'
]不存在
'
}
}
function
getMapRegion
({
mapId
}
=
{})
{
const
nativeMap
=
plus
.
maps
.
getMapById
(
mapId
+
''
);
if
(
nativeMap
)
{
const
bounds
=
nativeMap
.
getBounds
();
const
northeast
=
bounds
.
getNorthEase
();
const
southwest
=
bounds
.
getSouthWest
();
return
{
northeast
:
{
latitude
:
northeast
.
getLat
(),
longitude
:
northeast
.
getLng
()
},
southwest
:
{
latitude
:
southwest
.
getLat
(),
longitude
:
southwest
.
getLng
()
},
errMsg
:
'
getMapRegion:ok
'
}
}
return
{
errMsg
:
'
getMapRegion:fail:地图[
'
+
mapId
+
'
]不存在
'
}
}
function
operateVideoPlayer
({
data
,
videoPlayerId
,
type
})
{
const
nativeVideo
=
plus
.
video
.
getVideoPlayerById
(
videoPlayerId
+
''
);
if
(
nativeVideo
)
{
switch
(
type
)
{
case
'
play
'
:
case
'
pause
'
:
case
'
stop
'
:
case
'
requestFullScreen
'
:
case
'
exitFullScreen
'
:
case
'
seek
'
:
case
'
playbackRate
'
:
case
'
showStatusBar
'
:
nativeVideo
[
type
].
apply
(
nativeVideo
,
data
);
return
{
errMsg
:
'
operateVideoPlayer:ok
'
}
case
'
sendDanmu
'
:
nativeVideo
.
sendDanmu
({
text
:
data
[
0
],
color
:
data
[
1
]
});
return
{
errMsg
:
'
operateVideoPlayer:ok
'
}
default
:
return
{
errMsg
:
'
operateVideoPlayer:fail:暂不支持[
'
+
type
+
'
]
'
}
}
}
else
{
return
{
errMsg
:
'
operateVideoPlayer:fail:视频组件[
'
+
videoPlayerId
+
'
]不存在
'
}
}
}
const
DEVICE_FREQUENCY
=
200
;
const
DEVICE_FREQUENCY
=
200
;
const
NETWORK_TYPES
=
[
'
unknown
'
,
'
none
'
,
'
ethernet
'
,
'
wifi
'
,
'
2g
'
,
'
3g
'
,
'
4g
'
];
const
NETWORK_TYPES
=
[
'
unknown
'
,
'
none
'
,
'
ethernet
'
,
'
wifi
'
,
'
2g
'
,
'
3g
'
,
'
4g
'
];
...
@@ -3469,7 +3350,7 @@ function setKeepScreenOn ({
...
@@ -3469,7 +3350,7 @@ function setKeepScreenOn ({
}
}
function
getClipboardData
(
options
,
callbackId
)
{
function
getClipboardData
(
options
,
callbackId
)
{
const
clipboard
=
weex
.
requireModule
(
'
clipboard
'
);
const
clipboard
=
requireNativePlugin
(
'
clipboard
'
);
clipboard
.
getString
(
ret
=>
{
clipboard
.
getString
(
ret
=>
{
if
(
ret
.
result
===
'
success
'
)
{
if
(
ret
.
result
===
'
success
'
)
{
invoke
(
callbackId
,
{
invoke
(
callbackId
,
{
...
@@ -3488,7 +3369,7 @@ function getClipboardData (options, callbackId) {
...
@@ -3488,7 +3369,7 @@ function getClipboardData (options, callbackId) {
function
setClipboardData
({
function
setClipboardData
({
data
data
})
{
})
{
const
clipboard
=
weex
.
requireModule
(
'
clipboard
'
);
const
clipboard
=
requireNativePlugin
(
'
clipboard
'
);
clipboard
.
setString
(
data
);
clipboard
.
setString
(
data
);
return
{
return
{
errMsg
:
'
setClipboardData:ok
'
errMsg
:
'
setClipboardData:ok
'
...
@@ -3884,7 +3765,7 @@ let initView = function () {
...
@@ -3884,7 +3765,7 @@ let initView = function () {
view
.
interceptTouchEvent
(
true
);
view
.
interceptTouchEvent
(
true
);
view
.
addEventListener
(
'
click
'
,
(
e
)
=>
{
view
.
addEventListener
(
'
click
'
,
(
e
)
=>
{
if
(
!
__
wx
Config
.
__ready__
)
{
// 未 ready,不允许点击
if
(
!
__
uni
Config
.
__ready__
)
{
// 未 ready,不允许点击
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
console
.
log
(
`UNIAPP[tabbar].prevent`
);
console
.
log
(
`UNIAPP[tabbar].prevent`
);
}
}
...
@@ -5305,7 +5186,7 @@ const createDownloadTaskById = function (downloadTaskId, {
...
@@ -5305,7 +5186,7 @@ const createDownloadTaskById = function (downloadTaskId, {
header
header
}
=
{})
{
}
=
{})
{
const
downloader
=
plus
.
downloader
.
createDownload
(
url
,
{
const
downloader
=
plus
.
downloader
.
createDownload
(
url
,
{
time
:
__
wxConfig
.
networkTimeout
.
downloadFile
?
__wx
Config
.
networkTimeout
.
downloadFile
/
1000
:
120
,
time
:
__
uniConfig
.
networkTimeout
.
downloadFile
?
__uni
Config
.
networkTimeout
.
downloadFile
/
1000
:
120
,
filename
:
TEMP_PATH
+
'
/download/
'
,
filename
:
TEMP_PATH
+
'
/download/
'
,
// 需要与其它平台上的表现保持一致,不走重试的逻辑。
// 需要与其它平台上的表现保持一致,不走重试的逻辑。
retry
:
0
,
retry
:
0
,
...
@@ -5455,13 +5336,11 @@ function createRequestTaskById (requestTaskId, {
...
@@ -5455,13 +5336,11 @@ function createRequestTaskById (requestTaskId, {
if
(
!
hasContentType
&&
method
===
'
POST
'
)
{
if
(
!
hasContentType
&&
method
===
'
POST
'
)
{
xhr
.
setRequestHeader
(
'
Content-Type
'
,
'
application/x-www-form-urlencoded; charset=UTF-8
'
);
xhr
.
setRequestHeader
(
'
Content-Type
'
,
'
application/x-www-form-urlencoded; charset=UTF-8
'
);
}
}
if
(
__
wx
Config
.
crossDomain
===
true
)
{
if
(
__
uni
Config
.
crossDomain
===
true
)
{
xhr
.
setRequestHeader
(
'
User-Agent
'
,
USER_AGENT
);
xhr
.
setRequestHeader
(
'
User-Agent
'
,
USER_AGENT
);
}
}
if
(
__wxConfig
.
appid
&&
__wxConfig
.
crossDomain
===
true
)
{
xhr
.
setRequestHeader
(
'
Referer
'
,
`https://servicewechat.com/
${
__wxConfig
.
appid
}
/1/`
);
if
(
__uniConfig
.
networkTimeout
.
request
)
{
}
if
(
__wxConfig
.
networkTimeout
.
request
)
{
abortTimeout
=
setTimeout
(()
=>
{
abortTimeout
=
setTimeout
(()
=>
{
xhr
.
onreadystatechange
=
null
;
xhr
.
onreadystatechange
=
null
;
xhr
.
abort
();
xhr
.
abort
();
...
@@ -5472,7 +5351,7 @@ function createRequestTaskById (requestTaskId, {
...
@@ -5472,7 +5351,7 @@ function createRequestTaskById (requestTaskId, {
statusCode
:
0
,
statusCode
:
0
,
errMsg
:
'
timeout
'
errMsg
:
'
timeout
'
});
});
},
__
wx
Config
.
networkTimeout
.
request
);
},
__
uni
Config
.
networkTimeout
.
request
);
}
}
if
(
typeof
data
!==
'
string
'
&&
method
===
'
GET
'
)
{
if
(
typeof
data
!==
'
string
'
&&
method
===
'
GET
'
)
{
...
@@ -5528,7 +5407,7 @@ const createSocketTaskById = function (socketTaskId, {
...
@@ -5528,7 +5407,7 @@ const createSocketTaskById = function (socketTaskId, {
protocols
protocols
}
=
{})
{
}
=
{})
{
// fixed by hxy 需要测试是否支持 arraybuffer
// fixed by hxy 需要测试是否支持 arraybuffer
const
socket
=
weex
.
requireModule
(
'
webSocket
'
);
const
socket
=
requireNativePlugin
(
'
webSocket
'
);
socket
.
WebSocket
(
url
,
Array
.
isArray
(
protocols
)
?
protocols
.
join
(
'
,
'
)
:
protocols
);
socket
.
WebSocket
(
url
,
Array
.
isArray
(
protocols
)
?
protocols
.
join
(
'
,
'
)
:
protocols
);
// socket.binaryType = 'arraybuffer'
// socket.binaryType = 'arraybuffer'
socketTasks
[
socketTaskId
]
=
socket
;
socketTasks
[
socketTaskId
]
=
socket
;
...
@@ -5576,7 +5455,7 @@ function operateSocketTask (args) {
...
@@ -5576,7 +5455,7 @@ function operateSocketTask (args) {
code
,
code
,
data
,
data
,
socketTaskId
socketTaskId
}
=
PlusNativeBuffer
.
unpack
(
args
);
}
=
unpack
(
args
);
const
socket
=
socketTasks
[
socketTaskId
];
const
socket
=
socketTasks
[
socketTaskId
];
if
(
!
socket
)
{
if
(
!
socket
)
{
return
{
return
{
...
@@ -5619,7 +5498,7 @@ const createUploadTaskById = function (uploadTaskId, {
...
@@ -5619,7 +5498,7 @@ const createUploadTaskById = function (uploadTaskId, {
formData
formData
}
=
{})
{
}
=
{})
{
const
uploader
=
plus
.
uploader
.
createUpload
(
url
,
{
const
uploader
=
plus
.
uploader
.
createUpload
(
url
,
{
timeout
:
__
wxConfig
.
networkTimeout
.
uploadFile
?
__wx
Config
.
networkTimeout
.
uploadFile
/
1000
:
120
,
timeout
:
__
uniConfig
.
networkTimeout
.
uploadFile
?
__uni
Config
.
networkTimeout
.
uploadFile
/
1000
:
120
,
// 需要与其它平台上的表现保持一致,不走重试的逻辑。
// 需要与其它平台上的表现保持一致,不走重试的逻辑。
retry
:
0
,
retry
:
0
,
retryInterval
:
0
retryInterval
:
0
...
@@ -6084,7 +5963,7 @@ function shareAppMessageDirectly ({
...
@@ -6084,7 +5963,7 @@ function shareAppMessageDirectly ({
imageUrl
,
imageUrl
,
useDefaultSnapshot
useDefaultSnapshot
},
callbackId
)
{
},
callbackId
)
{
title
=
title
||
__
wx
Config
.
appname
;
title
=
title
||
__
uni
Config
.
appname
;
const
goShare
=
()
=>
{
const
goShare
=
()
=>
{
share
({
share
({
provider
:
'
weixin
'
,
provider
:
'
weixin
'
,
...
@@ -6539,21 +6418,12 @@ function showTabBar$2 ({
...
@@ -6539,21 +6418,12 @@ function showTabBar$2 ({
var
api$1
=
/*#__PURE__*/
Object
.
freeze
({
var
api$1
=
/*#__PURE__*/
Object
.
freeze
({
startPullDownRefresh
:
startPullDownRefresh$1
,
startPullDownRefresh
:
startPullDownRefresh$1
,
stopPullDownRefresh
:
stopPullDownRefresh$1
,
stopPullDownRefresh
:
stopPullDownRefresh$1
,
startRecord
:
startRecord
,
chooseImage
:
chooseImage$1
,
stopRecord
:
stopRecord
,
playVoice
:
playVoice
,
pauseVoice
:
pauseVoice
,
stopVoice
:
stopVoice
,
createAudioInstance
:
createAudioInstance
,
createAudioInstance
:
createAudioInstance
,
destroyAudioInstance
:
destroyAudioInstance
,
destroyAudioInstance
:
destroyAudioInstance
,
setAudioState
:
setAudioState
,
setAudioState
:
setAudioState
,
getAudioState
:
getAudioState
,
getAudioState
:
getAudioState
,
operateAudio
:
operateAudio
,
operateAudio
:
operateAudio
,
getMapCenterLocation
:
getMapCenterLocation
,
moveToMapLocation
:
moveToMapLocation
,
getMapScale
:
getMapScale
,
getMapRegion
:
getMapRegion
,
operateVideoPlayer
:
operateVideoPlayer
,
enableAccelerometer
:
enableAccelerometer
,
enableAccelerometer
:
enableAccelerometer
,
addPhoneContact
:
addPhoneContact
,
addPhoneContact
:
addPhoneContact
,
openBluetoothAdapter
:
openBluetoothAdapter
,
openBluetoothAdapter
:
openBluetoothAdapter
,
...
@@ -6599,12 +6469,16 @@ var api$1 = /*#__PURE__*/Object.freeze({
...
@@ -6599,12 +6469,16 @@ var api$1 = /*#__PURE__*/Object.freeze({
chooseLocation
:
chooseLocation
,
chooseLocation
:
chooseLocation
,
getLocation
:
getLocation$1
,
getLocation
:
getLocation$1
,
openLocation
:
openLocation$1
,
openLocation
:
openLocation$1
,
startRecord
:
startRecord
,
stopRecord
:
stopRecord
,
playVoice
:
playVoice
,
pauseVoice
:
pauseVoice
,
stopVoice
:
stopVoice
,
getMusicPlayerState
:
getMusicPlayerState
,
getMusicPlayerState
:
getMusicPlayerState
,
operateMusicPlayer
:
operateMusicPlayer
,
operateMusicPlayer
:
operateMusicPlayer
,
setBackgroundAudioState
:
setBackgroundAudioState
,
setBackgroundAudioState
:
setBackgroundAudioState
,
operateBackgroundAudio
:
operateBackgroundAudio
,
operateBackgroundAudio
:
operateBackgroundAudio
,
getBackgroundAudioState
:
getBackgroundAudioState
,
getBackgroundAudioState
:
getBackgroundAudioState
,
chooseImage
:
chooseImage$1
,
chooseVideo
:
chooseVideo$1
,
chooseVideo
:
chooseVideo$1
,
compressImage
:
compressImage
,
compressImage
:
compressImage
,
getImageInfo
:
getImageInfo$1
,
getImageInfo
:
getImageInfo$1
,
...
...
src/platforms/app-plus-nvue/service/api.js
0 → 100644
浏览文件 @
e5551fd7
import
*
as
appApi
from
'
../../app-plus/service/api/index
'
import
*
as
nvueApi
from
'
./api/index
'
export
default
Object
.
assign
(
appApi
,
nvueApi
)
src/platforms/app-plus-nvue/service
s
/api/context/live-pusher.js
→
src/platforms/app-plus-nvue/service/api/context/live-pusher.js
浏览文件 @
e5551fd7
...
@@ -69,11 +69,11 @@ class LivePusherContext {
...
@@ -69,11 +69,11 @@ class LivePusherContext {
export
function
createLivePusherContext
(
id
,
vm
)
{
export
function
createLivePusherContext
(
id
,
vm
)
{
if
(
!
vm
)
{
if
(
!
vm
)
{
global
.
nativeLog
(
'
uni.createLivePusherContext 必须传入第二个参数,即当前 vm 对象(this)
'
,
'
__WARN
'
)
return
global
.
nativeLog
(
'
uni.createLivePusherContext 必须传入第二个参数,即当前 vm 对象(this)
'
,
'
__WARN
'
)
}
}
const
elm
=
findElmById
(
id
,
vm
)
const
elm
=
findElmById
(
id
,
vm
)
if
(
!
elm
)
{
if
(
!
elm
)
{
global
.
nativeLog
(
'
Can not find `
'
+
id
+
'
`
'
,
'
__WARN
'
)
return
global
.
nativeLog
(
'
Can not find `
'
+
id
+
'
`
'
,
'
__WARN
'
)
}
}
return
new
LivePusherContext
(
id
,
elm
)
return
new
LivePusherContext
(
id
,
elm
)
}
}
src/platforms/app-plus-nvue/service
s
/api/context/map.js
→
src/platforms/app-plus-nvue/service/api/context/map.js
浏览文件 @
e5551fd7
...
@@ -37,11 +37,11 @@ class MapContext {
...
@@ -37,11 +37,11 @@ class MapContext {
export
function
createMapContext
(
id
,
vm
)
{
export
function
createMapContext
(
id
,
vm
)
{
if
(
!
vm
)
{
if
(
!
vm
)
{
global
.
nativeLog
(
'
uni.createMapContext 必须传入第二个参数,即当前 vm 对象(this)
'
,
'
__WARN
'
)
return
global
.
nativeLog
(
'
uni.createMapContext 必须传入第二个参数,即当前 vm 对象(this)
'
,
'
__WARN
'
)
}
}
const
elm
=
findElmById
(
id
,
vm
)
const
elm
=
findElmById
(
id
,
vm
)
if
(
!
elm
)
{
if
(
!
elm
)
{
global
.
nativeLog
(
'
Can not find `
'
+
id
+
'
`
'
,
'
__WARN
'
)
return
global
.
nativeLog
(
'
Can not find `
'
+
id
+
'
`
'
,
'
__WARN
'
)
}
}
return
new
MapContext
(
id
,
elm
)
return
new
MapContext
(
id
,
elm
)
}
}
src/platforms/app-plus-nvue/service
s
/api/context/video.js
→
src/platforms/app-plus-nvue/service/api/context/video.js
浏览文件 @
e5551fd7
...
@@ -53,11 +53,11 @@ class VideoContext {
...
@@ -53,11 +53,11 @@ class VideoContext {
export
function
createVideoContext
(
id
,
vm
)
{
export
function
createVideoContext
(
id
,
vm
)
{
if
(
!
vm
)
{
if
(
!
vm
)
{
global
.
nativeLog
(
'
uni.createVideoContext 必须传入第二个参数,即当前 vm 对象(this)
'
,
'
__WARN
'
)
return
global
.
nativeLog
(
'
uni.createVideoContext 必须传入第二个参数,即当前 vm 对象(this)
'
,
'
__WARN
'
)
}
}
const
elm
=
findElmById
(
id
,
vm
)
const
elm
=
findElmById
(
id
,
vm
)
if
(
!
elm
)
{
if
(
!
elm
)
{
global
.
nativeLog
(
'
Can not find `
'
+
id
+
'
`
'
,
'
__WARN
'
)
return
global
.
nativeLog
(
'
Can not find `
'
+
id
+
'
`
'
,
'
__WARN
'
)
}
}
return
new
VideoContext
(
id
,
elm
)
return
new
VideoContext
(
id
,
elm
)
}
}
src/platforms/app-plus-nvue/service/api/index.js
0 → 100644
浏览文件 @
e5551fd7
export
*
from
'
./context/live-pusher
'
export
*
from
'
./context/map
'
export
*
from
'
./context/video
'
src/platforms/app-plus-nvue/service
s
/api/util.js
→
src/platforms/app-plus-nvue/service/api/util.js
浏览文件 @
e5551fd7
...
@@ -7,11 +7,6 @@ const FAIL = 'fail'
...
@@ -7,11 +7,6 @@ const FAIL = 'fail'
const
COMPLETE
=
'
complete
'
const
COMPLETE
=
'
complete
'
const
CALLBACKS
=
[
SUCCESS
,
FAIL
,
COMPLETE
]
const
CALLBACKS
=
[
SUCCESS
,
FAIL
,
COMPLETE
]
export
const
UNIAPP_SERVICE_NVUE_ID
=
'
__uniapp__service
'
export
function
noop
()
{
}
/**
/**
* 调用无参数,或仅一个参数且为 callback 的 API
* 调用无参数,或仅一个参数且为 callback 的 API
* @param {Object} vm
* @param {Object} vm
...
...
src/platforms/app-plus-nvue/services/README.md
已删除
100644 → 0
浏览文件 @
f7ce3bf8
uni.navigateTo(plus.webview.open)
旧页面通过 viewdisappear 触发 onHide
新页面通过 beforeCreate 触发 onShow
uni.redirectTo(page.webview.close,plus.webview.show)
旧页面通过 beforeDestroy 触发 onUnload
新页面通过 beforeCreate 触发 onShow
uni.switchTab
旧非 Tab 页面通过 beforeDestroy 触发 onUnload
旧 Tab 页面通过 viewdisappear 触发 onHide
新创建 Tab 页面通过 beforeCreate 触发 onShow
新显示 Tab 页面通过 viewdisappear 触发 onShow
uni.reLaunch
旧页面通过 beforeDestroy 触发 onUnload
新页面通过 beforeCreate 触发 onShow
\ No newline at end of file
src/platforms/app-plus-nvue/services/api/legacy/api.js
浏览文件 @
e5551fd7
...
@@ -11,6 +11,6 @@ export {
...
@@ -11,6 +11,6 @@ export {
}
}
from
'
../event-bus
'
from
'
../event-bus
'
export
*
from
'
../
context/map
'
export
*
from
'
../
../../service/api/context/map
'
export
*
from
'
../
context/video
'
export
*
from
'
../
../../service/api/context/video
'
export
*
from
'
../context/live-pusher
'
export
*
from
'
../
../../service/api/
context/live-pusher
'
src/platforms/app-plus-nvue/services/api/legacy/index.js
浏览文件 @
e5551fd7
...
@@ -7,12 +7,9 @@ import {
...
@@ -7,12 +7,9 @@ import {
}
from
'
uni-core/helpers/promise
'
}
from
'
uni-core/helpers/promise
'
import
{
import
{
initSubNVue
initSubNVue
,
}
from
'
../sub-nvue
'
import
{
initPostMessage
initPostMessage
}
from
'
../
post-messag
e
'
}
from
'
../
sub-nvu
e
'
import
{
import
{
initTitleNView
initTitleNView
...
...
src/platforms/app-plus-nvue/services/api/post-message.js
已删除
100644 → 0
浏览文件 @
f7ce3bf8
import
{
UNIAPP_SERVICE_NVUE_ID
}
from
'
./util
'
export
function
initPostMessage
(
nvue
)
{
const
plus
=
nvue
.
requireModule
(
'
plus
'
)
return
{
postMessage
(
data
)
{
plus
.
postMessage
(
data
,
UNIAPP_SERVICE_NVUE_ID
)
}
}
}
src/platforms/app-plus-nvue/services/api/sub-nvue.js
浏览文件 @
e5551fd7
import
{
const
UNIAPP_SERVICE_NVUE_ID
=
'
__uniapp__service
'
UNIAPP_SERVICE_NVUE_ID
}
from
'
./util
'
export
function
initPostMessage
(
nvue
)
{
const
plus
=
nvue
.
requireModule
(
'
plus
'
)
return
{
postMessage
(
data
)
{
plus
.
postMessage
(
data
,
UNIAPP_SERVICE_NVUE_ID
)
}
}
}
export
function
initSubNVue
(
nvue
,
plus
,
BroadcastChannel
)
{
export
function
initSubNVue
(
nvue
,
plus
,
BroadcastChannel
)
{
let
origin
let
origin
...
...
src/platforms/app-plus-nvue/services/api/title-nview.js
浏览文件 @
e5551fd7
import
{
function
noop
()
{}
noop
}
from
'
./util
'
export
function
initTitleNView
(
nvue
)
{
export
function
initTitleNView
(
nvue
)
{
const
eventMaps
=
{
const
eventMaps
=
{
onNavigationBarButtonTap
:
noop
,
onNavigationBarButtonTap
:
noop
,
...
...
src/platforms/app-plus/service/api/context/map.js
已删除
100644 → 0
浏览文件 @
f7ce3bf8
import
{
invoke
}
from
'
../../bridge
'
export
function
getMapCenterLocation
({
mapId
}
=
{},
callbackId
)
{
const
nativeMap
=
plus
.
maps
.
getMapById
(
mapId
+
''
)
if
(
nativeMap
)
{
nativeMap
.
getCurrentCenter
((
state
,
{
latitude
,
longitude
}
=
{})
=>
{
if
(
state
===
0
)
{
invoke
(
callbackId
,
{
latitude
,
longitude
,
errMsg
:
'
getMapCenterLocation:ok
'
})
}
else
{
invoke
(
callbackId
,
{
errMsg
:
'
getMapCenterLocation:fail:state[
'
+
state
+
'
]
'
})
}
})
}
else
{
return
{
errMsg
:
'
getMapCenterLocation:fail:地图[
'
+
mapId
+
'
]不存在
'
}
}
}
export
function
moveToMapLocation
({
mapId
}
=
{})
{
const
nativeMap
=
plus
.
maps
.
getMapById
(
mapId
+
''
)
if
(
nativeMap
)
{
nativeMap
.
getUserLocation
((
state
,
{
latitude
,
longitude
}
=
{})
=>
{
if
(
state
===
0
)
{
nativeMap
.
setCenter
(
new
plus
.
maps
.
Point
(
longitude
,
latitude
))
}
})
}
return
{
errMsg
:
'
moveToMapLocation:ok
'
}
}
export
function
getMapScale
({
mapId
}
=
{})
{
const
nativeMap
=
plus
.
maps
.
getMapById
(
mapId
+
''
)
if
(
nativeMap
)
{
return
{
scale
:
nativeMap
.
getZoom
(),
errMsg
:
'
getMapScale:ok
'
}
}
return
{
errMsg
:
'
getMapScale:fail:地图[
'
+
mapId
+
'
]不存在
'
}
}
export
function
getMapRegion
({
mapId
}
=
{})
{
const
nativeMap
=
plus
.
maps
.
getMapById
(
mapId
+
''
)
if
(
nativeMap
)
{
const
bounds
=
nativeMap
.
getBounds
()
const
northeast
=
bounds
.
getNorthEase
()
const
southwest
=
bounds
.
getSouthWest
()
return
{
northeast
:
{
latitude
:
northeast
.
getLat
(),
longitude
:
northeast
.
getLng
()
},
southwest
:
{
latitude
:
southwest
.
getLat
(),
longitude
:
southwest
.
getLng
()
},
errMsg
:
'
getMapRegion:ok
'
}
}
return
{
errMsg
:
'
getMapRegion:fail:地图[
'
+
mapId
+
'
]不存在
'
}
}
src/platforms/app-plus/service/api/context/video.js
已删除
100644 → 0
浏览文件 @
f7ce3bf8
export
function
operateVideoPlayer
({
data
,
videoPlayerId
,
type
})
{
const
nativeVideo
=
plus
.
video
.
getVideoPlayerById
(
videoPlayerId
+
''
)
if
(
nativeVideo
)
{
switch
(
type
)
{
case
'
play
'
:
case
'
pause
'
:
case
'
stop
'
:
case
'
requestFullScreen
'
:
case
'
exitFullScreen
'
:
case
'
seek
'
:
case
'
playbackRate
'
:
case
'
showStatusBar
'
:
nativeVideo
[
type
].
apply
(
nativeVideo
,
data
)
return
{
errMsg
:
'
operateVideoPlayer:ok
'
}
case
'
sendDanmu
'
:
nativeVideo
.
sendDanmu
({
text
:
data
[
0
],
color
:
data
[
1
]
})
return
{
errMsg
:
'
operateVideoPlayer:ok
'
}
default
:
return
{
errMsg
:
'
operateVideoPlayer:fail:暂不支持[
'
+
type
+
'
]
'
}
}
}
else
{
return
{
errMsg
:
'
operateVideoPlayer:fail:视频组件[
'
+
videoPlayerId
+
'
]不存在
'
}
}
}
src/platforms/app-plus/service/api/index.js
浏览文件 @
e5551fd7
export
*
from
'
./context/audio
'
export
*
from
'
./context/audio
'
export
*
from
'
./context/background-audio
'
export
*
from
'
./context/background-audio
'
export
*
from
'
./context/map
'
export
*
from
'
./context/video
'
export
*
from
'
./device/accelerometer
'
export
*
from
'
./device/accelerometer
'
export
*
from
'
./device/add-phone-contact
'
export
*
from
'
./device/add-phone-contact
'
...
...
src/platforms/app-plus/service/uni.js
浏览文件 @
e5551fd7
...
@@ -13,7 +13,7 @@ import {
...
@@ -13,7 +13,7 @@ import {
import
baseApi
from
'
uni-core/service/api
'
import
baseApi
from
'
uni-core/service/api
'
import
platformApi
from
'
.
/api
'
import
platformApi
from
'
uni-platform/service
/api
'
const
api
=
Object
.
create
(
null
)
const
api
=
Object
.
create
(
null
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录