diff --git a/collect_information/src/assets/02.png b/collect_information/src/assets/02.png new file mode 100644 index 0000000..e69de29 diff --git a/collect_information/src/assets/03.png b/collect_information/src/assets/03.png new file mode 100644 index 0000000..e69de29 diff --git a/collect_information/src/assets/images/01.png b/collect_information/src/assets/images/01.png deleted file mode 100644 index b66fa47..0000000 Binary files a/collect_information/src/assets/images/01.png and /dev/null differ diff --git a/collect_information/src/pages/register/register.vue b/collect_information/src/pages/register/register.vue index 0368d69..269da3c 100644 --- a/collect_information/src/pages/register/register.vue +++ b/collect_information/src/pages/register/register.vue @@ -55,8 +55,9 @@ v-model:visible="visible" v-model="TreeValue" title="选择地址" - :options="TreeData" @change="change" + lazy + :lazy-load="lazyLoad" text-key="label" > @@ -95,18 +96,28 @@ const formData = ref({ }); const show = ref(false) const visible = ref(false) + const TreeValue = ref[]>([]) -const TreeData = ref(['']); +// const TreeData = ref([]); + const streetCommunitySmallCommunityLabel = ref(""); -const getAdministrativeDivisionTree = async () => { - const resp = await api.get[]>('/common/administrativeDivisionTree') - TreeData.value = resp.data as any - console.log(resp.data) +const getAdministrativeDivisionTree = async (value:string) => { + const resp = await api.get[]>('/common/administrativeDivisionByParentCode',{parentCode:value}) + return resp.data as any } -const change = (value: string, pathNodes: Record[]) => { + + +const change = async (value: string, pathNodes: Record[]) => { streetCommunitySmallCommunityLabel.value = pathNodes.map((e) => e.text).join(","); TreeValue.value = value as any } +const lazyLoad = async (node:any, resolve:any)=>{ + if (node.root) { + await resolve(getAdministrativeDivisionTree ('0')) + } else { + await resolve(getAdministrativeDivisionTree (node.value)) + } +} const columns = ref([]) const unitsList = async () => { if (streetCommunitySmallCommunityLabel.value !== '') { @@ -126,7 +137,7 @@ const unitsList = async () => { const selectedLabel = ref('') -const confirm = ({selectedOptions, selectedValue}) => { +const confirm = ({selectedOptions}) => { Object.keys(selectedOptions).forEach((e) => { selectedLabel.value = selectedOptions[e].label formData.value.unitId = selectedOptions[e].value @@ -136,7 +147,7 @@ const confirm = ({selectedOptions, selectedValue}) => { } // 身份 -watch(() => formData.value.identity, (value) => { +watch(() => formData.value.identity, () => { formData.value.unitId = '' selectedLabel.value = '' }) @@ -165,7 +176,7 @@ const register = async () => { await Taro.setStorage({ key: "token", data: resp.data, - success(res) { + success() { Taro.navigateTo({ url: '/pages/login/login' }) @@ -209,10 +220,10 @@ const onChooseAvatar = (e) => { formData.value.avatar = avatarUrl } // 获取昵称 -const getNickname = (e) => { - formData.value.name = e.detail.value - console.log(formData.value.name) -} +// const getNickname = (e) => { +// formData.value.name = e.detail.value +// console.log(formData.value.name) +// } onMounted(async () => { await getAdministrativeDivisionTree()