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

第三方导航栏返回事件调整

上级 8b52795e
......@@ -211,6 +211,8 @@ export class DingTalkService {
*/
private backEvent:Function = ()=>{};
/**
* 设置钉钉导航栏返回事件
*
......@@ -218,7 +220,8 @@ export class DingTalkService {
* @returns {DingTalkService}
* @memberof DingTalkService
*/
public setBackEvent(event:Function){
this.backEvent = event;
public setBackEvent(event:Array<Function>){
this.backEvent = event[event.length -1];
}
}
......@@ -39,6 +39,10 @@ export class ThirdPartyService {
* @memberof ThirdPartyService
*/
public weChat: WeChatService = WeChatService.getInstance();
private backEvent:Array<Function> = [];
/**
* 是否已经初始化
*
......@@ -49,6 +53,7 @@ export class ThirdPartyService {
public get isInit(): boolean {
return this.dd.isInit || this.weChat.isInit;
}
/**
* Creates an instance of ThirdPartyService.
* @memberof ThirdPartyService
......@@ -166,6 +171,7 @@ export class ThirdPartyService {
this.weChat.setTitle(title);
}
}
/**
* 设置第三方容器导航栏返回事件
......@@ -175,11 +181,28 @@ export class ThirdPartyService {
* @memberof DingTalkService
*/
public setBackEvent(event:Function){
this.backEvent.push(event);
if (this.isDingTalk()) {
this.dd.setBackEvent(event);
this.dd.setBackEvent(this.backEvent);
} else if (this.isWeChat()) {
this.weChat.setBackEvent(event);
this.weChat.setBackEvent(this.backEvent);
}
}
/**
* 第三方容器导航销毁返回事件
*/
public destroyBackEvent() {
this.backEvent = (this.backEvent.slice(0,-1) as any);
alert(this.backEvent.length);
if(!this.backEvent){
return
}
if (this.isDingTalk()) {
this.dd.setBackEvent(this.backEvent);
} else if (this.isWeChat()) {
this.weChat.setBackEvent(this.backEvent);
}
}
}
\ No newline at end of file
......@@ -228,7 +228,7 @@ export class WeChatService {
* @returns {DingTalkService}
* @memberof DingTalkService
*/
public setBackEvent(event:Function){
this.backEvent = event;
public setBackEvent(event:Array<Function>){
this.backEvent = event[event.length -1];
}
}
\ No newline at end of file
......@@ -256,6 +256,7 @@ export default class AppModalCompponent extends Vue {
* @memberof AppModalCompponent
*/
public handleShowState($event: any) {
this.$viewTool.destroyBackEvent();
if (!$event) {
return;
}
......
......@@ -418,4 +418,11 @@ export class ViewTool {
public ThirdPartyClose() {
this.thirdPartyService.close();
}
/**
* 销毁第三方导航返回事件
*/
public destroyBackEvent() {
this.thirdPartyService.destroyBackEvent();
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册