提交小程序

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:visible="visible"
v-model="TreeValue" v-model="TreeValue"
title="选择地址" title="选择地址"
:options="TreeData"
@change="change" @change="change"
lazy
:lazy-load="lazyLoad"
text-key="label" text-key="label"
></nut-cascader> ></nut-cascader>
<nut-popup v-model:visible="show" position="bottom"> <nut-popup v-model:visible="show" position="bottom">
@ -95,18 +96,28 @@ const formData = ref<RegisterParams>({
}); });
const show = ref(false) const show = ref(false)
const visible = ref(false) const visible = ref(false)
const TreeValue = ref<Record<string, any>[]>([]) const TreeValue = ref<Record<string, any>[]>([])
const TreeData = ref(['']); // const TreeData = ref([]);
const streetCommunitySmallCommunityLabel = ref<string>(""); const streetCommunitySmallCommunityLabel = ref<string>("");
const getAdministrativeDivisionTree = async () => { const getAdministrativeDivisionTree = async (value:string) => {
const resp = await api.get<TreeNodeVo<string>[]>('/common/administrativeDivisionTree') const resp = await api.get<TreeNodeVo<string>[]>('/common/administrativeDivisionByParentCode',{parentCode:value})
TreeData.value = resp.data as any return resp.data as any
console.log(resp.data)
} }
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(","); streetCommunitySmallCommunityLabel.value = pathNodes.map((e) => e.text).join(",");
TreeValue.value = value as any 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 columns = ref([])
const unitsList = async () => { const unitsList = async () => {
if (streetCommunitySmallCommunityLabel.value !== '') { if (streetCommunitySmallCommunityLabel.value !== '') {
@ -126,7 +137,7 @@ const unitsList = async () => {
const selectedLabel = ref('') const selectedLabel = ref('')
const confirm = ({selectedOptions, selectedValue}) => { const confirm = ({selectedOptions}) => {
Object.keys(selectedOptions).forEach((e) => { Object.keys(selectedOptions).forEach((e) => {
selectedLabel.value = selectedOptions[e].label selectedLabel.value = selectedOptions[e].label
formData.value.unitId = selectedOptions[e].value 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 = '' formData.value.unitId = ''
selectedLabel.value = '' selectedLabel.value = ''
}) })
@ -165,7 +176,7 @@ const register = async () => {
await Taro.setStorage({ await Taro.setStorage({
key: "token", key: "token",
data: resp.data, data: resp.data,
success(res) { success() {
Taro.navigateTo({ Taro.navigateTo({
url: '/pages/login/login' url: '/pages/login/login'
}) })
@ -209,10 +220,10 @@ const onChooseAvatar = (e) => {
formData.value.avatar = avatarUrl formData.value.avatar = avatarUrl
} }
// //
const getNickname = (e) => { // const getNickname = (e) => {
formData.value.name = e.detail.value // formData.value.name = e.detail.value
console.log(formData.value.name) // console.log(formData.value.name)
} // }
onMounted(async () => { onMounted(async () => {
await getAdministrativeDivisionTree() await getAdministrativeDivisionTree()