瀏覽代碼

Merge branch 'master' of http://115.29.66.169:10080/GA-ZW/H5

zhangkang 2 月之前
父節點
當前提交
9f7532294c
共有 10 個文件被更改,包括 636 次插入214 次删除
  1. 4 1
      App.vue
  2. 5 5
      api/map.js
  3. 327 108
      components/tiandituMap/tiandituMap - 副本.vue
  4. 6 4
      components/tiandituMap/tiandituMap.vue
  5. 1 1
      index.html
  6. 1 1
      package.json
  7. 100 53
      pages/map/index.vue
  8. 109 0
      pages/map/model/hint - 副本.vue
  9. 51 37
      pages/map/model/hint.vue
  10. 32 4
      utils/tool.js

+ 4 - 1
App.vue

@@ -1,4 +1,4 @@
-<script>
+<script> 
 	export default {
 		onLaunch: function() {
 			console.log('App Launch')
@@ -14,6 +14,9 @@
 		},
 		onHide: function() {
 			console.log('App Hide')
+		},
+		mounted() {
+	 
 		}
 	}
 </script>

+ 5 - 5
api/map.js

@@ -2,18 +2,18 @@ import http from "@/utils/request.js";
 
 // 获取地图中心点
 export const getMapCenterPoint_Api = () => http.get('/h5/biz/map/getCenterPoint')
- 
- 
+
+
 // 获取地图列表
-export const getMapList_Api = (params) => http.get('/h5/biz/map/list' , {params:params})
+export const getMapList_Api = (params) => http.get('/h5/biz/map/list', { params: params })
 
 
 // 获取地图类型
-export const getMaptypeList_Api = (params) => http.get('/h5/biz/maptype/list' , {params:params})
+export const getMaptypeList_Api = (params) => http.get('/h5/biz/maptype/list', { params: params })
 
 
 // 获取地图点位服务
-export const getMapMatterList_Api = (params) => http.get('/h5/biz/map/matterList' , {params:params})
+export const getMapMatterList_Api = (params) => http.get('/h5/biz/map/matterList', { params: params })
 // 获取地图点位服务
 export const getMapMatterListH6_Api = (params) =>
     http.get("/h6/biz/map/matterList", { params: params });

文件差異過大導致無法顯示
+ 327 - 108
components/tiandituMap/tiandituMap - 副本.vue


+ 6 - 4
components/tiandituMap/tiandituMap.vue

@@ -6,7 +6,7 @@
 			</view>
 			<view class="position" @click.stop="$emit('openHint')">
 				<image class="position-icon" src="@/static/images/hint.png" mode="aspectFit"></image>
-				<text class="position-text">声明</text>
+				<text class="position-text">提示</text>
 			</view>
 			<view v-if="isFeedback" class="position" @click.stop="$emit('openFeedback')">
 				<image class="position-icon" src="@/static/images/feedback.png" mode="aspectFit"></image>
@@ -326,7 +326,7 @@
 			},
 			addMapEvent() {
 				//移除地图的移动停止事件
-				this.getLocation()
+				// this.getLocation()
 				this.removeMapEvent()
 				if (Tmap) {
 					Tmap.addEventListener("moveend", this.MapMoveend);
@@ -368,6 +368,7 @@
 					// 		})
 					// 	}
 					// }
+					console.log('this.checkedDot === ' , this.checkedDot)
 					// 地图移动,判断是否缩放/移动地图,还是通过点位定位
 					if (!this.checkedDot) {
 						const v = e.target.getCenter()
@@ -482,7 +483,6 @@
 				}
 			},
 			initChartsRender() {
-				this.$ownerInstance.callMethod('compliteonLoadTianDiTu')
 				const {
 					lng,
 					lat
@@ -502,7 +502,9 @@
 				// 	console.log('addEventListener  = ' , e)
 				// });
 				this.addMapEvent()
-				this.$emit("handleSearch")
+				
+				this.$ownerInstance.callMethod('compliteonLoadTianDiTu')
+				// this.$emit("handleSearch")
 			},
 			// upDataChartsRender(lng, lat) {
 			// 	if (!Tmap) return

+ 1 - 1
index.html

@@ -61,6 +61,6 @@
 	</head>
 	<body>
 		<div id="app"><!--app-html--></div>
-		<script type="module" src="/main.js"></script>
+		<!-- <script type="module" src="/main.js"></script> -->
 	</body>
 </html>

+ 1 - 1
package.json

@@ -5,4 +5,4 @@
 		"uview-ui": "2.0.38",
 		"whichtype": "^1.0.1"
 	}
-}
+}

+ 100 - 53
pages/map/index.vue

@@ -1,17 +1,17 @@
 <template>
 	<view class="map-box">
-		<search ref="searchRef" @handleSearch="handleSearch" v-if="showMap" />
+		<search ref="searchRef" @handleSearch="handleSearch" v-show="showMap" />
 
 		<tiandituMap ref="tiandituMapRefs" @handleSearch="$refs.searchRef.onSearchFocus()" @clickMap="handleClickMap"
 			@moveMap="moveMapSearch" @onLoadTianDiTu="initMaps" @onSelect="selectPoint" :apiKey="apiKey"
 			@handleMapSite="handleMapSite" @centre-text-callback="e => centreText = e" :siteListArr='siteListArr'
-			:searchDot="searchDot" @openHint="$refs.HintContentRef.open()" @openFeedback="goPages('feedback')"/>
+			:searchDot="searchDot" @openHint="$refs.HintContentRef.open()" @openFeedback="goPages('feedback')" />
 
 
-		<Touchbox ref="TouchboxRef" :maxHeight="0.8" v-if="showMap && siteListArr && siteListArr.length > 0"
+		<Touchbox ref="TouchboxRef" :maxHeight="0.8" v-show="showMap && siteListArr && siteListArr.length > 0"
 			:zIndex="1001" @currentHeight="e => TouchHeight = e">
-			<template #touchSlot> 
-			<!-- 	<view class="centre-box" v-if="SearchText">
+			<template #touchSlot>
+				<!-- 	<view class="centre-box" v-if="SearchText">
 					<text class="text">为您展示</text>
 					<text class="text-val one-row">{{SearchText}}</text>
 					<text class="text">相关的大厅</text>
@@ -48,13 +48,24 @@
 	import search from "./model/search.vue"
 	import siteListModel from "./model/siteList.vue";
 	import tools from '@/components/tiandituMap/tools.js'
-	import { getMapCenterPoint_Api, getMapList_Api } from "@/api/map.js"
+	import {
+		getMapCenterPoint_Api,
+		getMapList_Api,
+		getVisituvpv_Api
+	} from "@/api/map.js"
 	import siteDetails from "./model/siteDetails.vue"
 	import $config from "@/config/index.js"
-	import { EventBus } from "@/utils/vueBus.js"
-	import { getLocation } from "@/utils/tool.js"
+	import {
+		EventBus
+	} from "@/utils/vueBus.js"
+	import {
+		getLocation
+	} from "@/utils/tool.js"
 	import serviceCenter from "./model/service-center.vue"
-	import HintContent from "./model/hint.vue" 
+	import HintContent from "./model/hint.vue"
+	import {
+		getUUID
+	} from "@/utils/tool.js";
 	export default {
 		name: 'tdtmap',
 		components: {
@@ -62,7 +73,7 @@
 			siteListModel,
 			serviceCenter,
 			siteDetails,
-			HintContent, 
+			HintContent,
 		},
 		data() {
 			return {
@@ -70,7 +81,7 @@
 				searchDot: false,
 				// 是否显示地图
 				showMap: false,
-				SearchText:'',
+				SearchText: '',
 
 
 
@@ -79,8 +90,8 @@
 
 
 
-				longitude: undefined,
-				latitude: undefined,
+				longitude: '114.28944',
+				latitude: '30.66195',
 				apiKey: $config.tianKey,
 				winWidth: 0,
 				winHeight: 0,
@@ -101,16 +112,23 @@
 			}
 		},
 		created() {
-			getLocation();
+			// getLocation();
 
-			this.getMapCenterPoint()
+			// this.getMapCenterPoint()
 		},
 		mounted() {
+			const userLabel = getUUID();
+			const refererStr = document.referrer;
+			getVisituvpv_Api({
+				userLabel,
+				refererStr,
+			})
 			// setTimeout(() => {
 			// 	console.log("this.$refs.SelectMapNavigationRef = " , this.$refs.SelectMapNavigationRef)
 			// 	this.$refs.SelectMapNavigationRef.open()
 			// }, 3000)
-			this.disableScroll()
+			this.disableScroll();
+			this.open(this.longitude, this.latitude);
 		},
 		beforeDestroy() {
 			try {
@@ -128,16 +146,58 @@
 
 		},
 		methods: {
+			async initMaps() {
+				console.warn('--------天地图加载完成--------');
+				this.$emit('onLoad') 
+				try {
+					uni.showLoading()
+					const { longitude, latitude } = await getLocation();
+					// console.log("longitude, latitude = " , longitude, latitude)
+					if(longitude && latitude){
+						this.longitude = longitude;
+						this.latitude = latitude;
+						this.movePT({longitude , latitude} , true)
+						uni.hideLoading()
+						this.handleSearch()
+					}else{
+						throw new Error()	
+					}
+						// this.longitude = '114.25497';
+						// this.latitude = '30.62832';
+						// this.movePT({longitude:this.longitude , latitude:this.latitude} , true)
+						// uni.hideLoading()
+						// this.handleSearch()
+				} catch (error) {
+					uni.hideLoading()
+					this.getMapCenterPoint()
+				} finally{
+					this.showMap = true;
+				}
+			},
+			/**
+			 * 移动到中心点
+			 * PT 点位
+			 * refresh 移动之后是否刷新获取数据
+			*/
+			movePT(PT , refresh = false){
+				this.$refs.tiandituMapRefs.SelectedDot({longitude:this.longitude , latitude:this.latitude} , !refresh)
+			},
 			// 获取地图中心点
 			getMapCenterPoint() {
 				uni.showLoading()
-				this.showMap = false;
 				getMapCenterPoint_Api().then(res => {
-					const { longitude, latitude, mapTypeIcon } = res || {};
+					const {
+						longitude,
+						latitude,
+						mapTypeIcon
+					} = res || {};
 					this.longitude = longitude;
 					this.latitude = latitude;
-					this.open(longitude, latitude, mapTypeIcon);
-				}).catch(err => { this.open(null, null) }).finally(() => {
+					this.movePT({longitude , latitude} , true)
+					this.handleSearch()
+				}).catch(err => {
+					this.open(null, null)
+				}).finally(() => {
 					uni.hideLoading()
 				})
 			},
@@ -145,7 +205,6 @@
 				if (lon && lat) {
 					this.$nextTick(() => {
 						this.$refs.tiandituMapRefs.initCharts(lon, lat, mapTypeIcon)
-						this.showMap = true;
 					})
 				} else {
 					uni.showModal({
@@ -160,6 +219,7 @@
 
 			},
 			handleSearch(val = {}) {
+				this.showMap = true;
 				const parms = {
 					...val,
 					longitude: this.longitude,
@@ -197,28 +257,6 @@
 			},
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 			getScrollHeight(TouchHeight, centreText) {
 				const h = centreText ? this.centreTextHeight : 0
 				return TouchHeight - h - 15 + 'px'
@@ -227,7 +265,9 @@
 				if (typeof window.addEventListener === 'function') {
 					document.addEventListener('touchmove', function(e) {
 						e.preventDefault();
-					}, { passive: false });
+					}, {
+						passive: false
+					});
 					document.body.addEventListener('mousewheel', function(e) {
 						e.preventDefault();
 					});
@@ -271,10 +311,20 @@
 			},
 
 			moveMapSearch(parms) {
-				const { Lng, Lat } = parms;
+				console.log('moveMapSearch = ' ,1 )
+				const {
+					Lng,
+					Lat
+				} = parms;
 				this.longitude = Lng;
 				this.latitude = Lat;
-				this.$refs.searchRef.onSearchFocus()
+				
+				if(this.$refs.searchRef){
+					this.$refs.searchRef.onSearchFocus()
+				}else{
+					this.handleSearch()
+				}
+				// 
 				// console.log("moveMapSearch", Lng, Lat)
 			},
 
@@ -383,10 +433,7 @@
 				this.datalist = [e]
 				this.selectItem = e
 			},
-			initMaps() {
-				console.warn('--------天地图加载完成--------');
-				this.$emit('onLoad')
-			},
+
 			// start(e) {
 			// 	const clientY = e.changedTouches[0].clientY
 			// 	this.startY = clientY
@@ -427,12 +474,12 @@
 				//最大高度
 				this.scrollMaxHeight = val;
 			},
-			
+
 			// 页面跳转
-			goPages(){
+			goPages() {
 				// 'feedback'
 				uni.navigateTo({
-					url:"/pages/feedback/feedback"
+					url: "/pages/feedback/feedback"
 				})
 			}
 

+ 109 - 0
pages/map/model/hint - 副本.vue

@@ -0,0 +1,109 @@
+<template>
+	<uni-popup ref="hintRef" :isMaskClick='true' type="center" border-radius="10px 10px 0 0"
+		maskBackgroundColor='rgba(0, 0, 0, 0.1)'>
+		<view class="hint-box">
+			<view class="hint-title">服务声明</view>
+			<view class="hint-val">
+				尊敬的市民朋友,您好!【武汉公安政务服务地图】正在试运行中,如有任何疑问和建议,欢迎致电武汉公安政务服务专线027-85395115。
+			</view>
+			<view class="hint-btns" @click.stop="onClose()">
+				<view class="hint-btn">关闭</view>
+			</view>
+		</view>
+	</uni-popup>
+</template>
+
+<script>
+	import { PhoneCall } from "@/utils/tool.js";
+	export default {
+		data() {
+			return {
+				hintList: []
+			}
+		},
+		created() {
+
+		},
+		mounted() {
+			this.cheackShow();
+		},
+		methods: {
+			cheackShow() {
+				try {
+					const a = uni.getStorageSync('showHint');
+					if (!a) {
+						this.open()
+					}
+				} catch (e) {
+					this.open()
+				}
+			},
+			open() {
+				this.$refs.hintRef.open()
+				try {
+					uni.setStorageSync('showHint', true);
+				} catch (e) {
+					// error
+				}
+			},
+			onPhoneCall(phone) {
+				PhoneCall(phone).then(res => {
+					this.onClose()
+				})
+			},
+			onClose() {
+				this.$refs.hintRef.close()
+				this.hintList = [];
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.uni-popup {
+		z-index: 1002;
+
+		.hint-box {
+			width: 80vw;
+			min-height: 30vh;
+			height: auto;
+			max-height: 70vh;
+			background-color: #fff;
+			border-radius: 20rpx;
+			display: flex;
+			flex-direction: column;
+			// justify-content: center;
+			align-items: center;
+			justify-content: space-between;
+
+			.hint-title {
+				font-size: 36rpx;
+				padding: 20rpx 0;
+			}
+
+			.hint-val {
+				height: 1px;
+				flex: 1;
+				padding: 20rpx 30rpx;
+				color: #6F6F6F;
+
+			}
+
+			.hint-btns {
+				padding: 20rpx 0;
+
+				.hint-btn {
+					width: 260rpx;
+					height: 80rpx;
+					display: flex;
+					justify-content: center;
+					align-items: center;
+					color: #fff;
+					border-radius: 10rpx;
+					background-color: #3291F8;
+				}
+
+			}
+		}
+	}
+</style>

+ 51 - 37
pages/map/model/hint.vue

@@ -71,45 +71,59 @@ export default {
 .uni-popup {
   z-index: 1002;
 
-  .hint-box {
-    width: 80vw;
-    min-height: 30vh;
-    height: auto;
-    max-height: 70vh;
-    background-color: #fff;
-    border-radius: 20rpx;
-    display: flex;
-    flex-direction: column;
-    // justify-content: center;
-    align-items: center;
-    justify-content: space-between;
+		.hint-box {
+			width: 80vw;
+			background-color: #fff;
+			border-radius: 20rpx;
+			// display: flex;
+			// flex-direction: column;
+			// justify-content: center;
+			// align-items: center;
+			// justify-content: space-between;
 
-    .hint-title {
-      font-size: 36rpx;
-      padding: 20rpx 0;
-    }
+			.hint-title {
+				text-align: center;
+				font-size: 36rpx;
+				height: 80rpx;
+				line-height: 80rpx;
+			}
 
-    .hint-val {
-      height: 1px;
-      flex: 1;
-      padding: 20rpx 30rpx;
-      color: #6f6f6f;
-    }
+			.hint-val {
+				// height: calc(100% - 76rpx - 130rpx);
+				padding: 20rpx 30rpx;
+				color: #6F6F6F;
 
-    .hint-btns {
-      padding: 20rpx 0;
+				.hint-content {
+					height: auto;
+					min-height: 20rpx;
+					max-height: 65vh;
+				}
 
-      .hint-btn {
-        width: 260rpx;
-        height: 80rpx;
-        display: flex;
-        justify-content: center;
-        align-items: center;
-        color: #fff;
-        border-radius: 10rpx;
-        background-color: #3291f8;
-      }
-    }
-  }
-}
+				.paragraph-item {
+					text-indent: 2em;
+
+					.item-sing {
+						font-weight: bold;
+					}
+				}
+			}
+
+			.hint-btns {
+				padding: 20rpx 0;
+
+				.hint-btn {
+					margin: 0 auto;
+					width: 260rpx;
+					height: 80rpx;
+					display: flex;
+					justify-content: center;
+					align-items: center;
+					color: #fff;
+					border-radius: 10rpx;
+					background-color: #3291F8;
+				}
+
+			}
+		}
+	}
 </style>

+ 32 - 4
utils/tool.js

@@ -55,7 +55,7 @@ export const getLocation = () => {
 			uni.getLocation({
 				type: 'wgs84', // 返回可以用于uni.openLocation的经纬度
 				success: (res) => {
-					console.log("getLocation 1111111111111111111= ", res)
+					// console.log("getLocation 1111111111111111111= ", res)
 					// this.selfLatitude = res.longitude;
 					// this.selfLongitude = res.latitude;
 					resolve(res)
@@ -63,24 +63,29 @@ export const getLocation = () => {
 				fail: (err) => {
 					console.log('获取位置失败2 :', err);
 					reject()
+				},
+				complete() {
+					console.log('获取位置失败结束1');
 				}
 			});
 		} catch (error) {
 			console.log('获取位置失败 1:', error);
-			//TODO handle the exception
+			reject()
+		} finally{
+			console.log('获取位置失败结束2');
 		}
 	})
 }
 
 
 
-export const uploadImage = (num = 1, type = 'img' , extension = ['.png','.jpg']) => {
+export const uploadImage = (num = 1, type = 'img', extension = ['.png', '.jpg']) => {
 	return new Promise(async (resolve, reject) => {
 		uni.chooseImage({
 			count: num,
 			sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
 			sourceType: ['album'], //从相册选择
-			extension:extension,
+			extension: extension,
 			// crop: {
 			// 	quality: 100, // 图片裁剪质量
 			// 	width: 100, // 裁剪的宽度
@@ -172,4 +177,27 @@ export const SingleFileUpload = (file, showLoading = false) => {
 			}
 		})
 	})
+}
+
+export const getUUID = () => {
+	return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
+		return (c === "x" ? (Math.random() * 16) | 0 : "r&0x3" | "0x8").toString(
+			16
+		);
+	});
+}
+
+export const createTianditu = (key) => {
+	console.log("key keykeykeykeykeykeykeykeykeykey= " , key)
+  return new Promise((resolve, reject) => {
+    if (window.T) {
+      resolve(window.T);
+      return;
+    }
+    const script = document.createElement('script');
+    script.src = `https://api.tianditu.gov.cn/api?v=4.0&tk=${key}`;
+    script.onload = () => resolve(window.T);
+    script.onerror = reject;
+    document.head.appendChild(script);
+  });
 }