Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
d436f272
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,发现更多精彩内容 >>
提交
d436f272
编写于
5月 18, 2021
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: context PageVm
上级
6809dbef
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
38 addition
and
47 deletion
+38
-47
packages/uni-api/src/service/context/canvas.ts
packages/uni-api/src/service/context/canvas.ts
+7
-6
packages/uni-api/src/service/context/createMapContext.ts
packages/uni-api/src/service/context/createMapContext.ts
+13
-14
packages/uni-api/src/service/context/createVideoContext.ts
packages/uni-api/src/service/context/createVideoContext.ts
+16
-17
packages/uni-h5/src/service/api/context/operateMap.ts
packages/uni-h5/src/service/api/context/operateMap.ts
+1
-5
packages/uni-h5/src/service/api/context/operateVideoPlayer.ts
...ages/uni-h5/src/service/api/context/operateVideoPlayer.ts
+1
-5
未找到文件。
packages/uni-api/src/service/context/canvas.ts
浏览文件 @
d436f272
...
...
@@ -28,7 +28,8 @@ import type {
import
{
hasOwn
}
from
'
@vue/shared
'
import
{
getCurrentPageId
,
getPageIdByVm
,
getCurrentPageVm
,
createCallbacks
,
ServiceJSBridge
,
}
from
'
@dcloudio/uni-core
'
...
...
@@ -1005,9 +1006,9 @@ export const createCanvasContext =
API_CREATE_CANVAS_CONTEXT
,
(
canvasId
,
componentInstance
):
any
=>
{
if
(
componentInstance
)
{
return
new
CanvasContext
(
canvasId
,
componentInstance
.
$page
.
id
)
return
new
CanvasContext
(
canvasId
,
getPageIdByVm
(
componentInstance
)
!
)
}
const
pageId
=
get
CurrentPageId
()
const
pageId
=
get
PageIdByVm
(
getCurrentPageVm
()
!
)
!
if
(
pageId
)
{
return
new
CanvasContext
(
canvasId
,
pageId
)
}
else
{
...
...
@@ -1021,7 +1022,7 @@ export const canvasGetImageData =
defineAsyncApi
<
API_TYPE_CANVAS_GET_IMAGE_DATA
>
(
API_CANVAS_GET_IMAGE_DATA
,
({
canvasId
,
x
,
y
,
width
,
height
},
{
resolve
,
reject
})
=>
{
const
pageId
=
get
CurrentPageId
()
const
pageId
=
get
PageIdByVm
(
getCurrentPageVm
()
!
)
!
if
(
!
pageId
)
{
reject
()
return
...
...
@@ -1056,7 +1057,7 @@ export const canvasPutImageData =
defineAsyncApi
<
API_TYPE_CANVAS_PUT_IMAGE_DATA
>
(
API_CANVAS_PUT_IMAGE_DATA
,
async
({
canvasId
,
data
,
x
,
y
,
width
,
height
},
{
resolve
,
reject
})
=>
{
var
pageId
=
get
CurrentPageId
()
var
pageId
=
get
PageIdByVm
(
getCurrentPageVm
()
!
)
!
if
(
!
pageId
)
{
reject
()
return
...
...
@@ -1111,7 +1112,7 @@ export const canvasToTempFilePath =
},
{
resolve
,
reject
}
)
=>
{
var
pageId
=
get
CurrentPageId
()
var
pageId
=
get
PageIdByVm
(
getCurrentPageVm
()
!
)
!
if
(
!
pageId
)
{
reject
()
return
...
...
packages/uni-api/src/service/context/createMapContext.ts
浏览文件 @
d436f272
import
{
ComponentPublicInstance
}
from
'
vue
'
import
{
getCurrentPageVm
}
from
'
@dcloudio/uni-core
'
import
{
getPageIdByVm
,
getCurrentPageVm
}
from
'
@dcloudio/uni-core
'
import
{
operateMap
}
from
'
@dcloudio/uni-platform
'
import
{
defineSyncApi
}
from
'
../../helpers/api
'
import
{
...
...
@@ -8,30 +7,30 @@ import {
CreateMapContextProtocol
,
}
from
'
../../protocols/context/context
'
class
MapContext
implements
UniApp
.
MapContext
{
export
class
MapContext
implements
UniApp
.
MapContext
{
private
id
:
string
private
vm
:
ComponentPublicInstance
constructor
(
id
:
string
,
vm
:
ComponentPublicInstance
)
{
private
pageId
:
number
constructor
(
id
:
string
,
pageId
:
number
)
{
this
.
id
=
id
this
.
vm
=
vm
this
.
pageId
=
pageId
}
getCenterLocation
(
options
:
any
)
{
operateMap
(
this
.
id
,
this
.
vm
,
'
getCenterLocation
'
,
options
)
operateMap
(
this
.
id
,
this
.
pageId
,
'
getCenterLocation
'
,
options
)
}
moveToLocation
()
{
operateMap
(
this
.
id
,
this
.
vm
,
'
moveToLocation
'
)
operateMap
(
this
.
id
,
this
.
pageId
,
'
moveToLocation
'
)
}
getScale
(
options
:
any
)
{
operateMap
(
this
.
id
,
this
.
vm
,
'
getScale
'
,
options
)
operateMap
(
this
.
id
,
this
.
pageId
,
'
getScale
'
,
options
)
}
getRegion
(
options
:
any
)
{
operateMap
(
this
.
id
,
this
.
vm
,
'
getRegion
'
,
options
)
operateMap
(
this
.
id
,
this
.
pageId
,
'
getRegion
'
,
options
)
}
includePoints
(
options
:
any
)
{
operateMap
(
this
.
id
,
this
.
vm
,
'
includePoints
'
,
options
)
operateMap
(
this
.
id
,
this
.
pageId
,
'
includePoints
'
,
options
)
}
translateMarker
(
options
:
any
)
{
operateMap
(
this
.
id
,
this
.
vm
,
'
translateMarker
'
,
options
)
operateMap
(
this
.
id
,
this
.
pageId
,
'
translateMarker
'
,
options
)
}
addCustomLayer
()
{}
removeCustomLayer
()
{}
...
...
@@ -50,9 +49,9 @@ export const createMapContext = <API_TYPE_CREATE_MAP_CONTEXT>defineSyncApi(
API_CREATE_MAP_CONTEXT
,
(
id
,
context
)
=>
{
if
(
context
)
{
return
new
MapContext
(
id
,
context
)
return
new
MapContext
(
id
,
getPageIdByVm
(
context
)
!
)
}
return
new
MapContext
(
id
,
get
CurrentPageVm
(
)
!
)
return
new
MapContext
(
id
,
get
PageIdByVm
(
getCurrentPageVm
()
!
)
!
)
},
CreateMapContextProtocol
)
packages/uni-api/src/service/context/createVideoContext.ts
浏览文件 @
d436f272
import
{
ComponentPublicInstance
}
from
'
vue
'
import
{
getCurrentPageVm
}
from
'
@dcloudio/uni-core
'
import
{
getPageIdByVm
,
getCurrentPageVm
}
from
'
@dcloudio/uni-core
'
import
{
operateVideoPlayer
}
from
'
@dcloudio/uni-platform
'
import
{
defineSyncApi
}
from
'
../../helpers/api
'
import
{
...
...
@@ -11,39 +10,39 @@ const RATES = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0]
export
class
VideoContext
{
private
id
:
string
private
vm
:
ComponentPublicInstance
constructor
(
id
:
string
,
vm
:
ComponentPublicInstance
)
{
private
pageId
:
number
constructor
(
id
:
string
,
pageId
:
number
)
{
this
.
id
=
id
this
.
vm
=
vm
this
.
pageId
=
pageId
}
play
()
{
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
play
'
)
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
play
'
)
}
pause
()
{
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
pause
'
)
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
pause
'
)
}
stop
()
{
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
stop
'
)
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
stop
'
)
}
seek
(
position
?:
number
)
{
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
seek
'
,
{
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
seek
'
,
{
position
,
})
}
sendDanmu
(
args
:
WechatMiniprogram
.
Danmu
)
{
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
sendDanmu
'
,
args
)
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
sendDanmu
'
,
args
)
}
playbackRate
(
rate
:
number
)
{
if
(
!~
RATES
.
indexOf
(
rate
))
{
rate
=
1.0
}
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
playbackRate
'
,
{
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
playbackRate
'
,
{
rate
,
})
}
...
...
@@ -51,19 +50,19 @@ export class VideoContext {
requestFullScreen
(
args
:
WechatMiniprogram
.
VideoContextRequestFullScreenOption
=
{}
)
{
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
requestFullScreen
'
,
args
)
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
requestFullScreen
'
,
args
)
}
exitFullScreen
()
{
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
exitFullScreen
'
)
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
exitFullScreen
'
)
}
showStatusBar
()
{
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
showStatusBar
'
)
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
showStatusBar
'
)
}
hideStatusBar
()
{
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
hideStatusBar
'
)
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
hideStatusBar
'
)
}
}
...
...
@@ -71,8 +70,8 @@ export const createVideoContext = defineSyncApi<API_TYPE_CREATE_VIDEO_CONTEXT>(
API_CREATE_VIDEO_CONTEXT
,
(
id
,
context
)
=>
{
if
(
context
)
{
return
new
VideoContext
(
id
,
context
)
return
new
VideoContext
(
id
,
getPageIdByVm
(
context
)
!
)
}
return
new
VideoContext
(
id
,
get
CurrentPageVm
(
)
!
)
return
new
VideoContext
(
id
,
get
PageIdByVm
(
getCurrentPageVm
()
!
)
!
)
}
)
packages/uni-h5/src/service/api/context/operateMap.ts
浏览文件 @
d436f272
import
{
ComponentPublicInstance
}
from
'
vue
'
import
{
getPageIdByVm
}
from
'
@dcloudio/uni-core
'
export
function
operateMap
(
id
:
string
,
vm
:
ComponentPublicInstance
,
pageId
:
number
,
type
:
string
,
data
?:
unknown
)
{
const
pageId
=
getPageIdByVm
(
vm
)
!
UniServiceJSBridge
.
publishHandler
(
'
map.
'
+
id
,
{
...
...
packages/uni-h5/src/service/api/context/operateVideoPlayer.ts
浏览文件 @
d436f272
import
{
ComponentPublicInstance
}
from
'
vue
'
import
{
getPageIdByVm
}
from
'
@dcloudio/uni-core
'
export
function
operateVideoPlayer
(
videoId
:
string
,
vm
:
ComponentPublicInstance
,
pageId
:
number
,
type
:
string
,
data
?:
unknown
)
{
const
pageId
=
getPageIdByVm
(
vm
)
!
UniServiceJSBridge
.
publishHandler
(
'
video.
'
+
videoId
,
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录