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. 64
      pages/index/index.vue
  7. 1
      pages/login/login.vue
  8. 9
      pages/lssjgl/lssjgl.vue
  9. 13
      pages/sjgl/sjgl.vue
  10. 78
      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() {

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

@ -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);
}
} }
}); });

@ -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