From 1e71dd86f6d0c4fc7e5143600d4bc4b50992a2a7 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Thu, 04 Jul 2024 14:51:28 +0800
Subject: [PATCH] fix: 高德密钥修改
---
pages/actionChange/newPage/index.vue | 174 +++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 148 insertions(+), 26 deletions(-)
diff --git a/pages/actionChange/newPage/index.vue b/pages/actionChange/newPage/index.vue
index 5198746..1f53fb0 100644
--- a/pages/actionChange/newPage/index.vue
+++ b/pages/actionChange/newPage/index.vue
@@ -10,7 +10,18 @@
@confirm="checkTime" @cancel='showeEscalationTime=false' />
</u-form-item>
<u-form-item border-bottom label="������������:" prop="pollutePosition" required>
- <u-input v-model="form.pollutePosition" border="none" placeholder="���������" type="text" />
+ <view style="display: flex;align-items: center;">
+ <u--textarea v-model="form.pollutePosition" border="none" placeholder="���������"
+ autoHeight></u--textarea>
+ <view style="width: 60px;">
+ <u-button @tap="authVerification()" text="������������" type="success" size="mini"></u-button>
+ </view>
+ </view>
+ <!-- <u-input v-model="form.pollutePosition" border="none" placeholder="���������" type="text">
+ <template slot="suffix">
+ <u-button @tap="authVerification()" text="������������" type="success" size="mini"></u-button>
+ </template>
+ </u-input> -->
</u-form-item>
<u-form-item border-bottom label="������������:" prop="unitId" required @click="
showCheckBox = true;
@@ -54,12 +65,10 @@
</u-radio-group>
</u-form-item>
<u-form-item border-bottom label="������������:" prop="keyPoint">
- <u-checkbox-group v-model="form.keyPoint" placement='column' style="font-size: 13px;"
- @change='changeKeyPoint'>
- <u-checkbox :key="index" v-for="(item, index) in emphasisEnumlist"
- :customStyle="{marginTop: '10px'}" shape="circle" :label="item.name" :name="item.value"
- :disabled="item.disabled"></u-checkbox>
- </u-checkbox-group>
+ <u-radio-group v-model="form.keyPoint" style="font-size: 13px;" placement='column'>
+ <u-radio :key="index" v-for="(item, index) in Dic.emphasisEnum" :customStyle="{marginTop: '10px'}"
+ :label="item.name" :name="item.value" />
+ </u-radio-group>
</u-form-item>
<u-form-item border-bottom label="������������:" prop="problemDescribe" required>
<u--textarea v-model="form.problemDescribe" border="none" placeholder="���������������" />
@@ -86,6 +95,7 @@
</template>
<script>
import fileUpload from '../components/fileUpload.vue'
+ import amap from '../../../libs/amap-wx.js'
export default {
components: {
fileUpload
@@ -97,6 +107,7 @@
labelStyle: {
fontSize: '30.77rpx'
},
+ addressInfor: {},
showeEscalationTime: false,
actionOptionList: [],
rules: {
@@ -155,7 +166,7 @@
escalationTime: '',
problemDescribe: '',
pollutePosition: '',
- keyPoint: []
+ keyPoint: 0
},
sumbitForm: {
unitId: '',
@@ -172,12 +183,18 @@
unitList: [],
polluteList: [],
fileBaseList: [],
- emphasisEnumlist: []
+ key: '00801eb7a8b1d415c94860ccbb765610',
+ amapPlugin: null,
}
},
onReady() {
//onReady ���uni-app���������������������������
this.$refs.uForm.setRules(this.rules)
+ },
+ onLoad() {
+ this.amapPlugin = new amap.AMapWX({
+ key: this.key //���key ���������������������������������������key
+ })
},
onShow() {
uni.hideTabBar()
@@ -193,22 +210,90 @@
return false
},
methods: {
- changeKeyPoint(name) {
- if (name.length > 0) {
- this.sumbitForm.keyPoint = name[0]
- this.emphasisEnumlist.forEach(item => {
- if (item.value === name[0]) {
- item.disabled = false
+ authVerification() {
+ uni.getSetting({
+ success: res => {
+ if (res.authSetting['scope.userLocation']) {
+ /* ������������������������������ */
+ this.handerLocation()
+ } else if (res.authSetting['scope.userLocation'] === undefined) {
+ /* ��������������������������� */
+ console.log('������������', res)
+ this.handleOpenSetting()
} else {
- item.disabled = true
+ /* ��������������������������������� */
+ console.log('��������������� false')
+ this.handleOpenSetting()
+ }
+ },
+ })
+ },
+ handerChooseLocation(latitude, longitude) {
+ uni.chooseLocation({
+ latitude: latitude || '',
+ longitude: longitude || '',
+ success: res => {
+ console.log('������������', res)
+ this.addressInfor = res
+ this.form.pollutePosition = `${res.name } ��� ${res.address}`
+ },
+ fail: function(err) {
+ console.log('������������', err)
+ }
+ })
+ },
+ handerLocation() {
+ let that = this
+ if (this.addressInfor.latitude === '') {
+ uni.getLocation({
+ type: 'gcj02',
+ isHighAccuracy: true, //���������������������
+ success: function(res) {
+ console.log('111', res)
+ that.handerChooseLocation(res.latitude, res.longitude)
+ },
+ fail(error) {
+ console.log('������', error)
}
})
} else {
- this.emphasisEnumlist.forEach(item => {
- item.disabled = false
- })
+ that.handerChooseLocation(this.addressInfor.latitude, this.addressInfor.longitude)
}
- console.log(this.emphasisEnumlist)
+ },
+ handleOpenSetting() {
+ let that = this
+ uni.authorize({
+ scope: 'scope.userLocation',
+ success() {
+ console.log('res', '1111')
+ //���������������--��������������������������������������� ���������������������������������
+ that.handerLocation()
+ },
+ fail(error) {
+ //������������������������--������������������������������������--������������������������������������������������
+ console.log('������������', error)
+ uni.showModal({
+ title: '������',
+ content: '������������������������������������������������',
+ cancelText: '���������',
+ confirmText: '������',
+ success(res) {
+ console.log(res)
+ if (res.confirm) {
+ // ���������������������
+ uni.openSetting({
+ success(res) {
+ that.handerLocation()
+ }
+ })
+ } else if (res.cancel) {
+ // ��������������� ���������
+ console.log('���������������������')
+ }
+ }
+ })
+ }
+ })
},
handleFile(data) {
console.log('datadata', data)
@@ -258,21 +343,29 @@
this.sumbitForm.escalationTime = data
},
submit() {
+ console.log('this.sumbitForm', this.form)
this.$refs.uForm.validate().then(res => {
this.sumbitForm.problemDescribe = this.form.problemDescribe
this.sumbitForm.pollutePosition = this.form.pollutePosition
+ this.sumbitForm.address = this.addressInfor.name
+ this.sumbitForm.latitude = this.addressInfor.latitude
+ this.sumbitForm.longitude = this.addressInfor.longitude
+ this.sumbitForm.name = this.addressInfor.name
this.sumbitForm.changeDay = this.form.changeDay
this.sumbitForm.escalationName = this.form.escalationName
this.sumbitForm.investigationType = this.form.investigationType
this.sumbitForm.fileBaseList = this.fileBaseList
this.sumbitForm.changeType = this.form.changeType
+ this.sumbitForm.keyPoint = this.form.keyPoint
this.sumbitForm.state = '20'
- console.log('this.sumbitForm', this.sumbitForm)
this.$http.httpPost('/allocation/insert', {
...this.sumbitForm
}).then(res => {
uni.$u.toast('������������')
this.close()
+ }).catch(errors => {
+ uni.$u.toast(errors.split(',')[0])
+ console.log(errors)
})
}).catch(errors => {
uni.$u.toast('������������')
@@ -295,12 +388,40 @@
this.sumbitForm.unitId = userInfor.unitId
this.form.escalationUnitId = data
this.sumbitForm.escalationUnitId = userInfor.unitId
+ } else {
+ if (this.unitList.length > 0) {
+ this.form.unitId = this.unitList[0].unitName
+ this.sumbitForm.unitId = this.unitList[0].unitId
+ this.form.escalationUnitId = this.unitList[0].unitName
+ this.sumbitForm.escalationUnitId = this.unitList[0].unitId
+ }
}
this.form.escalationName = userInfor.userName || ''
this.sumbitForm.escalationName = userInfor.userName || ''
this.form.investigationType = 1
this.sumbitForm.investigationType = 1
- console.log('this.sumbitForm', this.sumbitForm)
+ let that = this
+ uni.getLocation({
+ type: 'gcj02',
+ isHighAccuracy: true, //���������������������
+ success: function(res) {
+ that.amapPlugin.getRegeo({
+ type: 'gcj02',
+ location: '' + res.longitude + ',' + res.latitude + '',
+ success: function(e) {
+ console.log(e)
+ that.addressInfor.address = `${ e[0].desc } ��� ${e[0].name}`
+ that.addressInfor.latitude = e[0].latitude
+ that.addressInfor.longitude = e[0].longitude
+ that.addressInfor.name = e[0].desc
+ that.form.pollutePosition = `${ e[0].desc } ��� ${e[0].name}`
+ },
+ fail: res => {
+ console.log(JSON.stringify(res))
+ }
+ })
+ }
+ })
},
// ������������������list
getUnitList() {
@@ -309,10 +430,6 @@
this.Dic = JSON.parse(uni.getStorageSync('dict') || '[]')
this.changeEnum = this.Dic.changeEnum
this.changeEnum = this.Dic.changeEnum
- this.emphasisEnumlist = this.Dic.emphasisEnum.map(item => {
- item.disabled = false
- return item
- })
this.setDefaultValue()
})
},
@@ -346,6 +463,11 @@
padding-left: 10px;
}
+ /deep/.u-textarea {
+ padding: 0 !important;
+ width: calc(100%-70px);
+ }
+
// /deep/.u-form-item__body {
// padding: 8px 0px !important;
// font-size: 15px !important;
--
Gitblit v1.8.0