README.md 33.4 KB

有货 App跳转规则

说明

该跳转规则的目的是:一个链接在我们的系统里(H5和App)都能够跳转到想要的地方。整个跳转路径分为3段

1. URL
2. 打开方式
3. 打开参数

openby

新增URL SCHME方式

URL

用于网页的跳转

打开方式

openby:用于表示当前的跳转路径用哪个App打开

参数 说明
yohobuy 用yohobuy内置规则打开
show 用show内置规则打开
boy 用yoho!boy内置规则打开
girl 用yoho!girl内置规则打开
browser 用当前系统的浏览器打开

打开参数

Yohobuy

action 跳转目的 跳转参数 说明
go.brand 品牌列表页 yohobuy={"action":"go.brand","params":{"shop_id":"356","jumptoshop":"Y","brand_id":"4","promotion":"4",tags_filter: "1","app_type":"1"}} app_type 0:有货 1:BLK
go.productDetail 商品详情页 yohobuy={"action":"go.productDetail","params":{"product_skn":"126131",tags_filter: "1","from_page_name":"aFP_XXX","from_page_param":"12354"}} tags_filter(默认不填,1:全球购羊头品牌标签过滤),from_page_name:当前页面P_NAME, from_page_param:当前页面P_PARAM
go.coupon 优惠券页 yohobuy={"action":"go.coupon"}
go.fav 收藏列表页 yohobuy={"action":"go.fav","params":{"favType":"0"}} favType标示收藏类型:0:商品收藏和 1:品牌收藏
go.mine 我的页面 yohobuy={"action":"go.mine"}
go.list 商品列表页 yohobuy={"action":"go.list","params":{"msort":"1","misort":"11","title":"上衣", "actiontype":"1" ,"shop_id":"356", "query":"关键字搜索", "gender":"1,3", "brand":"1", "color":"1", "size":"12", "price":"10", "page":"1", "isrecommd":"Y", "ishot":"Y", "p_d":"0.1, 0.9", "promotion":"23","outlets":"1","app_type":"0","cover_url":"imageurl"}} actiontype=0 其他,支持promotion搜索;actiontype=1 普通分类;actiontype=2 专区商品列表 cover_url 专区配置顶部banner图片url; outlets=1表示是奥莱的商品 app_type 0:有货 1:BLK
go.attention 分类页 yohobuy={"action":"go.attention","params":{"actiontype":"0"}} "actiontype=0 品类 1品牌 2关注"
go.plus plus页 yohobuy={"action":"go.plus"}
go.star star页 yohobuy={"action":"go.star"}
go.new 新品到着页 yohobuy={"action":"go.new","params":{"msort":"10","channel":"2"}} msort在家居频道时配置 cid频道标识
go.sale 折扣页 yohobuy={"action":"go.sale","params":{"msort":"10","channel":"2"}} msort在家居频道时配置 cid频道标识
go.share 分享 yohobuy={"action":"go.share","params":{"title":"分享的标题","content":"分享的文字内容","url":"分享的URL","pic":"图片链接"}}
go.h5 h5网页(目前用在逛) yohobuy={"action":"go.h5","params":{"needlogout":"Y","id":"74","share":"/guang/api/v1/share/guang?id=74","shareparam":{"id":"74"},"islogin":"Y","type":1,"updateflag":"2adfw4e243abdefwqg1234dfarq","url":"http://guang.m.yohobuy.com/info/index","param":{"id":"74"}}} "type:0 普通 type:1 顶部有喜欢,评论(逛 ),type:5 领券中心,params里的param字段用于url请求时附带的参数,由web任意组合" updateflag标识用于缓存 islogin建议一般设置为N needlogout 需要先退出刷新session
go.weblogin h5网页调用本地登录 yohobuy={"action":"go.weblogin","params":{"needlogout":"Y","jumpurl":{"url":"http://guang.m.yohobuy.com/info/index,//用于本地登录成功后webView需要跳转的页面url,可以是当前页也可以是其他页","param":{"id":"74"}},"requesturl":{"param":{"id":"56","query":"aaaaaa"},"url":"http://guang.m.yohobuy.com/info/index,//用于本地登录成功后本地发出的httpRequest,可以是对任意接口调用,param字段传请求时的参数"},"priority":"Y或者N, Y则请求接口结束后再刷新网页。N可并行请求接口和刷新网页",needlogout 需要退出刷新session }}
go.activity h5活动页 yohobuy={"action":"go.activity","params":{"act_id":"4","act_title":"春装五折起", "islogin":"Y", "link":"http://m.yohobuy.com/get-red-envelope-1111.html"}} 兼容老版本跳转
go.guangchannel 跳转到逛频道/ShOw晒单页 yohobuy= {"action":"go.guangchannel","params":{"id":"分类的id","name":"类别名","index":"0"}} index缺省或者值为0时跳转到逛,index=1跳转到社区,index=2跳转到ShOw
go.home 侧滑跳转到首页 yohobuy={"action":"go.home","params":{"gender":"1","channel":"2"}} 除侧滑二级页面,其它禁用 channel频道标识
go.secondhome 跳转到第二首页 yohobuy={"action":"go.secondhome"} 无参数
go.newyohood banner跳转到yohood页 yohobuy={"action":"go.newyohood"}
go.top100 热卖排行榜 yohobuy={"action":"go.top100","params":{"page":"0"}} page表示显示的tab页索引,0 第一个
go.activitytemplate 活动模板 yohobuy={"action":"go.activitytemplate","params":{"template_id":"0","title":"标题","type":"0"}} template_id表示活动ID ,title表示活动标题 ,type区分不同类型(0通用、1新人专享)(同类型活动模板根据type区分)
go.subchannel 二级频道 yohobuy={"action":"go.subchannel","params":{"template_id":"28","title":"标题","content_code":"891b7811db16feba557fd8eff7f07dcf"}} template_id表示你可能喜欢数据的ID ,title表示二级频道标题 ,content_code表示二级频道资源位
go.showgoods 去晒单 yohobuy={"action":"go.showgoods"}
go.globalpurchase 全球购首页 yohobuy={"action":"go.globalpurchase"} 不带任何参数
go.globalpurchase 全球购品牌列表 yohobuy={"action":"go.globalpurchase","params":{"brand":"all"}} 不带其他参数
go.globalpurchase 全球购分类列表 yohobuy={"action":"go.globalpurchase","params":{"sort":"all"}} 不带其他参数
go.globalpurchase 全球购商品列表 yohobuy={"action":"go.globalpurchase","params":{"brand":"1","sort":"97","title":"T恤","yh_channel":"1","order":"s_t_desc"}} title表示商品列表的标题,brand表示品牌(可选),sort表示分类物理类目(可选),yh_channel表示频道(可选),order表示排序规则(可选,默认最新)
go.globalpurchase 全球购商品详情 yohobuy={"action":"go.globalpurchase","params":{"skn":"1231400"}} skn表示商品SKN
go.limitpurchase 尖货频道 yohobuy={"action":"go.limitpurchase"}
go.limitpurchase 尖货详情 yohobuy={"action":"go.limitpurchase","params":{"lp":"1231400"}} lp表示限购商品的唯一标识符
go.vippro 会员商品 yohobuy={"action":"go.vippro","channel":"1"} channel(选填)表示指定频道(男1、女2、童3,家4),不配默认当前频道 sale频道--Vip商品列表
go.vipexclusivepro 会员商品 yohobuy={"action":"go.vipexclusivepro"} 会员中心 --Vip专享商品列表
go.shortsize 断码页 yohobuy={"action":"go.shortsize","channel":"1"} channel(选填)表示指定频道(男1、女2、童3,家4),不配默认当前频道
go.discountmarket 折扣专区 yohobuy={"action":"go.discountmarket"}
go.discountmarketpro 折扣专区详情页 yohobuy={"action":"go.discountmarketpro","params":{"id":"1","cover_url":"封面图","title":"T恤","start_date":"2016-03-10 14:32:25"}} start_date指开始活动时间,格式要保持固定
go.signin 签到页 yohobuy={"action":"go.signin"}
go.shop 店铺标准模版页 yohobuy={"action":"go.shop","params":{"shop_id":"356","shop_template_type":"1","shop_name":"DGK"}} shop_template_type = 1是基础模板,2是标准模板
go.newoutlet 奥莱频道页 yohobuy={"action":"go.newoutlet","params":{"category_id":"6","yh_channel":"1","content_code":"abcd123456"}} category_id(必填)为奥莱频道的分类管理中的id, yh_channel(选填)表示二级频道(男1、女2、童3,家4), content_code(选填)表示二级频道的资源位码。只填category_id时,进入奥莱频道页,三个字段都填写时,可进入奥莱的二级频道页
go.outletactivity 奥莱活动详情页 yohobuy={"action":"go.outletactivity","params":{"activity_id":"123"}} activity_id为奥莱活动的活动id
go.comm.postdetail 社区帖子详情页 yohobuy={"action":"go.comm.postdetail","params":{"postid":"123"}} postid为社区帖子id
go.comm.forum 社区版块首页 yohobuy={"action":"go.comm.forum","params":{"forumid":"123"}} forumid为社区版块id
go.comm.h5 社区H5 yohobuy={"action":"go.comm.h5","params":{"title":"test","url":"testurl"}} title为H5页标题,url为H5要加载的url
go.comm.productDetail 社区商品详情页 yohobuy={"action":"go.comm.productDetail","params":{"product_skn":"123"}} product_skn为商品的skn
go.instalmentRepayment 分期还款视图 yohobuy={"action":"go.instalmentRepayment","params":{"amount":"500","list":[{"index":"0","orderCode":"14535343","termNo":1}]}} amount为还款金额
go.instalmentActivated 分期开通成功 yohobuy={"action":"go.instalmentActivated"} 无参数,表示分期开通接口成功
go.bindCardResult 分期绑卡结果 yohobuy={"action":"go.bindCardResult", "params":{"status":"1"}} status=1表示成功,status=0表示失败
go.picker 调用原生pickerView yohobuy={"action":"go.picker","type":"1", "params":{"title":"标题", "list":["item0", "item1", ...]}} type:类型(1学历,2年份),title:pickerView标题, list:pickerView内容
go.videolive 直播详情页 yohobuy={"action":"go.videolive", "params":{"room":"1","bgpic":"xxx.xxx.xxx"}} room:直播号,bgpic:背景图片url
go.videoreplay 重播详情页 yohobuy={"action":"go.videoreplay", "params":{"videoid":"1","bgpic":"xxx.xxx.xxx"}} videoid:重播号,bgpic:背景图片url
go.poollist 商品列表页 yohobuy={"action":"go.poollist","params":{"msort":"1","misort":"11","title":"上衣", "actiontype":"1" ,"shop_id":"356", "gender":"1,3", "brand":"1", "color":"1", "size":"12", "price":"10", "page":"1", "isrecommd":"Y", "ishot":"Y", "p_d":"0.1, 0.9", "promotion":"23","outlets":"1","productPool":"32","app_type":"0"}} actiontype=0 其他,支持promotion搜索;actiontype=1 普通分类;outlets=1表示是奥莱的商品 productPool:商品池编号 app_type 0:有货 1:BLK
go.instalmentlist 分期商品列表页 yohobuy={"action":"go.instalmentlist","params":{"msort":"1","misort":"11","title":"上衣", "gender":"1,3", "brand":"1", "color":"1", "size":"12", "price":"10", "page":"1", "isrecommd":"Y", "ishot":"Y", "p_d":"0.1, 0.9", "promotion":"23"}}
go.copy 复制内容 yohobuy={"action":"go.copy", "params":{"text":"要复制的内容"}} text:要复制的内容。当url配置此规则时,wap和pc不应打开url链接
go.couponCenter 领券中心 yohobuy={"action":"go.couponCenter", "params":{"share":"/operations/api/v5/webshare/getShare","share_id":"1037","title":"领券中心"}} share_id为获取分享信息id
go.vipInfo 我的会员详情 yohobuy={"action":"go.vipInfo"}
go.order 我的订单列表 yohobuy={"action":"go.order","params":{"index":"3"}}
go.birthCoupons 我的生日券领取 yohobuy={"action":"go.birthCoupons"}
go.orderService 退换货列表 yohobuy={"action":"go.orderService"}
go.blkbrandcategory BLK品牌品类页 yohobuy={"action":"go.blkbrandcategory","params":{"actiontype":"0"}} actiontype:0表示BLK品牌,1表示BLK品类页,2全部分类页
go.findgoodgoods 发现好货(v5.5) yohobuy={"action":"go.findgoodgoods",params":{"title":"Find 好货"}} title:页面标题
go.gallay xx馆落地页 yohobuy={"action":"go.gallay","params":{"gallaytype":"1","tabindex":"1","title":"美妆馆","contentcode":"192a176fb28c1996b4f575900d518890"}} gallaytype: 0,普通馆 , 1,品牌馆 tabindex:默认展示的第几个tab页 title :馆名称 contentcode//资源code码
go.shopactivity 店铺活动页 yohobuy={"action":"go.shopactivity"} // 店铺活动 所有店铺活动的聚合页
go.newarrivalsingleshop 新品到着单品 {"action":"go.newarrivalsingleshop","params":{"shopid":"1258","shopname":"VANS", "firstProductSkn" : "12345678", "pool_id" : "12"}} shopid:店铺id shopname:店铺名称
go.blkhome blk首页 {"action":"go.blkhome"}
go.couponProductList 优惠商品列表 {"action":"go.couponProductList","params":{"coupon_code":"1258","coupon_id":"1234", "title" : "x优惠活动", "coupon_title" : "以下商品满xxx减xx活动"}} coupon_id:券ID coupon_code:券码 coupon_title:促销内容 title:标题
go.associatorgift 会员礼包 {"action":"go.associatorgift"}
go.promotion 促销商品列表 {"action":"go.promotion","params":{"title":"主标题","promotiontitle":"促销标题","promotion_id":"108"}} title:页面标题 promotiontitle:促销标题 promotion_id:促销id
go.searchlist 模糊搜索列表页 {"action":"go.searchlist","params":{"keyword":"店铺名字"}} keyword:店铺名字 keyword信息会显示顶部的搜索框

新增推送(push)方式,兼容现有新跳转规则(统一有货 App跳转规则)

跳转参数

action 跳转目的 推送跳转参数 说明
go.brand 品牌列表页 {"type":"push","url":{"action":"go.brand","params":{"brand_id":"4","promotion":"4","app_type":"0"}}} *promotion专区id(童装),app_type 0:有货 1:BLK
go.productDetail 商品详情页 {"type""push","url":{"action":"go.productDetail","params":{"product_skn":"126131"}}}
go.coupon 优惠券页 {"type": "push","url":{"action":"go.coupon"}}
go.shopcart 购物车页 {"type": "push","url":{"action":"go.shopcart","params":{"islogin":"Y"}}}
go.fav 收藏列表页 {"type": "push","url":{"action":"go.fav","params":{"favType":"0"}}} favType标示收藏类型:0:商品收藏和 1:品牌收藏
go.mine 我的页面 {"type": "push","url":{"action":"go.mine"}}
go.list 商品列表页 {"type": "push","url":{"action":"go.list","params":{"msort":"1","misort":"11","title":"上衣", "actiontype":"1" ,"shop_id":"356", "query":"关键字搜索", "gender":"1,3", "brand":"1", "color":"1", "size":"12", "price":"10", "page":"1", "isrecommd":"Y", "ishot":"Y", "p_d":"0.1, 0.9", "promotion":"23","app_type":"0"}}} actiontype=0 其他,支持promotion搜索;actiontype=1 普通分类;actiontype=2 奥莱分类 app_type 0:有货 1:BLK
go.attention 分类页 {"type": "push","url":{"action":"go.attention","params":{"actiontype":"0"}}} "actiontype=0 品类 1品牌 2关注"
go.plus plus页 {"type": "push","url":{"action":"go.plus"}}
go.star star页 {"type": "push","url":{"action":"go.star"}}
go.new 新品到着页 {"type": "push","url":{"action":"go.new","params":{"msort":"10","channel":"2"}}} msort在家居频道时配置 cid频道标识
go.sale 折扣页 {"type": "push","url":{"action":"go.sale","params":{"msort":"10","channel":"2"}}} msort在家居频道时配置 cid频道标识
go.share 分享 {"type": "push","url":{"action":"go.share","params":{"title":"分享的标题","content":"分享的文字内容","url":"分享的URL","pic":"图片链接"}}}
go.h5 h5网页 {"type": "push","url":{"action":"go.h5","params":{"id":"74","share":"/guang/api/v1/share/guang?id=74","shareparam":{"id":"74"},"islogin":"Y","type":1,"updateflag":"2adfw4e243abdefwqg1234dfarq","url":"http://guang.m.yohobuy.com/info/index","param":{"id":"74"}}}} "type:0 普通 type:1 顶部有喜欢,评论(逛 ), type:2 秒杀H5页面,type:3 秒杀原生页面(原生根据开关状态选择加载页面),type:5 领券中心,type:7 明星原创详情页,type:9 5.5版本是app的套餐,5.5之前是H5的套餐,type:11 逛页面中编辑推荐, type:12 逛页面tag列表, type:13 学生认证,params里的param字段用于url请求时附带的参数,由web任意组合" updateflag标识用于缓存 islogin建议一般设置为N
go.weblogin h5网页调用本地登录 {"type": "push","url":{"action":"go.weblogin","params":{"jumpurl":{"url":"http://guang.m.yohobuy.com/info/index,//用于本地登录成功后webView需要跳转的页面url,可以是当前页也可以是其他页","param":{"id":"74"}},"requesturl":{"param":{"id":"56","query":"aaaaaa"},"url":"http://guang.m.yohobuy.com/info/index,//用于本地登录成功后本地发出的httpRequest,可以是对任意接口调用,param字段传请求时的参数"},"priority":"Y或者N, Y则请求接口结束后再刷新网页。N可并行请求接口和刷新网页"}}}
go.activity h5活动页 {"type": "push","url":{"action":"go.activity","params":{"act_id":"4","act_title":"春装五折起", "islogin":"Y", "link":"http://m.yohobuy.com/get-red-envelope-1111.html"}}} 兼容老版本跳转
go.guangchannel 跳转到逛频道/ShOw晒单页 {"type": "push","url":{"action":"go.guangchannel","params":{"id":"分类的id","name":"类别名","index":"0"}}} index缺省或者值为0时跳转到逛,index=1跳转到社区,index=2跳转到ShOw
go.home 侧滑跳转到首页 {"type": "push","url":{"action":"go.home","params":{"gender":"1","channel":"2"}}} 除侧滑二级页面,其它禁用 channel频道标识
go.newyohood banner跳转到yohood页 {"type": "push","url":{"action":"go.newyohood"}}
go.top100 热卖排行榜 {"type": "push","url":{"action":"go.top100","params":{"page":"0"}}} page表示显示的tab页索引,0 第一个
go.activitytemplate 活动模板 {"type": "push","url":{"action":"go.activitytemplate","params":{"template_id":"0","title":"标题","type":"0"}}} template_id表示活动ID ,title表示活动标题 ,type区分不同类型(0通用、1新人专享)(同类型活动模板根据type区分)
go.subchannel 二级频道 {"type": "push","url":{"action":"go.subchannel","params":{"template_id":"28","title":"标题","content_code":"891b7811db16feba557fd8eff7f07dcf"}}} template_id表示你可能喜欢数据的ID ,title表示二级频道标题 ,content_code表示二级频道资源位
go.showgoods 去晒单 {"type": "push","url":{"action":"go.showgoods"}}
go.globalpurchase 全球购首页 {"type": "push","url":{"action":"go.globalpurchase"}} 不带任何参数
go.globalpurchase 全球购品牌列表 {"type": "push","url":{"action":"go.globalpurchase","params":{"brand":"all"}}} 不带其他参数
go.globalpurchase 全球购分类列表 {"type": "push","url":{"action":"go.globalpurchase","params":{"sort":"all"}}} 不带其他参数
go.globalpurchase 全球购商品列表 {"type": "push","url":{"action":"go.globalpurchase","params":{"brand":"1","sort":"97","title":"T恤","yh_channel":"1","order":"s_t_desc"}}} title表示商品列表的标题,brand表示品牌(可选),sort表示分类物理类目(可选),yh_channel表示频道(可选),order表示排序规则(可选,默认最新)
go.globalpurchase 全球购商品详情 {"type": "push","url":{"action":"go.globalpurchase","params":{"skn":"1231400"}}} skn表示商品SKN
go.limitpurchase 尖货频道 {"type": "push","url":{"action":"go.limitpurchase"}}
go.limitpurchase 尖货详情 {"type": "push","url":{"action":"go.limitpurchase","params":{"lp":"1231400"}}} lp表示限购商品的唯一标识符
go.vippro 会员商品 {"type": "push","url":{"action":"go.vippro"}}
go.shortsize 断码页 {"type": "push","url":{"action":"go.shortsize"}}
go.discountmarket 折扣专区 {"type": "push","url":{"action":"go.discountmarket"}}
go.discountmarketpro 折扣专区详情页 {"type": "push","url":{"action":"go.discountmarketpro","params":{"id":"1","cover_url":"封面图","title":"T恤","start_date":"2016-03-10 14:32:25"}}} start_date指开始活动时间,格式要保持固定
go.signin 签到页 {"type": "push","url":{"action":"go.signin"}}
go.shop 店铺标准模版页 {"type": "push","url":{"action":"go.shop","params":{"shop_id":"356","shop_template_type":"1","shop_name":"DGK"}}} shop_template_type = 1是基础模板,2是标准模板
go.newoutlet 奥莱频道页 {"type": "push","url":{"action":"go.newoutlet","params":{"category_id":"6","yh_channel":"1","content_code":"abcd123456"}}} category_id(必填)为奥莱频道的分类管理中的id, yh_channel(选填)表示二级频道(男1、女2、童3,家4), content_code(选填)表示二级频道的资源位码。只填category_id时,进入奥莱频道页,三个字段都填写时,可进入奥莱的二级频道页
go.outletactivity 奥莱活动详情页 {"type": "push","url":{"action":"go.outletactivity","params":{"activity_id":"123"}}} activity_id为奥莱活动的活动id
go.videolive 直播详情页 {"type": "push","url":{"action":"go.videolive", "params":{"room":"1","bgpic":"xxx.xxx.xxx"}}} room:直播号,bgpic:背景图片url
go.videoreplay 重播详情页 {"type": "push","url":{"action":"go.videoreplay", "params":{"videoid":"1","bgpic":"xxx.xxx.xxx"}}} videoid:重播号,bgpic:背景图片url
go.poollist 商品列表页 {"type": "push","url":{"action":"go.poollist","params":{"msort":"1","misort":"11","title":"上衣", "actiontype":"1" ,"shop_id":"356", "gender":"1,3", "brand":"1", "color":"1", "size":"12", "price":"10", "page":"1", "isrecommd":"Y", "ishot":"Y", "p_d":"0.1, 0.9", "promotion":"23","outlets":"1","productPool":"32","app_type":"0"}}} actiontype=0 其他,支持promotion搜索;actiontype=1 普通分类;outlets=1表示是奥莱的商品 productPool:商品池编号 app_type 0:有货 1:BLK
go.couponCenter 领券中心 {"type": "push","url":{"action":"go.couponCenter", "params":{"share":"/operations/api/v5/webshare/getShare","share_id":"1037","title":"领券中心"}}} share_id为获取分享信息id
go.refundorderdetail 退货详情页 {"type": "push","url":{"action":"go.refundorderdetail","params":{"id":"123"}}} ,id:退货id
go.changeorderdetail 换货详情页 {"type": "push","url":{"action":"go.changeorderdetail","params":{"id":"123"}}} ,id:换货id
go.yohocoin 我的有货币 {"type": "push","url":{"action":"go.yohocoin"}}
go.userLogout 账号注销 {"title":"账号注销","type":"userLogout"} title为页面名称,type指定注销页面,其中type类型有:'userLogout'账户注销页,'userLogoutClause'注销条款页面,'userLogouReason'注销原因页面,'userLogoutFaildReason'注销失败原因页面,'userLogoutFaild'注销失败页面,'userLogoutStatus'注销状态页面
go.minealliance 我的联盟 {"action":"go.minealliance","params":{"title":"我的联盟"}} title:页面标题
go.ufo 球鞋市集UFO {"action":"go.ufo","params":{"pagename":"home"}} 更多参数参数见UFO 跳转规则

新增推送(push)更新App新版本

更新App新版本推送参数

客户端 推送跳转参数 说明
IOS {"type":"event","ad_action":"go.url","ad_option":"link=http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho"} 更新IOS App新版本
Android {"type":"app","link":"http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho"} 更新Android App新版本

在跳转中使用本地能力(YHExplorer组件)

说明

目前YHExplorer组件计划支撑的本地能力如下: 1. 摄像头,2. LBS,3. Device,4. Media,5. 传感器,6. FileSystem.

<!-- 组装参数,下面是基本参数结构 -->
var params = { "ability":"action", "options":{"optionKey":"optionValue"} };
<!-- 触发机能 -->
yohoInterface.triggerEvent(onSuccess, onFail, params);

onSuccess回调里面会传递结果。

定义

1. 摄像头
  • 拍照/访问相册

    <!--
    pictureSourceType:
    -- 访问相册 SAVEDPHOTOALBUM
    -- 摄像头 CAMERA
    -->
    var params = { "Native_Camera":"takePicture", "options":{ "quality":75, "pictureSourceType":"CAMERA" } };
  • 展示获取的照片Example

    function onSuccess(imageData) {
    var image = document.getElementById('myImage');
    image.src = "data:image/jpeg;base64," + imageData;
    }
2. LBS
  • 获取Location
var params = { "Native_LBS":"getLocation" };

<!-- 回调Example: -->
function onSuccess(coordinate) {
    alert('Coordinate Latitude: ' + coordinate.latitude + '\n' +
          'Coordinate Longitude: ' + coordinate.longitude);
};
3. Device
  • 获取设备信息
var params = { "Native_Device":"getDeviceInfo" };

<!-- 回调Example: -->
function onSuccess(device) {
    alert('Model: ' + device.model + '\n' +
          'Platform: ' + device.platform + '\n' +
          'OSVersion: ' + device.version);
};
4. Media
  • 调用iOS媒体播放器 javascript var params = { "Native_Media":"playMedia", "options":{ "url":"http://xxxxxxx.mp4" } };
5. 传感器
  • 震动
<!-- duration为震动时长 -->
var params = { "Native_Motion":"vibrate", "options":{ "duration":1.2 } };
  • 获取加速计状态
<!-- period为观察间隔,单位是毫秒 -->
var params = { "Native_Motion":"watchAcceleration", "options":{ "period":1000 } };

<!-- 回调Example: -->
function onSuccess(acceleration) {
    alert('Acceleration X: ' + acceleration.x + '\n' +
          'Acceleration Y: ' + acceleration.y + '\n' +
          'Acceleration Z: ' + acceleration.z + '\n' +
          'Timestamp: '      + acceleration.timestamp + '\n');
};
  • 停止获取加速计状态(不需要加速计状态时,务必调用来停止加速计刷新)
var params = { "Native_Motion":"clearWatchAcceleration" };
6. FileSystem
  • 获取目录
<!-- Documents目录 -->
var params = { "Native_FS":"getDocumentsPath" };
<!-- tmp目录 -->
var params = { "Native_FS":"getTemporaryPath" };
<!-- cache目录 -->
var params = { "Native_FS":"getCachePath" };

<!-- 回调Example: -->
function onSuccess(path) {
    alert('path: ' + path);
};
  • 删除文件
var params = { "Native_FS":"deleteItemAtPath", "options":{ "path":"itemPath" }};
  • 拷贝文件
var params = { "Native_FS":"copyItem", "options":{ "srcPath":"xxx", "dstPath":"xxx" } };