Files

39 lines
1.1 KiB
Vue

<template>
<view v-if="show" class="fixed top-0 left-0 right-0 h-[100vh] w-full p-10 bg-black/50 z-[99999]" style="display: flex; justify-content: center; align-items: center;">
<view class="w-full">
<wd-swiper :list="dataList" autoplay v-model:current="current" height="75vh" imageMode="aspectFit"></wd-swiper>
<view class="text-center pt-5">
<text class="bg-white/30 text-white rounded-full px-5 py-2 inline-block " @click="() => show = false">关闭</text>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { commonApi } from '@/api/modules/common'
const show = ref(false)
const current = ref<number>(0)
const dataList = ref([])
const getAdvertisementList = async () => {
const res = await commonApi.getAdvertisementList({
type: 10
})
dataList.value = res.list.map((item: any) => item.icon)
console.log('请求广告列表', dataList.value)
if (dataList.value.length > 0) {
show.value = true
}
}
onLoad(async () => {
await getAdvertisementList()
})
</script>
<style scoped lang="scss">
</style>