From f097140d43d081e3197e70922bf3c88af58cdb45 Mon Sep 17 00:00:00 2001 From: X_Rian <904416525@qq.com> Date: Sat, 10 Aug 2024 17:17:22 +0800 Subject: [PATCH] =?UTF-8?q?flx=EF=BC=9A=E4=BF=AE=E6=94=B9=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectEnd/InspectionRoute/inspection.vue | 29 ++ .../mapLocatoin/mapLocatoin.vue | 259 +++++++++++------- 2 files changed, 192 insertions(+), 96 deletions(-) diff --git a/pages/projectEnd/InspectionRoute/inspection.vue b/pages/projectEnd/InspectionRoute/inspection.vue index d8c32791..72dc528b 100644 --- a/pages/projectEnd/InspectionRoute/inspection.vue +++ b/pages/projectEnd/InspectionRoute/inspection.vue @@ -4,6 +4,9 @@ 智能巡检 + + + @@ -116,6 +119,18 @@ url: `/pages/projectEnd/InspectionRoute/${page}` }) }, + getScanCode() { + const that = this; + uni.scanCode({ + scanType: ['qrCode'], + success: function(res) { + console.log('扫一扫得到的数据:' + res.result) + uni.navigateTo({ + url: `${res.result}` + }) + } + }) + }, } } @@ -137,6 +152,20 @@ background: #2b8df3; color: #fff; } + + /deep/ .right { + font-size: 24rpx; + position: absolute; + right: 20rpx; + top: 50%; + z-index: 4; + transform: translateY(-50%); + + .scancode { + width: 56rpx; + height: 56rpx; + } + } } .noData { diff --git a/pages/projectEnd/InspectionRoute/mapLocatoin/mapLocatoin.vue b/pages/projectEnd/InspectionRoute/mapLocatoin/mapLocatoin.vue index b87192f8..381edf49 100644 --- a/pages/projectEnd/InspectionRoute/mapLocatoin/mapLocatoin.vue +++ b/pages/projectEnd/InspectionRoute/mapLocatoin/mapLocatoin.vue @@ -21,22 +21,28 @@ - + + + + + + + {{item.name}} + + + + + + + - + }" :show-scale="true" :scale="mapConfig.scale" :latitude="mapConfig.latitude" :longitude="mapConfig.longitude" + :markers="mapConfig.markers" :circles="mapConfig.circles"> @@ -54,8 +60,8 @@ scale: 14, latitude: undefined, longitude: undefined, - markers: [], // 定位配置 - circles: [], // 显示圆配置 + markers: [], // 定位配置 + circles: [], // 显示圆配置 address: "" }, showMap: false, @@ -63,7 +69,9 @@ map: null, standOptions: [5, 10, 20, 30, 50, 100, 200, 300], standArea: undefined, - searchVal: "" + searchVal: "", + addressList: [], + showListView: false, } }, mounted() { @@ -71,11 +79,11 @@ uni.getSystemInfo({ success(res) { that.mobileTopHeight = res.statusBarHeight ? res.statusBarHeight : 0; - uni.setStorageSync('systemInfo',res) + uni.setStorageSync('systemInfo', res) console.log(res) } }) - console.log('this.mobileTopHeight',this.mobileTopHeight) + console.log('this.mobileTopHeight', this.mobileTopHeight) this.initMap() }, onLoad(option) { @@ -84,10 +92,10 @@ this.mapConfig.latitude = option.latitude; this.mapConfig.longitude = option.longitude; this.mapConfig.address = option.addr; - + this.mapConfig.width = info.windowWidth; this.mapConfig.height = info.windowHeight - 170; - + console.info(info.windowHeight, 'info.windowHeight') // uni.showLoading({ // title: "加载地图资源中" @@ -97,7 +105,7 @@ methods: { initMap() { // uni.hideLoading(); - this.map = uni.createMapContext("map",this); + this.map = uni.createMapContext("map", this); this.registerEvent() this.mapSetLocation() this.drawCircle() @@ -124,7 +132,7 @@ }, //画圆 drawCircle() { - this.mapConfig.circles = [ // 显示圆配置 + this.mapConfig.circles = [ // 显示圆配置 { latitude: this.mapConfig.latitude, longitude: this.mapConfig.longitude, @@ -159,22 +167,51 @@ this.standArea = this.standOptions[e.detail.value]; this.drawCircle() }, - // 搜索详细位置 - searchArea() { + changeInput(){ let that = this; - if(!this.searchVal) return; + if (!this.searchVal) return; mapSearch.poiKeywordsSearch({ point: { latitude: this.mapConfig.latitude, longitude: this.mapConfig.longitude }, key: this.searchVal - },(res) => { - console.info('搜索:',res) - if(res.poiList.length) { - const { latitude, longitude } = res.poiList[0].location; + }, (res) => { + console.info('搜索:', res) + if (res.poiList.length) { + that.addressList = res.poiList; + that.showListView = true; + } + }) + }, + chooseIs(index, item){ + this.searchVal = item.name; + this.searchArea(); + console.log(item) + }, + onBlur(){ + this.showListView = false; + }, + // 搜索详细位置 + searchArea() { + let that = this; + if (!this.searchVal) return; + mapSearch.poiKeywordsSearch({ + point: { + latitude: this.mapConfig.latitude, + longitude: this.mapConfig.longitude + }, + key: this.searchVal + }, (res) => { + console.info('搜索:', res) + if (res.poiList.length) { + const { + latitude, + longitude + } = res.poiList[0].location; that.mapConfig.latitude = latitude; that.mapConfig.longitude = longitude; + that.showListView = false; that.mapSetLocation() that.drawCircle() that.getAddress() @@ -189,85 +226,115 @@ standArea: this.standArea, address: this.mapConfig.address }) - setTimeout(() =>{ + setTimeout(() => { uni.navigateBack() - },10) + }, 10) }, // 地址逆解析,根据经纬度获取详细位置 getAddress() { mapSearch.reverseGeocode({ - point: { - latitude: this.mapConfig.latitude, - longitude: this.mapConfig.longitude - } - }, - res => { - console.info('成功回调', res) - this.mapConfig.address = res.address || "未知位置" - }) + point: { + latitude: this.mapConfig.latitude, + longitude: this.mapConfig.longitude + } + }, + res => { + console.info('成功回调', res) + this.mapConfig.address = res.address || "未知位置" + }) }, }, } + + .content { + width: 100%; + box-sizing: border-box; + } + + .search-box { + height: 100rpx; + background-color: rgba(16, 16, 16, 0.08); + display: flex; + align-items: center; + } + + .picker { + width: 140rpx; + height: 62rpx; + line-height: 40rpx; + border-radius: 22rpx; + background-color: rgba(255, 255, 255, 1); + color: rgba(51, 51, 51, 0.48); + font-size: 28rpx; + display: flex; + padding: 0 16rpx; + margin: 0 16rpx; + align-items: center; + } + + .search-input { + flex: 1; + min-width: 400rpx; + height: 62rpx; + line-height: 40rpx; + border-radius: 22rpx; + background-color: rgba(255, 255, 255, 1); + color: rgba(51, 51, 51, 0.48); + font-size: 28rpx; + padding: 0 16rpx; + } + + .search-btn { + margin: 0 16rpx; + flex-shrink: 0; + } + + .save-btn { + width: 100%; + z-index: 999; + } + \ No newline at end of file