You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
1.9 KiB
89 lines
1.9 KiB
|
2 years ago
|
<template>
|
||
|
|
<view class="container">
|
||
|
|
<uni-section title="GIS定位" type="line">
|
||
|
|
<uni-forms ref="form" :modelValue="form" :rules="rules" class="padding-wrap">
|
||
|
|
<uni-forms-item label="经度:" name="longidute" required>
|
||
|
|
<uni-easyinput v-model="form.longidute" />
|
||
|
|
</uni-forms-item>
|
||
|
|
<uni-forms-item label="维度:" name="latidute" required>
|
||
|
|
<uni-easyinput v-model="form.latidute" />
|
||
|
|
</uni-forms-item>
|
||
|
|
<uni-forms-item label="msg:">
|
||
|
|
<uni-easyinput type="textarea" v-model="form.msg" />
|
||
|
|
</uni-forms-item>
|
||
|
|
<view style="display: flex;">
|
||
|
|
<button @click="GetGisPostion">获取位置</button>
|
||
|
|
<button type="primary" @click="UpLoadGisInfo">上报位置</button>
|
||
|
|
</view>
|
||
|
|
</uni-forms>
|
||
|
|
</uni-section>
|
||
|
|
</view>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
import {
|
||
|
|
client,
|
||
|
|
isRegisted
|
||
|
|
} from "@/util/dispatch.js";
|
||
|
|
export default {
|
||
|
|
data() {
|
||
|
|
return {
|
||
|
|
form: {
|
||
|
|
longidute: '',
|
||
|
|
latidute: '',
|
||
|
|
msg: ''
|
||
|
|
},
|
||
|
|
rules: {
|
||
|
|
longidute: {
|
||
|
|
rules: [{
|
||
|
|
required: true,
|
||
|
|
errorMessage: "请输入上报经度"
|
||
|
|
}]
|
||
|
|
},
|
||
|
|
latidute: {
|
||
|
|
rules: [{
|
||
|
|
required: true,
|
||
|
|
errorMessage: "请输入上报维度"
|
||
|
|
}]
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onLoad() {
|
||
|
|
let test = isRegisted();
|
||
|
|
uni.showModal({
|
||
|
|
content:test?'1':'0'
|
||
|
|
})
|
||
|
|
// #ifdef APP-PLUS
|
||
|
|
// #endif
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
//获取位置
|
||
|
|
GetGisPostion(number) {
|
||
|
|
client.getGisPosition(number).then((result) => {
|
||
|
|
mylog("getGisPosition : " + JSON.stringify(result));
|
||
|
|
})
|
||
|
|
},
|
||
|
|
//上传位置
|
||
|
|
UpLoadGisInfo() {
|
||
|
|
this.$refs.form.validate().then(res => {
|
||
|
|
client.uploadGisInfo(this.longidute, this.latidute, this.msg);
|
||
|
|
}).catch(err => {
|
||
|
|
uni.showToast({title:err});
|
||
|
|
})
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<style>
|
||
|
|
page,
|
||
|
|
.container {
|
||
|
|
min-height: 100%;
|
||
|
|
background-color: #FFFFFF;
|
||
|
|
}
|
||
|
|
|
||
|
|
.padding-wrap {
|
||
|
|
padding: 0 20upx;
|
||
|
|
}
|
||
|
|
</style>
|