3 Commits
Author SHA1 Message Date
ilhamtahir 08d03cfbe0 feat: 完成宠物列表接口对接 2024-12-31 20:26:05 +08:00
ilhamtahir e46919a938 fix: carousal 2024-12-25 17:14:39 +08:00
ilhamtahir e286106b11 fix: 修改文章描述样式 2024-12-25 16:27:49 +08:00
7 changed files with 48 additions and 23 deletions

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
import type { CreatePetRequest, Pet } from '@/model/pet'
import httpClient from '@/api/httpClient'
export function createPet(createPetRequest: CreatePetRequest) {
return httpClient.post('/pets', createPetRequest)
}
export function getOwnPets() {
return httpClient.get<Pet[]>('/pets/own')
}
+1 -1
View File
@@ -10,7 +10,7 @@ export interface BaseModel {
updateTime: string updateTime: string
} }
export interface AuditBaseModel extends BaseModel { export interface TraceableModel extends BaseModel {
createBy: User createBy: User
updateBy: User updateBy: User
} }
+19
View File
@@ -0,0 +1,19 @@
import type { TraceableModel } from '@/model/base'
export interface Pet extends TraceableModel {
birthday: string
bodyType: string
gender: number
isActive: boolean
isLactation: boolean
isPregnant: boolean
isSterilization: boolean
name: string
photo: string
type: string
weight: number
}
export interface CreatePetRequest extends Omit<Pet, keyof TraceableModel> {
}
+2 -2
View File
@@ -1,6 +1,6 @@
import type { AuditBaseModel, BaseFilterRequest } from '@/model/base' import type { BaseFilterRequest, TraceableModel } from '@/model/base'
export interface User extends AuditBaseModel { export interface User extends TraceableModel {
username: string username: string
locked: boolean locked: boolean
enabled: boolean enabled: boolean
+14 -18
View File
@@ -1,10 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import avator from '@/static/image/pet-parameters/avator.png' import type { Pet } from '@/model/pet'
import { getOwnPets } from '@/api/pet'
import avatar from '@/static/image/pet-parameters/avator.png'
import addBtn from '@/static/image/pet-plan/add_btn.png' import addBtn from '@/static/image/pet-plan/add_btn.png'
import card from '@/static/image/pet-plan/card.png' import card from '@/static/image/pet-plan/card.png'
import editBtn from '@/static/image/pet-plan/edit.png' import editBtn from '@/static/image/pet-plan/edit.png'
import userAddBtn from '@/static/image/pet-plan/user_add_btn.png' import userAddBtn from '@/static/image/pet-plan/user_add_btn.png'
import ToolApi from '@/utils'
interface User { interface User {
name: string name: string
@@ -13,19 +14,14 @@ interface User {
isClick: boolean isClick: boolean
plan: { image: string, name: string, weight: string, energy: string, label: string[] }[] plan: { image: string, name: string, weight: string, energy: string, label: string[] }[]
} }
const safeHeight = ToolApi.getSafeHeight()
// 用户存在情况 const pets = ref<Pet[]>([])
// const userList = ref<User[]>([ async function fetchPets() {
// { name: '子龙', image: avator, label: ['1岁', '孟加拉豹猫', '8kg'], plan: [ pets.value = await getOwnPets()
// { image: miniGoods, name: 'MINI主食包', weight: '500', energy: '1200kcal', label: ['湿粮', '呵护肠胃'] }, }
// { image: nutritionGoods, name: '营养加焙烘焙粮', weight: '500', energy: '1200kcal', label: ['湿粮', '呵护肠胃'] },
// ], isClick: true }, onMounted(fetchPets)
// { name: '广坤', image: avator, label: ['12岁', '孟加拉豹猫', '8kg'], plan: [
// { image: miniGoods, name: 'MINI主食包', weight: '600', energy: '1300kcal', label: ['湿粮', '呵护肠胃'] },
// { image: nutritionGoods, name: '营养加焙烘焙粮', weight: '1000', energy: '1300kcal', label: ['湿粮', '呵护肠胃'] },
// ], isClick: false },
// ])
// 用户不存在情况
const userList = ref<User[]>([]) const userList = ref<User[]>([])
const clickUser = computed(() => { const clickUser = computed(() => {
return userList.value.filter(user => user.isClick === true) return userList.value.filter(user => user.isClick === true)
@@ -46,9 +42,9 @@ function handleEdit() {
</script> </script>
<template> <template>
<view class="flex flex-col bg-[#F5F6F7] overflow-y-auto" :style="`height:calc(100vh - ${safeHeight}px)`"> <view class="flex flex-col bg-[#F5F6F7] overflow-y-auto h-screen">
<!-- 喂养计划未注册 --> <!-- 喂养计划未注册 -->
<view v-if="userList.length === 0" class="w-[calc(100% - 32px)] min-h-[135px] rounded-lg m-[16px] relative"> <view v-if="pets.length === 0" class="w-[calc(100% - 32px)] min-h-[135px] rounded-lg m-[16px] relative">
<image :src="card" class="w-full h-full absolute z-20" /> <image :src="card" class="w-full h-full absolute z-20" />
<view class="z-20 absolute w-full mt-[35px] flex flex-col"> <view class="z-20 absolute w-full mt-[35px] flex flex-col">
<image :src="addBtn" class="w-[47px] h-[47px] mx-auto" @click="handleAdd" /> <image :src="addBtn" class="w-[47px] h-[47px] mx-auto" @click="handleAdd" />
@@ -75,7 +71,7 @@ function handleEdit() {
</view> </view>
<view v-for="(item, index) in clickUser" :key="index" class="w-[calc(100% - 32px)] min-h-[129px] rounded-lg m-[16px] relative bg-[white] p-[16px] flex items-center"> <view v-for="(item, index) in clickUser" :key="index" class="w-[calc(100% - 32px)] min-h-[129px] rounded-lg m-[16px] relative bg-[white] p-[16px] flex items-center">
<image :src="avator" class="w-[64px] h-[64px] rounded-full" /> <image :src="avatar" class="w-[64px] h-[64px] rounded-full" />
<view class="ml-[16px] min-h-[54px] flex-1"> <view class="ml-[16px] min-h-[54px] flex-1">
<text class="font-600"> <text class="font-600">
{{ item.name }} {{ item.name }}
+1 -1
View File
@@ -46,7 +46,7 @@ function handleLoadMore() {
<view class="text-[14px]"> <view class="text-[14px]">
{{ item.title }} {{ item.title }}
</view> </view>
<view class="mt-2 flex-1 text-[11px] text-[#999] whitespace-pre-line"> <view class="mt-2 flex-1 text-[11px] leading-3 text-[#999] whitespace-pre-line line-clamp-3 w-full overflow-hidden">
{{ item.description }} {{ item.description }}
</view> </view>
<view class="mt-3 text-[10px] text-[#D8D8D8]"> <view class="mt-3 text-[10px] text-[#D8D8D8]">
+1 -1
View File
@@ -198,7 +198,7 @@ init()
<swiper class="swiper-box" @change="change"> <swiper class="swiper-box" @change="change">
<swiper-item v-for="(item, index) in info" :key="index"> <swiper-item v-for="(item, index) in info" :key="index">
<view class="swiper-item w-full h-full flex items-center justify-center"> <view class="swiper-item w-full h-full flex items-center justify-center">
<image :src="item.imageUrl" mode="heightFix" class="w-full h-full" @tap="handleJumpUrl(item)" /> <image :src="item.imageUrl" mode="widthFix" @tap="handleJumpUrl(item)" />
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>