qingyiay
2023-05-17 af436aa050f76584cd5cb88e413e45cd08c15d50
pages/public-page/mapRoute/mapRoute.vue
@@ -2,7 +2,16 @@
   <view>
      <view class="page-body" style="margin-top: 4rpx;">
         <view class="page-section page-section-gap">
            <map style="width: 100%; height: 600px;" :latitude="latitude" :longitude="longitude" :markers="markers" :polyline="polyline"></map>
            <map
               style="width: 100%; height: 600px;"
               :latitude="latitude"
               :longitude="longitude"
               :markers="markers"
               :polyline="polyline"
               @markertap="awaken"
               @callouttap="awaken"
               @tap="awaken"
            ></map>
         </view>
      </view>
      <view class="tip">
@@ -15,7 +24,7 @@
            <text>{{ duration || '' }}</text>
         </view>
      </view>
      <!-- <view class="" @click="awaken"><button type="default">跳转</button></view> -->
      <view class="open-button" @click="awaken"><u-button type="primary">使用手机地图</u-button></view>
   </view>
</template>
@@ -213,27 +222,11 @@
      },
      // 唤醒
      awaken() {
         uni.getSystemInfo({
            success: function(res) {
               if (res.platform == 'android') {
                  uni.navigateTo({
                     url: `intent://map/routeplan?type=drive&fromcoord=&from=${_this.fromLocation}&tocoord=${_this.toLocation.latitude},${
                        _this.toLocation.longitude
                     }&to=name&policy=0&referer=myapp#Intent;scheme=qqmap;package=com.tencent.map;end`
                  });
               } else if (res.platform == 'ios') {
                  uni.navigateTo({
                     url: `qqmap://map/routeplan?type=drive&fromcoord=&from=${_this.fromLocation}&tocoord=${_this.toLocation.latitude},${
                        _this.toLocation.longitude
                     }&to=name&policy=0&referer=myapp`
                  });
               } else {
                  uni.showToast({
                     title: '当前设备不支持地图导航',
                     icon: 'none'
                  });
               }
            }
         uni.openLocation({
            latitude: this.markers[1].latitude,
            longitude: this.markers[1].longitude,
            name: '目的地位置',
            address: '目的地位置'
         });
      }
   },
@@ -254,18 +247,30 @@
<style lang="scss" scoped>
.tip {
   margin-top: 60rpx;
   width: 94%;
   height: 40rpx;
   font-size: 40rpx;
   margin: vww(22) auto;
   display: flex;
   justify-content: space-around;
   .first {
      color: #c78a64;
      color: #515151;
      text {
         font-size: 45rpx;
         color: #f81414;
      }
   }
}
.open-button {
   width: 100%;
   margin: 40rpx 0;
   display: flex;
   justify-content: center;
   /deep/.u-button {
      width: 300rpx;
      border: 1px solid #3b56eb;
      border-radius: 37rpx 37rpx 37rpx 37rpx;
      background-color: transparent;
      color: #3b56eb;
   }
}
</style>