screenInit showWelcome showText showMenu showImg showImgs showVideo showVideos imageLists videoLists imagesLists videosLists exitScreen cachefile
这是双屏异显功能,副屏可以显示不同于主屏的内容,可用来向用户展示广告,视频,图片,购物订单等内容
注意
使用该插件时需要使用升级后的编译环境,请在应用打包的时候勾选“使用升级环境编译”,并且在控制台 “高级设置” 中将固件版本设置为4.4或以上
初始化副屏
screenInit(callback(ret, err))
ret:
{
status: true, //false
}
var demo = api.require('sunmiT2Screen');
demo.screenInit(function(ret, err) {
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示欢迎
showWelcome(callback(ret, err))
ret:
{
status: true, //false
}
var demo = api.require('sunmiT2Screen');
demo.showWelcome(function(ret, err) {
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示文本
showText({params},callback(ret, err))
title: content:
title:'金额',//显示的标题
content:'¥18.5'//显示的内容
ret:
{
status: true, //false
}
var demo = api.require('sunmiT2Screen');
demo.showText({
title:'金额',
content:'¥18.5'
},function(ret, err) {
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示清单
showMenu({params}, callback(ret, err))
json:
{
"title": "本小店欢迎你",//显示店名
"head": {
"param1": "序列号",//显示商品列表表头序列号
"param2": "商品名",//显示商品列表表头商品名
"param3": "单价",//显示商品列表表头单价
"param4": "数量",//显示商品列表表头数量
"param5": "小结"//显示商品列表表头小结
},
"list": [
{
"param1": "0",//显示第一个商品的序号
"param2": "华夫饼",//显示第一个商品名称
"param3": "10.00",//显示第一个商品价格
"param4": "1",//显示第一个商品数量
"param5":"10.00"//显示第一个商品总价
},
{
"param1": "1",//显示第二个商品的序号
"param2": "吞拿鱼华夫饼",//显示第二个商品名称
"param3": "12.00",//显示第二个商品价格
"param4": "1",//显示第二个商品数量
"param5":"12.00"//显示第二个商品总价
}
],
"KVPList": [
{
"name": "收款",//表格底部显示收款
"value": "¥40.00"//表格底部显示收款总价
},
{
"name": "优惠",//表格底部显示优惠
"value": "¥3.00"//表格底部显示优惠金额
},
{
"name": "找零",//表格底部显示找零
"value": "¥3.00"//表格底部显示找零金额
},
{
"name": "实收",//表格底部显示实收
"value": "¥37.00"//表格底部显示实收金额
}
]
};
ret:
{
status: true, //false
}
var obj = api.require('sunmiT2Screen');
demo.showMenu({
json:{
"title": "本小店欢迎你",
"head": {
"param1": "序列号",
"param2": "商品名",
"param3": "单价",
"param4": "数量",
"param5": "小结"
},
"list": [
{
"param1": "1",
"param2": "华夫饼",
"param3": "10.00",
"param4": "1",
"param5":"10.00"
},
{
"param1": "1",
"param2": "吞拿鱼华夫饼",
"param3": "12.00",
"param4": "1",
"param5":"12.00"
}
],
"KVPList": [
{
"name": "收款",
"value": "¥40.00"
},
{
"name": "优惠",
"value": "¥3.00"
},
{
"name": "找零",
"value": "¥3.00"
},
{
"name": "实收",
"value": "¥37.00"
}
]
};
},function(ret){
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示图片
showImg({params},callback(ret, err))
img:
img:显示图片本地路径
ret:
{
status: true, //false
}
var demo = api.require('sunmiT2Screen');
demo.showImg({
img:"widget://image/img_06.png"
},function(ret, err) {
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示轮播图片
showImgs({params},callback(ret, err))
imgs: rotation_time:
imgs:显示图片本地路径的数组
rotation_time:轮播时间间隔
ret:
{
status: true, //false
}
var demo = api.require('sunmiT2Screen');
demo.showImgs({
imgs:[
"widget://image/img_06.png",
"widget://image/img_04.png",
"widget://image/img_02.png"
],
rotation_time:3000
},function(ret){
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示单个视频
showVideo({params},callback(ret, err))
PathVideo:
pathVideo:显示视频本地路径
ret:
{
status: true, //false
}
var demo = api.require('sunmiT2Screen');
demo.showVideo(
{
pathVideo:"widget://image/video_03.mp4",
},function(ret){
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示轮播视频
showVideos({params},callback(ret, err))
videos:
videos:显示视频本地路径的数组
ret:
{
status: true, //false
}
var demo = api.require('sunmiT2Screen');
demo.showVideos({
videos:[
"widget://image/video_03.mp4",
"widget://image/video_02.mp4",
"widget://image/video_01.mp4"
],
},function(ret){
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示单个图片清单
imageLists((params),callback(ret, err))
json: img:
json:和显示清单一样
img:显示图片本地路径
ret:
{
status: true, //false
}
var demo = api.require('sunmiT2Screen');
demo.imageLists({
json:{
"title": "本小店欢迎你",
"head": {
"param1": "序列号",
"param2": "商品名",
"param3": "单价",
"param4": "数量",
"param5": "小结"
},
"list": [
{
"param1": "1",
"param2": "华夫饼",
"param3": "10.00",
"param4": "1",
"param5":"10.00"
},
{
"param1": "1",
"param2": "吞拿鱼华夫饼",
"param3": "12.00",
"param4": "1",
"param5":"12.00"
}
],
"KVPList": [
{
"name": "收款",
"value": "¥40.00"
},
{
"name": "优惠",
"value": "¥3.00"
},
{
"name": "找零",
"value": "¥3.00"
},
{
"name": "实收",
"value": "¥37.00"
}
]
},
img:"widget://image/img_03.png"
},function(ret){
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示单个视频清单
videoLists((parames),callback(ret, err))
json: video:
json:和显示清单一样
video:显示视频本地路径
ret:
{
status: true, //false
}
var demo = api.require('sunmiT2Screen');
demo.videoLists({
json:{
"title": "本小店欢迎你",
"head": {
"param1": "序列号",
"param2": "商品名",
"param3": "单价",
"param4": "数量",
"param5": "小结"
},
"list": [
{
"param1": "1",
"param2": "华夫饼",
"param3": "10.00",
"param4": "1",
"param5":"10.00"
},
{
"param1": "1",
"param2": "吞拿鱼华夫饼",
"param3": "12.00",
"param4": "1",
"param5":"12.00"
}
],
"KVPList": [
{
"name": "收款",
"value": "¥40.00"
},
{
"name": "优惠",
"value": "¥3.00"
},
{
"name": "找零",
"value": "¥3.00"
},
{
"name": "实收",
"value": "¥37.00"
}
]
},
video:"widget://image/video_02.mp4",
},function(ret){
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示轮播图清单
imagesLists((parames),callback(ret, err))
json: imgs: rotation_time:
json:和显示清单一样
imgs:显示图片数组本地路径
rotation_time:轮播图切换的时间
ret:
{
status: true, //false
}
var demo = api.require('sunmiT2Screen');
demo.imagesLists({
json:{
"title": "本小店欢迎你",
"head": {
"param1": "序列号",
"param2": "商品名",
"param3": "单价",
"param4": "数量",
"param5": "小结"
},
"list": [
{
"param1": "1",
"param2": "华夫饼",
"param3": "10.00",
"param4": "1",
"param5":"10.00"
},
{
"param1": "1",
"param2": "吞拿鱼华夫饼",
"param3": "12.00",
"param4": "1",
"param5":"12.00"
}
],
"KVPList": [
{
"name": "收款",
"value": "¥40.00"
},
{
"name": "优惠",
"value": "¥3.00"
},
{
"name": "找零",
"value": "¥3.00"
},
{
"name": "实收",
"value": "¥37.00"
}
]
},
imgs:[
"widget://image/img_06.png",
"widget://image/img_04.png",
"widget://image/img_02.png"
],
rotation_time:2000
},function(ret){
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
显示轮播视频清单
videosLists((params),callback(ret, err))
json: videos:
json:和显示清单一样
videos:显示视频数组本地路径
ret:
{
status: true, //false
}
var demo = api.require('sunmiT2Screen');
demo.videosLists({
videos:[
"widget://image/video_03.mp4",
"widget://image/video_02.mp4",
"widget://image/video_01.mp4"
],
json:{
"title": "本小店欢迎你",
"head": {
"param1": "序列号",
"param2": "商品名",
"param3": "单价",
"param4": "数量",
"param5": "小结"
},
"list": [
{
"param1": "1",
"param2": "华夫饼",
"param3": "10.00",
"param4": "1",
"param5":"10.00"
},
{
"param1": "1",
"param2": "吞拿鱼华夫饼",
"param3": "12.00",
"param4": "1",
"param5":"12.00"
}
],
"KVPList": [
{
"name": "收款",
"value": "¥40.00"
},
{
"name": "优惠",
"value": "¥3.00"
},
{
"name": "找零",
"value": "¥3.00"
},
{
"name": "实收",
"value": "¥37.00"
}
]
}
},function(ret){
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
退出副屏
exitScreen(callback(ret, err))
ret:
{
status: true
}
var demo = api.require('sunmiT2Screen');
demo.exitScreen(function(ret, err) {
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本
清除缓存
cachefile(callback(ret, err))
ret:
{
status: true
}
var demo = api.require('sunmiT2Screen');
demo.cachefile(function(ret){
alert(JSON.stringify(ret));
});
Android系统
可提供的1.0.0及更高版本