12618 编辑页面 判空提示语不正确

main
liujun 2023-12-14 16:44:35 +08:00
parent 1b237cca8a
commit dda1e5fa98
5 changed files with 145 additions and 1 deletions

File diff suppressed because one or more lines are too long

59
hybrid/html/newMap.html Normal file
View File

@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<script src="http://api.tianditu.gov.cn/api?v=4.0&tk=e8a16137fd226a62a23cc7ba5c9c78ce" type="text/javascript">
</script>
<script src="./js/uni.webview.1.5.4.js"></script>
<body onLoad="onLoad()">
<div id="mapDiv" style="position:absolute;width:100vw; height:100vh"></div>
</body>
<style>
* {
margin: 0;
padding: 0;
}
</style>
<script>
var map;
var zoom = 14;
function getUrlParam(name) {
const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
const r = window.location.search.substr(1).match(reg);
if (r != null) return decodeURI(r[2]);
return "";
}
function onLoad() {
var imageURL = "http://t0.tianditu.gov.cn/img_w/wmts?" +
"SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles" +
"&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=e8a16137fd226a62a23cc7ba5c9c78ce";
lay = new T.TileLayer(imageURL, {minZoom: 1, maxZoom: 18});
var config = {layers: [lay]};
map = new T.Map("mapDiv", config);
map.centerAndZoom(new T.LngLat(getUrlParam('longitude'), getUrlParam('latitude')), zoom);
map.enableScrollWheelZoom();
addMapClick()
}
function addMapClick() {
map.addEventListener("click", MapClick);
}
function MapClick(event) {
var marker = new T.Marker(new T.LngLat(event.lnglat.getLng(), event.lnglat.getLat()));
map.clearOverLays();
map.addOverLay(marker);
console.log(event.lnglat.getLng(), event.lnglat.getLat());
uni.postMessage({
data: {
"longitue": event.lnglat.getLng(),
"latitude": event.lnglat.getLat(),
}
})
}
</script>
</html>

View File

@ -469,6 +469,12 @@
"navigationBarTitleText": "地图"
}
},
{
"path" : "pages/map/mapPro",
"style" : {
"navigationBarTitleText": "地图"
}
},
{
"path": "pages/information/index/index",
"style": {

78
pages/map/mapPro.vue Normal file
View File

@ -0,0 +1,78 @@
<template>
<view>
<cu-custom bgColor="bg-gradual-blueness" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">位置定位</block>
</cu-custom>
<web-view id="webview" :src="url" @message="messageChange"></web-view>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
url: '',
longitude: '',
latitude: ''
}
},
onLoad(option) {
this.longitude = 119.67751
this.latitude = 39.92596
this.init();
const eventChannel = this.$scope.eventChannel; // APP-NVUE
// acceptDataFromOpenerPageeventChannel
eventChannel.on('acceptDataFromOpenerPage', function (data) {
console.log(data)
})
},
onBackPress(options) {
return false;
},
onUnload() {
},
onShow() {
},
methods: {
goBack() {
uni.navigateBack()
},
saveData() {
},
init() {
this.url = ('/hybrid/html/newMap.html?longitude='+this.longitude+'&latitude='+this.latitude+ 't=' + new Date().getTime());
console.log(this.url);
},
messageChange(e) {
console.log("messageChange");
console.log(e);
uni.setStorageSync("info", e.detail.data[0]);
const eventChannel = this.$scope.eventChannel; // APP-NVUE
console.log(eventChannel)
eventChannel.emit('acceptDataFromOpenedPage', {data: e.detail.data[0]});
uni.navigateBack();
}
}
}
</script>
<style scoped>
page,
uni-page-body,
.container {
background: rgba(245, 245, 245, 1);
min-height: calc(100%);
}
</style>

View File

@ -903,7 +903,7 @@ export default {
showMapModal() {
let _this = this
uni.navigateTo({
url: '/pages/map/map',
url: '/pages/map/mapPro',
events: {
acceptDataFromOpenedPage: function (e) {
_this.hiddenForm.LONGITUDE = e.data.longitue;