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
},
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() {

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

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

@ -1,5 +1,11 @@
{
"pages": [{
"path": "pages/blank/blank",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}, {
"path": "pages/index/index",
"style": {
"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,
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],

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

@ -3,7 +3,7 @@
<uni-notice-bar color="#2979FF" background-color="#EAF2FF" text="在无网络环境时上报的数据将存储在此处,进入到有网络的环境时进行统一上报。" />
<uni-notice-bar v-if="networkType==='none'" text="当前无法连接网络,无法进行数据上报。 " />
<view v-for="(item,i) in datas">
<uni-card style="padding: 0;">
<view style="padding: 10px;">
@ -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) => {

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

@ -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(',');

@ -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() {

Loading…
Cancel
Save