feat: 添加广告列表功能及组件
This commit is contained in:
@@ -41,5 +41,19 @@ export const commonApi = {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { isBook, isMedical, isSociology }
|
data: { isBook, isMedical, isSociology }
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取广告列表
|
||||||
|
* @param params
|
||||||
|
* @param params.type 应用类型 10-吴门国际
|
||||||
|
* @returns 广告列表
|
||||||
|
*/
|
||||||
|
getAdvertisementList: async (params: any) => {
|
||||||
|
return skeletonClient.request<IApiResponse>({
|
||||||
|
url: 'common/mainAd/getMainAd',
|
||||||
|
method: 'POST',
|
||||||
|
data: params
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
38
components/advertisement/advertisement.vue
Normal file
38
components/advertisement/advertisement.vue
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<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>
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
"appid" : "__UNI__1250B39",
|
"appid" : "__UNI__1250B39",
|
||||||
"description" : "吴门国际",
|
"description" : "吴门国际",
|
||||||
"sassImplementationName" : "node-sass",
|
"sassImplementationName" : "node-sass",
|
||||||
"versionName" : "1.1.17",
|
"versionName" : "1.1.18",
|
||||||
"versionCode" : 1117,
|
"versionCode" : 1118,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
|
|||||||
@@ -215,6 +215,8 @@
|
|||||||
</template>
|
</template>
|
||||||
</Skeleton>
|
</Skeleton>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<Advertisement></Advertisement>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -228,6 +230,7 @@ import { getNotchHeight } from '@/utils/system'
|
|||||||
// import { onPageJump } from '@/utils'
|
// import { onPageJump } from '@/utils'
|
||||||
import type { ICategory, ICourse, INews } from '@/types/course'
|
import type { ICategory, ICourse, INews } from '@/types/course'
|
||||||
import { useUserStore } from '@/stores/user'
|
import { useUserStore } from '@/stores/user'
|
||||||
|
import Advertisement from '@/components/advertisement/advertisement.vue'
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
|
|||||||
@@ -75,9 +75,7 @@
|
|||||||
<text v-if="item.hufenState" class="menu-list-hufen">{{hufenData?.total ?? 0}}<text
|
<text v-if="item.hufenState" class="menu-list-hufen">{{hufenData?.total ?? 0}}<text
|
||||||
style="margin-left: 6rpx;">湖分</text></text>
|
style="margin-left: 6rpx;">湖分</text></text>
|
||||||
</wd-cell>
|
</wd-cell>
|
||||||
<wd-cell is-link @click="uni.navigateTo({
|
<wd-cell is-link @click="uni.navigateTo({url: '/pages/index'})">测试页</wd-cell>
|
||||||
url: '/pages/index'
|
|
||||||
})">前往测试</wd-cell>
|
|
||||||
</wd-cell-group>
|
</wd-cell-group>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */
|
/*! tailwindcss v4.2.1 | MIT License | https://tailwindcss.com */
|
||||||
@layer properties;
|
@layer properties;
|
||||||
@layer theme, base, components, utilities;
|
@layer theme, base, components, utilities;
|
||||||
@layer theme {
|
@layer theme {
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
|
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
|
||||||
"Courier New", monospace;
|
"Courier New", monospace;
|
||||||
--color-red-500: oklch(63.7% 0.237 25.331);
|
--color-red-500: oklch(63.7% 0.237 25.331);
|
||||||
|
--color-black: #000;
|
||||||
--color-white: #fff;
|
--color-white: #fff;
|
||||||
--spacing: 0.25rem;
|
--spacing: 0.25rem;
|
||||||
--text-xs: 0.75rem;
|
--text-xs: 0.75rem;
|
||||||
@@ -194,6 +195,24 @@
|
|||||||
.sticky {
|
.sticky {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
}
|
}
|
||||||
|
.start {
|
||||||
|
inset-inline-start: var(--spacing);
|
||||||
|
}
|
||||||
|
.end {
|
||||||
|
inset-inline-end: var(--spacing);
|
||||||
|
}
|
||||||
|
.top-0 {
|
||||||
|
top: calc(var(--spacing) * 0);
|
||||||
|
}
|
||||||
|
.right-0 {
|
||||||
|
right: calc(var(--spacing) * 0);
|
||||||
|
}
|
||||||
|
.left-0 {
|
||||||
|
left: calc(var(--spacing) * 0);
|
||||||
|
}
|
||||||
|
.z-\[99999\] {
|
||||||
|
z-index: 99999;
|
||||||
|
}
|
||||||
.container {
|
.container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@media (width >= 40rem) {
|
@media (width >= 40rem) {
|
||||||
@@ -260,12 +279,18 @@
|
|||||||
.h-100 {
|
.h-100 {
|
||||||
height: calc(var(--spacing) * 100);
|
height: calc(var(--spacing) * 100);
|
||||||
}
|
}
|
||||||
|
.h-\[100vh\] {
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
.w-\[50\%\] {
|
.w-\[50\%\] {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
}
|
}
|
||||||
.w-\[100px\] {
|
.w-\[100px\] {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
}
|
}
|
||||||
|
.w-full {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
.flex-1 {
|
.flex-1 {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
@@ -287,16 +312,34 @@
|
|||||||
.rounded-\[10rpx\] {
|
.rounded-\[10rpx\] {
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
}
|
}
|
||||||
|
.rounded-full {
|
||||||
|
border-radius: calc(infinity * 1px);
|
||||||
|
}
|
||||||
.border {
|
.border {
|
||||||
border-style: var(--tw-border-style);
|
border-style: var(--tw-border-style);
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
}
|
}
|
||||||
|
.bg-black\/50 {
|
||||||
|
background-color: color-mix(in srgb, #000 50%, transparent);
|
||||||
|
@supports (color: color-mix(in lab, red, red)) {
|
||||||
|
background-color: color-mix(in oklab, var(--color-black) 50%, transparent);
|
||||||
|
}
|
||||||
|
}
|
||||||
.bg-white {
|
.bg-white {
|
||||||
background-color: var(--color-white);
|
background-color: var(--color-white);
|
||||||
}
|
}
|
||||||
|
.bg-white\/30 {
|
||||||
|
background-color: color-mix(in srgb, #fff 30%, transparent);
|
||||||
|
@supports (color: color-mix(in lab, red, red)) {
|
||||||
|
background-color: color-mix(in oklab, var(--color-white) 30%, transparent);
|
||||||
|
}
|
||||||
|
}
|
||||||
.p-0\! {
|
.p-0\! {
|
||||||
padding: calc(var(--spacing) * 0) !important;
|
padding: calc(var(--spacing) * 0) !important;
|
||||||
}
|
}
|
||||||
|
.p-10 {
|
||||||
|
padding: calc(var(--spacing) * 10);
|
||||||
|
}
|
||||||
.p-\[10rpx\] {
|
.p-\[10rpx\] {
|
||||||
padding: 10rpx;
|
padding: 10rpx;
|
||||||
}
|
}
|
||||||
@@ -306,9 +349,18 @@
|
|||||||
.p-\[30rpx\] {
|
.p-\[30rpx\] {
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
}
|
}
|
||||||
|
.px-5 {
|
||||||
|
padding-inline: calc(var(--spacing) * 5);
|
||||||
|
}
|
||||||
|
.py-2 {
|
||||||
|
padding-block: calc(var(--spacing) * 2);
|
||||||
|
}
|
||||||
.pt-1 {
|
.pt-1 {
|
||||||
padding-top: calc(var(--spacing) * 1);
|
padding-top: calc(var(--spacing) * 1);
|
||||||
}
|
}
|
||||||
|
.pt-5 {
|
||||||
|
padding-top: calc(var(--spacing) * 5);
|
||||||
|
}
|
||||||
.pt-10 {
|
.pt-10 {
|
||||||
padding-top: calc(var(--spacing) * 10);
|
padding-top: calc(var(--spacing) * 10);
|
||||||
}
|
}
|
||||||
@@ -355,6 +407,9 @@
|
|||||||
.text-red-500 {
|
.text-red-500 {
|
||||||
color: var(--color-red-500);
|
color: var(--color-red-500);
|
||||||
}
|
}
|
||||||
|
.text-white {
|
||||||
|
color: var(--color-white);
|
||||||
|
}
|
||||||
.lowercase {
|
.lowercase {
|
||||||
text-transform: lowercase;
|
text-transform: lowercase;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user