郭宇琦 vor 3 Tagen
Ursprung
Commit
6d216bf862

+ 72 - 0
component/googleMap/googleMaps.vue

@@ -0,0 +1,72 @@
+<template>
+	<view :style="{width:width,height:height}">
+		<view :style="{width:width,height:height}" id='map'></view>
+	</view>
+</template>
+
+<script>
+	import { Loader } from "@googlemaps/js-api-loader"
+	export default {
+		props:{
+			width: {
+				type: String,
+				default: '100%'
+			},
+			height: {
+				type: String,
+				default: '100%'
+			},
+			myLocations:{
+				type:Object,
+				default:{}
+			}
+		},
+		data() {
+			return {
+				maps: null,
+				loader:null
+			}
+		},
+		mounted() {
+			// https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap
+			const script = document.createElement('script')
+			script.src =
+				'https://maps.googleapis.com/maps/api/js?key=AIzaSyCWxFJPWgJP8hb2cTbvfZb13tbm2rlhxgs&callback=initMap&v=weekly&loading=async';
+			script.async = true; // 异步加载
+			script.defer = true; // 延迟执行
+			document.head.appendChild(script)
+			window.initMap = function() {
+				console.log('啦啦啦啦')
+			};
+			// let loader = new Loader({
+			// 	apiKey: "AIzaSyCWxFJPWgJP8hb2cTbvfZb13tbm2rlhxgs",
+			// 	version: "weekly",
+			// });
+			// this.init(loader)
+		},
+		methods: {
+			async init(loader) {
+				loader.load().then(async res => {
+					console.log(res)
+					const {
+						Map
+					} = await google.maps.importLibrary("maps");
+
+					this.map = new Map(document.getElementById("map"), {
+						center: {
+							lat: -34.397,
+							lng: 150.644
+						},
+						zoom: 8,
+					});
+				}).catch(err=>{
+					console.log(err)
+				});
+			}
+		}
+	}
+</script>
+
+<style>
+
+</style>

+ 1 - 0
package.json

@@ -30,6 +30,7 @@
     },
     "dependencies": {
         "@amap/amap-jsapi-loader": "^1.0.1",
+        "@googlemaps/js-api-loader": "^1.16.8",
         "crypto-js": "^4.2.0",
         "dayjs": "^1.11.13",
         "echarts": "^5.6.0",

+ 4 - 3
pages/index/index.vue

@@ -63,11 +63,11 @@
 						<!-- <img :src="car_info.model_images||'https://qiniu.bms16.com/Fg8_p7083jpsy8BXG4bR6yMs7jQX'" style="width: 100%;height: 526rpx;" alt=""> -->
 						<!-- <img :src="'https://qiniu.bms16.com/Fg8_p7083jpsy8BXG4bR6yMs7jQX'"
 							style="width: 100%;height: 526rpx;" alt=""> -->
-							<view @tap="toMoreInfoPage" class="custom-swiper-view">
-								<u-swiper v-if="car_image.length!=0" :list="car_image"  :autoplay="false" mode="none"
+							<view class="custom-swiper-view">
+								<u-swiper @click="toMoreInfoPage" v-if="car_image.length!=0" :list="car_image"  :autoplay="false" mode="none"
 									 :height="480" bgColor="transparent" class="custom-swiper">
 								</u-swiper>
-								<image v-else style="width: 100%;height: 480rpx;" src="https://qiniu.bms16.com/Fg8_p7083jpsy8BXG4bR6yMs7jQX" mode="">
+								<image @click="toMoreInfoPage" v-else style="width: 100%;height: 480rpx;" src="https://qiniu.bms16.com/Fg8_p7083jpsy8BXG4bR6yMs7jQX" mode="">
 								</image>
 							</view>
 							
@@ -349,6 +349,7 @@
 				})
 			},
 			toMoreInfoPage() {
+				console.log(2555555)
 				uni.navigateTo({
 					url: '/pages/moreInfo/moreInfo',
 				});

+ 1 - 1
pages/openCabinet/openCabinet.vue

@@ -27,7 +27,7 @@
 				</view>
 				<view v-if="list.status==3" class="open-result-view">
 					<view class="open-result flex-row">换电成功</view>
-					<view class="open-result-tip flex-row">即将跳转至首页,祝您骑行愉快</view>
+					<view class="open-result-tip flex-row">祝您骑行愉快</view>
 				</view>
 				<view v-if="list.status==4" class="open-result-view">
 					<view class="open-result flex-row">换电失败</view>

+ 1 - 1
pages/travelingTrack/travelingTrack.css

@@ -37,9 +37,9 @@
 	color: #5E6F90;
 	background-color: #F3F8FF;
 	border-radius: 40rpx;
+	padding: 0 20rpx;
 	padding-top: 12rpx;
 	padding-bottom: 12rpx;
-	width: 208rpx;
 	text-align: center;
 }
 

+ 7 - 5
pages/travelingTrack/travelingTrack.vue

@@ -15,11 +15,13 @@
 			type:3,
 			polylines
 		}' :myLocation='myLocation'></googleMap>
+		
+		<!-- <googleMaps width="100%" height='calc(50vh - 0rpx)' :myLocations='myLocation'></googleMaps> -->
 		<!-- #endif -->
 
 		<view class="car-info">
 			<view class="info-top flex-row flex-between">
-				<view class="top-left">
+				<view class="top-left f">
 					<view>{{carInfo.car_name}}</view>
 					<view>车牌号:{{carInfo.license_plate_number}}</view>
 				</view>
@@ -43,11 +45,11 @@
 			</view>
 			<view class="info-bottom flex-row flex-between">
 				<view class="bottom-item">
-					<view>{{trackInfo.total_mil}}<text>km</text></view>
+					<view>{{(trackInfo.total_mil / 1000).toFixed(2)}}<text>km</text></view>
 					<view>行驶里程</view>
 				</view>
 				<view class="bottom-item">
-					<view>{{tools.toFix((trackInfo.using_time || 0) /3600)}}<text>h</text></view>
+					<view>{{tools.toFix((trackInfo.total_time || 0) / 3600)}}<text>h</text></view>
 					<view>骑行时长</view>
 				</view>
 				<view class="bottom-item">
@@ -65,7 +67,7 @@
 <script module="tools" lang="wxs" src="@/pages/common/wxs/tools.wxs"></script>
 <script module="tools" lang="sjs" src="@/pages/common/wxs/tools.sjs"></script>
 <script>
-	import googleMap from "@/component/googleMap/googleMap";
+	import googleMaps from "@/component/googleMap/googleMaps";
 	var common = require('../../common/common.js');
 	var amap = require('../../common/amap-wx.js');
 	var config = require('../../common/config.js');
@@ -75,7 +77,7 @@
 	var storage = require('../../common/storage.js');
 	export default {
 		components: {
-			googleMap,
+			googleMaps,
 		},
 		data() {
 			return {