Author SHA1 Message Date
zlong 24814b7dee add:新增轮播图展示 2024-12-06 14:40:57 +08:00
3 changed files with 106 additions and 32 deletions

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
export interface CreateCarousalsRequest {
imageUrl: string
targetType: string
targetUrl?: string
targetId?: string
}
+76 -20
View File
@@ -26,39 +26,30 @@ const videoSrc = ref(
muted muted
:controls="false" :controls="false"
/> />
<view class="content absolute box-border top-0 left-0 w-full h-full p-[23px]"> <view class="content">
<image :src="left_top_logo" class="left-3 w-48 h-6" /> <image :src="left_top_logo" class="left-3 w-48 h-6" />
<view <view
class="content_text flex justify-between flex-col w-full h-full items-center " class="content_text flex justify-between flex-col my-8 w-full h-5/6 items-center"
>
<view
class="flex justify-center flex-col text-[29px] w-full items-center mt-[100px]
tracking-[5.45px] text-[#FFF] leading-[37px]"
> >
<view class="flex justify-center flex-col w-full items-center">
<view>为你的爱宠建档</view> <view>为你的爱宠建档</view>
<view>制定专业喂养方案</view> <view>制定专业喂养方案</view>
<view class="mt-[15px] text-[12px] text-center font-normal tracking-[1.45px] leading-[16px]"> <view class="conten_science">
科学喂养专业有爱 科学喂养专业有爱
</view> </view>
</view> </view>
<view class="flex justify-center flex-col w-full items-center h-full mt-[200px] text-[#FFF]"> <view class="flex justify-center flex-col w-full items-center">
<view <view class="content_botton">
class="content_botton flex w-[176px] h-[47px] justify-center <button type="primary" class="content_botton_text">
items-center bg-[#4545E5] rounded-[69px]"
>
<button
class=" text-[18px] font-normal
tracking-[.36px] leading-[37px] shrink-0" hover-class="bg-[#4545E5]"
>
开始建档 开始建档
</button> </button>
</view> </view>
<view class="content_details tracking-[1.8px] mt-[40px] text-[12px] font-normal "> <view class="content_details">
下拉了解详情 下拉了解详情
</view> </view>
<view class="content_img mt-[15px]"> <view class="content_img">
<image :src="Rectangle" class="w-[15px] h-2 shrink-0 stroke-[2px] fill-white stroke-white" /> <image :src="Rectangle" />
<image :src="Rectangle" class="w-[15px] h-2 shrink-0 stroke-[2px] fill-white stroke-white" /> <image :src="Rectangle" />
</view> </view>
</view> </view>
</view> </view>
@@ -84,4 +75,69 @@ const videoSrc = ref(
controlslist: none controlslist: none
aspect-ratio: 16 / 9 aspect-ratio: 16 / 9
object-fit: cover object-fit: cover
.content
position: absolute
box-sizing: border-box
top: 0
left: 0
width: 100%
height: 100%
padding: 23px
&_text
color: var(--Color, #fff)
text-align: center
font-family: "Source Han Sans CN"
font-size: 29px
font-style: normal
font-weight: 500
line-height: 37px /* 127.586% */
letter-spacing: 1.45px
.conten_science
color: var(--Color, #fff)
text-align: center
font-family: "Source Han Sans CN"
font-size: 12px
font-style: normal
font-weight: 400
line-height: 16px /* 133.333% */
letter-spacing: 0.6px
.content_botton
display: inline
padding: 5px 51px
justify-content: center
align-items: center
&_text
display: block
width: 176px
border-radius: 69px
background: #4545e5 /* 按钮 */
box-shadow: 0px 4px 12px 0px rgba(69, 69, 229, 0.3)
color: var(--Color, #fff)
text-align: center
font-family: "PingFang SC"
font-size: 18px
font-style: normal
font-weight: 400
line-height: 37px /* 205.556% */
letter-spacing: 0.36px
.content_details
margin-top: 20px
color: var(--Color, #fff)
text-align: center
font-family: "Source Han Sans CN"
font-size: 12px
font-style: normal
font-weight: 400
line-height: 16px /* 133.333% */
letter-spacing: 1.8px
.content_img
width: 16px
height: 16px
& image
background: #4545e5
</style> </style>
+24 -12
View File
@@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import type { CreateCarousalsRequest } from '@/model/carousals'
import carousalApi from '@/api/carousal' import carousalApi from '@/api/carousal'
import CardList from '@/pages/pet-manual/components/CardList.vue' import CardList from '@/pages/pet-manual/components/CardList.vue'
// const searchValue = ref('') // const searchValue = ref('')
@@ -13,9 +14,9 @@ interface ListItem {
desc: string desc: string
time: string time: string
} }
interface Item { // interface Item {
content: string // content: string
} // }
interface DotStyle { interface DotStyle {
backgroundColor: string backgroundColor: string
selectedBackgroundColor: string selectedBackgroundColor: string
@@ -74,10 +75,13 @@ const listModel = ref<ListItem[]>([
const safeHeight = ToolApi.getSafeHeight() const safeHeight = ToolApi.getSafeHeight()
const searchValue = ref<string>('') const searchValue = ref<string>('')
const info = ref<Item[]>([ const info = ref<CreateCarousalsRequest[] | null>([
{ content: '内容 A' }, {
{ content: '内容 B' }, imageUrl: '',
{ content: '内容 C' }, targetId: '',
targetType: '',
targetUrl: '',
},
]) ])
const current = ref<number>(0) const current = ref<number>(0)
@@ -121,8 +125,16 @@ const findList = ref<{ name: string }[]>([
{ name: '宠物吃饭慢' }, { name: '宠物吃饭慢' },
{ name: '猫咪尿闭怎么办' }, { name: '猫咪尿闭怎么办' },
]) ])
function onLoad() { async function onLoad() {
carousalApi.getCarousalList() const getCarousalListApi = await carousalApi.getCarousalList()
info.value = getCarousalListApi
}
function handleJumpUrl(item: CreateCarousalsRequest) {
if (item.targetType === 'url') {
uni.navigateTo({
url: item.targetUrl,
})
}
} }
onLoad() onLoad()
</script> </script>
@@ -176,9 +188,9 @@ onLoad()
<view class="mx-4 mt-4"> <view class="mx-4 mt-4">
<uni-swiper-dot :info="info" :current="current" field="content" mode="dot" :dots-styles="dotStyle"> <uni-swiper-dot :info="info" :current="current" field="content" mode="dot" :dots-styles="dotStyle">
<swiper class="swiper-box" @change="change"> <swiper class="swiper-box" @change="change">
<swiper-item v-for="(item, index) in info" :key="index" style="background: rgba(0, 0, 0, 0.20)"> <swiper-item v-for="(item, index) in info" :key="index">
<view class="swiper-item"> <view class="swiper-item w-full h-full flex items-center justify-center">
{{ item.content }} <image :src="item.imageUrl" mode="heightFix" class="w-full h-full" @tap="handleJumpUrl(item)" />
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>