1 line
6.4 KiB
Plaintext
1 line
6.4 KiB
Plaintext
{"version":3,"file":"pet-detail-page.js","sources":["../../../../../src/pages/pet/pet-detail-page.vue","../../../../../uniPage:/cGFnZXMvcGV0L3BldC1kZXRhaWwtcGFnZS52dWU"],"sourcesContent":["<route lang=\"json5\">\n{\n style: {\n navigationBarTitleText: '宠物详情',\n navigationStyle: 'custom',\n },\n}\n</route>\n\n<template>\n <TopBar />\n <image\n :src=\"imgUrl('@/static/push/bg.png')\"\n class=\"object-cover absolute top-[-80px] left-0 w-full z-[-1]\"\n mode=\"widthFix\"\n ></image>\n <view class=\"w-full h-40\"></view>\n <view class=\"w-full bg-[#ffff]\">\n <!-- 顶部背景和头像 -->\n <view class=\"relative\">\n <view class=\"absolute left-4 bottom-[-20px] z-10\">\n <image\n :src=\"petInfo.profileUrl ? imgUrl(petInfo.profileUrl) : imgUrl('@/static/icons/cat.png')\"\n class=\"w-20 h-20 object-cover rounded-full border-4 border-white\"\n ></image>\n </view>\n <!-- 圆角遮罩 -->\n <view\n class=\"absolute bottom-[-5px] left-0 w-full h-6 bg-white rounded-tl-xl rounded-tr-xl z-0\"\n ></view>\n </view>\n\n <!-- 数据统计 -->\n <view class=\"flex justify-around bg-white pt-4 rounded-lg\">\n <view class=\"text-center\">\n <text class=\"text-lg\">0</text>\n <text class=\"block text-gray-600\">粉丝</text>\n </view>\n <view class=\"text-center\">\n <text class=\"text-lg\">0</text>\n <text class=\"block text-gray-600\">关注度</text>\n </view>\n <view class=\"text-center\">\n <text class=\"text-lg\">0</text>\n <text class=\"block text-gray-600\">获得赞</text>\n </view>\n </view>\n\n <view class=\"pl-4 pr-4\">\n <!-- 宠物信息 -->\n <view class=\"bg-white p-4 rounded-lg\">\n <text class=\"text-xl\">{{ petInfo.name || 'cat' }}</text>\n <view class=\"flex items-center mt-2\">\n <wd-icon name=\"calendar\" size=\"20\" class=\"text-[#ffc107]\"></wd-icon>\n <text class=\"ml-2 text-gray-600\">\n 距离生日还有{{ daysUntilBirthday(petInfo.age) }}天哦\n </text>\n </view>\n </view>\n\n <!-- 操作按钮 -->\n <view class=\"flex justify-between py-4\">\n <button\n @click=\"editPet(petInfo.id)\"\n class=\"bg-[#F0985A] text-white rounded-lg py-2 px-6 h-9 flex-grow-[8] flex items-center justify-center\"\n >\n 修改信息\n </button>\n <button\n @click=\"share\"\n class=\"bg-[#ffc107] text-white rounded-lg py-2 px-6 h-9 flex-grow-[2] flex items-center justify-center ml-4\"\n >\n 分享\n </button>\n </view>\n\n <!-- 标签栏 -->\n <view class=\"flex justify-around bg-white py-2 rounded-lg\">\n <view\n v-for=\"tab in tabs\"\n :key=\"tab\"\n :class=\"[\n 'text-lg px-4',\n activeTab === tab\n ? 'text-[#ffc107] relative border-b-2 border-[#ffc107]'\n : 'text-gray-600',\n ]\"\n @click=\"activeTab = tab\"\n >\n {{ tab }}\n <view v-if=\"activeTab === tab\" class=\"active-underline\"></view>\n </view>\n </view>\n\n <!-- 内容提示 -->\n <EmptyState type=\"default\" message=\"暂无内容\" />\n </view>\n </view>\n</template>\n\n<script setup>\nimport EmptyState from '@/components/EmptyState.vue'\nimport TopBar from '@/components/TopBar.vue'\nimport { imgUrl, toast, toPath } from '@/utils/commUtils'\nimport { httpGet } from '@/utils/http'\nimport { ref } from 'vue'\n\nconst tabs = ref(['全部', '心情', '养护', '清洁'])\nconst activeTab = ref('全部')\nconst petInfo = ref({})\n\nconst getPetId = async (id) => {\n try {\n const res = await httpGet('/petInfo/find_by_id/' + id)\n if (res.code === 200) {\n petInfo.value = res.data\n console.log(petInfo.value)\n } else {\n toast(res.data.message)\n }\n } catch (e) {\n console.log(e)\n }\n}\n\nconst editPet = (id) => {\n toPath('/pages/pet/pet-add-page?id=' + id)\n}\n\nconst share = () => {}\n\nconst daysUntilBirthday = (birthDateStr) => {\n // 将出生日期转换为日期对象\n const birthDate = new Date(birthDateStr)\n const today = new Date()\n\n // 将出生年份替换为当前年份\n const nextBirthday = new Date(today.getFullYear(), birthDate.getMonth(), birthDate.getDate())\n\n // 如果今年的生日已经过了,则计算明年的生日\n if (nextBirthday < today) {\n nextBirthday.setFullYear(today.getFullYear() + 1)\n }\n\n // 计算天数差\n const oneDay = 24 * 60 * 60 * 1000 // 一天的毫秒数\n const daysLeft = Math.ceil((nextBirthday - today) / oneDay)\n\n return daysLeft\n}\n\nonLoad(async (options) => {\n if (options.id) {\n await getPetId(options.id)\n }\n})\n</script>\n\n<style scoped>\n/* 使用 UnoCSS 定义样式 */\n.view {\n @apply bg-[#F5F5F5] h-full;\n}\n\n.image {\n @apply w-full h-40 object-cover;\n}\n\n.button {\n @apply bg-[#ffc107] text-white rounded-lg py-2 px-6 h-12;\n}\n\n.text-gray-600 {\n @apply text-gray-600;\n}\n\n.text-gray-400 {\n @apply text-gray-400;\n}\n\n.border-b-2 {\n border-bottom-width: 2px;\n}\n\n.active-underline {\n @apply w-6 h-[0.20rem] bg-yellow-400 mt-1 absolute bottom-[-2px] left-[1.45rem] transform;\n}\n</style>\n","import MiniProgramPage from 'D:/App/Work/addr/acdr-ui/src/pages/pet/pet-detail-page.vue'\nwx.createPage(MiniProgramPage)"],"names":["ref","httpGet","toast","toPath","onLoad"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOQ,MAAA,aAAA,MAAA;AAAA,MAAA,SAAA,MAAA;;;;AAAA,UAAA,OAAAA,cAAA,IAAA,CAAA,MAAA,MAAA,MAAA,IAAA,CAAA;AAAA,UAAA,YAAAA,cAAA,IAAA,IAAA;AAAA,UAAA,UAAAA,cAAA,IAAA,EAAA;AAAA,UAAA,WAAA,CAAA,OAAA;AAAA,UAAA;AAAA,cAAA,MAAA,MAAAC,mBAAA,yBAAA,EAAA;AAAA,YAAA,IAAA,SAAA,KAAA;AAAA,kBAAA,QAAA,IAAA;AAAA,kBAAA,IAAA,QAAA,KAAA;AAAA,QAAA,OAAA;AAAAC,gCAAA,IAAA,KAAA,OAAA;AAAA,QAAA;AAAA,MAAA,SAAA,GAAA;AA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