|
@@ -59,29 +59,15 @@
|
|
|
<up-button size="small" type="primary" text="前往人脸识别" @click="startFace"></up-button>
|
|
|
</up-form-item>
|
|
|
|
|
|
- <!-- <up-form-item v-if="item.type === 'city'" :label="item.label" :prop="item.key" borderBottom
|
|
|
- labelWidth="94" :required="item.required">
|
|
|
- <view @click.self="() => openCity(item)">
|
|
|
- <up-input v-model="formData[item.key]" disabled disabledColor="#ffffff" placeholder="省、市、区等地区信息"
|
|
|
- border="none"></up-input>
|
|
|
- </view>
|
|
|
- <template #right>
|
|
|
- <up-icon name="map" size="22" @click="onCityWx(item)"></up-icon>
|
|
|
- </template>
|
|
|
- </up-form-item> -->
|
|
|
-
|
|
|
<up-form-item v-if="item.type === 'city'" :label="item.label" :prop="item.key" borderBottom
|
|
|
labelWidth="94" :required="item.required">
|
|
|
- <pickerAddress
|
|
|
- @change="(info)=>addressChange(info,item)"
|
|
|
- :selectValue="[ formData.provinceInd, formData.cityInd, formData.districtInd ]"
|
|
|
- >
|
|
|
+ <pickerAddress @change="(info) => addressChange(info, item)"
|
|
|
+ :selectValue="[formData.provinceInd, formData.cityInd, formData.districtInd]">
|
|
|
<view class="inp"
|
|
|
- :class="formData.provinceName&&formData.cityName&&formData.districtName?'':'address-inp'"
|
|
|
- >
|
|
|
- {{formData.provinceName ? formData.provinceName:'省'}} /
|
|
|
- {{formData.cityName ? formData.cityName:'市'}} /
|
|
|
- {{formData.districtName ? formData.districtName:'区'}}
|
|
|
+ :class="formData.provinceName && formData.cityName && formData.districtName ? '' : 'address-inp'">
|
|
|
+ {{ formData.provinceName ? formData.provinceName : '省' }} /
|
|
|
+ {{ formData.cityName ? formData.cityName : '市' }} /
|
|
|
+ {{ formData.districtName ? formData.districtName : '区' }}
|
|
|
</view>
|
|
|
</pickerAddress>
|
|
|
<template #right>
|
|
@@ -101,7 +87,6 @@
|
|
|
</up-form-item>
|
|
|
</view>
|
|
|
</up-form>
|
|
|
- <!-- <up-button type="primary" text="提交" customStyle="margin-top: 50px" @click="onSubmit"></up-button> -->
|
|
|
|
|
|
<up-action-sheet :show="showSex" :actions="actions.option" :title="'请选择' + actions.label"
|
|
|
@close="showSex = false" @select="ActionSheetSelect">
|
|
@@ -126,8 +111,8 @@ import {
|
|
|
onShow,
|
|
|
onUnload
|
|
|
} from "@dcloudio/uni-app";
|
|
|
-import { splitAddress,getCityCode } from '@/utils/adress'
|
|
|
-import {regionAddresstree} from '@/api/home.js'
|
|
|
+import { splitAddress, getCityCode } from '@/utils/adress'
|
|
|
+import { regionAddresstree } from '@/api/home.js'
|
|
|
|
|
|
import pickerAddress from '../pickerAddress/pickerAddress.vue'
|
|
|
|
|
@@ -146,16 +131,16 @@ const formData = reactive({
|
|
|
city: null,
|
|
|
|
|
|
provinceName: '', // 省
|
|
|
- provinceCode: '',
|
|
|
- provinceInd: 21,
|
|
|
+ provinceCode: '',
|
|
|
+ provinceInd: 21,
|
|
|
|
|
|
- cityName: '', // 市
|
|
|
- cityCode: '',
|
|
|
- cityInd: 0,
|
|
|
+ cityName: '', // 市
|
|
|
+ cityCode: '',
|
|
|
+ cityInd: 0,
|
|
|
|
|
|
- districtName: '',
|
|
|
- districtCode: '',
|
|
|
- districtInd: 17,
|
|
|
+ districtName: '',
|
|
|
+ districtCode: '',
|
|
|
+ districtInd: 17,
|
|
|
|
|
|
// address: "永川区",
|
|
|
// age: "1",
|
|
@@ -330,62 +315,62 @@ function clickPick(row) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-function addressChange(info,row) {
|
|
|
- actions.value = row
|
|
|
- console.log(info, '>>>>data');
|
|
|
-
|
|
|
- if (!info || !info.data) {
|
|
|
- console.error('Invalid address change info:', info);
|
|
|
- return;
|
|
|
- }
|
|
|
+function addressChange(info, row) {
|
|
|
+ actions.value = row
|
|
|
+ console.log(info, '>>>>data');
|
|
|
|
|
|
- if (!Array.isArray(info.data) || info.data.length < 3) {
|
|
|
- console.error('Invalid address data:', info.data);
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (!info || !info.data) {
|
|
|
+ console.error('Invalid address change info:', info);
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- const code = Array.isArray(info.code) ? info.code : ['', '', ''];
|
|
|
+ if (!Array.isArray(info.data) || info.data.length < 3) {
|
|
|
+ console.error('Invalid address data:', info.data);
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- let indexArray;
|
|
|
- if (Array.isArray(info.index)) {
|
|
|
- indexArray = info.index;
|
|
|
- } else if (info.index && typeof info.index[Symbol.iterator] === 'function') {
|
|
|
- indexArray = Array.from(info.index);
|
|
|
- } else {
|
|
|
- indexArray = [0, 0, 0];
|
|
|
- }
|
|
|
+ const code = Array.isArray(info.code) ? info.code : ['', '', ''];
|
|
|
|
|
|
-
|
|
|
- Object.assign(formData, {
|
|
|
- provinceName: info.data[0],
|
|
|
- provinceCode: info.code[0],
|
|
|
- provinceInd:indexArray[0] || 0,
|
|
|
- cityName: info.data[1],
|
|
|
- cityCode:info.code[1],
|
|
|
- cityInd:indexArray[1] || 0,
|
|
|
- districtName: info.data[2],
|
|
|
- districtCode:info.code[2],
|
|
|
- districtInd:indexArray[2] || 0
|
|
|
- })
|
|
|
- console.log('formData===>',formData);
|
|
|
-
|
|
|
+ let indexArray;
|
|
|
+ if (Array.isArray(info.index)) {
|
|
|
+ indexArray = info.index;
|
|
|
+ } else if (info.index && typeof info.index[Symbol.iterator] === 'function') {
|
|
|
+ indexArray = Array.from(info.index);
|
|
|
+ } else {
|
|
|
+ indexArray = [0, 0, 0];
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ Object.assign(formData, {
|
|
|
+ provinceName: info.data[0],
|
|
|
+ provinceCode: info.code[0],
|
|
|
+ provinceInd: indexArray[0] || 0,
|
|
|
+ cityName: info.data[1],
|
|
|
+ cityCode: info.code[1],
|
|
|
+ cityInd: indexArray[1] || 0,
|
|
|
+ districtName: info.data[2],
|
|
|
+ districtCode: info.code[2],
|
|
|
+ districtInd: indexArray[2] || 0
|
|
|
+ })
|
|
|
+ console.log('formData===>', formData);
|
|
|
+
|
|
|
+}
|
|
|
function onCityWx(row) {
|
|
|
- console.log('地区选点',row);
|
|
|
+ console.log('地区选点', row);
|
|
|
wx.chooseLocation({
|
|
|
- success:async function (res) {
|
|
|
- console.log('res.address',res.address);
|
|
|
-
|
|
|
+ success: async function (res) {
|
|
|
+ console.log('res.address', res.address);
|
|
|
+
|
|
|
const result = splitAddress(res.address);
|
|
|
- console.log("TCL: onCityWx -> result", result)
|
|
|
+ console.log("TCL: onCityWx -> result", result)
|
|
|
const res_dara = await regionAddresstree();
|
|
|
- const handlecityData = getCityCode([result.province,result.city,result.district].join(' '),res_dara.data)
|
|
|
- console.log("TCL: onCityWx -> handlecityData", handlecityData)
|
|
|
- addressChange(handlecityData,row)
|
|
|
+ const handlecityData = getCityCode([result.province, result.city, result.district].join(' '), res_dara.data)
|
|
|
+ console.log("TCL: onCityWx -> handlecityData", handlecityData)
|
|
|
+ addressChange(handlecityData, row)
|
|
|
|
|
|
- Object.assign(formData, {
|
|
|
+ Object.assign(formData, {
|
|
|
// [row.key]: `${result.province}${result.city}${result.district}`,
|
|
|
- address:result.detail
|
|
|
+ address: result.detail
|
|
|
})
|
|
|
|
|
|
// Object.assign(cityData, {
|
|
@@ -407,7 +392,7 @@ function onCityWx(row) {
|
|
|
|
|
|
// address:result.detail
|
|
|
// })
|
|
|
-
|
|
|
+
|
|
|
// Object.assign(formData, {
|
|
|
// [row.key]: `${result.province}${result.city}${result.district}`,
|
|
|
// address:result.detail
|
|
@@ -416,15 +401,15 @@ function onCityWx(row) {
|
|
|
fail: function (err) {
|
|
|
console.log(err);
|
|
|
uni.showToast({
|
|
|
- title:'获取地址失败',
|
|
|
- icon: 'error',
|
|
|
- });
|
|
|
+ title: '获取地址失败',
|
|
|
+ icon: 'error',
|
|
|
+ });
|
|
|
},
|
|
|
})
|
|
|
}
|
|
|
|
|
|
onShow(() => {
|
|
|
-
|
|
|
+
|
|
|
})
|
|
|
onUnload(() => {
|
|
|
|