diff --git a/App.vue b/App.vue
index de698f1..461c838 100644
--- a/App.vue
+++ b/App.vue
@@ -5,73 +5,6 @@
map: null
},
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() {},
onHide: function() {
diff --git a/common/helper.js b/common/helper.js
index c4881d9..a559339 100644
--- a/common/helper.js
+++ b/common/helper.js
@@ -115,5 +115,6 @@ export default {
geoserverUrl,
globalMap,
mgServerUrl,
- startMeasure
+ startMeasure,
+ tempToken: ''
}
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
index 71d1a1d..c638956 100644
--- a/manifest.json
+++ b/manifest.json
@@ -11,8 +11,8 @@
"nvueCompiler" : "uni-app",
"nvueStyleCompiler" : "uni-app",
"splashscreen" : {
- "alwaysShowBeforeRender" : false,
- "waiting" : false,
+ "alwaysShowBeforeRender" : true,
+ "waiting" : true,
"autoclose" : false,
"delay" : 0
},
diff --git a/pages.json b/pages.json
index f7a4356..d1221fe 100644
--- a/pages.json
+++ b/pages.json
@@ -1,5 +1,11 @@
{
"pages": [{
+ "path": "pages/blank/blank",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ }, {
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
diff --git a/pages/blank/blank.vue b/pages/blank/blank.vue
new file mode 100644
index 0000000..1881f45
--- /dev/null
+++ b/pages/blank/blank.vue
@@ -0,0 +1,87 @@
+
+
+ 1
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 41779b1..66e2bd1 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -143,7 +143,8 @@
currentGroupTab: null,
token: '',
measureStatus: '',
- currentClickLayerItem: null
+ currentClickLayerItem: null,
+ xzgjPoints: []
}
},
watch: {
@@ -165,10 +166,19 @@
}
},
onLoad() {
- uni.getStorage({
- key: 'token',
- success: (token) => {
- this.token = token.data;
+ this.token = helper.tempToken;
+ uni.onLocationChange(res => {
+ if (!this.xzgjPoints.find(point => {
+ 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') {
this.measureStatus = ''
this.mapData = {}
+ uni.stopLocationUpdate();
} else {
this.measureStatus = 'xzgj';
+ this.xzgjPoints = []
+ uni.startLocationUpdate({
+ type: 'gcj02'
+ })
this.mapData = {
xzgj: true
}
@@ -205,6 +220,7 @@
this.mapData = {
mjcl: true
}
+ uni.stopLocationUpdate();
}
},
showFfzy(id) {
@@ -550,6 +566,44 @@
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() {
@@ -582,7 +636,7 @@
map = new Map({
controls: [],
target: 'map',
- layers: [tdt],
+ layers: [tdt],
view: new View({
projection: 'EPSG:4326',
center: [102.45438, 32.53223],
diff --git a/pages/login/login.vue b/pages/login/login.vue
index a44d1a5..6c2f81f 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -63,6 +63,7 @@
title: '登录失败'
})
} else {
+ helper.tempToken = resp.data.data.token;
uni.showToast({
icon: 'success',
title: '登录成功'
diff --git a/pages/lssjgl/lssjgl.vue b/pages/lssjgl/lssjgl.vue
index c449845..e88cee4 100644
--- a/pages/lssjgl/lssjgl.vue
+++ b/pages/lssjgl/lssjgl.vue
@@ -3,7 +3,7 @@
-
+
@@ -43,14 +43,7 @@
}
},
onLoad() {
- uni.getStorage({
- key: 'token',
- success: (resp) => {
- this.token = resp.data;
- },
- fail(err) {},
- complete: () => {}
- });
+ this.token = helper.tempToken;
uni.getNetworkType({
success: (res) => {
diff --git a/pages/sjgl/sjgl.vue b/pages/sjgl/sjgl.vue
index 192aa03..499fa85 100644
--- a/pages/sjgl/sjgl.vue
+++ b/pages/sjgl/sjgl.vue
@@ -55,16 +55,9 @@
onLoad() {},
onShow(e) {
console.log('onshow', e)
- uni.getStorage({
- key: 'token',
- success: (token) => {
- this.token = token.data;
- this.datas = [];
- this.requestData(this.pageNum);
- },
- fail(err) {},
- complete: () => {}
- })
+ this.token = helper.tempToken;
+ this.datas = [];
+ this.requestData(this.pageNum);
},
onNavigationBarButtonTap(e) {
this.searchVisible = true
diff --git a/pages/sjsb/sjsb.vue b/pages/sjsb/sjsb.vue
index 7c779b5..96c57e9 100644
--- a/pages/sjsb/sjsb.vue
+++ b/pages/sjsb/sjsb.vue
@@ -82,53 +82,47 @@
} else {
this.submitText = '上报'
}
+ this.token = helper.tempToken;
uni.getNetworkType({
success: (res) => {
console.log(res.networkType);
this.networkType = res.networkType;
- uni.getStorage({
- key: 'token',
- success: (token) => {
- this.token = token.data;
- if (!e.id) {
- this.locationLoading = true
- if (res.networkType !== 'none') {
- uni.getLocation({
- type: 'gcj02',
- success: (res) => {
- this.jd = res.longitude;
- this.wd = res.latitude;
- this.locationLoading = false
- },
- fail: (error) => {
- 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: '定位失败'
- })
- });
+ if (!e.id) {
+ this.locationLoading = true
+ if (res.networkType !== 'none') {
+ uni.getLocation({
+ type: 'gcj02',
+ success: (res) => {
+ this.jd = res.longitude;
+ this.wd = res.latitude;
+ this.locationLoading = false
+ },
+ fail: (error) => {
+ this.locationLoading = false
+ uni.showModal({
+ content: JSON.stringify(error),
+ title: '定位失败'
+ })
}
- } else {
- this.id = e.id
- this.requestItem(e.id);
- }
- },
- fail(err) {},
- complete: () => {}
- })
+ });
+ } 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
+ this.requestItem(e.id);
+ }
+
}
});
@@ -158,7 +152,7 @@
const str = item.geom?.replace('POINT (', '').replace(')', '');
console.log(str)
const strs = str.split(' ');
- this.jd = parseFloat(strs[0]);
+ this.jd = parseFloat(strs[0]);
this.wd = parseFloat(strs[1]);
this.reason = item.reason;
this.imgStrs = item.img?.split(',');
diff --git a/pages/wdxx/wdxx.vue b/pages/wdxx/wdxx.vue
index 8eafdba..e5f3e1a 100644
--- a/pages/wdxx/wdxx.vue
+++ b/pages/wdxx/wdxx.vue
@@ -35,16 +35,9 @@
}
},
onShow(e) {
- uni.getStorage({
- key: 'token',
- success: (token) => {
- this.token = token.data;
- this.datas = [];
- this.requestData();
- },
- fail(err) {},
- complete: () => {}
- })
+ this.token = helper.tempToken;
+ this.datas = [];
+ this.requestData();
},
methods: {
readAll() {