提交 7b312db1 编写于 作者: KK's avatar KK

更新

上级 6a7287e6
......@@ -272,14 +272,14 @@ export class DingTalkService {
/**
* 震动
*/
public vibrate(arg:any) : Promise<any> {
public vibrate(arg: any): Promise<any> {
return new Promise((resolve, reject) => {
dd.device.notification.vibrate({
duration: arg, //震动时间,android可配置 iOS忽略
})
resolve({});
});
}
/**
......@@ -353,6 +353,33 @@ export class DingTalkService {
}
/**
* 钉钉导航栏返回事件
*
* @memberof DingTalkService
*/
public initRightBtn({ model, fun }: any) {
if(model){
const nameArr = Object.keys(model).filter((item:any)=>{
return model[item].visabled;
})
// 单个按钮
if(nameArr.length == 1){
const btn = model[nameArr[0]];
dd.biz.navigation.setRight({
show: true,//控制按钮显示, true 显示, false 隐藏, 默认true
control: true,//是否控制点击事件,true 控制,false 不控制, 默认false
text: btn.caption,//控制显示文本,空字符串表示显示默认文本
onSuccess: () => {
fun({ tag: btn.name });
}
});
}
// 多个按钮 todo
}
}
/**
* 钉钉导航栏返回事件
......@@ -411,5 +438,8 @@ export class DingTalkService {
if (Object.is(tag, "vibrate")) {
return this.vibrate(arg);
}
if (Object.is(tag, "initRightBtn")) {
return this.initRightBtn(arg);
}
}
}
\ No newline at end of file
......@@ -235,4 +235,13 @@ export class ThirdPartyService {
return this.dd.ddEvent(tag, arg);
}
}
/**
* 初始化右侧按钮
*/
public initRightBtn(model:any,fun:Function){
if (this.isDingTalk()) {
this.thirdPartyEvent('initRightBtn', {model:model,fun:fun});
}
}
}
\ No newline at end of file
......@@ -431,4 +431,11 @@ export class ViewTool {
public thirdPartyEvent(tag:string,arg:any={}){
this.thirdPartyService.thirdPartyEvent(tag,arg);
}
/**
* 初始化右侧按钮
*/
public initRightBtn(model:any,fun:any) {
this.thirdPartyService.initRightBtn(model,fun);
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册