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

当前用户设备工具类

上级 219d41fe
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';
/** /**
* 钉钉服务 * 钉钉服务
* *
...@@ -186,9 +186,7 @@ export class DingTalkService { ...@@ -186,9 +186,7 @@ export class DingTalkService {
* @memberof DingTalkService * @memberof DingTalkService
*/ */
private navBack(){ private navBack(){
var u = navigator.userAgent; if(Util.isAndroid()){
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
if(isAndroid){
document.addEventListener('backbutton', (e:any)=> { document.addEventListener('backbutton', (e:any)=> {
e.preventDefault(); e.preventDefault();
this.backEvent(); this.backEvent();
......
...@@ -317,4 +317,15 @@ export class Util { ...@@ -317,4 +317,15 @@ export class Util {
return schema.validate({ [property]: value }) return schema.validate({ [property]: value })
} }
/**
* 当前用户设备是否为安卓
*
* @returns {boolean}
* @memberof Util
*/
public static isAndroid() :boolean{
let u :any= navigator.userAgent;
return u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;
}
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册