Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
faf124f0
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1598
Star
27
Fork
9
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
2
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
Hello UTS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
2
Issue
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
faf124f0
编写于
10月 13, 2022
作者:
杜庆泉
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
系统api 界面ui调整
上级
f9c26bbc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
103 addition
and
45 deletion
+103
-45
pages.json
pages.json
+10
-0
pages/SystemAPI/SystemAPI.vue
pages/SystemAPI/SystemAPI.vue
+23
-45
pages/SystemAPI/android/screenlisten.vue
pages/SystemAPI/android/screenlisten.vue
+70
-0
未找到文件。
pages.json
浏览文件 @
faf124f0
...
...
@@ -63,6 +63,16 @@
}
},
{
"path"
:
"pages/SystemAPI/android/screenlisten"
,
"style"
:
{
"navigationBarTitleText"
:
""
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/SyntaxCase/index"
,
"style"
:
...
...
pages/SystemAPI/SystemAPI.vue
浏览文件 @
faf124f0
<
template
>
<view>
<page-head
:title=
"title"
></page-head>
<view
class=
"uni-btn-v uni-common-mt"
>
<button
type=
"primary"
@
tap=
"testGetBatteryCapacity"
>
获取电池电量
</button>
<button
type=
"primary"
@
tap=
"testGotoDemoActivity"
>
跳转至新的原生页面
</button>
<button
type=
"primary"
@
tap=
"testScreenShotPremission"
>
准备截屏监听权限
</button>
<button
type=
"primary"
@
tap=
"testScreenShotListen"
>
监听截屏事件
</button>
<button
type=
"primary"
@
tap=
"testScreenShotOff"
>
关闭截屏监听
</button>
<image
:src=
"screenImage"
class=
"screenImage"
mode=
"aspectFit"
></image>
</view>
<uni-collapse>
<uni-collapse-item
title=
"设备相关"
:border=
"false"
>
<uni-list>
<uni-list-item
@
tap=
"testGetBatteryCapacity"
title=
"获取电池电量"
class=
"itemButton"
:clickable=
"true"
/>
</uni-list>
</uni-collapse-item>
</uni-collapse>
<uni-collapse>
<uni-collapse-item
title=
"android平台"
:border=
"false"
>
<uni-list>
<uni-list-item
@
tap=
"testGotoDemoActivity"
title=
"自定义activity(需自定义基座)"
class=
"itemButton"
:clickable=
"true"
link
/>
<uni-list-item
@
tap=
"gotoScreenListen"
title=
"监听系统截屏"
class=
"itemButton"
:clickable=
"true"
link
/>
</uni-list>
</uni-collapse-item>
</uni-collapse>
</view>
</
template
>
<
script
>
import
getBatteryInfo
from
"
@/uni_modules/uni-getbatteryinfo
"
;
import
gotoDemoActivity
from
"
@/uni_modules/uts-nativepage
"
;
import
{
requestPremission
,
onUserCaptureScreen
,
offUserCaptureScreen
}
from
"
@/uni_modules/uts-screenshot-listener
"
;
export
default
{
data
()
{
return
{
title
:
'
系统API示例
'
,
screenImage
:
""
}
},
onUnload
:
function
()
{},
...
...
@@ -32,44 +38,16 @@
testGetBatteryCapacity
()
{
getBatteryInfo
({
success
(
res
)
{
console
.
log
(
"
dddeee
"
);
uni
.
showToast
({
title
:
"
当前电量:
"
+
res
.
level
+
'
%
'
,
icon
:
'
none
'
});
}
})
console
.
log
(
"
ccccc
"
);
},
testScreenShotPremission
()
{
// 请求写入储存的权限
requestPremission
();
},
testScreenShotListen
()
{
var
that
=
this
;
onUserCaptureScreen
(
function
(
res
)
{
console
.
log
(
res
);
that
.
screenImage
=
res
uni
.
showToast
({
icon
:
"
none
"
,
title
:
'
截屏捕捉成功
'
})
});
// 提示已经开始监听,注意观察
uni
.
showToast
({
icon
:
"
none
"
,
title
:
'
截屏监听已开启,注意观察下方Image组件
'
})
},
testScreenShotOff
()
{
var
that
=
this
;
offUserCaptureScreen
(
function
(
res
)
{
console
.
log
(
res
);
});
// 提示已经开始监听,注意观察
uni
.
showToast
({
icon
:
"
none
"
,
title
:
'
截屏监听已关闭
'
gotoScreenListen
(){
uni
.
navigateTo
({
url
:
'
/pages/SystemAPI/android/screenlisten
'
})
},
...
...
pages/SystemAPI/android/screenlisten.vue
0 → 100644
浏览文件 @
faf124f0
<
template
>
<view>
<page-head
title=
"监听系统截屏"
accordion
></page-head>
<uni-list>
<uni-list-item
@
tap=
"testScreenShotPremission"
title=
"准备截屏监听权限"
class=
"itemButton"
:clickable=
"true"
/>
<uni-list-item
@
tap=
"testScreenShotListen"
title=
"监听截屏事件"
class=
"itemButton"
:clickable=
"true"
/>
<uni-list-item
@
tap=
"testScreenShotOff"
title=
"关闭截屏监听"
class=
"itemButton"
:clickable=
"true"
/>
</uni-list>
<image
:src=
"screenImage"
mode=
"aspectFit"
style=
"margin-top:10px"
></image>
</view>
</
template
>
<
script
>
import
{
requestPremission
,
onUserCaptureScreen
,
offUserCaptureScreen
}
from
"
@/uni_modules/uts-screenshot-listener
"
;
export
default
{
data
()
{
return
{
screenImage
:
""
}
},
methods
:
{
testScreenShotPremission
()
{
// 请求写入储存的权限
requestPremission
();
},
testScreenShotListen
()
{
var
that
=
this
;
onUserCaptureScreen
(
function
(
res
)
{
console
.
log
(
res
);
that
.
screenImage
=
res
uni
.
showToast
({
icon
:
"
none
"
,
title
:
'
截屏捕捉成功
'
})
});
// 提示已经开始监听,注意观察
uni
.
showToast
({
icon
:
"
none
"
,
title
:
'
截屏监听已开启,注意观察下方Image组件
'
})
},
testScreenShotOff
()
{
var
that
=
this
;
offUserCaptureScreen
(
function
(
res
)
{
console
.
log
(
res
);
});
// 提示已经开始监听,注意观察
uni
.
showToast
({
icon
:
"
none
"
,
title
:
'
截屏监听已关闭
'
})
},
}
}
</
script
>
<
style
>
</
style
>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录