add:新增轮播图展示
This commit is contained in:
1 parent
cd7a77c6e4
commit
24814b7dee
3 files changed
+30
-13
No files matched your search
@@ -0,0 +1,6 @@
|
|||||||
|
export interface CreateCarousalsRequest {
|
||||||
|
imageUrl: string
|
||||||
|
targetType: string
|
||||||
|
targetUrl?: string
|
||||||
|
targetId?: string
|
||||||
|
}
|
||||||
@@ -37,6 +37,5 @@
|
|||||||
"navigationBarTitleText": "Vitesse-Uni",
|
"navigationBarTitleText": "Vitesse-Uni",
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
},
|
},
|
||||||
"__esModule": true,
|
|
||||||
"subPackages": []
|
"subPackages": []
|
||||||
}
|
}
|
||||||
@@ -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>
|
||||||
|
|||||||
Reference in new issue
Block a user