flat: 地图修改

This commit is contained in:
Apcallover
2024-06-11 10:10:29 +08:00
parent 4dce135e0d
commit d19b4d502b
15 changed files with 1564 additions and 42 deletions

View File

@@ -0,0 +1,151 @@
<template>
<u-popup :show="show" zIndex="1007000" @close="close">
<view>
<view style="padding: 10px;">
<u-search placeholder="请输入关键字" @custom="searchList" @search="searchList"></u-search>
</view>
<view class="listBox">
<view style="display: flex;justify-content: space-between;align-items: center;">
<h3 style="margin-bottom: 10px;">历史记录</h3>
<view style="font-size: 12px; color: #666666;" @click="clearRcords">清空</view>
</view>
<view class="listBox1">
<view class="tab-card" v-for="(item,index) in records" @click="selectCity(item)" :key="item.value">
{{item.label}}
</view>
</view>
<u-divider text="分割线" :hairline="true"></u-divider>
<view class="listBoxchild">
<view class="listBoxchild2">
<view class="tab-card" v-for="(item,index) in list1" @click="selectCity(item)"
:key="item.value">
{{item.label}}
</view>
</view>
</view>
</view>
</view>
</u-popup>
</template>
<script>
import ListItem from './xc-list-item.vue';
const dataCityList = require('./data.json')
export default {
components: {
ListItem
},
data() {
return {
list1: [],
records: [],
key: 'record-gw'
}
},
props: {
show: {
type: Boolean,
default: false,
}
},
computed: {
cityList() {
return dataCityList
},
},
created() {
const stor = uni.getStorageSync(this.key)
if (stor && stor.length) {
this.records = stor
}
},
methods: {
close() {
this.$emit('close')
},
clearRcords() {
this.records = []
uni.setStorage({
key: 'record-gw',
data: []
})
},
selectCity(item) {
if (!this.records.some((zItem) => zItem.value === item.value)) {
const arr = [...this.records, item]
if (arr.length > 10) {
arr.shift()
}
this.records = arr
uni.setStorage({
key: 'record-gw',
data: this.records
})
}
this.$emit('select', item)
},
searchList(val) {
if (val) {
const arr = dataCityList.filter((item) => {
const reg = new RegExp(val, 'ig')
if (reg.test(item.label)) {
return true
}
})
this.list1 = arr
} else {
uni.showToast({
title: '请输入关键字',
icon: 'none',
mask: false,
});
}
}
}
}
</script>
<style>
.listBox {
display: flex;
flex-direction: column;
height: 70vh;
padding: 12px;
}
.listBoxheader {
display: flex;
justify-content: space-between;
align-items: center;
}
.listBox1 {
display: flex;
align-items: flex-start;
flex-wrap: wrap;
}
.listBoxchild {
flex: 1;
overflow: hidden;
}
.listBoxchild2 {
display: flex;
align-items: flex-start;
flex-wrap: wrap;
}
.tab-card {
background-color: #e8e8e8;
padding: 3px 5px;
font-size: 14px;
color: #666666;
height: 20px;
line-height: 20px;
text-align: center;
margin: 4px 6px 4px 4px;
}
</style>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,201 @@
<template>
<view class="waper">
<view id="mapDiv2" class="mapDiv2" :prop="option" :change:prop="Trenderjs.updateEcharts"></view>
</view>
</template>
<script>
const dataCityList = require('./data.json')
export default {
name: 'SelectSeeLocation',
data() {
return {
lat: '',
lon: '',
option: {
lng: '',
lat: '',
apikey: ''
}
}
},
props: {
apikey: {
type: String,
default: ''
}
},
mounted() {
},
methods: {
open(city, keyword) {
that.isshow = true
const item = dataCityList.filter((item) => item.label === city)
if (!item.length) {
uni.showToast({
title: '未查到地图信息'
})
return
}
// that.lng = e
// that.lat = f
// that.option = {
// lng: e,
// lat: f,
// apikey: g
// }
// var that = this;
// let params = {
// postStr: {
// "keyWord": keyword,
// "queryType": 12,
// "start": 0,
// "count": 10,
// "specify": this.city.value
// },
// type: 'query',
// tk: this.apikey,
// }
// uni.showLoading({
// mask: true
// })
// uni.request({
// url: 'http://api.tianditu.gov.cn/v2/search',
// method: 'GET',
// data: params,
// success: res => {
// if (res.data.status.infocode === 1000) {
// const {
// pois: aPoints,
// count
// } = res.data
// if (count === '0' || !aPoints || !aPoints.length) {
// uni.showToast({
// title: '没有找到该地址',
// icon: 'none',
// mask: false,
// });
// return
// }
// const {
// pois,
// keyWord,
// lonlat
// } = aPoints[0]
// const values = aPoints.map((item) => this.formatterAdressLocation(item, 2))
// that.arr_list = values
// const [lon, lat] = lonlat.split(',')
// this.setIcon(new T.LngLat(lon, lat), true)
// this.changeCenter(lon, lat)
// } else {
// }
// },
// fail: () => {
// //console.log('获取失败')
// },
// complete: () => {
// uni.hideLoading();
// }
// });
}
}
}
</script>
<style scoped>
.waper {
width: 100%;
height: 100%;
}
</style>
<script module="Trenderjs" lang="renderjs">
const iconPath = require('./xwz_dw.png')
let Tmap
export default {
data() {
return {
isinit: false,
}
},
mounted(e) {
if (typeof window.T === 'function') {
//this.initEcharts()
} else {
////console.log('init00')
if (this.option && this.option.apikey) {
const script = document.createElement('script')
// view 层的页面运行在 www 根目录,其相对路径相对于 www 计算
script.src = 'http://api.tianditu.gov.cn/api?v=4.0&tk=' + this.option.apikey
script.onload = this.initEcharts.bind(this)
document.head.appendChild(script)
}
}
},
methods: {
updateEcharts(newValue, oldValue, ownerInstance, instance) {
// 监听 service 层数据变更
////console.log(9999)
////console.log(newValue)
////console.log(oldValue)
if (this.option.apikey) {
const script = document.createElement('script')
script.src = 'http://api.tianditu.gov.cn/api?v=4.0&tk=' + this.option.apikey
script.onload = this.initEcharts.bind(this)
document.head.appendChild(script)
}
},
initEcharts() {
var that = this;
//return
////console.log(window.T)
Tmap = new T.Map('mapDiv', {
projection: 'EPSG:4326',
minZoom: 10,
maxZoom: 20,
zoom: 12,
});
// console.log(this.option)
// console.log('init')
Tmap.centerAndZoom(new T.LngLat(that.option.lng, that.option.lat), 17);
//Tmap.removeEventListener("moveend");
this.setIcon(new T.LngLat(that.option.lng, that.option.lat))
// Tmap.addEventListener("moveend", function(e) {
// ////console.log(e.target.getCenter().getLng() + "," + e.target.getCenter().getLat())
// that.$ownerInstance.callMethod('nijiexi', {
// lng: e.target.getCenter().getLng(),
// lat: e.target.getCenter().getLat(),
// apikey: that.option.apikey
// })
// });
},
changeCenter(lng, lat) {
Tmap.centerAndZoom(new T.LngLat(lng, lat), 17);
},
setIcon(position, isClear) {
if (isClear) {
Tmap.clearOverLays()
}
const icon = new T.Icon({
iconUrl: iconPath,
iconSize: new T.Point(30, 30),
iconAnchor: new T.Point(30, 30),
});
const marker = new T.Marker(position, {
icon,
});
Tmap.addOverLay(marker);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,385 @@
<template>
<view>
<view v-if="isshow" :style="{ height: (winHeight)+ 'px',width: winWidth+'px',overflow:'hidden'}">
<syljSelectlocation-tmap ref="selectLocationPop" :prop="option" @ok="ok" :apikey="apikey"
@guanbi="guanbi"></syljSelectlocation-tmap>
</view>
</view>
</template>
<script>
import syljSelectlocation_tmap from './tmap.vue'
export default {
components: {
'syljSelectlocation-tmap': syljSelectlocation_tmap
},
name: 'syljSelectlocation',
props: {
apikey: {
type: String,
default: ''
}
},
data() {
return {
winHeight: 500,
winWidth: 300,
iStatusBarHeight: 0,
arr_list: [],
lng: "",
lat: "",
isshow: false,
option: {
lng: "",
lat: "",
apikey: "",
}
}
},
onLoad(e) {
var that = this;
that.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
uni.getSystemInfo({
success: function(res) {
that.winWidth = res.windowWidth
that.winHeight = res.windowHeight
}
});
},
onHide() {
//console.log('hide')
},
methods: {
ok(data) {
this.$emit('ok', data)
this.isshow = false
//this.$destroy();
},
open(e, f, g) {
var that = this;
that.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
uni.getSystemInfo({
success: function(res) {
that.winWidth = res.windowWidth
that.winHeight = res.windowHeight
}
});
if (e && f && g) {
that.isshow = true
that.lng = e
that.lat = f
that.option = {
lng: e,
lat: f,
apikey: g
}
setTimeout(function() {
that.$refs.selectLocationPop.open(e, f, g);
}, 100)
} else {
if (g) {
that.lng = 116.40769
that.lat = 32.89945
that.nijiexi({
lng: e,
lat: f,
apikey: g
})
} else {
uni.showToast({
title: '请输入天地图apikey',
icon: 'none',
//mask: true,
duration: 2000
});
}
}
},
guanbi() {
var that = this;
that.isshow = false
//console.log(888)
//this.$destroy();
//that.$refs.selectLocationPop.$destroy()
},
queding() {
var that = this;
uni.navigateBack();
},
nijiexi(e) {
////console.log(e)
var that = this;
uni.showLoading({
//content: '',
mask: true
})
uni.request({
//url: 'https://service.sdmap.gov.cn/geodecode',
url: 'https://api.tianditu.gov.cn/geocoder',
method: 'GET',
data: {
postStr: JSON.stringify({
lon: e.lng,
lat: e.lat,
ver: 1,
}),
type: 'geocode',
tk: e.apikey
},
success: res => {
//console.log(res);
if (res.data.result) {
var fobg = res.data.result
fobg.name = res.data.result.formatted_address
that.arr_list = [
fobg
]
//that.dqdz=res.data.result.point.name
} else {
}
},
fail: () => {
//console.log('获取失败')
},
complete: () => {
uni.hideLoading();
}
});
}
}
}
</script>
<script module="Trenderjs" lang="renderjs">
let Tmap
export default {
data() {
return {
isinit: false,
}
},
mounted(e) {
if (typeof window.T === 'function') {
//this.initEcharts()
} else {
////console.log('init00')
if (this.option && this.option.apikey) {
const script = document.createElement('script')
// view 层的页面运行在 www 根目录,其相对路径相对于 www 计算
script.src = 'http://api.tianditu.gov.cn/api?v=4.0&tk=' + this.option.apikey
script.onload = this.initEcharts.bind(this)
document.head.appendChild(script)
}
}
},
methods: {
updateEcharts(newValue, oldValue, ownerInstance, instance) {
// 监听 service 层数据变更
//console.log(9999)
//console.log(newValue)
//console.log(oldValue)
if (this.option.apikey) {
const script = document.createElement('script')
script.src = 'http://api.tianditu.gov.cn/api?v=4.0&tk=' + this.option.apikey
script.onload = this.initEcharts.bind(this)
document.head.appendChild(script)
}
},
initEcharts() {
var that = this;
//return
////console.log(window.T)
Tmap = new T.Map('mapDiv', {
projection: 'EPSG:4326'
});
////console.log(this.option)
//console.log('init')
Tmap.centerAndZoom(new T.LngLat(that.option.lng, that.option.lat), 15);
//Tmap.removeEventListener("moveend");
Tmap.addEventListener("moveend", function(e) {
// //console.log(e.target.getCenter().getLng() + "," + e.target.getCenter().getLat())
that.$ownerInstance.callMethod('nijiexi', {
lng: e.target.getCenter().getLng(),
lat: e.target.getCenter().getLat(),
apikey: that.option.apikey
})
});
//var statisticsForm=this.data.bsForm
},
}
}
</script>
<style>
page {
background-color: #FFF;
}
.mapDiv {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1008;
background: #EDEDED;
}
.mapDiv2 {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
}
.mapDiv21 {
width: 30px;
height: 30px;
position: fixed;
left: 50%;
margin-left: -15px;
top: 50%;
margin-top: -15px;
z-index: 1000;
}
.jfh {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 44px;
z-index: 1000;
background: rgba(0, 0, 0, 0);
}
.jfhz {
widows: 40px;
height: 26px;
line-height: 26px;
position: absolute;
left: 4%;
bottom: 9px;
text-align: left;
font-size: 14px;
color: #464646;
}
.jfhy {
width: 40px;
height: 26px;
line-height: 26px;
position: absolute;
right: 4%;
bottom: 9px;
text-align: center;
font-size: 14px;
color: white;
background: #3E89F7;
border-radius: 6px;
}
.xlistt {
width: 100%;
height: 50px;
line-height: 50px;
text-align: center;
font-size: 16px;
font-weight: bold;
color: #333333;
border-bottom: 1px solid #F3F3F3;
}
.xlistw {
overflow: scroll;
position: fixed;
height: 180px;
left: 0;
bottom: 0;
background-color: white;
width: 100%;
z-index: 1006;
}
.xlist {
width: 100%;
height: auto;
position: relative;
line-height: 20px;
}
.xlist1 {
width: 100%;
height: auto;
box-sizing: border-box;
position: relative;
line-height: 20px;
padding-top: 10px;
padding-bottom: 5px;
padding-left: 4%;
padding-right: 4%;
font-size: 16px;
color: #1A1A1A;
}
.xlist2 {
width: 100%;
height: auto;
box-sizing: border-box;
position: relative;
line-height: 20px;
padding-top: 0px;
padding-bottom: 10px;
padding-left: 4%;
padding-right: 4%;
font-size: 14px;
color: #BEBEBE;
}
</style>

View File

@@ -0,0 +1,624 @@
<template>
<view>
<view v-if="isshow" :style="{ height: (winHeight)+ 'px',width: winWidth+'px',overflow:'hidden'}">
<view class="jfh" :style="{ height: (iStatusBarHeight + 44 )+ 'px' }">
<view class="jfhz" @tap="guanbi">
取消
</view>
<!-- <view class="jfhy" @tap="ok">
确定
</view> -->
<CityPopup :show="showCity" @select="afterSlectCity" @close="showCity = false"></CityPopup>
</view>
<view class="search" :style="{ marginTop: (iStatusBarHeight + 44 )+ 'px' }">
<view class="search-content">
<view class="search-icon" @click="selectCity">{{city.label}}</view>
<input class="search-input" v-model="keyword" placeholder="请输入详细地址" />
<view class="search-btn" @click="searchKeyword">搜索</view>
</view>
</view>
<view id="mapDiv" class="mapDiv" :prop="option" :change:prop="Trenderjs.updateEcharts"
:style="{height:(winHeight-0-180)+'px'}"></view>
<!-- <image src="./xwz_dw.png" mode="" class="mapDiv21" :style="{top:((winHeight-iStatusBarHeight-180)/2)+'px'}"> -->
</image>
<view class="xlistw">
<view class="xlistt">
所有地址
</view>
<view class="xlistwx">
<view class="xlist" v-for="(iv,index) in arr_list" :key="index" @click="ok(iv)">
<view class="xlist1">
{{iv.address}}{{iv.name && `(${iv.name})`}}
</view>
<view class="xlist2">
{{iv.infomation.city && iv.infomation.city }} ({{iv.location.lon}},{{iv.location.lat}})
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import CityPopup from './citypopup.vue';
export default {
components: {
CityPopup
},
name: 'syljSelectlocation',
props: {
apikey: {
type: String,
default: ''
}
},
data() {
return {
winHeight: 500,
winWidth: 300,
iStatusBarHeight: 0,
arr_list: [],
lng: "",
lat: "",
isshow: false,
showCity: false,
keyword: '',
option: {
lng: "",
lat: "",
apikey: "",
},
city: {
"label": "德阳市",
"value": "156510600"
}
}
},
props: {
apikey: {
type: String,
default: ''
}
},
onLoad(e) {
var that = this;
that.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
uni.getSystemInfo({
success: function(res) {
that.winWidth = res.windowWidth
that.winHeight = res.windowHeight
}
});
},
onHide() {
//console.log('hide')
},
methods: {
selectCity() {
this.showCity = true
},
afterSlectCity(val) {
this.city = val
this.showCity = false
},
searchKeyword() {
if (!this.keyword) {
uni.showToast({
title: '请输入详细地址',
icon: 'none',
mask: false,
});
return
}
var that = this;
let params = {
postStr: {
"keyWord": this.keyword,
"queryType": 12,
"start": 0,
"count": 10,
"specify": this.city.value
},
type: 'query',
tk: this.apikey,
}
uni.showLoading({
mask: true
})
uni.request({
url: 'http://api.tianditu.gov.cn/v2/search',
method: 'GET',
data: params,
success: res => {
if (res.data.status.infocode === 1000) {
const {
pois: aPoints,
count
} = res.data
if (count === '0' || !aPoints || !aPoints.length) {
uni.showToast({
title: '没有找到该地址',
icon: 'none',
mask: false,
});
return
}
const {
pois,
keyWord,
lonlat
} = aPoints[0]
const values = aPoints.map((item) => this.formatterAdressLocation(item, 2))
that.arr_list = values
const [lon, lat] = lonlat.split(',')
this.setIcon(new T.LngLat(lon, lat), true)
this.changeCenter(lon, lat)
} else {
}
},
fail: () => {
//console.log('获取失败')
},
complete: () => {
uni.hideLoading();
}
});
},
ok(item) {
this.$emit('ok', item)
this.isshow = false
this.$destroy();
},
open(e, f, g) {
var that = this;
that.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
uni.getSystemInfo({
success: function(res) {
that.winWidth = res.windowWidth
that.winHeight = res.windowHeight
}
});
if (e && f && g) {
that.isshow = true
that.lng = e
that.lat = f
that.option = {
lng: e,
lat: f,
apikey: g
}
that.nijiexi({
lng: e,
lat: f,
apikey: g
})
} else {
if (g) {
that.lng = 116.40769
that.lat = 32.89945
that.nijiexi({
lng: e,
lat: f,
apikey: g
})
} else {
uni.showToast({
title: '请输入天地图apikey',
icon: 'none',
//mask: true,
duration: 2000
});
}
}
},
guanbi() {
var that = this;
that.isshow = false
this.$emit('guanbi', this.arr_list[0])
//console.log(888)
//this.$destroy();
//that.$refs.selectLocationPop.$destroy()
},
queding() {
var that = this;
uni.navigateBack();
},
nijiexi(e) {
////console.log(e)
var that = this;
uni.showLoading({
//content: '',
mask: true
})
uni.request({
//url: 'https://service.sdmap.gov.cn/geodecode',
url: 'https://api.tianditu.gov.cn/geocoder',
method: 'GET',
data: {
postStr: JSON.stringify({
lon: e.lng,
lat: e.lat,
ver: 1,
}),
type: 'geocode',
tk: e.apikey
},
success: res => {
//console.log(res);
if (res.data.result) {
const value = that.formatterAdressLocation(res.data.result, 1)
that.arr_list = [value]
//that.dqdz=res.data.result.point.name
} else {
}
},
fail: () => {
//console.log('获取失败')
},
complete: () => {
uni.hideLoading();
}
});
},
formatterAdressLocation(obj, type) {
switch (type) {
case 1:
return {
address: obj.formatted_address,
name: '',
location: obj.location,
infomation: obj.addressComponent
}
break;
case 2:
const [lon, lat] = obj.lonlat.split(',')
return {
address: obj.address,
name: obj.name,
location: {
lon,
lat
},
infomation: obj
}
break
default:
break;
}
}
}
}
</script>
<script module="Trenderjs" lang="renderjs">
const iconPath = require('./xwz_dw.png')
let Tmap
export default {
data() {
return {
isinit: false,
}
},
mounted(e) {
if (typeof window.T === 'function') {
//this.initEcharts()
} else {
////console.log('init00')
if (this.option && this.option.apikey) {
const script = document.createElement('script')
// view 层的页面运行在 www 根目录,其相对路径相对于 www 计算
script.src = 'http://api.tianditu.gov.cn/api?v=4.0&tk=' + this.option.apikey
script.onload = this.initEcharts.bind(this)
document.head.appendChild(script)
}
}
},
methods: {
updateEcharts(newValue, oldValue, ownerInstance, instance) {
// 监听 service 层数据变更
////console.log(9999)
////console.log(newValue)
////console.log(oldValue)
if (this.option.apikey) {
const script = document.createElement('script')
script.src = 'http://api.tianditu.gov.cn/api?v=4.0&tk=' + this.option.apikey
script.onload = this.initEcharts.bind(this)
document.head.appendChild(script)
}
},
initEcharts() {
var that = this;
//return
////console.log(window.T)
Tmap = new T.Map('mapDiv', {
projection: 'EPSG:4326',
minZoom: 10,
maxZoom: 20,
zoom: 12,
});
//console.log(this.option)
//console.log('init')
Tmap.centerAndZoom(new T.LngLat(that.option.lng, that.option.lat), 17);
//Tmap.removeEventListener("moveend");
this.setIcon(new T.LngLat(that.option.lng, that.option.lat))
// Tmap.addEventListener("moveend", function(e) {
// ////console.log(e.target.getCenter().getLng() + "," + e.target.getCenter().getLat())
// that.$ownerInstance.callMethod('nijiexi', {
// lng: e.target.getCenter().getLng(),
// lat: e.target.getCenter().getLat(),
// apikey: that.option.apikey
// })
// });
Tmap.addEventListener('click', (e) => {
const {
lnglat
} = e
const {
lat,
lng
} = lnglat
that.$ownerInstance.callMethod('nijiexi', {
lng: lng,
lat: lat,
apikey: that.option.apikey
})
this.setIcon(new T.LngLat(lng, lat), true)
});
},
changeCenter(lng, lat) {
Tmap.centerAndZoom(new T.LngLat(lng, lat), 17);
},
setIcon(position, isClear) {
if (isClear) {
Tmap.clearOverLays()
}
const icon = new T.Icon({
iconUrl: iconPath,
iconSize: new T.Point(30, 30),
iconAnchor: new T.Point(30, 30),
});
const marker = new T.Marker(position, {
icon,
});
Tmap.addOverLay(marker);
}
}
}
</script>
<style>
page {
background-color: #FFF;
}
.mapDiv {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1008;
background: #EDEDED;
}
.mapDiv2 {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
}
.mapDiv21 {
width: 30px;
height: 30px;
position: fixed;
left: 50%;
margin-left: -15px;
top: 50%;
margin-top: -15px;
z-index: 10010;
}
.jfh {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 44px;
z-index: 100101;
background: white;
}
.jfhz {
widows: 40px;
height: 26px;
line-height: 26px;
position: absolute;
left: 4%;
bottom: 9px;
text-align: left;
font-size: 14px;
color: #464646;
}
.jfhy {
width: 40px;
height: 26px;
line-height: 26px;
position: absolute;
right: 4%;
bottom: 9px;
text-align: center;
font-size: 14px;
color: white;
background: #3E89F7;
border-radius: 6px;
}
.search {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 44px;
z-index: 100100;
display: flex;
justify-content: center;
background-color: #FFFFFF;
}
.search-content {
width: calc(100% - 48px);
height: 32px;
border-radius: 10px;
padding: 0 5px 0 10px;
background-color: rgb(242, 242, 242);
border-radius: 100px;
font-size: 14px;
display: flex;
justify-content: space-between;
align-items: center;
}
.search-icon {
margin-right: 5px;
border-right: 1px solid #bababa;
padding-right: 5px;
}
.search-icon:active {
color: #666666;
}
.search-input {
flex: 1;
font-size: 14px;
}
.search-btn {
height: 24px;
color: #FFFFFF;
font-size: 14px;
background-color: rgba(148, 170, 41, 0.7);
text-align: center;
line-height: 24px;
border-radius: 25px;
padding: 0 8px;
}
.search-btn:active {
background-color: #e8e8e8;
color: #666666;
}
.xlistt {
width: 100%;
height: 50px;
line-height: 50px;
text-align: center;
font-size: 16px;
font-weight: bold;
color: #333333;
border-bottom: 1px solid #F3F3F3;
background-color: #FFFFFF;
position: absolute;
top: -50px;
z-index: 1;
}
.xlistw {
position: fixed;
height: 240px;
left: 0;
bottom: 0;
background-color: white;
width: 100%;
z-index: 10006;
display: flex;
flex-direction: column;
}
.xlistwx {
flex: 1;
overflow: scroll;
}
.xlist {
width: 100%;
height: auto;
position: relative;
line-height: 20px;
}
.xlist:active {
background-color: #e8e8e8;
}
.xlist1 {
width: 100%;
height: auto;
box-sizing: border-box;
position: relative;
line-height: 20px;
padding-top: 10px;
padding-bottom: 5px;
padding-left: 4%;
padding-right: 4%;
font-size: 16px;
color: #1A1A1A;
}
.xlist2 {
width: 100%;
height: auto;
box-sizing: border-box;
position: relative;
line-height: 20px;
padding-top: 0px;
padding-bottom: 10px;
padding-left: 4%;
padding-right: 4%;
font-size: 14px;
color: #BEBEBE;
}
</style>

View File

@@ -0,0 +1,25 @@
<template>
<view class="item" v-html="item.value">
<!-- {{item.value}} -->
</view>
</template>
<script>
export default {
props: {
item: {
type: Object,
default: () => ({
value: 1
})
}
},
}
</script>
<style lang="scss">
.item {
width: 100%;
margin-bottom: 20rpx;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -89,6 +89,11 @@
type: Boolean,
required: false,
default: false,
},
init: {
type: Boolean,
required: false,
default: true,
}
},
data() {
@@ -109,13 +114,20 @@
};
},
mounted() {
this.initMap()
if (this.flagTip) {
this.createHelpTooltip()
if (this.init) {
this.initMap()
}
},
methods: {
initMap() {
initMap(options) {
let lat, lon;
if (options) {
lat = options.lat
lon = options.lon
} else {
lat = this.latitude
lon = this.longitude
}
this.map = new Map({
target: 'map',
controls: control.defaults({
@@ -132,7 +144,7 @@
}),
],
view: new View({
center: [this.longitude, this.latitude],
center: [lon, lat],
maxZoom: this.maxZoom,
minZoom: this.minZoom,
zoom: this.zoom,
@@ -170,8 +182,8 @@
if (this.open) {
this.addFeature([{
id: 1,
latitude: this.latitude,
longitude: this.longitude,
latitude: lat,
longitude: lon,
iconPath: mypoint,
title: '我的位置',
width: 20,
@@ -179,12 +191,17 @@
}])
}
if (this.flagTip) {
this.createHelpTooltip()
}
},
addMarker(point) {
console.log('point', point)
// this.ceateMarker([104.404419, 31.133980])
},
addFeature(covers) {
console.log(covers)
const features = covers.map((item) => ({
type: 'Feature',
geometry: {

View File

@@ -2,6 +2,8 @@ module.exports = {
baseUrl: '',
// 图片地址
imageUrl: '',
// 天地图tk
apiKey: 'e122b0518f43b32dcc256edbae20a5d1',
// 显示标题
showTitle: false,
// map 1、黑色模块 2、白色模块

View File

@@ -102,7 +102,7 @@
</view>
<view class="map">
<super-map ref="uMap" style="width: 100%;height: 100%;" :latitude="latitude" :longitude="longitude"
:open="true" :zoom="14" :min-zoom="10" :max-zoom="20" :MapUrl="$config.supperMap"
:open="true" :zoom="14" :min-zoom="10" :max-zoom="20" :MapUrl="$config.supperMap" :init="false"
:flag-tip="false"></super-map>
</view>
<!-- <map class="map" :latitude="latitude" :longitude="longitude" :markers="covers"></map> -->
@@ -324,19 +324,23 @@
detail(self.missionNo).then(res => {
self.info = res.data.data;
self.status = res.data.data.detailStatus;
AddressToLocation({
smart_address: res.data.data.address
}).then((result) => {
console.log('result', result)
self.latitude = result.location.lat;
self.longitude = result.location.lon;
self.covers[0].latitude = result.location.lat;
self.covers[0].longitude = result.location.lon;
})
// AddressToLocation({
// smart_address: res.data.data.address
// }).then((result) => {
// console.log('result', result)
// self.latitude = result.location.lat;
// self.longitude = result.location.lon;
// self.covers[0].latitude = result.location.lat;
// self.covers[0].longitude = result.location.lon;
// })
// self.latitude = self.info.lat;
// self.longitude = self.info.lon;
// self.covers[0].latitude = self.info.lat;
// self.covers[0].longitude = self.info.lon;
self.$refs.uMap.initMap({
lat: self.info.lat,
lon: self.info.lon,
})
self.showDetail = true;
self.getCollectStatus();
if (self.type === 1) {

View File

@@ -104,8 +104,9 @@
详细地址{{info.address || '暂无'}}
</view>
<view class="map">
<!-- <seeLocation ref="cMap" :apikey="$config.apiKey"></seeLocation> -->
<super-map ref="uMap" style="width: 100%;height: 100%;" :latitude="latitude" :longitude="longitude"
:open="true" :zoom="14" :min-zoom="10" :max-zoom="20" :MapUrl="$config.supperMap"
:open="true" :zoom="14" :min-zoom="10" :max-zoom="20" :MapUrl="$config.supperMap" :init="false"
:flag-tip="false"></super-map>
</view>
<!-- <map class="map" :latitude="latitude" :longitude="longitude" :markers="covers"></map> -->
@@ -221,6 +222,7 @@
} from '@/api/userrecruit.js'
import uniMask from '@/components/uni-mask/mask.vue'
import validCode from '@/components/p-valid-code/p-valid-code.vue'
import seeLocation from '@/components/sylj-selectLocation/seeLocation.vue';
import {
getuserrecruitDetailApp
} from '@/api/userrecruit.js'
@@ -235,8 +237,8 @@
maskShow: false,
nextBtn: false,
loading: false,
latitude: 31.126855, //中心点
longitude: 104.397894,
latitude: 30.70032, //中心点
longitude: 104.05235,
covers: [{ //marker标记位置
id: 0,
latitude: 0,
@@ -258,7 +260,8 @@
},
components: {
uniMask,
validCode
validCode,
seeLocation
},
onLoad: function(option) { //option为object类型会序列化上个页面传递的参数
// this.$store.dispatch('setAutograph')
@@ -329,10 +332,15 @@
self.info = resData.data.data;
self.status = resData.data.data.status;
self.missionNo = resData.data.data.missionNo;
// self.latitude = self.info.lat;
// self.longitude = self.info.lon;
// self.covers[0].latitude = self.info.lat;
// self.covers[0].longitude = self.info.lon;
self.latitude = self.info.lat;
self.longitude = self.info.lon;
self.covers[0].latitude = self.info.lat;
self.covers[0].longitude = self.info.lon;
self.$refs.uMap.initMap({
lat: self.info.lat,
lon: self.info.lon,
})
// this.$refs.cMap.open()
self.showDetail = true;
if (!this.seeDeatil) {
self.getCollectStatus();

View File

@@ -110,7 +110,7 @@
</view>
<view class="map">
<super-map ref="uMap" style="width: 100%;height: 100%;" :latitude="latitude" :longitude="longitude"
:open="true" :zoom="14" :min-zoom="10" :max-zoom="20" @regionchange="show = false"
:open="true" :zoom="14" :min-zoom="10" :max-zoom="20" @regionchange="show = false" :init="false"
:MapUrl="$config.supperMap" :flag-tip="false"></super-map>
</view>
<!-- <map class="map" :latitude="latitude" :longitude="longitude" :markers="covers"></map> -->
@@ -334,10 +334,14 @@
self.info = resData.data.data;
self.status = resData.data.data.status;
self.missionNo = resData.data.data.missionNo;
// self.latitude = self.info.lat;
// self.longitude = self.info.lon;
// self.covers[0].latitude = self.info.lat;
// self.covers[0].longitude = self.info.lon;
self.latitude = self.info.lat;
self.longitude = self.info.lon;
self.covers[0].latitude = self.info.lat;
self.covers[0].longitude = self.info.lon;
self.$refs.uMap.initMap({
lat: self.info.lat,
lon: self.info.lon,
})
self.showDetail = true;
if (!this.seeDeatil) {
self.getCollectStatus();

View File

@@ -107,7 +107,7 @@
</view>
<view class="map">
<super-map ref="uMap" style="width: 100%;height: 100%;" :latitude="latitude" :longitude="longitude"
:open="true" :zoom="14" :min-zoom="10" :max-zoom="20" @regionchange="show = false"
:open="true" :zoom="14" :min-zoom="10" :max-zoom="20" @regionchange="show = false" :init="false"
:MapUrl="$config.supperMap" :flag-tip="false"></super-map>
</view>
</view>
@@ -316,10 +316,14 @@
self.info = res.data.data;
self.status = res.data.data.status;
self.missionNo = res.data.data.missionNo;
// self.latitude = self.info.lat;
// self.longitude = self.info.lon;
// self.covers[0].latitude = self.info.lat;
// self.covers[0].longitude = self.info.lon;
self.latitude = self.info.lat;
self.longitude = self.info.lon;
self.covers[0].latitude = self.info.lat;
self.covers[0].longitude = self.info.lon;
self.$refs.uMap.initMap({
lat: self.info.lat,
lon: self.info.lon,
})
self.showDetail = true;
self.getCollectStatus();
if (self.type === 1) {

View File

@@ -132,16 +132,18 @@
</PickerTree>
</u-form-item>
<u-form-item label="详细地址" prop="address" borderBottom labelWidth="80" ref="item1">
<u--input v-model="info.address" border="none" placeholder="请输入详细地址"></u--input>
<view class="addressinfo" @click="selectMap">{{info.address}}</view>
<!-- <textarea placeholder-style="color: rgb(192, 196, 204); fontSize: 15px" @focus="selectMap"
v-model="info.address" placeholder="请输入详细地址" style="width: 100%;" /> -->
<!-- <lin-select :list="addressOptions" value-key="location" name-key="title" max-height="180"
:loading="loading" loading-text="数据加载中" placeholder="请输入详细地址" @input="selectInput"
v-model="info.address" @confirm="selectConfirm" /> -->
</u-form-item>
<view class="map">
<!-- <view class="map">
<super-map ref="uMap" style="width: 100%;height: 100%;" :latitude="latitude" :longitude="longitude"
:open="true" :zoom="14" :min-zoom="10" :max-zoom="20" @regionchange="show = false"
:MapUrl="$config.supperMap" :flag-tip="false"></super-map>
</view>
</view> -->
<!-- <map class="map" :latitude="latitude" :longitude="longitude" :markers="covers"></map> -->
</u--form>
<u-button type="primary" text="提交" customStyle="margin-top: 50px" @click="submit"></u-button>
@@ -171,6 +173,9 @@
@confirm="stimeConfirm" @cancel="stimeClose" @close="stimeClose"></u-datetime-picker>
<u-datetime-picker :show="showEtime" :value="birthday" mode="date" closeOnClickOverlay
@confirm="etimeConfirm" @cancel="etimeClose" @close="etimeClose"></u-datetime-picker>
<sylj-selectLocation ref="selectLocationPop" @ok="selectedOk"
:apikey="$config.apiKey"></sylj-selectLocation>
</view>
</view>
</template>
@@ -185,6 +190,7 @@
getDeptAllTree
} from '@/api/userrecruit.js'
import PickerTree from './enterpriceCertification/pickerTree.vue'
import syljSelectLocation from '@/components/sylj-selectLocation/sylj-selectLocation.vue'
import {
mapGetters
} from 'vuex'
@@ -441,6 +447,44 @@
},
methods: {
selectedOk(data) {
const {
infomation,
location,
name,
address
} = data
const {
lon,
lat
} = location
this.latitude = lat
this.longitude = lon
this.info.address = `${data.address}${ data.name && '(' + data.name + ')' }`
},
selectMap() {
const that = this
// uni.getLocation({
// type: 'wgs84',
// success: function(res) {
// console.log(res)
// uni.hideLoading();
// console.log('当前位置的经度:' + res.longitude);
// console.log('当前位置的纬度:' + res.latitude);
// // that.$refs.selectLocationPop.open(res.longitude, res.latitude, that.$config.apiKey);
// },
// fail: function(err) {
// console.log('获取失败');
// uni.hideLoading();
// },
// });
that.$refs.selectLocationPop.open(that.longitude, that.latitude, that.$config.apiKey);
console.log(this.latitude, this.longitude)
console.log('聚焦')
},
async getTreeDept() {
let resData = await getDeptAllTree()
if (resData.data.code === 200) {
@@ -812,4 +856,10 @@
/deep/.wageunitLeft .u-form-item__body {
padding: 0;
}
.addressinfo {
width: 100%;
height: fit-content;
min-height: 21px;
}
</style>

View File

@@ -136,13 +136,14 @@
</PickerTree>
</u-form-item>
<u-form-item label="详细地址" prop="address" borderBottom labelWidth="80" ref="item1">
<u--input v-model="info.address" border="none" placeholder="请输入详细地址"></u--input>
<view class="addressinfo" @click="selectMap">{{info.address}}</view>
<!-- <u--input v-model="info.address" border="none" placeholder="请输入详细地址"></u--input> -->
</u-form-item>
<view class="map">
<!-- <view class="map">
<super-map ref="uMap" style="width: 100%;height: 100%;" :latitude="latitude" :longitude="longitude"
:open="true" :zoom="14" :min-zoom="10" :max-zoom="20" :MapUrl="$config.supperMap"
:flag-tip="false"></super-map>
</view>
</view> -->
<!-- <map class="map" :latitude="latitude" :longitude="longitude" :markers="covers"></map> -->
</u--form>
<u-button type="primary" text="提交" customStyle="margin-top: 50px" @click="submit"></u-button>
@@ -173,6 +174,7 @@
<u-datetime-picker :show="showEtime" :value="birthday" mode="date" closeOnClickOverlay
@confirm="etimeConfirm" @cancel="etimeClose" @close="etimeClose"></u-datetime-picker>
</view>
<sylj-selectLocation ref="selectLocationPop" @ok="selectedOk" :apikey="$config.apiKey"></sylj-selectLocation>
</view>
</template>
@@ -186,6 +188,7 @@
getDeptAllTree
} from '@/api/userrecruit.js'
import PickerTree from './enterpriceCertification/pickerTree.vue'
import syljSelectLocation from '@/components/sylj-selectLocation/sylj-selectLocation.vue'
import {
mapGetters
} from 'vuex'
@@ -412,7 +415,8 @@
}
},
components: {
PickerTree
PickerTree,
syljSelectLocation
},
computed: {
...mapGetters(['area'])
@@ -433,6 +437,42 @@
}
},
methods: {
selectedOk(data) {
const {
infomation,
location,
name,
address
} = data
const {
lon,
lat
} = location
this.latitude = lat
this.longitude = lon
this.info.address = `${data.address}${ data.name && '(' + data.name + ')' }`
},
selectMap() {
const that = this
// uni.getLocation({
// type: 'wgs84',
// success: function(res) {
// console.log(res)
// uni.hideLoading();
// console.log('当前位置的经度:' + res.longitude);
// console.log('当前位置的纬度:' + res.latitude);
// // that.$refs.selectLocationPop.open(res.longitude, res.latitude, that.$config.apiKey);
// },
// fail: function(err) {
// console.log('获取失败');
// uni.hideLoading();
// },
// });
that.$refs.selectLocationPop.open(that.longitude, that.latitude, that.$config.apiKey);
},
async getTreeDept() {
let resData = await getDeptAllTree()
if (resData.data.code === 200) {
@@ -801,4 +841,10 @@
/deep/.wageunitLeft .u-form-item__body {
padding: 0;
}
.addressinfo {
width: 100%;
height: fit-content;
min-height: 21px;
}
</style>