MS-CIAZDCOIXVRW\Administrator 3 лет назад
Родитель
Сommit
b7f4c5a2ac
92 измененных файлов с 5474 добавлено и 3606 удалено
  1. 125 50
      pages/addLocation/addLocation.vue
  2. 72 7
      pages/home/home.vue
  3. 3 3
      pages/index/index.vue
  4. 38 41
      pages/location/location.vue
  5. 66 37
      pages/punchLocation/punchLocation.vue
  6. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/common/main.js.map
  7. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/common/vendor.js.map
  8. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/components/chocolate-progress-bar/chocolate-progress-bar.js.map
  9. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/404/404.js.map
  10. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/addLocation/addLocation.js.map
  11. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/addRules/addRules.js.map
  12. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/authentication/authentication.js.map
  13. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/cardRecord/cardRecord.js.map
  14. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/editRules/editRules.js.map
  15. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/group/group.js.map
  16. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/home/home.js.map
  17. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/index/index.js.map
  18. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/location/location.js.map
  19. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/my/my.js.map
  20. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/particulars/particulars.js.map
  21. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/powerSet/powerSet.js.map
  22. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/punchLocation/punchLocation.js.map
  23. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/punchTime/punchTime.js.map
  24. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/qr_code/qr_code.js.map
  25. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/ruleName/ruleName.js.map
  26. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/ruleSet/ruleSet.js.map
  27. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/rulesDetail/rulesDetail.js.map
  28. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/setPunchTime/setPunchTime.js.map
  29. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/stat/stat.js.map
  30. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/statDetail/statDetail.js.map
  31. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/jlk-week/components/jlk-week/jlk-week.js.map
  32. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-calendar/components/uni-calendar/uni-calendar-item.js.map
  33. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-calendar/components/uni-calendar/uni-calendar.js.map
  34. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-collapse/components/uni-collapse-item/uni-collapse-item.js.map
  35. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-collapse/components/uni-collapse/uni-collapse.js.map
  36. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js.map
  37. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-icons/components/uni-icons/uni-icons.js.map
  38. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-popup/components/uni-popup/uni-popup.js.map
  39. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.js.map
  40. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.js.map
  41. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.js.map
  42. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/zwx-dropDown/components/zwx-dropDown/zwx-dropDown.js.map
  43. 1 1
      unpackage/dist/dev/mp-weixin/common/main.js
  44. 3201 2450
      unpackage/dist/dev/mp-weixin/common/vendor.js
  45. 14 14
      unpackage/dist/dev/mp-weixin/components/chocolate-progress-bar/chocolate-progress-bar.js
  46. 17 17
      unpackage/dist/dev/mp-weixin/pages/404/404.js
  47. 134 60
      unpackage/dist/dev/mp-weixin/pages/addLocation/addLocation.js
  48. 1 1
      unpackage/dist/dev/mp-weixin/pages/addLocation/addLocation.wxml
  49. 2 2
      unpackage/dist/dev/mp-weixin/pages/addLocation/addLocation.wxss
  50. 21 21
      unpackage/dist/dev/mp-weixin/pages/addRules/addRules.js
  51. 18 18
      unpackage/dist/dev/mp-weixin/pages/authentication/authentication.js
  52. 21 21
      unpackage/dist/dev/mp-weixin/pages/cardRecord/cardRecord.js
  53. 21 21
      unpackage/dist/dev/mp-weixin/pages/editRules/editRules.js
  54. 25 25
      unpackage/dist/dev/mp-weixin/pages/group/group.js
  55. 109 36
      unpackage/dist/dev/mp-weixin/pages/home/home.js
  56. 1 1
      unpackage/dist/dev/mp-weixin/pages/home/home.wxml
  57. 24 30
      unpackage/dist/dev/mp-weixin/pages/index/index.js
  58. 51 54
      unpackage/dist/dev/mp-weixin/pages/location/location.js
  59. 1 1
      unpackage/dist/dev/mp-weixin/pages/location/location.wxml
  60. 17 17
      unpackage/dist/dev/mp-weixin/pages/my/my.js
  61. 73 73
      unpackage/dist/dev/mp-weixin/pages/particulars/particulars.js
  62. 18 18
      unpackage/dist/dev/mp-weixin/pages/powerSet/powerSet.js
  63. 69 43
      unpackage/dist/dev/mp-weixin/pages/punchLocation/punchLocation.js
  64. 1 1
      unpackage/dist/dev/mp-weixin/pages/punchLocation/punchLocation.wxml
  65. 3 3
      unpackage/dist/dev/mp-weixin/pages/punchLocation/punchLocation.wxss
  66. 20 20
      unpackage/dist/dev/mp-weixin/pages/punchTime/punchTime.js
  67. 12 12
      unpackage/dist/dev/mp-weixin/pages/qr_code/qr_code.js
  68. 0 1
      unpackage/dist/dev/mp-weixin/pages/qr_code/qr_code.wxss
  69. 17 17
      unpackage/dist/dev/mp-weixin/pages/ruleName/ruleName.js
  70. 19 19
      unpackage/dist/dev/mp-weixin/pages/ruleSet/ruleSet.js
  71. 18 18
      unpackage/dist/dev/mp-weixin/pages/rulesDetail/rulesDetail.js
  72. 158 158
      unpackage/dist/dev/mp-weixin/pages/setPunchTime/setPunchTime.js
  73. 27 27
      unpackage/dist/dev/mp-weixin/pages/stat/stat.js
  74. 21 21
      unpackage/dist/dev/mp-weixin/pages/statDetail/statDetail.js
  75. 18 1
      unpackage/dist/dev/mp-weixin/project.config.json
  76. 27 0
      unpackage/dist/dev/mp-weixin/project.private.config.json
  77. 16 16
      unpackage/dist/dev/mp-weixin/uni_modules/jlk-week/components/jlk-week/jlk-week.js
  78. 15 15
      unpackage/dist/dev/mp-weixin/uni_modules/uni-calendar/components/uni-calendar/uni-calendar-item.js
  79. 17 17
      unpackage/dist/dev/mp-weixin/uni_modules/uni-calendar/components/uni-calendar/uni-calendar.js
  80. 15 15
      unpackage/dist/dev/mp-weixin/uni_modules/uni-collapse/components/uni-collapse-item/uni-collapse-item.js
  81. 14 14
      unpackage/dist/dev/mp-weixin/uni_modules/uni-collapse/components/uni-collapse/uni-collapse.js
  82. 15 15
      unpackage/dist/dev/mp-weixin/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js
  83. 15 15
      unpackage/dist/dev/mp-weixin/uni_modules/uni-icons/components/uni-icons/uni-icons.js
  84. 15 15
      unpackage/dist/dev/mp-weixin/uni_modules/uni-popup/components/uni-popup/uni-popup.js
  85. 16 16
      unpackage/dist/dev/mp-weixin/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.js
  86. 14 14
      unpackage/dist/dev/mp-weixin/uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.js
  87. 21 21
      unpackage/dist/dev/mp-weixin/uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.js
  88. 10 10
      unpackage/dist/dev/mp-weixin/uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.js
  89. 11 11
      unpackage/dist/dev/mp-weixin/uni_modules/uni-transition/components/uni-transition/uni-transition.js
  90. 15 15
      unpackage/dist/dev/mp-weixin/uni_modules/zwx-dropDown/components/zwx-dropDown/zwx-dropDown.js
  91. 741 0
      util/qqmap-wx-jssdk1.1/qqmap-wx-jssdk.js
  92. 3 0
      util/qqmap-wx-jssdk1.1/qqmap-wx-jssdk.min.js

+ 125 - 50
pages/addLocation/addLocation.vue

@@ -2,22 +2,22 @@
 	<view class="container">
 		<!-- 地图区域 -->
 		<view class="map">
-			<map style="width: 100%; height: 100%;" :latitude="latitude" :longitude="longitude" :scale="18"
-				:markers="covers">
+			<map style="width: 100%; height: 100%;" :latitude="latitude" :longitude="longitude" :scale="16"
+				:markers="covers" @tap="handleClick">
 			</map>
 		</view>
 
 		<!-- 顶部搜索框区域 -->
 		<view class="search">
-			<uni-search-bar placeholder="请输入搜索内容" cancelButton="none" v-model="searchValue" @input="input"
+			<uni-search-bar bgColor="#fff" placeholder="请输入搜索地点" cancelButton="none" v-model="searchValue"
 				@clear="clear" @blur="blur">
 			</uni-search-bar>
 		</view>
 
 		<!-- 位置列表区域 -->
-		<view class="list">
+		<view class="list" v-if="placeList.length">
 			<!-- 每一个位置区域 -->
-			<view class="box" v-for="item in list" :key="item.id">
+			<view class="box" v-for="item in placeList" :key="item.id" @click="handleChoose(item)">
 				<view class="icon">
 					<img src="../../static/location2.png">
 				</view>
@@ -26,19 +26,19 @@
 						{{item.title}}
 					</view>
 					<view class="bottom">
-						地点:{{item.place}}
+						地点:{{item.address}}
 					</view>
 				</view>
 			</view>
 		</view>
 
 		<!-- 打卡范围区域 -->
-		<view class="range">
+		<view class="range" v-if="placeList.length">
 			<view class="key">
 				打卡范围:
 			</view>
 			<view class="value" @click="changeRange">
-				<text>300米</text>
+				<text>{{rangeValue}}米</text>
 				<img src="../../static/right.png">
 			</view>
 		</view>
@@ -46,72 +46,147 @@
 </template>
 
 <script>
+	var QQMapWX = require('../../util/qqmap-wx-jssdk1.1/qqmap-wx-jssdk');
+	var qqmapsdk;
 	export default {
 		data() {
 			return {
-				latitude: 39.909,
-				longitude: 116.39742,
+				latitude: null,
+				longitude: null,
 				covers: [{
 					id: 1,
-					latitude: 39.909,
-					longitude: 116.39742,
+					latitude: null,
+					longitude: null,
 					iconPath: '../../static/location.png',
 					width: 20,
-					height: 20
+					height: 20,
+					callout: {
+						content: "",
+						display: "ALWAYS"
+					}
 				}],
 				imgUrl: "",
+				// 搜索框绑定的值
 				searchValue: "",
-				list: [{
-						id: 1,
-						title: "南昌交通学院",
-						place: "江西省南昌市经开区广兰大道899号"
-					},
-					{
-						id: 2,
-						title: "华东理工学院",
-						place: "江西省南昌市经开区广兰大道899号"
-					},
-					{
-						id: 3,
-						title: "江西财经大学",
-						place: "江西省南昌市经开区广兰大道899号"
-					}
-				],
-				rangeList:['300米', '400米', '500米'],
+				// 范围选择数组
+				rangeList: ['300', '400', '500'],
+				// 搜索地点数组
+				placeList: [],
+				// 范围数值
+				rangeValue: 300,
+				chooseList:[]
 			}
 		},
+		onLoad() {
+			// 实例化API核心类
+			qqmapsdk = new QQMapWX({
+				// 申请的key
+				key: 'R43BZ-2XROX-L7T45-T5OQI-IBDFT-GNBOI'
+			});
+			this.getLocationData()
+		},
 		methods: {
+			// 获取当前位置信息
+			getLocationData() {
+				qqmapsdk.reverseGeocoder({
+					success: (res) => {
+						// console.log(res);
+						// console.log(res.result);
+						if (res.status == 0) {
+							// 获取地址经纬度
+							this.latitude = res.result.location.lat
+							this.longitude = res.result.location.lng
+							// 获取标记点地址经纬度
+							this.covers[0].latitude = res.result.location.lat
+							this.covers[0].longitude = res.result.location.lng
+							// 获取详细地址信息
+							this.covers[0].callout.content = res.result.address
+						} else {
+							uni.showToast({
+								title: "请求定位失败",
+								icon: 'none'
+							})
+						}
+					}
+				})
+			},
+			// 点击地图回调事件
+			handleClick(res) {
+				this.placeList = []
+				let {
+					latitude
+				} = res.detail
+				let {
+					longitude
+				} = res.detail
+				this.covers[0].latitude = latitude
+				this.covers[0].longitude = longitude
+				qqmapsdk.reverseGeocoder({
+					location: {
+						latitude,
+						longitude
+					},
+					get_poi: 1,
+					poi_options: "policy=2",
+					success: (res) => {
+						// console.log(res.result);
+						// console.log(res.result.pois);
+						if (res.status == 0) {
+							this.placeList = res.result.pois
+							this.covers[0].callout.content = res.result.address
+						} else {
+							uni.showToast({
+								title: "请求定位失败",
+								icon: 'none'
+							})
+						}
+					}
+				})
+			},
+			// 选择单个地址时的回调
+			handleChoose(item) {
+				console.log(item);
+				this.chooseList.push({
+					title:item.title,
+					address:item.address,
+					scope:this.rangeValue
+				})
+				let temList = JSON.stringify(this.chooseList)
+				uni.redirectTo({
+					url:`/pages/punchLocation/punchLocation?temList=${temList}`
+				})
+			},
 			// 点击选择打卡范围回调
 			changeRange() {
 				uni.showActionSheet({
 					itemList: this.rangeList,
 					success: (res) => {
-						console.log(res);
-						console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
-						console.log(this.rangeList[res.tapIndex]);
-					},
-					fail: (res) => {
-						console.log(res.errMsg);
+						// console.log(res);
+						this.rangeValue = this.rangeList[res.tapIndex]
 					}
 				});
 			},
 			// 搜索框失焦回调
 			blur(res) {
-				uni.showToast({
-					title: '搜索:' + res.value,
-					icon: 'none'
-				})
-			},
-			// 搜索框输入时的回调
-			input(res) {
-				console.log('----input:', res)
+				this.placeList = []
+				qqmapsdk.search({
+					keyword: res.value,
+					auto_extend: "0",
+					success: (res) => {
+						if (res.status == 0) {
+							this.placeList = res.data
+						} else {
+							uni.showToast({
+								title: "搜索位置失败",
+								icon: 'none'
+							})
+						}
+					},
+				});
 			},
 			// 清除搜索框内容时的回调
 			clear(res) {
-				uni.showToast({
-					title: 'clear事件,清除值为:' + res.value,
-					icon: 'none'
-				})
+				this.placeList = []
 			},
 		}
 	}
@@ -156,7 +231,7 @@
 
 				.icon {
 					margin-top: 10rpx;
-					flex: 1;
+					width: 80rpx;
 					text-align: center;
 
 					img {
@@ -166,7 +241,7 @@
 				}
 
 				.place {
-					flex: 7;
+					width: 550rpx;
 
 					.top {
 						font-size: 32rpx;

+ 72 - 7
pages/home/home.vue

@@ -48,13 +48,13 @@
 					无法打卡
 				</view>
 				<view class="time">
-					11:11:56
+					{{nowTime}}
 				</view>
 			</view>
 
 			<!-- 位置信息区域 -->
 			<view class="address" v-if="flags&&list.length">
-				江西省南昌市经开区黄家湖东路122号
+				{{address}}
 			</view>
 			<view class="address" v-if="addressFlags&&!flags">
 				不在管理员设定范围打卡
@@ -77,9 +77,14 @@
 </template>
 
 <script>
+	var QQMapWX = require('../../util/qqmap-wx-jssdk1.1/qqmap-wx-jssdk');
+	var qqmapsdk;
 	export default {
 		data() {
 			return {
+				// 用户信息
+				userInfo: {},
+				// 打卡规则列表
 				list: [{
 						id: 1,
 						title: "课间操打卡规则",
@@ -101,21 +106,66 @@
 				],
 				flags: true,
 				addressFlags: false,
-				timeFlags: false
+				timeFlags: false,
+				// 当前时间
+				nowTime: "",
+				// 当前定位位置信息
+				address: "",
+				// 定时器标识
+				timer: null
 			};
 		},
 		onLoad() {
+			// 实例化API核心类
+			qqmapsdk = new QQMapWX({
+				// 申请的key
+				key: 'R43BZ-2XROX-L7T45-T5OQI-IBDFT-GNBOI'
+			});
+			this.getNowTime()
+			this.getUserInfo()
+			this.getLocationData()
 			// this.getRulesList()
 		},
+		onUnload() {
+			if (this.timer) {
+				clearInterval(this.timer)
+			}
+		},
 		methods: {
+			// 从缓存中获取用户信息
+			getUserInfo() {
+				try {
+					const value = uni.getStorageSync('userInfo')
+					if (value) {
+						this.userInfo = value
+					}
+				} catch (e) {
+					console.log(e);
+				}
+			},
+			getLocationData() {
+				qqmapsdk.reverseGeocoder({
+					success: (res) => {
+						// console.log(res);
+						if (res.status == 0) {
+							// 获取详细地址信息
+							this.address = res.result.address
+						} else {
+							uni.showToast({
+								title: "请求定位失败",
+								icon: 'none'
+							})
+						}
+					}
+				})
+			},
 			// 获取打卡规则列表
 			async getRulesList() {
-				console.log(1);
 				let res = await this.$myRequest({
-					url: "/attendance/api/settings/rule/list",
+					url: "/attendance/api/sign/check/in/list",
+					name: this.userInfo.username
 				})
 				console.log(res);
-				console.log(2);
 			},
 			// 点击打卡按钮回调
 			handlePunch() {
@@ -143,7 +193,22 @@
 						});
 					}
 				})
-			}
+			},
+			// 获取当前时间
+			getNowTime() {
+				if (this.timer) {
+					clearInterval(this.timer)
+				} else {
+					this.timer = setInterval(() => {
+						let date = new Date()
+						let hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
+						let minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
+						let seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
+						this.nowTime = hours + ':' + minutes + ':' + seconds
+						// console.log(this.nowTime);
+					}, 1000)
+				}
+			},
 		}
 	}
 </script>

+ 3 - 3
pages/index/index.vue

@@ -29,9 +29,9 @@
 		methods: {
 			// 检查是否存在用户信息
 			hasUserInfo() {
-				let userinfo = uni.getStorageSync('userinfo');
-				console.log(userinfo);
-				if (userinfo) {
+				let userInfo = uni.getStorageSync('userInfo');
+				console.log(userInfo);
+				if (userInfo) {
 					uni.navigateTo({
 						url: "/pages/home/home"
 					})

+ 38 - 41
pages/location/location.vue

@@ -3,7 +3,7 @@
 		<!-- 地图区域 -->
 		<view class="map">
 			<map style="width: 100%; height: 100%;" :latitude="latitude" :longitude="longitude" :scale="16"
-				:markers="covers" :circles="circles">
+				:markers="covers">
 			</map>
 		</view>
 		<!-- 盒子区域 -->
@@ -15,10 +15,10 @@
 						我的位置
 					</view>
 					<view class="left_place">
-						南昌交通学院食堂
+						{{address}}
 					</view>
 				</view>
-				<view class="right">
+				<view class="right" @click="getLocationData">
 					<img src="./imgs/refresh.png">
 				</view>
 			</view>
@@ -34,7 +34,7 @@
 			<!-- 提示倒计时区域 -->
 			<view class="bottom">
 				<view class="button">
-					15:05:05 打卡(15分钟内提交打卡)
+					请在08:00-09:00时间段之内提交打卡
 				</view>
 			</view>
 		</view>
@@ -42,11 +42,15 @@
 </template>
 
 <script>
+	var QQMapWX = require('../../util/qqmap-wx-jssdk1.1/qqmap-wx-jssdk');
+	var qqmapsdk;
 	export default {
 		data() {
 			return {
+				// 定位经纬度
 				latitude: null,
 				longitude: null,
+				// 地图标记点属性
 				covers: [{
 					id: 1,
 					latitude: null,
@@ -55,48 +59,44 @@
 					width: 20,
 					height: 20
 				}],
-				circles: [{
-					longitude: null,
-					latitude: null,
-					fillColor: "#FF2B431A",
-					color: "#FF0000",
-					radius: 100,
-					strokeWidth: 1
-				}],
-				imgUrl: ""
+				// 照片信息
+				imgUrl: "",
+				// 定位位置信息
+				address: ""
 			};
 		},
 		onLoad() {
+			// 实例化API核心类
+			qqmapsdk = new QQMapWX({
+				// 申请的key
+				key: 'R43BZ-2XROX-L7T45-T5OQI-IBDFT-GNBOI'
+			});
 			this.getLocationData()
-			this.test()
 		},
 		methods: {
+			// 获取定位具体信息
 			getLocationData() {
-				uni.getLocation({
-					type: 'gcj02',
+				qqmapsdk.reverseGeocoder({
 					success: (res) => {
-						console.log(res);
-						this.latitude = res.latitude
-						this.longitude = res.longitude
-						this.covers[0].latitude = res.latitude
-						this.covers[0].longitude = res.longitude
-						this.circles[0].latitude = res.latitude
-						this.circles[0].longitude = res.longitude
-						console.log('当前位置的经度:' + res.longitude);
-						console.log('当前位置的纬度:' + res.latitude);
+						// console.log(res);
+						// console.log(res.result);
+						if (res.status == 0) {
+							// 获取详细地址信息
+							this.address = res.result.address
+							// 获取地址经纬度
+							this.latitude = res.result.location.lat
+							this.longitude = res.result.location.lng
+							// 获取标记点地址经纬度
+							this.covers[0].latitude = res.result.location.lat
+							this.covers[0].longitude = res.result.location.lng
+						} else {
+							uni.showToast({
+								title: "请求定位失败",
+								icon: 'none'
+							})
+						}
 					}
-				});
-			},
-			test() {
-				console.log(789);
-				uni.chooseLocation({
-					success: (res) => {
-						console.log('位置名称:' + res.name);
-						console.log('详细地址:' + res.address);
-						console.log('纬度:' + res.latitude);
-						console.log('经度:' + res.longitude);
-					}
-				});
+				})
 			},
 			// 点击拍照图标回调
 			handlePhoto() {
@@ -104,9 +104,6 @@
 				uni.authorize({
 					scope: 'scope.camera',
 					success() {
-						// uni.navigateTo({
-						// 	url: "/pages/location/location"
-						// })
 						uni.chooseImage({
 							count: 1,
 							sourceType: ['camera'],
@@ -138,7 +135,7 @@
 						});
 					}
 				})
-			}
+			},
 		}
 	}
 </script>

+ 66 - 37
pages/punchLocation/punchLocation.vue

@@ -17,7 +17,7 @@
 				<!-- 每一个时间段区域 -->
 				<uni-swipe-action-item :auto-close="true" :right-options="options" @click="onClick(item.id)"
 					v-for="item in list" :key="item.id">
-					
+
 					<view class="box">
 						<view class="icon">
 							<img src="../../static/location2.png">
@@ -27,10 +27,10 @@
 								{{item.title}}
 							</view>
 							<view class="center">
-								地址:{{item.place}}
+								地址:{{item.address}}
 							</view>
 							<view class="bottom">
-								范围:{{item.scope}}
+								范围:{{item.scope}}
 							</view>
 						</view>
 						<view class="right">
@@ -47,24 +47,25 @@
 	export default {
 		data() {
 			return {
-				list: [{
-						id: 1,
-						title: "操场",
-						place: "江西省南昌市经开区广兰大道899号",
-						scope:"300米"
-					},
-					{
-						id: 2,
-						title: "操场",
-						place: "江西省南昌市经开区广兰大道899号",
-						scope:"400米"
-					},
-					{
-						id: 3,
-						title: "操场",
-						place: "江西省南昌市经开区广兰大道899号",
-						scope:"500米"
-					}
+				list: [
+					// {
+					// 	id: 1,
+					// 	title: "操场",
+					// 	place: "江西省南昌市经开区广兰大道899号",
+					// 	scope: "300米"
+					// },
+					// {
+					// 	id: 2,
+					// 	title: "操场",
+					// 	place: "江西省南昌市经开区广兰大道899号",
+					// 	scope: "400米"
+					// },
+					// {
+					// 	id: 3,
+					// 	title: "操场",
+					// 	place: "江西省南昌市经开区广兰大道899号",
+					// 	scope: "500米"
+					// }
 				],
 				options: [{
 					text: '删除',
@@ -74,11 +75,36 @@
 				}],
 			}
 		},
+		onLoad(options) {
+			if (options.temList) {
+				this.list = JSON.parse(options.temList)
+			}
+		},
 		methods: {
 			handleAdd() {
-				console.log("添加打卡位置");
-				uni.navigateTo({
-					url:"/pages/addLocation/addLocation"
+				// 获取用户位置权限
+				uni.authorize({
+					scope: 'scope.userLocation',
+					success() {
+						uni.navigateTo({
+							url: "/pages/addLocation/addLocation"
+						})
+					},
+					fail() {
+						uni.showModal({
+							title: '提示',
+							content: '请先开启定位权限,否则将无法使用定位功能',
+							cancelText: '不授权',
+							confirmText: '授权',
+							success: function(res) {
+								if (res.confirm) {
+									uni.openSetting({
+										success(res) {}
+									})
+								} else if (res.cancel) {}
+							}
+						});
+					}
 				})
 			},
 			// 点击右侧删除按钮回调
@@ -143,7 +169,7 @@
 		.list {
 			margin-top: 20rpx;
 			padding-bottom: 30rpx;
-			
+
 			.box {
 				display: flex;
 				align-items: center;
@@ -153,35 +179,36 @@
 				height: 137rpx;
 				border-radius: 14rpx;
 				background-color: #fff;
-			
+
 				.icon {
 					margin-top: 10rpx;
-					flex: 1;
+					width: 75rpx;
 					text-align: center;
-			
+
 					img {
 						width: 40rpx;
 						height: 40rpx;
 					}
 				}
-			
+
 				.place {
-					flex: 7;
-			
+					width: 540rpx;
+
 					.top {
 						font-size: 32rpx;
 						overflow: hidden;
 						white-space: nowrap;
 						text-overflow: ellipsis;
 					}
-					.center{
+
+					.center {
 						font-size: 24rpx;
 						color: #999999;
 						overflow: hidden;
 						white-space: nowrap;
 						text-overflow: ellipsis;
 					}
-			
+
 					.bottom {
 						font-size: 24rpx;
 						color: #999999;
@@ -190,10 +217,12 @@
 						text-overflow: ellipsis;
 					}
 				}
-				.right{
-					flex: 1;
+
+				.right {
+					width: 75rpx;
 					text-align: center;
-					img{
+
+					img {
 						width: 15rpx;
 						height: 28rpx;
 					}
@@ -206,4 +235,4 @@
 	::v-deep .uni-swipe_button-group {
 		margin-bottom: 20rpx;
 	}
-</style>
+</style>

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/common/main.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/common/vendor.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/components/chocolate-progress-bar/chocolate-progress-bar.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/404/404.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/addLocation/addLocation.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/addRules/addRules.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/authentication/authentication.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/cardRecord/cardRecord.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/editRules/editRules.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/group/group.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/home/home.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/index/index.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/location/location.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/my/my.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/particulars/particulars.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/powerSet/powerSet.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/punchLocation/punchLocation.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/punchTime/punchTime.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/qr_code/qr_code.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/ruleName/ruleName.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/ruleSet/ruleSet.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/rulesDetail/rulesDetail.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/setPunchTime/setPunchTime.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/stat/stat.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/statDetail/statDetail.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/jlk-week/components/jlk-week/jlk-week.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-calendar/components/uni-calendar/uni-calendar-item.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-calendar/components/uni-calendar/uni-calendar.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-collapse/components/uni-collapse-item/uni-collapse-item.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-collapse/components/uni-collapse/uni-collapse.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-icons/components/uni-icons/uni-icons.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-popup/components/uni-popup/uni-popup.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/zwx-dropDown/components/zwx-dropDown/zwx-dropDown.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/mp-weixin/common/main.js


Разница между файлами не показана из-за своего большого размера
+ 3201 - 2450
unpackage/dist/dev/mp-weixin/common/vendor.js


Разница между файлами не показана из-за своего большого размера
+ 14 - 14
unpackage/dist/dev/mp-weixin/components/chocolate-progress-bar/chocolate-progress-bar.js


Разница между файлами не показана из-за своего большого размера
+ 17 - 17
unpackage/dist/dev/mp-weixin/pages/404/404.js


Разница между файлами не показана из-за своего большого размера
+ 134 - 60
unpackage/dist/dev/mp-weixin/pages/addLocation/addLocation.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/addLocation/addLocation.wxml


+ 2 - 2
unpackage/dist/dev/mp-weixin/pages/addLocation/addLocation.wxss

@@ -36,7 +36,7 @@
 }
 .container .list .box .icon.data-v-4b369518 {
   margin-top: 10rpx;
-  flex: 1;
+  width: 80rpx;
   text-align: center;
 }
 .container .list .box .icon ._img.data-v-4b369518 {
@@ -44,7 +44,7 @@
   height: 40rpx;
 }
 .container .list .box .place.data-v-4b369518 {
-  flex: 7;
+  width: 550rpx;
 }
 .container .list .box .place .top.data-v-4b369518 {
   font-size: 32rpx;

Разница между файлами не показана из-за своего большого размера
+ 21 - 21
unpackage/dist/dev/mp-weixin/pages/addRules/addRules.js


Разница между файлами не показана из-за своего большого размера
+ 18 - 18
unpackage/dist/dev/mp-weixin/pages/authentication/authentication.js


Разница между файлами не показана из-за своего большого размера
+ 21 - 21
unpackage/dist/dev/mp-weixin/pages/cardRecord/cardRecord.js


Разница между файлами не показана из-за своего большого размера
+ 21 - 21
unpackage/dist/dev/mp-weixin/pages/editRules/editRules.js


Разница между файлами не показана из-за своего большого размера
+ 25 - 25
unpackage/dist/dev/mp-weixin/pages/group/group.js


Разница между файлами не показана из-за своего большого размера
+ 109 - 36
unpackage/dist/dev/mp-weixin/pages/home/home.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/home/home.wxml


Разница между файлами не показана из-за своего большого размера
+ 24 - 30
unpackage/dist/dev/mp-weixin/pages/index/index.js


Разница между файлами не показана из-за своего большого размера
+ 51 - 54
unpackage/dist/dev/mp-weixin/pages/location/location.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/location/location.wxml


Разница между файлами не показана из-за своего большого размера
+ 17 - 17
unpackage/dist/dev/mp-weixin/pages/my/my.js


Разница между файлами не показана из-за своего большого размера
+ 73 - 73
unpackage/dist/dev/mp-weixin/pages/particulars/particulars.js


Разница между файлами не показана из-за своего большого размера
+ 18 - 18
unpackage/dist/dev/mp-weixin/pages/powerSet/powerSet.js


Разница между файлами не показана из-за своего большого размера
+ 69 - 43
unpackage/dist/dev/mp-weixin/pages/punchLocation/punchLocation.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/punchLocation/punchLocation.wxml


+ 3 - 3
unpackage/dist/dev/mp-weixin/pages/punchLocation/punchLocation.wxss

@@ -47,7 +47,7 @@
 }
 .container .list .box .icon.data-v-1623ff8e {
   margin-top: 10rpx;
-  flex: 1;
+  width: 75rpx;
   text-align: center;
 }
 .container .list .box .icon ._img.data-v-1623ff8e {
@@ -55,7 +55,7 @@
   height: 40rpx;
 }
 .container .list .box .place.data-v-1623ff8e {
-  flex: 7;
+  width: 540rpx;
 }
 .container .list .box .place .top.data-v-1623ff8e {
   font-size: 32rpx;
@@ -78,7 +78,7 @@
   text-overflow: ellipsis;
 }
 .container .list .box .right.data-v-1623ff8e {
-  flex: 1;
+  width: 75rpx;
   text-align: center;
 }
 .container .list .box .right ._img.data-v-1623ff8e {

Разница между файлами не показана из-за своего большого размера
+ 20 - 20
unpackage/dist/dev/mp-weixin/pages/punchTime/punchTime.js


Разница между файлами не показана из-за своего большого размера
+ 12 - 12
unpackage/dist/dev/mp-weixin/pages/qr_code/qr_code.js


+ 0 - 1
unpackage/dist/dev/mp-weixin/pages/qr_code/qr_code.wxss

@@ -1 +0,0 @@
-/* pages/qr_code/qr_code.wxss */

Разница между файлами не показана из-за своего большого размера
+ 17 - 17
unpackage/dist/dev/mp-weixin/pages/ruleName/ruleName.js


Разница между файлами не показана из-за своего большого размера
+ 19 - 19
unpackage/dist/dev/mp-weixin/pages/ruleSet/ruleSet.js


Разница между файлами не показана из-за своего большого размера
+ 18 - 18
unpackage/dist/dev/mp-weixin/pages/rulesDetail/rulesDetail.js


Разница между файлами не показана из-за своего большого размера
+ 158 - 158
unpackage/dist/dev/mp-weixin/pages/setPunchTime/setPunchTime.js


Разница между файлами не показана из-за своего большого размера
+ 27 - 27
unpackage/dist/dev/mp-weixin/pages/stat/stat.js


Разница между файлами не показана из-за своего большого размера
+ 21 - 21
unpackage/dist/dev/mp-weixin/pages/statDetail/statDetail.js


+ 18 - 1
unpackage/dist/dev/mp-weixin/project.config.json

@@ -21,7 +21,24 @@
     "libVersion": "2.28.1",
     "appid": "wxd6f090391d410534",
     "projectname": "校园考勤打卡",
-    "condition": {},
+    "condition": {
+        "search": {
+            "current": -1,
+            "list": []
+        },
+        "conversation": {
+            "current": -1,
+            "list": []
+        },
+        "game": {
+            "current": -1,
+            "list": []
+        },
+        "miniprogram": {
+            "current": -1,
+            "list": []
+        }
+    },
     "editorSetting": {
         "tabIndent": "insertSpaces",
         "tabSize": 4

+ 27 - 0
unpackage/dist/dev/mp-weixin/project.private.config.json

@@ -3,5 +3,32 @@
     "projectname": "mp-weixin",
     "setting": {
         "compileHotReLoad": true
+    },
+    "condition": {
+        "miniprogram": {
+            "list": [
+                {
+                    "name": "",
+                    "pathName": "pages/addLocation/addLocation",
+                    "query": "",
+                    "launchMode": "default",
+                    "scene": null
+                },
+                {
+                    "name": "",
+                    "pathName": "pages/home/home",
+                    "query": "",
+                    "launchMode": "default",
+                    "scene": null
+                },
+                {
+                    "name": "",
+                    "pathName": "pages/index/index",
+                    "query": "",
+                    "launchMode": "default",
+                    "scene": null
+                }
+            ]
+        }
     }
 }

Разница между файлами не показана из-за своего большого размера
+ 16 - 16
unpackage/dist/dev/mp-weixin/uni_modules/jlk-week/components/jlk-week/jlk-week.js


Разница между файлами не показана из-за своего большого размера
+ 15 - 15
unpackage/dist/dev/mp-weixin/uni_modules/uni-calendar/components/uni-calendar/uni-calendar-item.js


Разница между файлами не показана из-за своего большого размера
+ 17 - 17
unpackage/dist/dev/mp-weixin/uni_modules/uni-calendar/components/uni-calendar/uni-calendar.js


Разница между файлами не показана из-за своего большого размера
+ 15 - 15
unpackage/dist/dev/mp-weixin/uni_modules/uni-collapse/components/uni-collapse-item/uni-collapse-item.js


Разница между файлами не показана из-за своего большого размера
+ 14 - 14
unpackage/dist/dev/mp-weixin/uni_modules/uni-collapse/components/uni-collapse/uni-collapse.js


Разница между файлами не показана из-за своего большого размера
+ 15 - 15
unpackage/dist/dev/mp-weixin/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js


Разница между файлами не показана из-за своего большого размера
+ 15 - 15
unpackage/dist/dev/mp-weixin/uni_modules/uni-icons/components/uni-icons/uni-icons.js


Разница между файлами не показана из-за своего большого размера
+ 15 - 15
unpackage/dist/dev/mp-weixin/uni_modules/uni-popup/components/uni-popup/uni-popup.js


Разница между файлами не показана из-за своего большого размера
+ 16 - 16
unpackage/dist/dev/mp-weixin/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.js


Разница между файлами не показана из-за своего большого размера
+ 14 - 14
unpackage/dist/dev/mp-weixin/uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.js


Разница между файлами не показана из-за своего большого размера
+ 21 - 21
unpackage/dist/dev/mp-weixin/uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.js


Разница между файлами не показана из-за своего большого размера
+ 10 - 10
unpackage/dist/dev/mp-weixin/uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.js


Разница между файлами не показана из-за своего большого размера
+ 11 - 11
unpackage/dist/dev/mp-weixin/uni_modules/uni-transition/components/uni-transition/uni-transition.js


Разница между файлами не показана из-за своего большого размера
+ 15 - 15
unpackage/dist/dev/mp-weixin/uni_modules/zwx-dropDown/components/zwx-dropDown/zwx-dropDown.js


+ 741 - 0
util/qqmap-wx-jssdk1.1/qqmap-wx-jssdk.js

@@ -0,0 +1,741 @@
+/**
+ * 微信小程序JavaScriptSDK
+ * 
+ * @version 1.1
+ * @date 2019-01-20
+ */
+
+var ERROR_CONF = {
+    KEY_ERR: 311,
+    KEY_ERR_MSG: 'key格式错误',
+    PARAM_ERR: 310,
+    PARAM_ERR_MSG: '请求参数信息有误',
+    SYSTEM_ERR: 600,
+    SYSTEM_ERR_MSG: '系统错误',
+    WX_ERR_CODE: 1000,
+    WX_OK_CODE: 200
+};
+var BASE_URL = 'https://apis.map.qq.com/ws/';
+var URL_SEARCH = BASE_URL + 'place/v1/search';
+var URL_SUGGESTION = BASE_URL + 'place/v1/suggestion';
+var URL_GET_GEOCODER = BASE_URL + 'geocoder/v1/';
+var URL_CITY_LIST = BASE_URL + 'district/v1/list';
+var URL_AREA_LIST = BASE_URL + 'district/v1/getchildren';
+var URL_DISTANCE = BASE_URL + 'distance/v1/';
+var EARTH_RADIUS = 6378136.49;
+var Utils = {
+    /**
+     * 得到终点query字符串
+     * @param {Array|String} 检索数据
+     */
+    location2query(data) {
+        if (typeof data == 'string') {
+            return data;
+        }
+        var query = '';
+        for (var i = 0; i < data.length; i++) {
+            var d = data[i];
+            if (!!query) {
+                query += ';';
+            }
+            if (d.location) {
+                query = query + d.location.lat + ',' + d.location.lng;
+            }
+            if (d.latitude && d.longitude) {
+                query = query + d.latitude + ',' + d.longitude;
+            }
+        }
+        return query;
+    },
+
+    /**
+     * 计算角度
+     */
+    rad(d) {
+      return d * Math.PI / 180.0;
+    },  
+    /**
+     * 处理终点location数组
+     * @return 返回终点数组
+     */
+    getEndLocation(location){
+      var to = location.split(';');
+      var endLocation = [];
+      for (var i = 0; i < to.length; i++) {
+        endLocation.push({
+          lat: parseFloat(to[i].split(',')[0]),
+          lng: parseFloat(to[i].split(',')[1])
+        })
+      }
+      return endLocation;
+    },
+
+    /**
+     * 计算两点间直线距离
+     * @param a 表示纬度差
+     * @param b 表示经度差
+     * @return 返回的是距离,单位m
+     */
+    getDistance(latFrom, lngFrom, latTo, lngTo) {
+      var radLatFrom = this.rad(latFrom);
+      var radLatTo = this.rad(latTo);
+      var a = radLatFrom - radLatTo;
+      var b = this.rad(lngFrom) - this.rad(lngTo);
+      var distance = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLatFrom) * Math.cos(radLatTo) * Math.pow(Math.sin(b / 2), 2)));
+      distance = distance * EARTH_RADIUS;
+      distance = Math.round(distance * 10000) / 10000;
+      return parseFloat(distance.toFixed(0));
+    },
+    /**
+     * 使用微信接口进行定位
+     */
+    getWXLocation(success, fail, complete) {
+        wx.getLocation({
+            type: 'gcj02',
+            success: success,
+            fail: fail,
+            complete: complete
+        });
+    },
+
+    /**
+     * 获取location参数
+     */
+    getLocationParam(location) {
+        if (typeof location == 'string') {
+            var locationArr = location.split(',');
+            if (locationArr.length === 2) {
+                location = {
+                    latitude: location.split(',')[0],
+                    longitude: location.split(',')[1]
+                };
+            } else {
+                location = {};
+            }
+        }
+        return location;
+    },
+
+    /**
+     * 回调函数默认处理
+     */
+    polyfillParam(param) {
+        param.success = param.success || function () { };
+        param.fail = param.fail || function () { };
+        param.complete = param.complete || function () { };
+    },
+
+    /**
+     * 验证param对应的key值是否为空
+     * 
+     * @param {Object} param 接口参数
+     * @param {String} key 对应参数的key
+     */
+    checkParamKeyEmpty(param, key) {
+        if (!param[key]) {
+            var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + key +'参数格式有误');
+            param.fail(errconf);
+            param.complete(errconf);
+            return true;
+        }
+        return false;
+    },
+
+    /**
+     * 验证参数中是否存在检索词keyword
+     * 
+     * @param {Object} param 接口参数
+     */
+    checkKeyword(param){
+        return !this.checkParamKeyEmpty(param, 'keyword');
+    },
+
+    /**
+     * 验证location值
+     * 
+     * @param {Object} param 接口参数
+     */
+    checkLocation(param) {
+        var location = this.getLocationParam(param.location);
+        if (!location || !location.latitude || !location.longitude) {
+            var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + ' location参数格式有误');
+            param.fail(errconf);
+            param.complete(errconf);
+            return false;
+        }
+        return true;
+    },
+
+    /**
+     * 构造错误数据结构
+     * @param {Number} errCode 错误码
+     * @param {Number} errMsg 错误描述
+     */
+    buildErrorConfig(errCode, errMsg) {
+        return {
+            status: errCode,
+            message: errMsg
+        };
+    },
+
+    /**
+     * 
+     * 数据处理函数
+     * 根据传入参数不同处理不同数据
+     * @param {String} feature 功能名称
+     * search 地点搜索
+     * suggest关键词提示
+     * reverseGeocoder逆地址解析
+     * geocoder地址解析
+     * getCityList获取城市列表:父集
+     * getDistrictByCityId获取区县列表:子集
+     * calculateDistance距离计算
+     * @param {Object} param 接口参数
+     * @param {Object} data 数据
+     */
+    handleData(param,data,feature){
+      if (feature === 'search') {
+        var searchResult = data.data;
+        var searchSimplify = [];
+        for (var i = 0; i < searchResult.length; i++) {
+          searchSimplify.push({
+            id: searchResult[i].id || null,
+            title: searchResult[i].title || null,
+            latitude: searchResult[i].location && searchResult[i].location.lat || null,
+            longitude: searchResult[i].location && searchResult[i].location.lng || null,
+            address: searchResult[i].address || null,
+            category: searchResult[i].category || null,
+            tel: searchResult[i].tel || null,
+            adcode: searchResult[i].ad_info && searchResult[i].ad_info.adcode || null,
+            city: searchResult[i].ad_info && searchResult[i].ad_info.city || null,
+            district: searchResult[i].ad_info && searchResult[i].ad_info.district || null,
+            province: searchResult[i].ad_info && searchResult[i].ad_info.province || null
+          })
+        }
+        param.success(data, {
+          searchResult: searchResult,
+          searchSimplify: searchSimplify
+        })
+      } else if (feature === 'suggest') {
+        var suggestResult = data.data;
+        var suggestSimplify = [];
+        for (var i = 0; i < suggestResult.length; i++) {
+          suggestSimplify.push({
+            adcode: suggestResult[i].adcode || null,
+            address: suggestResult[i].address || null,
+            category: suggestResult[i].category || null,
+            city: suggestResult[i].city || null,
+            district: suggestResult[i].district || null,
+            id: suggestResult[i].id || null,
+            latitude: suggestResult[i].location && suggestResult[i].location.lat || null,
+            longitude: suggestResult[i].location && suggestResult[i].location.lng || null,
+            province: suggestResult[i].province || null,
+            title: suggestResult[i].title || null,
+            type: suggestResult[i].type || null
+          })
+        }
+        param.success(data, {
+          suggestResult: suggestResult,
+          suggestSimplify: suggestSimplify
+          })
+      } else if (feature === 'reverseGeocoder') {
+        var reverseGeocoderResult = data.result;
+        var reverseGeocoderSimplify = {
+          address: reverseGeocoderResult.address || null,
+          latitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lat || null,
+          longitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lng || null,
+          adcode: reverseGeocoderResult.ad_info && reverseGeocoderResult.ad_info.adcode || null,
+          city: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.city || null,
+          district: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.district || null,
+          nation: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.nation || null,
+          province: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.province || null,
+          street: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street || null,
+          street_number: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street_number || null,
+          recommend: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.recommend || null,
+          rough: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.rough || null
+        };
+        if (reverseGeocoderResult.pois) {//判断是否返回周边poi
+          var pois = reverseGeocoderResult.pois;
+          var poisSimplify = [];
+          for (var i = 0;i < pois.length;i++) {
+            poisSimplify.push({
+              id: pois[i].id || null,
+              title: pois[i].title || null,
+              latitude: pois[i].location && pois[i].location.lat || null,
+              longitude: pois[i].location && pois[i].location.lng || null,
+              address: pois[i].address || null,
+              category: pois[i].category || null,
+              adcode: pois[i].ad_info && pois[i].ad_info.adcode || null,
+              city: pois[i].ad_info && pois[i].ad_info.city || null,
+              district: pois[i].ad_info && pois[i].ad_info.district || null,
+              province: pois[i].ad_info && pois[i].ad_info.province || null
+            })
+          }
+          param.success(data,{
+            reverseGeocoderResult: reverseGeocoderResult,
+            reverseGeocoderSimplify: reverseGeocoderSimplify,
+            pois: pois,
+            poisSimplify: poisSimplify
+          })
+        } else {
+          param.success(data, {
+            reverseGeocoderResult: reverseGeocoderResult,
+            reverseGeocoderSimplify: reverseGeocoderSimplify
+          })
+        }
+      } else if (feature === 'geocoder') {
+        var geocoderResult = data.result;
+        var geocoderSimplify = {
+          title: geocoderResult.title || null,
+          latitude: geocoderResult.location && geocoderResult.location.lat || null,
+          longitude: geocoderResult.location && geocoderResult.location.lng || null,
+          adcode: geocoderResult.ad_info && geocoderResult.ad_info.adcode || null,
+          province: geocoderResult.address_components && geocoderResult.address_components.province || null,
+          city: geocoderResult.address_components && geocoderResult.address_components.city || null,
+          district: geocoderResult.address_components && geocoderResult.address_components.district || null,
+          street: geocoderResult.address_components && geocoderResult.address_components.street || null,
+          street_number: geocoderResult.address_components && geocoderResult.address_components.street_number || null,
+          level: geocoderResult.level || null
+        };
+        param.success(data,{
+          geocoderResult: geocoderResult,
+          geocoderSimplify: geocoderSimplify
+        });
+      } else if (feature === 'getCityList') {
+        var provinceResult = data.result[0];
+        var cityResult = data.result[1];
+        var districtResult = data.result[2];
+        param.success(data,{
+          provinceResult: provinceResult,
+          cityResult: cityResult,
+          districtResult: districtResult
+        });
+      } else if (feature === 'getDistrictByCityId') {
+        var districtByCity = data.result[0];
+        param.success(data, districtByCity);
+      } else if (feature === 'calculateDistance') {
+        var calculateDistanceResult = data.result.elements;  
+        var distance = [];
+        for (var i = 0; i < calculateDistanceResult.length; i++){
+          distance.push(calculateDistanceResult[i].distance);
+        }   
+        param.success(data, {
+          calculateDistanceResult: calculateDistanceResult,
+          distance: distance
+          });
+      } else {
+        param.success(data);
+      }
+    },
+
+    /**
+     * 构造微信请求参数,公共属性处理
+     * 
+     * @param {Object} param 接口参数
+     * @param {Object} param 配置项
+     * @param {String} feature 方法名
+     */
+    buildWxRequestConfig(param, options, feature) {
+        var that = this;
+        options.header = { "content-type": "application/json" };
+        options.method = 'GET';
+        options.success = function (res) {
+            var data = res.data;
+            if (data.status === 0) {
+              that.handleData(param, data, feature);
+            } else {
+                param.fail(data);
+            }
+        };
+        options.fail = function (res) {
+            res.statusCode = ERROR_CONF.WX_ERR_CODE;
+            param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg));
+        };
+        options.complete = function (res) {
+            var statusCode = +res.statusCode;
+            switch(statusCode) {
+                case ERROR_CONF.WX_ERR_CODE: {
+                    param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg));
+                    break;
+                }
+                case ERROR_CONF.WX_OK_CODE: {
+                    var data = res.data;
+                    if (data.status === 0) {
+                        param.complete(data);
+                    } else {
+                        param.complete(that.buildErrorConfig(data.status, data.message));
+                    }
+                    break;
+                }
+                default:{
+                    param.complete(that.buildErrorConfig(ERROR_CONF.SYSTEM_ERR, ERROR_CONF.SYSTEM_ERR_MSG));
+                }
+
+            }
+        };
+        return options;
+    },
+
+    /**
+     * 处理用户参数是否传入坐标进行不同的处理
+     */
+    locationProcess(param, locationsuccess, locationfail, locationcomplete) {
+        var that = this;
+        locationfail = locationfail || function (res) {
+            res.statusCode = ERROR_CONF.WX_ERR_CODE;
+            param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg));
+        };
+        locationcomplete = locationcomplete || function (res) {
+            if (res.statusCode == ERROR_CONF.WX_ERR_CODE) {
+                param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg));
+            }
+        };
+        if (!param.location) {
+            that.getWXLocation(locationsuccess, locationfail, locationcomplete);
+        } else if (that.checkLocation(param)) {
+            var location = Utils.getLocationParam(param.location);
+            locationsuccess(location);
+        }
+    }
+};
+
+
+class QQMapWX {
+
+    /**
+     * 构造函数
+     * 
+     * @param {Object} options 接口参数,key 为必选参数
+     */
+    constructor(options) {
+        if (!options.key) {
+            throw Error('key值不能为空');
+        }
+        this.key = options.key;
+    };
+
+    /**
+     * POI周边检索
+     *
+     * @param {Object} options 接口参数对象
+     * 
+     * 参数对象结构可以参考
+     * @see http://lbs.qq.com/webservice_v1/guide-search.html
+     */
+    search(options) {
+        var that = this;
+        options = options || {};
+
+        Utils.polyfillParam(options);
+
+        if (!Utils.checkKeyword(options)) {
+            return;
+        }
+
+        var requestParam = {
+            keyword: options.keyword,
+            orderby: options.orderby || '_distance',
+            page_size: options.page_size || 10,
+            page_index: options.page_index || 1,
+            output: 'json',
+            key: that.key
+        };
+
+        if (options.address_format) {
+            requestParam.address_format = options.address_format;
+        }
+
+        if (options.filter) {
+            requestParam.filter = options.filter;
+        }
+
+        var distance = options.distance || "1000";
+        var auto_extend = options.auto_extend || 1;
+        var region = null;
+        var rectangle = null;
+
+        //判断城市限定参数
+        if (options.region) {
+          region = options.region;
+        }
+
+        //矩形限定坐标(暂时只支持字符串格式)
+        if (options.rectangle) {
+          rectangle = options.rectangle;
+        }
+
+        var locationsuccess = function (result) {        
+          if (region && !rectangle) {
+            //城市限定参数拼接
+            requestParam.boundary = "region(" + region + "," + auto_extend + "," + result.latitude + "," + result.longitude + ")";
+          } else if (rectangle && !region) {
+            //矩形搜索
+            requestParam.boundary = "rectangle(" + rectangle + ")";
+            } else {
+              requestParam.boundary = "nearby(" + result.latitude + "," + result.longitude + "," + distance + "," + auto_extend + ")";
+            }            
+            wx.request(Utils.buildWxRequestConfig(options, {
+                url: URL_SEARCH,
+                data: requestParam
+            }, 'search'));
+        };
+        Utils.locationProcess(options, locationsuccess);
+    };
+
+    /**
+     * sug模糊检索
+     *
+     * @param {Object} options 接口参数对象
+     * 
+     * 参数对象结构可以参考
+     * http://lbs.qq.com/webservice_v1/guide-suggestion.html
+     */
+    getSuggestion(options) {
+        var that = this;
+        options = options || {};
+        Utils.polyfillParam(options);
+
+        if (!Utils.checkKeyword(options)) {
+            return;
+        }
+
+        var requestParam = {
+            keyword: options.keyword,
+            region: options.region || '全国',
+            region_fix: options.region_fix || 0,
+            policy: options.policy || 0,
+            page_size: options.page_size || 10,//控制显示条数
+            page_index: options.page_index || 1,//控制页数
+            get_subpois : options.get_subpois || 0,//返回子地点
+            output: 'json',
+            key: that.key
+        };
+        //长地址
+        if (options.address_format) {
+          requestParam.address_format = options.address_format;
+        }
+        //过滤
+        if (options.filter) {
+          requestParam.filter = options.filter;
+        }
+        //排序
+        if (options.location) {
+          var locationsuccess = function (result) {
+            requestParam.location = result.latitude + ',' + result.longitude;
+            wx.request(Utils.buildWxRequestConfig(options, {
+              url: URL_SUGGESTION,
+              data: requestParam
+            }, "suggest"));      
+          };
+          Utils.locationProcess(options, locationsuccess);
+        } else {
+          wx.request(Utils.buildWxRequestConfig(options, {
+            url: URL_SUGGESTION,
+            data: requestParam
+          }, "suggest"));      
+        } 
+    };
+
+    /**
+     * 逆地址解析
+     *
+     * @param {Object} options 接口参数对象
+     * 
+     * 请求参数结构可以参考
+     * http://lbs.qq.com/webservice_v1/guide-gcoder.html
+     */
+    reverseGeocoder(options) {
+        var that = this;
+        options = options || {};
+        Utils.polyfillParam(options);
+        var requestParam = {
+            coord_type: options.coord_type || 5,
+            get_poi: options.get_poi || 0,
+            output: 'json',
+            key: that.key
+        };
+        if (options.poi_options) {
+            requestParam.poi_options = options.poi_options
+        }
+
+        var locationsuccess = function (result) {
+            requestParam.location = result.latitude + ',' + result.longitude;
+            wx.request(Utils.buildWxRequestConfig(options, {
+                url: URL_GET_GEOCODER,
+                data: requestParam
+            }, 'reverseGeocoder'));
+        };
+        Utils.locationProcess(options, locationsuccess);
+    };
+
+    /**
+     * 地址解析
+     *
+     * @param {Object} options 接口参数对象
+     * 
+     * 请求参数结构可以参考
+     * http://lbs.qq.com/webservice_v1/guide-geocoder.html
+     */
+    geocoder(options) {
+        var that = this;
+        options = options || {};
+        Utils.polyfillParam(options);
+
+        if (Utils.checkParamKeyEmpty(options, 'address')) {
+            return;
+        }
+
+        var requestParam = {
+            address: options.address,
+            output: 'json',
+            key: that.key
+        };
+
+        //城市限定
+        if (options.region) {
+          requestParam.region = options.region;
+        }
+
+        wx.request(Utils.buildWxRequestConfig(options, {
+            url: URL_GET_GEOCODER,
+            data: requestParam
+        },'geocoder'));
+    };
+
+
+    /**
+     * 获取城市列表
+     *
+     * @param {Object} options 接口参数对象
+     * 
+     * 请求参数结构可以参考
+     * http://lbs.qq.com/webservice_v1/guide-region.html
+     */
+    getCityList(options) {
+        var that = this;
+        options = options || {};
+        Utils.polyfillParam(options);
+        var requestParam = {
+            output: 'json',
+            key: that.key
+        };
+
+        wx.request(Utils.buildWxRequestConfig(options, {
+            url: URL_CITY_LIST,
+            data: requestParam
+        },'getCityList'));
+    };
+
+    /**
+     * 获取对应城市ID的区县列表
+     *
+     * @param {Object} options 接口参数对象
+     * 
+     * 请求参数结构可以参考
+     * http://lbs.qq.com/webservice_v1/guide-region.html
+     */
+    getDistrictByCityId(options) {
+        var that = this;
+        options = options || {};
+        Utils.polyfillParam(options);
+
+        if (Utils.checkParamKeyEmpty(options, 'id')) {
+            return;
+        }
+
+        var requestParam = {
+            id: options.id || '',
+            output: 'json',
+            key: that.key
+        };
+
+        wx.request(Utils.buildWxRequestConfig(options, {
+            url: URL_AREA_LIST,
+            data: requestParam
+        },'getDistrictByCityId'));
+    };
+
+    /**
+     * 用于单起点到多终点的路线距离(非直线距离)计算:
+     * 支持两种距离计算方式:步行和驾车。
+     * 起点到终点最大限制直线距离10公里。
+     *
+     * 新增直线距离计算。
+     * 
+     * @param {Object} options 接口参数对象
+     * 
+     * 请求参数结构可以参考
+     * http://lbs.qq.com/webservice_v1/guide-distance.html
+     */
+    calculateDistance(options) {
+        var that = this;
+        options = options || {};
+        Utils.polyfillParam(options);
+
+        if (Utils.checkParamKeyEmpty(options, 'to')) {
+            return;
+        }
+
+        var requestParam = {
+            mode: options.mode || 'walking',
+            to: Utils.location2query(options.to),
+            output: 'json',
+            key: that.key
+        };
+
+        if (options.from) {
+          options.location = options.from;
+        }
+
+        //计算直线距离
+        if(requestParam.mode == 'straight'){        
+          var locationsuccess = function (result) {
+            var locationTo = Utils.getEndLocation(requestParam.to);//处理终点坐标
+            var data = {
+              message:"query ok",
+              result:{
+                elements:[]
+              },
+              status:0
+            };
+            for (var i = 0; i < locationTo.length; i++) {
+              data.result.elements.push({//将坐标存入
+                distance: Utils.getDistance(result.latitude, result.longitude, locationTo[i].lat, locationTo[i].lng),
+                duration:0,
+                from:{
+                  lat: result.latitude,
+                  lng:result.longitude
+                },
+                to:{
+                  lat: locationTo[i].lat,
+                  lng: locationTo[i].lng
+                }
+              });            
+            }
+            var calculateResult = data.result.elements;
+            var distanceResult = [];
+            for (var i = 0; i < calculateResult.length; i++) {
+              distanceResult.push(calculateResult[i].distance);
+            }  
+            return options.success(data,{
+              calculateResult: calculateResult,
+              distanceResult: distanceResult
+            });
+          };
+          
+          Utils.locationProcess(options, locationsuccess);
+        } else {
+          var locationsuccess = function (result) {
+            requestParam.from = result.latitude + ',' + result.longitude;
+            wx.request(Utils.buildWxRequestConfig(options, {
+              url: URL_DISTANCE,
+              data: requestParam
+            },'calculateDistance'));
+          };
+
+          Utils.locationProcess(options, locationsuccess);
+        }      
+    }
+};
+
+module.exports = QQMapWX;

Разница между файлами не показана из-за своего большого размера
+ 3 - 0
util/qqmap-wx-jssdk1.1/qqmap-wx-jssdk.min.js