O2OA API

Namespace

o2m

Summary

o2m 是O2OA移动端APP提供的调用原生控件的能力,帮助开发者高效使用拍照、定位等手机系统的能力,同时可以直接使用扫一扫、打开原生应用、选择时间,人员,组织等业务的能力,带给门户接近原生代码的体验
o2m 只有在O2OA移动端APP中才能提供能力

Usable Range

流程表单 门户

Syntax

// 可以在移动端 流程表单、门户 上使用
window.o2m

Methods

static

alert(obj)

原生Alert提示弹出窗

Parameters

  • obj Object

    提示窗传入对象

    {
     "title": "提示",  //消息标题,可为空
     "message": "这里是消息内容", //消息内容
     "buttonName": "确定", //确定按钮名称
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

样例效果:

o2m.notification.alert({
 message: "亲爱的",
 title: "提示",//可传空
 buttonName: "收到",
 onSuccess : function() {//onSuccess将在点击button之后回调},
 onFail : function(err) {}
});

Source

static

confirm(obj)

原生confirm提示弹出窗

Parameters

  • obj Object

    提示窗传入对象

    {
     "title": "提示",  //消息标题,可为空
     "message": "这里是消息内容", //消息内容
     "buttonLabels": ["确定", "取消"], //按钮名称 Array[String]
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

样例效果:

o2m.notification.confirm({
 message: "你爱我吗",
 title: "提示",//可传空
 buttonLabels: ['爱', '不爱'],
 onSuccess : function(buttonIndex) {
   //onSuccess将在点击button之后回调
   //buttonIndex: 0 被点击按钮的索引值,Number类型,从0开始
},
 onFail : function(err) {}
});

Source

static

prompt(obj)

原生prompt提示弹出窗

Parameters

  • obj Object

    prompt需要传入对象

    {
     "title": "提示",  //消息标题,可为空
     "message": "这里是消息内容", //消息内容
     "buttonLabels": ['继续', '不玩了'], //按钮名称 Array[String]
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

样例效果:

o2m.notification.prompt({
 message: "再说一遍?",
 title: "提示",//可传空
 buttonLabels: ['继续', '不玩了'],
 onSuccess : function(result) {
    //result是一个字符串,格式是json格式,内容如下:
    //{
    //    buttonIndex: 0, //被点击按钮的索引值,Number类型,从0开始
    //    value: '' //输入的值
    //}
},
 onFail : function(err) {}
});

Source

static

vibrate(obj)

手机震动

Parameters

  • obj Object

    震动需要传入对象

    {
     "duration": 300,  //震动时间,android可配置 iOS忽略
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

o2m.notification.vibrate({
 duration: 300, 
 onSuccess : function() {
},
 onFail : function(err) {}
});

Source

static

toast(obj)

toast提示

Parameters

  • obj Object

    toast需要传入对象

    {
     "message": "这里是提示信息",
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

o2m.notification.toast({
 message: "提示消息内容", 
 onSuccess : function() {
},
 onFail : function(err) {}
});

Source

static

actionSheet(obj)

底部弹出菜单

Parameters

  • obj Object

    actionSheet需要传入对象

    {
     "title": "谁是最棒哒?",//标题
     "cancelButton": '取消', //取消按钮文本
     "otherButtons": ["孙悟空","猪八戒","唐僧","沙和尚"], //其他选项按钮名称
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

样例效果:

o2m.notification.actionSheet({
 title: "谁是最棒哒?", //标题
 cancelButton: '取消', //取消按钮文本
 otherButtons: ["孙悟空","猪八戒","唐僧","沙和尚"],
 onSuccess : function(buttonIndex) {
 //buttonIndex: 0 被点击按钮的索引值,Number,从0开始, 取消按钮为-1
},
 onFail : function(err) {}
});

Source

static

showLoading(obj)

显示Loading浮层,请和hideLoading配合使用

Parameters

  • obj Object

    showLoading需要传入对象

    {
     text: "使劲加载中..", //loading显示的字符,空表示不显示文字
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

样例效果:

o2m.notification.showLoading({
 text: "使劲加载中..", //loading显示的字符,空表示不显示文字
 onSuccess : function() {
},
 onFail : function(err) {}
});

Source

static

hideLoading(obj)

隐藏Loading浮层

Parameters

  • obj Object

    hideLoading需要传入对象

    {
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

o2m.notification.hideLoading({
 onSuccess : function() {
},
 onFail : function(err) {}
});

Source

static

datePicker(obj)

日期选择器

Parameters

  • obj Object

    datePicker需要传入对象

    {
     value: '2019-04-17', //默认显示日期
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

样例效果:

o2m.util.date.datePicker({
value: '2019-04-17', //默认显示日期
onSuccess : function(result) {
    //onSuccess将在点击完成之后回调
    {
        value: "2019-02-10"
    }
 },
 onFail : function(err) {}
});

Source

static

timePicker(obj)

时间选择器

Parameters

  • obj Object

    timePicker需要传入对象

    {
     value: '14:00', //默认显示时间
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

样例效果:

o2m.util.date.timePicker({
value: '14:00', //默认显示时间
onSuccess : function(result) {
    //onSuccess将在点击完成之后回调
    {
        value: "18:10"
    }
 },
 onFail : function(err) {}
});

Source

static

dateTimePicker(obj)

日期时间选择器

Parameters

  • obj Object

    dateTimePicker需要传入对象

    {
     value: '2019-05-05 14:00', //默认显示时间
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

样例效果:

o2m.util.date.dateTimePicker({
value: '2019-05-05 14:00', //默认显示时间
onSuccess : function(result) {
    //onSuccess将在点击完成之后回调
    {
        value: "2019-03-18 18:10"
    }
 },
 onFail : function(err) {}
});

Source

static

chooseOneDay(obj)

月历日期选择器

Parameters

  • obj Object

    chooseOneDay需要传入对象

    {
     value: '2019-05-05', //默认显示日期
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

样例效果:

o2m.util.calendar.chooseOneDay({
value: '2019-05-05', //默认显示日期
onSuccess : function(result) {
    //onSuccess将在点击完成之后回调
    {
        value: "2019-03-18"
    }
 },
 onFail : function(err) {}
});

Source

static

chooseDateTime(obj)

月历日期时间选择器

Parameters

  • obj Object

    chooseDateTime需要传入对象

    {
     value: '2019-05-05 11:00', //默认显示时间
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

样例效果:

o2m.util.calendar.chooseDateTime({
value: '2019-05-05 11:00', //默认显示时间
onSuccess : function(result) {
    //onSuccess将在点击完成之后回调
    {
        value: "2019-03-18 18:45"
    }
 },
 onFail : function(err) {}
});

Source

static

chooseInterval(obj)

月历日期区间选择器

Parameters

  • obj Object

    chooseInterval需要传入对象

    {
     startDate: '2019-05-05',
     endDate: '2019-05-06',
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

样例效果:

o2m.util.calendar.chooseInterval({
startDate: '2019-05-05',
endDate: '2019-05-06',
onSuccess : function(result) {
    //onSuccess将在点击完成之后回调
    {
        startDate: "2019-05-05", 
            endDate: "2019-05-06",
    }
 },
 onFail : function(err) {}
});

Source

static

getPhoneInfo(obj)

获取手机基础信息

Parameters

  • obj Object

    getPhoneInfo需要传入对象

    {
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

o2m.util.device.getPhoneInfo({
onSuccess : function(result) {
    {
     screenWidth: 1080, // 手机屏幕宽度
     screenHeight: 1920, // 手机屏幕高度
     brand:'Mi', // 手机品牌
     model:'Note4', // 手机型号
     version:'7.0'. // 版本
     netInfo:'wifi' , // 网络类型 wifi/4g/3g 
     operatorType :'xx' // 运营商信息
    }
 },
 onFail : function(err) {}
});

Source

static

rotate(obj)

旋转屏幕

Parameters

  • obj Object

    rotate

    {
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

o2m.util.device.rotate({
onSuccess : function(result) {
},
 onFail : function(err) {}
});

Source

static

scan(obj)

扫二维码

Parameters

  • obj Object

    scan需要传入对象

    {
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

o2m.util.device.scan({
onSuccess : function(result) {
    // result返回结果就是扫码的结果
 },
 onFail : function(err) {}
});

Source

static

location(obj)

单次定位

Parameters

  • obj Object

    location需要传入对象

    {
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

o2m.util.device.location({
onSuccess : function(result) {
    //这里返回百度坐标系的定位信息 
    { 
     'latitude': 39.903578, // 纬度
     'longitude': 116.473565, // 经度
     'address': '地址描述'
     }
 },
 onFail : function(err) {}
});

Source

static

setTitle(obj)

设置原生页面标题

Parameters

  • obj Object

    setTitle需要传入对象

    {
     title : '导航标题',    
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

o2m.util.navigation.setTitle({
title : '导航标题', 
onSuccess : function() {
 },
 onFail : function(err) {}
});

Source

static

openInnerApp(obj)

打开内部应用

Parameters

  • obj Object

    openInnerApp需要传入对象

    {
     appKey : 'attendance',  // 对应用的 key:  task(待办)、taskcompleted(已办)、read(待阅)、readcompleted(已阅)、meeting(会议管理)、clouddisk(网盘)、bbs(论坛)、cms(信息中心)、attendance(考勤)、calendar(日程)、mindMap(脑图)、portal(门户,门户需要传入portalFlag和portalTitle)
     portalFlag : '门户标识',  
     portalTitle : '门户标题', 
     portalPage : '门户页面 id', 
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

o2m.util.navigation.openInnerApp({
appKey : 'attendance',
onSuccess : function() {
 },
 onFail : function(err) {}
});

Source

static

openWindow(obj)

新窗口打开网页

Parameters

  • obj Object

    openWindow需要传入对象

    {
     url : 'https://www.o2oa.net',  // 打开的网址
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

o2m.util.navigation.openWindow({
url : 'https://www.o2oa.net',
onSuccess : function() {
 },
 onFail : function(err) {}
});

Source

static

openInBrowser()

手机默认浏览器打开当前页面

Example

o2m.util.navigation.openInBrowser({
onSuccess : function() {
 },
 onFail : function(err) {}
});

Source

static

clearCache()

清理缓存并刷新页面

Example

o2m.util.navigation.clearCache({
onSuccess : function() {
 },
 onFail : function(err) {}
});

Source

static

departmentsPicker(obj)

通讯录选部门

Parameters

  • obj Object

    departmentsPicker需要传入对象

    {
     topList: [],//Array[String] 可选的顶级组织列表,不传或列表为空的时候,显示全部组织
     orgType: "",//String 可选择的组织类别。为空就是全部组织类型都可以
     multiple:true, //是否多选
     maxNumber: 0, //Int 当multiple为true的时候,最多可选择的部门数
     pickedDepartments:[],//Array[String] 已经选择的部门distinguishedName列表
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

样例效果:

o2m.biz.contact.departmentsPicker({
topList: [],//不传或者空列表,显示全部组织
orgType: "",//可传空 只显示某种类型的组织
multiple:true, //是否多选
maxNumber: 0, //最大选择数量
pickedDepartments:[],//已选部门
onSuccess : function(result) {
    //返回结果样例
    {
      departments:[{
      "id":"xxxx",
      "name":"部门名称", 
      "unique":"xxxx",
      "distinguishedName":"部门@xxxx@U",
      "typeList":["xxxx"],
      "shortName":"xxxx",
      "level": 0,
      "levelName":"xxxx",
      }]
    }
  
},
onFail : function(err) {}
});

Source

static

IdentityPicker(obj)

通讯录选身份

Parameters

  • obj Object

    IdentityPicker需要传入对象

    {
     topList: [],//Array[String] 可选的顶级组织列表,不传或列表为空的时候,显示全部组织
     multiple:true, //Boolean 是否多选
     maxNumber: 0, //Int 当multiple为true的时候,最多可选择的身份数
     pickedIdentities:[],//Array[String] 已经选择的身份distinguishedName列表
     duty: [],//Array[String] 可选择的人员职责
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

样例效果:

o2m.biz.contact.IdentityPicker({
topList: [],//不传或者空列表,显示全部组织
multiple:true, //是否多选
maxNumber: 0, //最大选择数量
pickedIdentities:[],//已选身份列表
duty: [],//人员职责
onSuccess : function(result) {
    //返回结果样例
    {
      identities:[{
        "id":"xxxx",
        "name":"姓名", 
        "distinguishedName":"姓名@xxxx@I",
        "person":"xxx", 
        "unique":"xxxx",
        "unit":"xxx",
        "unitName":"xxxx",
        "unitLevel": 0,
        "unitLevelName":"xxxx",
        "personName":"xxxx",
        "personUnique":"xxx",
        "personDn":"xxx"
        }]
    }
  
},
onFail : function(err) {}
});

Source

static

GroupPicker(obj)

群组选择

Parameters

  • obj Object

    GroupPicker需要传入对象

    {
     multiple:true, //Boolean 是否多选
     maxNumber: 0, //Int 当multiple为true的时候,最多可选择的身份数
     pickedGroups:[],//Array[String] 已经选择的群组distinguishedName列表
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

样例效果:

o2m.biz.contact.GroupPicker({
multiple:true, //是否多选
maxNumber: 0, //最大选择数量
pickedGroups:[],//已选群组列表
onSuccess : function(result) {
    //返回结果样例
    {
       groups:[{
          "id":"xxxx", 
          "name":"群组名称", 
          "distinguishedName":"群组名称@xxxx@G"
          "unique":"xxxx", 
          }]
    }
  
},
onFail : function(err) {}
});

Source

static

PersonPicker(obj)

人员选择

Parameters

  • obj Object

    PersonPicker需要传入对象

    {
     multiple:true, //Boolean 是否多选
     maxNumber: 0, //Int 当multiple为true的时候,最多可选择的身份数
     pickedUsers:[],//Array[String] 已经选择的人员distinguishedName列表
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

样例效果:

o2m.biz.contact.PersonPicker({
multiple:true, //是否多选
maxNumber: 0, //最大选择数量
pickedUsers:[],//已选人员列表
onSuccess : function(result) {
    //返回结果样例
    {
        users:[{
          "id":"xxx", 
          "name":"姓名", 
          "unique":"xxx", 
          "distinguishedName":"姓名@xxxx@P"
          "genderType":"xxx", 
          "employee":"xxx", 
          "mail":"xxx", 
          "weixin":"xxx", 
          "qq":"xxx", 
          "mobile":"xxx", 
          "officePhone":"xxx"
          }]
    }
  
},
onFail : function(err) {}
});

Source

static

ComplexPicker(obj)

复合选择器,可配置选择多种数据

Parameters

  • obj Object

    ComplexPicker需要传入对象

    {
     pickMode: ["departmentPicker", "identityPicker"], //Array[String] 选择器类型,可传入值:departmentPicker、identityPicker、groupPicker、personPicker
     topList:Array[String] 可选的顶级组织列表,不传或列表为空的时候,显示全部组织
     duty: Array[String] 可选择的人员职责
     orgType:String 可选择的组织类别。为空就是全部组织类型都可以
     multiple:true, //Boolean 是否多选
     maxNumber: 0, //Int 当multiple为true的时候,最多可选择的身份数
     pickedDepartments:Array[String] 已经选择的部门distinguishedName列表
     pickedIdentities:Array[String] 已经选择的身份distinguishedName列表
     pickedGroups: Array[String] 已经选择的群组distinguishedName列表
     pickedUsers:[],//Array[String] 已经选择的人员distinguishedName列表
     "onSuccess": function,  //成功回调
     "onFail": function, //失败回调
    }

Example

样例效果:

o2m.biz.contact.ComplexPicker({
pickMode: ["departmentPicker", "identityPicker"], //选择器类型
topList: [],//不传或者空列表,显示全部组织
orgType: "",//可传空 只显示某种类型的组织
duty: [],//人员职责
multiple:true, //是否多选
maxNumber: 0, //最大选择数量
pickedDepartments:[],//已选部门
pickedIdentities:[],//已选身份列表
pickedGroups:[],//已选群组列表
pickedUsers:[],//已选人员列表
onSuccess : function(result) {
    //返回结果样例
    {
      departments:[{
      "id":"xxxx",
      "name":"部门名称", 
      "unique":"xxxx",
      "distinguishedName":"部门@xxxx@U",
      "typeList":["xxxx"],
      "shortName":"xxxx",
      "level": 0,
      "levelName":"xxxx",
      }],
      identities:[{
      "id":"xxxx",
      "name":"姓名", 
      "distinguishedName":"姓名@xxxx@I",
      "person":"xxx", 
      "unique":"xxxx",
      "unit":"xxx",
      "unitName":"xxxx",
      "unitLevel": 0,
      "unitLevelName":"xxxx",
      "personName":"xxxx",
      "personUnique":"xxx",
      "personDn":"xxx"
      }],
      groups:[{
      "id":"xxxx", 
      "name":"群组名称", 
      "distinguishedName":"群组名称@xxxx@G"
      "unique":"xxxx", 
      }],
      users:[{
      "id":"xxx", 
      "name":"姓名", 
      "unique":"xxx", 
      "distinguishedName":"姓名@xxxx@P"
      "genderType":"xxx", 
      "employee":"xxx", 
      "mail":"xxx", 
      "weixin":"xxx", 
      "qq":"xxx", 
      "mobile":"xxx", 
      "officePhone":"xxx"
      }]
    }
},
onFail : function(err) {}
});

Source

results matching

    No results matching ''