提交 85eba721 编写于 作者: zhujiamin's avatar zhujiamin

debug移动端 新建待办时,直接返回,选择项仍然存在

上级 8738231f
import axios from 'axios'; import axios from 'axios';
import * as dd from 'dingtalk-jsapi'; import * as dd from 'dingtalk-jsapi';
import { Util } from '@/ibiz-core/utils'; import { Util } from '@/ibiz-core/utils';
import store from '@/store';
/** /**
* 钉钉服务 * 钉钉服务
* *
...@@ -15,7 +16,7 @@ export class DingTalkService { ...@@ -15,7 +16,7 @@ export class DingTalkService {
* @static * @static
* @memberof DingTalkService * @memberof DingTalkService
*/ */
private static readonly instance = new DingTalkService(); private static readonly instance = new DingTalkService(store);
/** /**
* 用户信息缓存key * 用户信息缓存key
* *
...@@ -56,11 +57,21 @@ export class DingTalkService { ...@@ -56,11 +57,21 @@ export class DingTalkService {
return this.$isInit; return this.$isInit;
} }
/**
* Vue 状态管理器
*
* @public
* @type {(any | null)}
* @memberof DingTalkService
*/
public $store:any;
/** /**
* Creates an instance of DingTalkService. * Creates an instance of DingTalkService.
* @memberof DingTalkService * @memberof DingTalkService
*/ */
private constructor() { private constructor(store:any) {
this.$store = store;
if (DingTalkService.instance) { if (DingTalkService.instance) {
return DingTalkService.instance; return DingTalkService.instance;
} }
...@@ -189,14 +200,14 @@ export class DingTalkService { ...@@ -189,14 +200,14 @@ export class DingTalkService {
if(Util.isAndroid()){ if(Util.isAndroid()){
document.addEventListener('backbutton', (e:any)=> { document.addEventListener('backbutton', (e:any)=> {
e.preventDefault(); e.preventDefault();
this.backEvent(); this.controlBackEvent();
},false) },false)
}else{ }else{
dd.biz.navigation.setLeft({ dd.biz.navigation.setLeft({
control : true,//是否控制点击事件,true 控制,false 不控制, 默认false control : true,//是否控制点击事件,true 控制,false 不控制, 默认false
text : '返回', //控制显示文本,空字符串表示显示默认文本 text : '返回', //控制显示文本,空字符串表示显示默认文本
onSuccess : ()=>{ onSuccess : ()=>{
this.backEvent(); this.controlBackEvent();
} }
}); });
} }
...@@ -211,8 +222,6 @@ export class DingTalkService { ...@@ -211,8 +222,6 @@ export class DingTalkService {
*/ */
private backEvent:Function = ()=>{}; private backEvent:Function = ()=>{};
/** /**
* 设置钉钉导航栏返回事件 * 设置钉钉导航栏返回事件
* *
...@@ -224,4 +233,13 @@ export class DingTalkService { ...@@ -224,4 +233,13 @@ export class DingTalkService {
this.backEvent = event[event.length -1]; this.backEvent = event[event.length -1];
} }
/**
* 是否调用导航栏返回事件
* @memberof DingTalkService
*/
public controlBackEvent(){
if (this.$store.state.selectStatus) {
this.backEvent();
}
}
} }
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册