|
- function SignView() {
- //先定位
- map = api.require('bMap');
- if (api.systemType == 'ISO') {
- map.initMapSDK(function(ret) {
- if (ret.status) {
- //alert('地图初始化成功,可以从百度地图服务器检索信息了!');
- }
- });
- }
- map.open({
- rect: {
- x: 0,
- y: 40,
- w: api.frameWidth,
- h: 300
- },
- zoomLevel: 15,
- showUserLocation: true,
- fixedOn: api.frameName,
- fixed: true
- }, function(ret) {
- if (ret.status) {
- ShowAddress();
- }
- });
- }
- function ShowAddress() {
- map.getLocation({
- accuracy: '10m',
- autoStop: true,
- filter: 1
- }, function(ret, err) {
- if (ret.status) {
- //定位成功再转地址
- map.getNameFromCoords({
- lon: ret.lon,
- lat: ret.lat
- }, function(ret, err) {
- if (ret.status) {
- $api.val($api.byId('tbAddress'), ret.address);
- $api.val($api.byId('tblon'), ret.lon);
- $api.val($api.byId('tblat'), ret.lat);
- map.open({
- rect: {
- x: 0,
- y: 40,
- w: api.frameWidth,
- h: 300
- },
- center: {
- lon: ret.lon,
- lat: ret.lat
- },
- zoomLevel: 15,
- showUserLocation: true,
- fixedOn: api.frameName,
- fixed: true
- }, function(ret) {
- if (!ret.status) {
- alert('地图加载失败!');
- }
- });
- }
- });
- }
- });
- }
复制代码
我这个写的有问题吗? |
|