From 5832b77acc225c03dd5a01941d7c9bb8179b2a90 Mon Sep 17 00:00:00 2001 From: longjieli <11918793+longjieli@user.noreply.gitee.com> Date: Thu, 3 Apr 2025 09:05:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../userManage/pet/components/petBaseInfo.vue | 14 +- .../userManage/pet/components/petHealthInfo.vue | 228 ++++++++++----------- otherPages/userManage/pet/index.vue | 33 +-- otherPages/userManage/pet/petInfo.vue | 18 +- 4 files changed, 133 insertions(+), 160 deletions(-) diff --git a/otherPages/userManage/pet/components/petBaseInfo.vue b/otherPages/userManage/pet/components/petBaseInfo.vue index 6c37116..74e22d7 100644 --- a/otherPages/userManage/pet/components/petBaseInfo.vue +++ b/otherPages/userManage/pet/components/petBaseInfo.vue @@ -10,7 +10,7 @@ placeholderStyle="text-align:right;color:#AAA" border="none" inputAlign="right"> - @@ -101,7 +101,8 @@ import { ref, onMounted, - watch + watch, + computed } from 'vue'; // 定义 props @@ -147,6 +148,14 @@ const tempDisposition = ref(''); const uForm = ref(null); const item1 = ref(null); + + const sexText = computed(() => { + const sexMap = { + 0: '男生', + 1: '女生' + }; + return sexMap[props.petBaseInfo.sex] || ''; + }); // 定义方法 const nameChange = () => { @@ -228,7 +237,6 @@ }; const checkboxChange = (n) => { - console.log('change', n); updatePetBaseInfo(); }; diff --git a/otherPages/userManage/pet/components/petHealthInfo.vue b/otherPages/userManage/pet/components/petHealthInfo.vue index 7118b5e..e9af5bb 100644 --- a/otherPages/userManage/pet/components/petHealthInfo.vue +++ b/otherPages/userManage/pet/components/petHealthInfo.vue @@ -1,69 +1,54 @@ + .personal-pet-health-info { + background-color: #fff; + padding: 10px 20px 0 20px; + margin-top: 10px; + } + + .health-select { + background-color: #fffcf2; + padding: 10px 20px; + } + + .dog-tips { + color: #A94F20; + font-size: 12px; + display: flex; + align-items: baseline; + margin-top: 5px; + } + \ No newline at end of file diff --git a/otherPages/userManage/pet/index.vue b/otherPages/userManage/pet/index.vue index ed0a150..1603b48 100644 --- a/otherPages/userManage/pet/index.vue +++ b/otherPages/userManage/pet/index.vue @@ -66,8 +66,8 @@ - + { petType.value = e.value[0]; - }; - - const confirm = (e) => { show.value = false; if (petType.value === '猫咪') { uni.navigateTo({ @@ -161,30 +158,9 @@ url: "/otherPages/userManage/pet/petInfo?petType=1&optionType=add" }) } - // if (!petType.value) { - // if (e.value[0] === '猫咪') { - // router.push({ - // path: `/pages/personalCenter/petInfo`, - // query: { - // petType: 'cat', - // optionType: 'add' - // } - // }); - // } - // if (e.value[0] === '狗狗') { - // router.push({ - // path: `/pages/personalCenter/petInfo`, - // query: { - // petType: 'dog', - // optionType: 'add' - // } - // }); - // } - // } }; const editPet = (item) => { - console.log(item) if (item.petType === '猫咪' || item.petType === 0) { uni.navigateTo({ url: `/otherPages/userManage/pet/petInfo?petType=0&optionType=edit&petId=${item.id}` @@ -205,8 +181,9 @@ const confirmDel = async () => { try { - await delByPetId({ id : deleteId.value }); - console.log('删除成功'); + await delByPetId({ + id: deleteId.value + }); getPetList(); } catch (error) { console.error('删除宠物失败', error); diff --git a/otherPages/userManage/pet/petInfo.vue b/otherPages/userManage/pet/petInfo.vue index f4ef39f..f713b55 100644 --- a/otherPages/userManage/pet/petInfo.vue +++ b/otherPages/userManage/pet/petInfo.vue @@ -19,7 +19,7 @@ - + 取消 @@ -84,7 +84,7 @@ vaccine: '', deworm: '', neutered: '', - doglicenseStatus: '', + petCard: '', health: '', remark: '' }); @@ -152,7 +152,9 @@ }; const getPetDetailsFunc = (petId) => { - getPetDetails({ id : petId }).then((res) => { + getPetDetails({ + id: petId + }).then((res) => { if (res.code == 200) { const { headImage, @@ -165,7 +167,7 @@ vaccine, deworm, neutered, - doglicenseStatus, + petCard, health, remark } = res.data; @@ -177,12 +179,11 @@ birthday, personality }; - petHealthInfo.value = { vaccine, deworm, neutered, - doglicenseStatus, + petCard, health, remark }; @@ -217,7 +218,6 @@ ...petBaseInfo.value, ...petHealthInfo.value }; - if (!params.nickName) { uni.showToast({ title: '请填写宠物昵称!', @@ -250,7 +250,7 @@ }); return; } - if (!params.vaccine) { + if (!(params.vaccine >= 0)) { uni.showToast({ title: '请选择宠物疫苗情况!', duration: 3000, @@ -258,7 +258,7 @@ }); return; } - if (!params.deworm) { + if (!(params.deworm >= 0)) { uni.showToast({ title: '请选择宠物驱虫情况!', duration: 3000,