From 9b476a2eb0dd47d941672f79cfc333b2fccf461f Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Mon, 29 Jul 2024 17:03:09 +0800
Subject: [PATCH] 代码优化

---
 static/img/tabbar-09-selected.png            |    0 
 static/img/tabbar-09.png                     |    0 
 pages/circle/index.vue                       |    4 
 pages.json                                   |   15 ++
 subPackage/label/check.vue                   |    3 
 pages/user/center.vue                        |    9 
 common/common.js                             |   36 ++++
 pages/myMap/myMap.vue                        |  273 +++++++++++++++++++++++++++++++++++++++
 pages/statistics/index.vue                   |    6 
 manifest.json                                |    6 
 pages/home/index.vue                         |    9 
 api/place/place.js                           |    9 +
 subPackage/school/security.vue               |    3 
 subPackage/house/houseNumber/siteInspect.vue |    4 
 14 files changed, 356 insertions(+), 21 deletions(-)

diff --git a/api/place/place.js b/api/place/place.js
index 976bb18..6c9b10c 100644
--- a/api/place/place.js
+++ b/api/place/place.js
@@ -104,4 +104,13 @@
 		method: 'GET',
 		params
 	})
+}
+
+
+export const getNearbyPlaceList = (params) => {
+	return http.request({
+		url: '/blade-place/place/getNearbyPlaceList',
+		method: 'GET',
+		params
+	})
 }
\ No newline at end of file
diff --git a/common/common.js b/common/common.js
index b186b74..1a57fd7 100644
--- a/common/common.js
+++ b/common/common.js
@@ -105,7 +105,13 @@
 				url: '/pages/home/index'
 			},
 			{
-				name: '圈子',
+				name: '周边',
+				iconPathSelected: '/static/img/tabbar-09-selected.png',
+				iconPath: '/static/img/tabbar-09.png',
+				url: '/pages/myMap/myMap'
+			},
+			{
+				name: '邻里圈',
 				iconPathSelected: '/static/img/tabbar-02-selected.png',
 				iconPath: '/static/img/tabbar-02.png',
 				url: '/pages/circle/index'
@@ -125,7 +131,13 @@
 				url: '/pages/home/index'
 			},
 			{
-				name: '圈子',
+				name: '周边',
+				iconPathSelected: '/static/img/tabbar-09-selected.png',
+				iconPath: '/static/img/tabbar-09.png',
+				url: '/pages/myMap/myMap'
+			},
+			{
+				name: '协同圈',
 				iconPathSelected: '/static/img/tabbar-08-selected.png',
 				iconPath: '/static/img/tabbar-08.png',
 				url: '/pages/circle/index'
@@ -153,7 +165,13 @@
 				url: '/pages/home/index'
 			},
 			{
-				name: '圈子',
+				name: '周边',
+				iconPathSelected: '/static/img/tabbar-09-selected.png',
+				iconPath: '/static/img/tabbar-09.png',
+				url: '/pages/myMap/myMap'
+			},
+			{
+				name: '协同圈',
 				iconPathSelected: '/static/img/tabbar-02-selected.png',
 				iconPath: '/static/img/tabbar-02.png',
 				url: '/pages/circle/index'
@@ -180,6 +198,12 @@
 				url: '/pages/home/index'
 			},
 			{
+				name: '周边',
+				iconPathSelected: '/static/img/tabbar-09-selected.png',
+				iconPath: '/static/img/tabbar-09.png',
+				url: '/pages/myMap/myMap'
+			},
+			{
 				name: '圈子',
 				iconPathSelected: '/static/img/tabbar-02-selected.png',
 				iconPath: '/static/img/tabbar-02.png',
@@ -206,6 +230,12 @@
 				url: '/pages/home/index'
 			},
 			{
+				name: '周边',
+				iconPathSelected: '/static/img/tabbar-09-selected.png',
+				iconPath: '/static/img/tabbar-09.png',
+				url: '/pages/myMap/myMap'
+			},
+			{
 				name: '我的',
 				iconPathSelected: '/static/img/tabbar-03-selected.png',
 				iconPath: '/static/img/tabbar-03.png',
diff --git a/manifest.json b/manifest.json
index 9bb1720..5858a21 100644
--- a/manifest.json
+++ b/manifest.json
@@ -230,10 +230,8 @@
         },
         "sdkConfigs" : {
             "maps" : {
-                "amap" : {
-                    "key" : "7fa69abe1defd5888bb85bc736cda874",
-                    "securityJsCode" : "8ac9e5f522c62ed6e3a5800a87b0d140",
-                    "serviceHost" : ""
+                "qqmap" : {
+                    "key" : "EG5BZ-FTCKW-SEMRD-3CVLI-X6MNH-QKBLS"
                 }
             }
         },
diff --git a/pages.json b/pages.json
index 4ad26cc..b83fe45 100644
--- a/pages.json
+++ b/pages.json
@@ -84,6 +84,13 @@
 				"navigationBarBackgroundColor": "#fff",
 				"navigationBarTextStyle": "black"
 			}
+		},
+		{
+			"path": "pages/myMap/myMap",
+			"style": {
+				"navigationBarTitleText": "地图",
+				"enablePullDownRefresh": false
+			}
 		}
 	],
 	"subPackages": [
@@ -1392,9 +1399,15 @@
 				"text": "首页"
 			},
 			{
-				"pagePath": "pages/circle/index",
+				"pagePath": "pages/myMap/myMap",
 				"iconPath": "static/img/tabbar-02.png",
 				"selectedIconPath": "static/img/tabbar-02-selected.png",
+				"text": "周边"
+			},
+			{
+				"pagePath": "pages/circle/index",
+				"iconPath": "static/img/tabbar-09.png",
+				"selectedIconPath": "static/img/tabbar-09-selected.png",
 				"text": "圈子"
 			},
 			{
diff --git a/pages/circle/index.vue b/pages/circle/index.vue
index 4b07ca6..4d44f91 100644
--- a/pages/circle/index.vue
+++ b/pages/circle/index.vue
@@ -93,7 +93,7 @@
 			</view>
 		</z-paging>
 
-		<tabBar :current="1" :list="tabList" />
+		<tabBar :current="2" :list="tabList" />
 
 	</view>
 
@@ -475,4 +475,4 @@
 		padding: 10rpx 0;
 		width: 200rpx;
 	}
-</style>
+</style>
\ No newline at end of file
diff --git a/pages/home/index.vue b/pages/home/index.vue
index 2eae2ab..ffa109d 100644
--- a/pages/home/index.vue
+++ b/pages/home/index.vue
@@ -279,6 +279,8 @@
 									</view>
 								</u-grid-item>
 
+
+
 							</block>
 							<u-grid-item v-if="roleName == 'xyzt'"
 								@click="navigatorPage('/subPackage/school/troubleTaskList')">
@@ -648,7 +650,6 @@
 							}
 						]
 					},
-
 				],
 
 
@@ -931,7 +932,7 @@
 			},
 
 			changeTabs(e) {
-				// console.log(item);
+				console.log("******eeeee**********", e);
 				this.tabIndex = e
 			},
 
@@ -1211,7 +1212,7 @@
 				this.liveList = this.setLiveMenu(this.hasMenu('生活'));
 				this.jobList = this.hasMenu('工作台')
 				this.sectionList = this.hasMenu('首页菜单')
-				let taskMenuList = this.hasMenu('待办事项菜单')
+				let taskMenuList = this.hasMenu('待办事项')
 				if (this.menuList.length) {
 					this.getContactMenu();
 					this.getHouseMenu();
@@ -1661,4 +1662,4 @@
 
 <style lang="scss">
 	@import "./index.scss";
-</style>
+</style>
\ No newline at end of file
diff --git a/pages/myMap/myMap.vue b/pages/myMap/myMap.vue
new file mode 100644
index 0000000..4999603
--- /dev/null
+++ b/pages/myMap/myMap.vue
@@ -0,0 +1,273 @@
+<template>
+	<view class="base_body">
+		<map :markers="markers" @tap="regionchange" :circles="circles" :show-compass="true" :scale="scale" id="map1"
+			style="width: 100%; height: 100%;" :latitude="latitude" :longitude="longitude">
+			<cover-view slot="callout">
+				<block v-for="(item,index) in markers" :key="index">
+					<cover-view class="customCallout" :marker-id="item.id" v-if="item.title">
+						<cover-view class="content">
+							<!-- <view>随意指定</view> -->
+							{{item.title}}
+						</cover-view>
+					</cover-view>
+				</block>
+			</cover-view>
+
+			<view class="home-icon" @click="backMyLocation">
+				<u-icon name="home" color="#000" size="28px"></u-icon>
+				<text style="font-size: 12px;">我的位置</text>
+			</view>
+		</map>
+		<tabBar :current="1" :list="tabbarList" />
+	</view>
+</template>
+
+<script>
+	import tabBar from "@/components/tabBar/tabBar.vue"
+	import {
+		getTabbarList
+	} from "@/common/common.js"
+	import {
+		getNearbyPlaceList
+	} from '@/api/place/place.js'
+	export default {
+		components: {
+			tabBar
+		},
+		data() {
+			return {
+				roleType: 1,
+				addressType: 1,
+				user_info: {},
+				color: "#017BFC",
+				tabbarList: [],
+				map: '',
+				scale: 18,
+				latitude: '', // 地图默认显示的维度
+				longitude: '', // 地图默认显示的纬度
+				markers: [],
+				//在地图上显示圈
+				circles: [{
+					longitude: 116.2529,
+					latitude: 39.542,
+					color: '#DEDEF8',
+					fillColor: '#DEDEF8', // 填充颜色
+					radius: 150, // 圆半径
+					strokeWidth: 1 // 边
+				}],
+			}
+		},
+		onLoad() {
+
+		},
+
+		onReady() {},
+
+		onShow() {
+			let role = uni.getStorageSync('activeRole')
+			if (role.roleName == "居民" || role.roleName == '无诈') {
+				this.tabbarList = getTabbarList(1)
+				this.roleType = 1
+				this.color = "#017BFC"
+				// this.tabbarIndex = 1;
+				this.tabbarIndex = 2
+			} else if (role.roleName == "民警") {
+				this.tabbarList = getTabbarList(2)
+				this.roleType = 2;
+				this.color = "#003399"
+				// this.tabbarIndex = 2;
+				this.tabbarIndex = 3;
+			} else if (role.roleName == "系统管理员") {
+				this.tabbarList = getTabbarList(4)
+				this.roleType = 1
+				this.color = "#017BFC";
+				// this.tabbarIndex = 2;
+				this.tabbarIndex = 3;
+			} else if (role.roleName == "网格员") {
+				this.tabbarList = getTabbarList(3)
+				this.roleType = 1
+				this.color = "#017BFC";
+				// this.tabbarIndex = 2;
+				this.tabbarIndex = 3;
+			} else if (role.roleName == '校园主体' || role.roleName == '校园通用') {
+				this.tabbarList = getTabbarList(5);
+				this.roleType = 5
+			} else {
+				this.tabbarList = getTabbarList(1)
+				this.roleType = 1
+				this.color = "#017BFC"
+				// this.tabbarIndex = 1;
+				this.tabbarIndex = 2
+			}
+			if (uni.getStorageSync("siteInfo")) {
+				this.addressType = uni.getStorageSync("siteInfo").addressType;
+			}
+			this.getLocations()
+		},
+
+		methods: {
+
+			backMyLocation() {
+				this.getLocations()
+			},
+
+			async getLocations() {
+				let param
+				let that = this
+				await uni.getLocation({
+					type: 'gcj02',
+					isHighAccuracy: true,
+					success: function(res) {
+						console.log('当前位置的经度:' + res.longitude);
+						console.log('当前位置的纬度:' + res.latitude);
+						that.latitude = res.latitude
+						that.longitude = res.longitude
+						that.getList()
+					}
+				});
+			},
+
+			regionchange(e) {
+				console.log("****************", e)
+				this.latitude = e.detail.latitude
+				this.longitude = e.detail.longitude
+				this.markers = []
+				// if (this.latitude || this.longitude) {
+				// 	return
+				// }
+				this.getList()
+			},
+
+			getList() {
+				this.markers.push({
+					id: 999,
+					latitude: this.latitude,
+					longitude: this.longitude,
+					title: '',
+					joinCluster: false,
+					width: '36px', //设置宽高
+					height: '46px',
+					customCallout: {
+						anchorY: 0, // Y轴偏移量
+						anchorX: 50, // X轴偏移量
+						display: "ALWAYS" // 一直展示
+					},
+					label: {
+						content: '当前位置',
+						color: '#fff',
+						fontSize: 12,
+						borderRadius: 5,
+						padding: 5,
+						textAlign: 'center',
+						bgColor: '#2979ff',
+					}
+				})
+				getNearbyPlaceList({
+					lat: this.latitude,
+					lng: this.longitude
+				}).then(res => {
+					let data = res.data;
+					for (var i = 0; i < data.length; i++) {
+						this.markers.push({
+							id: i,
+							latitude: data[i].lat,
+							longitude: data[i].lng,
+							title: data[i].placeName,
+							joinCluster: true,
+							width: '26px', //设置宽高
+							height: '36px',
+							customCallout: {
+								anchorY: 0, // Y轴偏移量
+								anchorX: 50, // X轴偏移量
+								display: "ALWAYS" // 一直展示
+							},
+
+						})
+					}
+					console.log("*********", data)
+				})
+			}
+		}
+	}
+</script>
+
+<style>
+	.base_body {
+		width: 100%;
+		height: 100%;
+		position: absolute;
+	}
+
+	/* 水平,垂直居中 */
+	.base_all_center {
+		justify-content: center;
+		align-items: center;
+	}
+
+	/* 垂直居中 */
+	.base_center_vertical {
+		display: flex;
+		align-items: center;
+	}
+
+	/* 水平居中 */
+	.base_center_horizontal {
+		display: flex;
+		justify-content: center;
+	}
+
+	/* 垂直布局 */
+	.base_column {
+		display: flex;
+		flex-direction: column;
+	}
+
+	/* 横向布局 */
+	.base_row {
+		display: flex;
+		flex-direction: row;
+	}
+
+	/* 基础dialog */
+	.base_dialog {
+		width: 100%;
+		height: 80%;
+		position: absolute;
+		top: 0px;
+		background: rgba(0, 0, 0, 0.5);
+	}
+
+	/* *************************************** */
+	.customCallout {
+		box-sizing: border-box;
+		background-color: #fff;
+		border: 1px solid #ccc;
+		border-radius: 30px;
+		/* width: 150px; */
+		/* height: 40px; */
+		display: inline-flex;
+		padding: 5px 10px;
+		justify-content: center;
+		align-items: center;
+	}
+
+	.content {
+		flex: 0 1 auto;
+		margin: 0 10px;
+		font-size: 14px;
+	}
+
+	.home-icon {
+		border-radius: 10px;
+		position: absolute;
+		bottom: 120px;
+		left: 83%;
+		color: black;
+		background-color: #fff;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		width: 55px;
+		height: 55px;
+	}
+</style>
\ No newline at end of file
diff --git a/pages/statistics/index.vue b/pages/statistics/index.vue
index 6ac70be..330460e 100644
--- a/pages/statistics/index.vue
+++ b/pages/statistics/index.vue
@@ -330,17 +330,17 @@
 			if (roleName == "网格员") {
 				this.tabList = getTabbarList(3);
 				// this.tabbarIndex = 1;
-				this.tabbarIndex = 2;
+				this.tabbarIndex = 3;
 			}
 			if (roleName == "民警") {
 				this.tabList = getTabbarList(2);
 				// this.tabbarIndex = 1;
-				this.tabbarIndex = 2;
+				this.tabbarIndex = 3;
 			}
 			if (roleName == "系统管理员") {
 				this.tabList = getTabbarList(4);
 				// this.tabbarIndex = 1;
-				this.tabbarIndex = 2;
+				this.tabbarIndex = 3;
 			}
 			this.refreshData();
 		},
diff --git a/pages/user/center.vue b/pages/user/center.vue
index 96ca119..318f1ca 100644
--- a/pages/user/center.vue
+++ b/pages/user/center.vue
@@ -128,7 +128,7 @@
 				user_info: {},
 				color: "#017BFC",
 				tabbarList: [],
-				tabbarIndex: 2
+				tabbarIndex: 3
 			};
 		},
 
@@ -140,19 +140,19 @@
 				this.roleType = 1
 				this.color = "#017BFC"
 				// this.tabbarIndex = 1;
-				this.tabbarIndex = 2
+				this.tabbarIndex = 3
 			} else if (role.roleName == "民警") {
 				this.tabbarList = getTabbarList(2)
 				this.roleType = 2;
 				this.color = "#003399"
 				// this.tabbarIndex = 2;
-				this.tabbarIndex = 3;
+				this.tabbarIndex = 4;
 			} else if (role.roleName == "系统管理员") {
 				this.tabbarList = getTabbarList(4)
 				this.roleType = 1
 				this.color = "#017BFC";
 				// this.tabbarIndex = 2;
-				this.tabbarIndex = 3;
+				this.tabbarIndex = 4;
 			} else if (role.roleName == "网格员") {
 				this.tabbarList = getTabbarList(3)
 				this.roleType = 1
@@ -161,6 +161,7 @@
 				this.tabbarIndex = 3;
 			} else if (role.roleName == '校园主体' || role.roleName == '校园通用') {
 				this.tabbarList = getTabbarList(5);
+				this.tabbarIndex = 2;
 				this.roleType = 5
 			} else {
 				this.tabbarList = getTabbarList(1)
diff --git a/static/img/tabbar-09-selected.png b/static/img/tabbar-09-selected.png
new file mode 100644
index 0000000..1548cd3
--- /dev/null
+++ b/static/img/tabbar-09-selected.png
Binary files differ
diff --git a/static/img/tabbar-09.png b/static/img/tabbar-09.png
new file mode 100644
index 0000000..4b2db80
--- /dev/null
+++ b/static/img/tabbar-09.png
Binary files differ
diff --git a/subPackage/house/houseNumber/siteInspect.vue b/subPackage/house/houseNumber/siteInspect.vue
index 795a5f9..c66bd0d 100644
--- a/subPackage/house/houseNumber/siteInspect.vue
+++ b/subPackage/house/houseNumber/siteInspect.vue
@@ -381,6 +381,10 @@
 						arr.push(i);
 						for (let k = 0, kk = data[i].children.length; k < kk; k++) {
 							// this.info.patrolRecordVOList.push(obj);
+							for (var j = 0; j < data[i].children.length; j++) {
+								data[i].children[j].state = 1
+							}
+
 							count += 1;
 						}
 					}
diff --git a/subPackage/label/check.vue b/subPackage/label/check.vue
index 93f4882..ab63be9 100644
--- a/subPackage/label/check.vue
+++ b/subPackage/label/check.vue
@@ -225,6 +225,9 @@
 						arr.push(i);
 						for (let k = 0, kk = data[i].children.length; k < kk; k++) {
 							// this.info.patrolRecordVOList.push(obj);
+							for (var j = 0; j < data[i].children.length; j++) {
+								data[i].children[j].state = 1
+							}
 							count += 1;
 						}
 					}
diff --git a/subPackage/school/security.vue b/subPackage/school/security.vue
index 2cce425..1b8b97b 100644
--- a/subPackage/school/security.vue
+++ b/subPackage/school/security.vue
@@ -323,6 +323,9 @@
 						arr.push(i);
 						for (let k = 0, kk = data[i].children.length; k < kk; k++) {
 							// this.info.patrolRecordVOList.push(obj);
+							for (var j = 0; j < data[i].children.length; j++) {
+								data[i].children[j].state = 1
+							}
 							count += 1;
 						}
 					}

--
Gitblit v1.9.3