Swanky 2 years ago
parent 2ba180b254
commit cbd4203357
  1. 22
      common/helper.js
  2. 23
      pages/index/index.vue
  3. 15
      pages/sjgl/sjgl.vue

@ -13,7 +13,8 @@ import {
getLength
} from 'ol/sphere.js';
import {
LineString
LineString,
Point
} from "ol/geom";
@ -50,7 +51,8 @@ const formatLength = function(line) {
const generateStyle = (feature, {
fillOpt,
strokeOpt
strokeOpt,
withNode
}) => {
let area = 0;
const geom = feature.getGeometry();
@ -59,7 +61,7 @@ const generateStyle = (feature, {
area = formatArea(geom);
const lineString = new LineString(geom.getCoordinates()[0]);
const length = formatLength(lineString);
lineStyle = new Style({
lineStyle = [new Style({
geometry: lineString,
text: new TextStyle({
text: length,
@ -79,7 +81,17 @@ const generateStyle = (feature, {
"overflow": true,
"rotation": 0
})
})
}), ...(withNode ? geom.getCoordinates()[0]?.map(coordinates => {
return new Style({
geometry: new Point(coordinates),
image: new CircleStyle({
fill: new Fill({
color: '#0ff'
}),
radius: 2
})
})
}) : [])]
}
return [new Style({
fill: new Fill({
@ -103,7 +115,7 @@ const generateStyle = (feature, {
"overflow": true,
"rotation": 0
})
}), lineStyle].filter(item => item);
}), ...(lineStyle || [])].filter(item => item);
}
const startMeasure = (map, callback) => {

@ -3,9 +3,9 @@
<view id="map" class="map" :prop="mapData" :change:prop="mapModule.updateMapData"></view>
<!-- <image-button @click="location" className="location" imgSrc="/static/dw.png"></image-button> -->
<view class="south">
<view class="south" :style="'transform:rotate('+compassNum.toString()+'deg)'">
<image src="/static/south.png" class="south-img" />
<text class="south-text"></text>
<text class="south-text" style="transform:rotate(180deg)"></text>
</view>
<view class="right-actions">
<view class="btn-tcdj right-btn" @click="showLayerModal">
@ -147,7 +147,8 @@
token: '',
measureStatus: '',
currentClickLayerItem: null,
xzgjPoints: []
xzgjPoints: [],
compassNum: 0
}
},
watch: {
@ -193,6 +194,18 @@
xzgjPoints: this.xzgjPoints
}
})
this.compassHandler = res => {
console.log(res)
this.compassNum = res.direction;
}
uni.onCompassChange(this.compassHandler);
},
onShow() {
uni.startCompass()
},
onHide() {
uni.stopCompass();
},
methods: {
checkLayer(value) {
@ -591,7 +604,8 @@
strokeOpt: {
color: '#ffcc33',
width: 2,
}
},
withNode: true
})
feature.setStyle(style);
vectorLayer.getSource().addFeature(feature)
@ -843,6 +857,7 @@
z-index: 1;
font-weight: bold;
font-size: 17px;
margin-top: 8px;
}
.btn-workbench {

@ -2,7 +2,7 @@
<view class="sjgl">
<view style="padding: 0 5px;border-bottom: 1px solid #ddd;">
<uni-search-bar v-if="searchVisible" bg-color="#fff" placeholder="请输入上报内容进行搜索" :focus="true"
@cancel="searchVisible=false" @confirm="search" v-model="searchValue"></uni-search-bar>
@cancel="searchCancel" @confirm="search" v-model="searchValue"></uni-search-bar>
</view>
<view v-for="item in datas">
<uni-card style="padding: 0;">
@ -63,6 +63,12 @@
this.searchVisible = true
},
methods: {
searchCancel() {
this.searchVisible = false;
this.searchValue = ''
this.datas = [];
this.requestData();
},
search(value) {
this.pageNum = 1;
this.datas = []
@ -145,7 +151,14 @@
} else {
this.loadStatus = 'more'
}
} else {
this.datas = [];
this.loadStatus = 'no-more'
}
},
fail: err => {
this.datas = [];
this.loadStatus = 'no-more'
}
})
}

Loading…
Cancel
Save