|
|
@@ -1,5 +1,5 @@
|
|
|
<script setup lang="ts">
|
|
|
-import type { CreateCarousalsRequest } from '@/model/carousals'
|
|
|
+import type { CreateCarousalsRequest, TypeList } from '@/model/carousals'
|
|
|
import carousalApi from '@/api/carousal'
|
|
|
import CardList from '@/pages/pet-manual/components/CardList.vue'
|
|
|
// const searchValue = ref('')
|
|
|
@@ -97,12 +97,7 @@ function change(e: CustomEvent<{ current: number }>): void {
|
|
|
current.value = e.detail.current
|
|
|
}
|
|
|
|
|
|
-const typeList = ref<TypeItem[]>([
|
|
|
- { name: '趣味科普', isClick: true },
|
|
|
- { name: '科学喂养', isClick: false },
|
|
|
- { name: '科学喂养', isClick: false },
|
|
|
- { name: '科学喂养', isClick: false },
|
|
|
-])
|
|
|
+const typeList = ref<TypeList[]>([])
|
|
|
|
|
|
function handleClickType(item: TypeItem) {
|
|
|
typeList.value.forEach(i => (i.isClick = false))
|
|
|
@@ -120,13 +115,20 @@ const historyList = ref<{ name: string }[]>([
|
|
|
{ name: '狗' },
|
|
|
{ name: '烘培粮' },
|
|
|
])
|
|
|
-
|
|
|
const findList = ref<{ name: string }[]>([
|
|
|
{ name: '宠物吃饭慢' },
|
|
|
{ name: '猫咪尿闭怎么办' },
|
|
|
])
|
|
|
-async function onLoad() {
|
|
|
+async function init() {
|
|
|
info.value = await carousalApi.getCarousalList()
|
|
|
+ typeList.value = (await carousalApi.getTypeList()).map((item, index) => {
|
|
|
+ return {
|
|
|
+ name: item.name,
|
|
|
+ id: item.id,
|
|
|
+ code: item.code,
|
|
|
+ isClick: index === 0,
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
function handleJumpUrl(item: CreateCarousalsRequest) {
|
|
|
if (item.targetType === 'url') {
|
|
|
@@ -135,7 +137,7 @@ function handleJumpUrl(item: CreateCarousalsRequest) {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
-onLoad()
|
|
|
+init()
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
@@ -198,7 +200,7 @@ onLoad()
|
|
|
<view class="ml-4 mt-5 text-[20px] font-600">
|
|
|
养宠贴士
|
|
|
</view>
|
|
|
- <view class="mx-4">
|
|
|
+ <view class="mx-4 sticky top-0 bg-[#f5f6f7]">
|
|
|
<scroll-view class="scroll mt-2" scroll-x="auto">
|
|
|
<view class="group h-[40px] mt-1">
|
|
|
<view
|