|
@@ -6,9 +6,9 @@
|
|
|
import Card from '@/components/card.vue'
|
|
|
import SectionHeading from '@/components/section-heading.vue'
|
|
|
import { abc, calculator } from '../../core/libs/pngs'
|
|
|
-import { getAppMaterials, getByDictType } from '../../core/libs/requests'
|
|
|
+import { getAppMaterials, getBanners, getByDictType } from '../../core/libs/requests'
|
|
|
import { materialDealers, close, phone } from '../../core/libs/svgs'
|
|
|
-import { DictType, MaterialDealer, MaterialsList } from '../../core/models/moment'
|
|
|
+import { BannerMode, DictType, MaterialDealer, MaterialsList } from '../../core/models/moment'
|
|
|
import router from '@designer-hub/assets/src/assets/svgs/router'
|
|
|
|
|
|
const { data: materialDealerData, run: setMaterialDealerData } = useRequest(
|
|
@@ -24,6 +24,10 @@ const { data: materialBrandTypes, run: setMaterialBrandTypes } = useRequest(
|
|
|
() => getByDictType(DictType.memberMaterialsBrandType),
|
|
|
{ initialData: [] },
|
|
|
)
|
|
|
+const { data: banners, run: setBanners } = useRequest(
|
|
|
+ () => getBanners({ mode: BannerMode.Material }),
|
|
|
+ { initialData: [] },
|
|
|
+)
|
|
|
const dealerPanelState = ref(false)
|
|
|
const currentDeraler = ref<MaterialsList>()
|
|
|
const pieces = ref([
|
|
@@ -50,6 +54,8 @@ const pieces = ref([
|
|
|
path: '/pages/material/recommend/index',
|
|
|
},
|
|
|
])
|
|
|
+const current = ref<number>(0)
|
|
|
+const swiperList = computed(() => banners.value.map((it) => it.bannerImgUrl))
|
|
|
const materialsByBrandLevel = ref<{ list: MaterialDealer[] }[]>([])
|
|
|
const handleMenuItemClick = ({ path }: any) => {
|
|
|
uni.navigateTo({ url: path })
|
|
@@ -62,10 +68,16 @@ const toDetail = (id: number) => {
|
|
|
const handleCall = (phone: string) => {
|
|
|
uni.makePhoneCall({ phoneNumber: phone })
|
|
|
}
|
|
|
+function handleClick(e) {
|
|
|
+ console.log(e)
|
|
|
+}
|
|
|
+function onChange(e) {
|
|
|
+ console.log(e)
|
|
|
+}
|
|
|
onMounted(async () => {
|
|
|
await run()
|
|
|
await setMaterialDealerData()
|
|
|
- await Promise.all([setMaterialBrandTypes(), setMaterialOperationTypes()])
|
|
|
+ await Promise.all([setMaterialBrandTypes(), setMaterialOperationTypes(), setBanners()])
|
|
|
// const reqs = data.value.map((it) =>
|
|
|
// getMaterials({ brandLevel: it.value }).then(({ data }) => data),
|
|
|
// )
|
|
@@ -78,11 +90,22 @@ onMounted(async () => {
|
|
|
<template>
|
|
|
<view class="">
|
|
|
<view class="bg-black w-full pos-relative aspect-[1.26/1]">
|
|
|
- <wd-img
|
|
|
+ <!-- <wd-img
|
|
|
width="100%"
|
|
|
height="100%"
|
|
|
src="https://image.zhuchaohui.com/zhucaohui/f866f4f72392e8f4627d8f5d6628739ad7f0907d3703139e7cdbcb999b803dfe.jpg"
|
|
|
- />
|
|
|
+ /> -->
|
|
|
+ <wd-swiper
|
|
|
+ custom-class="rounded-2xl overflow-hidden aspect-[1.26/1]"
|
|
|
+ width="100%"
|
|
|
+ height="100%"
|
|
|
+ :list="swiperList"
|
|
|
+ autoplay
|
|
|
+ v-model:current="current"
|
|
|
+ :indicator="{ type: 'dots-bar' } as any"
|
|
|
+ @click="handleClick"
|
|
|
+ @change="onChange"
|
|
|
+ ></wd-swiper>
|
|
|
</view>
|
|
|
<view class="bg-[#f6f6f6] relative bottom-4 rounded-t-2xl py-1">
|
|
|
<div class="my-6 grid grid-cols-2 grid-gap-3.5 mx-3.5">
|