Swanky 2 years ago
parent 8360161723
commit 52e68c8c92
  1. 67
      App.vue
  2. 3
      common/helper.js
  3. 4
      manifest.json
  4. 6
      pages.json
  5. 87
      pages/blank/blank.vue
  6. 66
      pages/index/index.vue
  7. 1
      pages/login/login.vue
  8. 11
      pages/lssjgl/lssjgl.vue
  9. 13
      pages/sjgl/sjgl.vue
  10. 80
      pages/sjsb/sjsb.vue
  11. 13
      pages/wdxx/wdxx.vue

@ -5,73 +5,6 @@
map: null map: null
}, },
onLaunch: function() { onLaunch: function() {
/* #ifndef H5 */
const getInfo = (token) => {
uni.request({
url: `${helper.serverUrl}/user/getInfo`,
header: {
Authorization: `Bearer ${token}`
},
success(resp) {
console.log('success', resp);
if (resp?.data?.code !== 200) {
uni.reLaunch({
url: '/pages/login/login',
success() {
plus.navigator.closeSplashscreen();
},
fail(err) {
console.log('reLaunch', err);
}
})
} else {
uni.reLaunch({
url: '/pages/index/index',
success() {
plus.navigator.closeSplashscreen();
},
fail(err) {
console.log('reLaunch', err);
}
})
}
},
fail(err) {
console.log('error', err);
if (token) {
uni.reLaunch({
url: '/pages/index/index',
success() {
plus.navigator.closeSplashscreen();
},
fail(err) {
console.log('reLaunch', err);
}
})
} else {
uni.reLaunch({
url: '/pages/login/login',
success() {
plus.navigator.closeSplashscreen();
}
})
}
}
})
}
uni.getStorage({
key: 'token',
success(token) {
console.log('token', token)
getInfo(token.data)
},
fail(err) {
console.log('err', err)
getInfo()
}
})
/* #endif */
}, },
onShow: function() {}, onShow: function() {},
onHide: function() { onHide: function() {

@ -115,5 +115,6 @@ export default {
geoserverUrl, geoserverUrl,
globalMap, globalMap,
mgServerUrl, mgServerUrl,
startMeasure startMeasure,
tempToken: ''
} }

@ -11,8 +11,8 @@
"nvueCompiler" : "uni-app", "nvueCompiler" : "uni-app",
"nvueStyleCompiler" : "uni-app", "nvueStyleCompiler" : "uni-app",
"splashscreen" : { "splashscreen" : {
"alwaysShowBeforeRender" : false, "alwaysShowBeforeRender" : true,
"waiting" : false, "waiting" : true,
"autoclose" : false, "autoclose" : false,
"delay" : 0 "delay" : 0
}, },

@ -1,5 +1,11 @@
{ {
"pages": [{ "pages": [{
"path": "pages/blank/blank",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}, {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
"navigationBarTitleText": "首页", "navigationBarTitleText": "首页",

@ -0,0 +1,87 @@
<template>
<view>
1
</view>
</template>
<script>
import helper from 'common/helper.js'
export default {
onLaunch: function() {},
onShow: function() {
/* #ifndef H5 */
const getInfo = (token) => {
uni.request({
url: `${helper.serverUrl}/user/getInfo`,
header: {
Authorization: `Bearer ${token}`
},
success(resp) {
console.log('success', resp);
if (resp?.data?.code !== 200) {
uni.reLaunch({
url: '/pages/login/login',
success() {
// plus.navigator.closeSplashscreen();
},
fail(err) {
console.log('reLaunch', err);
}
})
} else {
uni.reLaunch({
url: '/pages/index/index',
success() {
// plus.navigator.closeSplashscreen();
},
fail(err) {
console.log('reLaunch', err);
}
})
}
},
fail(err) {
console.log('error', err);
if (token) {
uni.reLaunch({
url: '/pages/index/index',
success() {
// plus.navigator.closeSplashscreen();
},
fail(err) {
console.log('reLaunch', err);
}
})
} else {
uni.reLaunch({
url: '/pages/login/login',
success() {
// plus.navigator.closeSplashscreen();
}
})
}
}
})
}
uni.getStorage({
key: 'token',
success(token) {
if (token) {
helper.tempToken = token.data;
}
getInfo(token.data)
},
fail(err) {
console.log('err', err)
getInfo()
}
})
/* #endif */
},
onHide: function() {}
}
</script>
<style>
</style>

@ -143,7 +143,8 @@
currentGroupTab: null, currentGroupTab: null,
token: '', token: '',
measureStatus: '', measureStatus: '',
currentClickLayerItem: null currentClickLayerItem: null,
xzgjPoints: []
} }
}, },
watch: { watch: {
@ -165,10 +166,19 @@
} }
}, },
onLoad() { onLoad() {
uni.getStorage({ this.token = helper.tempToken;
key: 'token', uni.onLocationChange(res => {
success: (token) => { if (!this.xzgjPoints.find(point => {
this.token = token.data; return point[0] === res.longitude && point[1] === res
.latitude;
})) {
this.xzgjPoints.push([res.longitude, res.latitude]);
}
console.log(this.xzgjPoints)
if (this.xzgjPoints.length >= 3) {
this.mapData = {
xzgjPoints: this.xzgjPoints
}
} }
}) })
}, },
@ -189,8 +199,13 @@
if (this.measureStatus === 'xzgj') { if (this.measureStatus === 'xzgj') {
this.measureStatus = '' this.measureStatus = ''
this.mapData = {} this.mapData = {}
uni.stopLocationUpdate();
} else { } else {
this.measureStatus = 'xzgj'; this.measureStatus = 'xzgj';
this.xzgjPoints = []
uni.startLocationUpdate({
type: 'gcj02'
})
this.mapData = { this.mapData = {
xzgj: true xzgj: true
} }
@ -205,6 +220,7 @@
this.mapData = { this.mapData = {
mjcl: true mjcl: true
} }
uni.stopLocationUpdate();
} }
}, },
showFfzy(id) { showFfzy(id) {
@ -550,6 +566,44 @@
this.ownerInstance?.callMethod('closeMeasureStatus', false) this.ownerInstance?.callMethod('closeMeasureStatus', false)
}) })
} }
if (newValue.xzgjPoints) {
this.clear();
const polygon = new Polygon([
[...newValue.xzgjPoints, newValue.xzgjPoints[0]]
]);
const feature = new Feature({
geometry: polygon
})
const area = helper.formatArea(polygon);
const style = new Style({
fill: new Fill({
color: 'rgba(255, 255, 255, 0.4)',
}),
stroke: new Stroke({
color: '#ffcc33',
width: 2,
}),
text: new TextStyle({
text: area,
"textBaseline": "middle",
"font": "bold 10px/1 Verdana",
"offsetX": 0,
"offsetY": 0,
fill: new Fill({
color: 'rgba(0, 0, 0, 0.9)',
}),
"placement": "point",
"maxAngle": 0.7853981633974483,
"overflow": true,
"rotation": 0
})
})
feature.setStyle(style);
vectorLayer.getSource().addFeature(feature)
const geom = polygon.clone().scale(0.5, 0.5);
map.getView().fit(geom)
}
} }
}, },
clear() { clear() {
@ -582,7 +636,7 @@
map = new Map({ map = new Map({
controls: [], controls: [],
target: 'map', target: 'map',
layers: [tdt], layers: [tdt],
view: new View({ view: new View({
projection: 'EPSG:4326', projection: 'EPSG:4326',
center: [102.45438, 32.53223], center: [102.45438, 32.53223],

@ -63,6 +63,7 @@
title: '登录失败' title: '登录失败'
}) })
} else { } else {
helper.tempToken = resp.data.data.token;
uni.showToast({ uni.showToast({
icon: 'success', icon: 'success',
title: '登录成功' title: '登录成功'

@ -3,7 +3,7 @@
<uni-notice-bar color="#2979FF" background-color="#EAF2FF" text="在无网络环境时上报的数据将存储在此处,进入到有网络的环境时进行统一上报。" /> <uni-notice-bar color="#2979FF" background-color="#EAF2FF" text="在无网络环境时上报的数据将存储在此处,进入到有网络的环境时进行统一上报。" />
<uni-notice-bar v-if="networkType==='none'" text="当前无法连接网络,无法进行数据上报。 " /> <uni-notice-bar v-if="networkType==='none'" text="当前无法连接网络,无法进行数据上报。 " />
<view v-for="(item,i) in datas"> <view v-for="(item,i) in datas">
<uni-card style="padding: 0;"> <uni-card style="padding: 0;">
<view style="padding: 10px;"> <view style="padding: 10px;">
@ -43,14 +43,7 @@
} }
}, },
onLoad() { onLoad() {
uni.getStorage({ this.token = helper.tempToken;
key: 'token',
success: (resp) => {
this.token = resp.data;
},
fail(err) {},
complete: () => {}
});
uni.getNetworkType({ uni.getNetworkType({
success: (res) => { success: (res) => {

@ -55,16 +55,9 @@
onLoad() {}, onLoad() {},
onShow(e) { onShow(e) {
console.log('onshow', e) console.log('onshow', e)
uni.getStorage({ this.token = helper.tempToken;
key: 'token', this.datas = [];
success: (token) => { this.requestData(this.pageNum);
this.token = token.data;
this.datas = [];
this.requestData(this.pageNum);
},
fail(err) {},
complete: () => {}
})
}, },
onNavigationBarButtonTap(e) { onNavigationBarButtonTap(e) {
this.searchVisible = true this.searchVisible = true

@ -82,53 +82,47 @@
} else { } else {
this.submitText = '上报' this.submitText = '上报'
} }
this.token = helper.tempToken;
uni.getNetworkType({ uni.getNetworkType({
success: (res) => { success: (res) => {
console.log(res.networkType); console.log(res.networkType);
this.networkType = res.networkType; this.networkType = res.networkType;
uni.getStorage({ if (!e.id) {
key: 'token', this.locationLoading = true
success: (token) => { if (res.networkType !== 'none') {
this.token = token.data; uni.getLocation({
if (!e.id) { type: 'gcj02',
this.locationLoading = true success: (res) => {
if (res.networkType !== 'none') { this.jd = res.longitude;
uni.getLocation({ this.wd = res.latitude;
type: 'gcj02', this.locationLoading = false
success: (res) => { },
this.jd = res.longitude; fail: (error) => {
this.wd = res.latitude; this.locationLoading = false
this.locationLoading = false uni.showModal({
}, content: JSON.stringify(error),
fail: (error) => { title: '定位失败'
this.locationLoading = false })
uni.showModal({
content: JSON.stringify(error),
title: '定位失败'
})
}
});
} else {
plus.geolocation.getCurrentPosition((res) => {
this.jd = res.coords.longitude;
this.wd = res.coords.latitude;
this.locationLoading = false
}, (error) => {
this.locationLoading = false
uni.showModal({
content: JSON.stringify(error),
title: '定位失败'
})
});
} }
} else { });
this.id = e.id } else {
this.requestItem(e.id); plus.geolocation.getCurrentPosition((res) => {
} this.jd = res.coords.longitude;
}, this.wd = res.coords.latitude;
fail(err) {}, this.locationLoading = false
complete: () => {} }, (error) => {
}) this.locationLoading = false
uni.showModal({
content: JSON.stringify(error),
title: '定位失败'
})
});
}
} else {
this.id = e.id
this.requestItem(e.id);
}
} }
}); });
@ -158,7 +152,7 @@
const str = item.geom?.replace('POINT (', '').replace(')', ''); const str = item.geom?.replace('POINT (', '').replace(')', '');
console.log(str) console.log(str)
const strs = str.split(' '); const strs = str.split(' ');
this.jd = parseFloat(strs[0]); this.jd = parseFloat(strs[0]);
this.wd = parseFloat(strs[1]); this.wd = parseFloat(strs[1]);
this.reason = item.reason; this.reason = item.reason;
this.imgStrs = item.img?.split(','); this.imgStrs = item.img?.split(',');

@ -35,16 +35,9 @@
} }
}, },
onShow(e) { onShow(e) {
uni.getStorage({ this.token = helper.tempToken;
key: 'token', this.datas = [];
success: (token) => { this.requestData();
this.token = token.data;
this.datas = [];
this.requestData();
},
fail(err) {},
complete: () => {}
})
}, },
methods: { methods: {
readAll() { readAll() {

Loading…
Cancel
Save