Просмотр исходного кода

移动端jsapi添加定位功能

fancy 5 лет назад
Родитель
Сommit
885db6187e
1 измененных файлов с 24 добавлено и 1 удалено
  1. 24 1
      o2web/source/x_desktop/js/o2m.api.js

+ 24 - 1
o2web/source/x_desktop/js/o2m.api.js

@@ -312,6 +312,7 @@
       device
         o2m.util.device.getPhoneInfo
         o2m.util.device.scan
+        o2m.util.deveice.location
       navigation
         o2m.util.navigation.setTitle
         o2m.util.navigation.close
@@ -510,7 +511,7 @@
 
   //o2m.util.device.scan
   this.o2m.util.device.scanSuccess = function (result) {
-    console.log("util calendar chooseInterval back, result:" + result);
+    console.log("util device scan back, result:" + result);
   };
   var _o2m_u_device_scan = function (c) {
     var onSuccess = c && c.onSuccess ? c.onSuccess : null;
@@ -529,6 +530,28 @@
   };
   this.o2m.util.device.scan = _o2m_u_device_scan;
 
+  
+  //o2m.util.device.location
+  this.o2m.util.device.locationSuccess = function (result) {
+    console.log("util device location back, result:" + result);
+  };
+  var _o2m_u_device_location = function(c) {
+    var onSuccess = c && c.onSuccess ? c.onSuccess : null;
+    var onFail = c && c.onFail ? c.onFail : null;
+    if (onSuccess && typeof onSuccess === "function") {
+      o2m.util.device.locationSuccess = onSuccess;
+    }
+    var body = {
+      type: "device.location",
+      callback: "o2m.util.device.locationSuccess",
+      data: {
+
+      }
+    };
+    _util_post(body, onFail);
+  };
+  this.o2m.util.device.location = _o2m_u_device_location;
+
 
   //o2m.util.navigation.setTitle
   this.o2m.util.navigation.setTitleSuccess = function (result) {