t-comm
Version:
专业、稳定、纯粹的工具库
72 lines (65 loc) • 2.78 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
var _createClass = require('@babel/runtime/helpers/createClass');
var location_locationInterface = require('../location-interface.js');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var _classCallCheck__default = /*#__PURE__*/_interopDefaultLegacy(_classCallCheck);
var _createClass__default = /*#__PURE__*/_interopDefaultLegacy(_createClass);
// import { post } from '../../network/post';
// 用特权sdk获取lbs地址
var TipSdkLocation = /*#__PURE__*/function () {
function TipSdkLocation() {
_classCallCheck__default["default"](this, TipSdkLocation);
}
return _createClass__default["default"](TipSdkLocation, [{
key: "getLocation",
value: function getLocation(options) {
return new Promise(function (resolve, reject) {
var _a;
if (!options.fetchTipSdkLBSRequest) {
reject();
return;
}
(_a = options.fetchTipSdkLBSRequest) === null || _a === void 0 ? void 0 : _a.call(options).then(function (response) {
var _a, _b;
// }))
// post({
// url: 'https://a.igame.qq.com/pmdtrpc.commcgi.user.user/GetUserLbsInfo',
// showMsgToast: false,
// timeout: options.timeout,
// }).then((response) => {
if (response.lbsinfo) {
if (((_a = response.lbsinfo.gpsinfo) === null || _a === void 0 ? void 0 : _a.lat) && response.lbsinfo.gpsinfo.lng) {
var location = {
lat: parseFloat("".concat(response.lbsinfo.gpsinfo.lat)),
lng: parseFloat("".concat(response.lbsinfo.gpsinfo.lng))
};
resolve({
location: location,
flag: location_locationInterface.LocationFlag.LocationSuccess
});
} else if (((_b = response.lbsinfo.netinfo) === null || _b === void 0 ? void 0 : _b.iplat) && response.lbsinfo.netinfo.iplng) {
var _location = {
lat: parseFloat("".concat(response.lbsinfo.netinfo.iplat)),
lng: parseFloat("".concat(response.lbsinfo.netinfo.iplng))
};
resolve({
location: _location,
flag: location_locationInterface.LocationFlag.LocationIpSuccess
});
} else {
reject();
}
} else {
reject();
}
})["catch"](function (error) {
console.log('GetUserLbsInfo', error);
reject();
});
});
}
}]);
}();
exports["default"] = TipSdkLocation;