12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <template>
- <view class="shareImage">
- <view style="">
- <web-view id="mapContainer" :src="srcHandler()"></web-view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- bgColor: '#317AFE',
- bool: false,
- lat: '',
- lng: ''
- }
- },
- created() {
- // this.getLngLat();
- },
- methods: {
- back(){
- uni.navigateBack({
-
- })
- },
- srcHandler() {
- // console.log(uni.getStorageSync('sendaddress'),uni.getStorageSync('unsendaddress'))
- var sendaddress=uni.getStorageSync('sendaddress').sendLatitude+','+uni.getStorageSync('sendaddress').sendLongitude
- var unsendaddress=uni.getStorageSync('unsendaddress').unsendLatitude+','+uni.getStorageSync('unsendaddress').unsendLongitude
- // console.log(this.lat,)
- return `/hybrid/html/map.html?lat=${sendaddress}&unsendaddress=${unsendaddress}&distance=${uni.getStorageSync('distance')}`
- },
- getLngLat() {
- uni.getLocation({
- type: 'wgs84',
- success: res => {
- if (res.latitude) {
- this.lat = res.latitude + ',' + res.longitude;
- // this.lng = res.longitude;
- } else {
- if (uni.getSystemInfoSync().platform == 'android') {
- var context = plus.android.importClass("android.content.Context");
- var locationManager = plus.android.importClass(
- "android.location.LocationManager");
- var main = plus.android.runtimeMainActivity();
- var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
- this.bool = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)
- }
- if (this.bool === false) {
- uni.showModal({
- title: '提示',
- content: '请打开定位服务',
- success: ({
- confirm,
- cancel
- }) => {
- if (confirm) {
- if (uni.getSystemInfoSync().platform == 'android') {
- var Intent = plus.android.importClass(
- 'android.content.Intent');
- var Settings = plus.android.importClass(
- 'android.provider.Settings');
- var intent = new Intent(Settings
- .ACTION_LOCATION_SOURCE_SETTINGS);
- var main = plus.android.runtimeMainActivity();
- main.startActivity(intent); // 打开系统设置GPS服务页面
- }
- }
- }
- });
- }
- }
- }
- });
- }
- }
- }
- </script>
|