提交小程序

This commit is contained in:
wangyilin 2024-11-01 17:10:58 +08:00
parent 93136c7295
commit c230692bda
4 changed files with 25 additions and 14 deletions

View File

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 KiB

View File

@ -55,8 +55,9 @@
v-model:visible="visible"
v-model="TreeValue"
title="选择地址"
:options="TreeData"
@change="change"
lazy
:lazy-load="lazyLoad"
text-key="label"
></nut-cascader>
<nut-popup v-model:visible="show" position="bottom">
@ -95,18 +96,28 @@ const formData = ref<RegisterParams>({
});
const show = ref(false)
const visible = ref(false)
const TreeValue = ref<Record<string, any>[]>([])
const TreeData = ref(['']);
// const TreeData = ref([]);
const streetCommunitySmallCommunityLabel = ref<string>("");
const getAdministrativeDivisionTree = async () => {
const resp = await api.get<TreeNodeVo<string>[]>('/common/administrativeDivisionTree')
TreeData.value = resp.data as any
console.log(resp.data)
const getAdministrativeDivisionTree = async (value:string) => {
const resp = await api.get<TreeNodeVo<string>[]>('/common/administrativeDivisionByParentCode',{parentCode:value})
return resp.data as any
}
const change = (value: string, pathNodes: Record<string, any>[]) => {
const change = async (value: string, pathNodes: Record<string, any>[]) => {
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()