5 changed files with 99 additions and 59 deletions
-
74src/components/XtxSwiper.vue
-
31src/components/styles/XtxSwiper.scss
-
24src/pages/index/index.vue
-
18src/services/home.ts
-
11src/types/home.d.ts
@ -0,0 +1,31 @@ |
|||||
|
/* 轮播图 */ |
||||
|
.carousel { |
||||
|
height: 280rpx; |
||||
|
position: relative; |
||||
|
overflow: hidden; |
||||
|
transform: translateY(0); |
||||
|
background-color: #efefef; |
||||
|
.indicator { |
||||
|
position: absolute; |
||||
|
left: 0; |
||||
|
right: 0; |
||||
|
bottom: 16rpx; |
||||
|
display: flex; |
||||
|
justify-content: center; |
||||
|
.dot { |
||||
|
width: 30rpx; |
||||
|
height: 6rpx; |
||||
|
margin: 0 8rpx; |
||||
|
border-radius: 6rpx; |
||||
|
background-color: rgba(255, 255, 255, 0.4); |
||||
|
} |
||||
|
.active { |
||||
|
background-color: #fff; |
||||
|
} |
||||
|
} |
||||
|
.navigator, |
||||
|
.image { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
} |
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
// 请求封装调用
|
||||
|
import { http } from '@/utils/http' |
||||
|
|
||||
|
// 存放路径: src/services/home.ts
|
||||
|
import type { BannerItem } from '@/types/home' |
||||
|
/** |
||||
|
* 首页-广告区域-小程序 |
||||
|
* @param distributionSite 广告区域展示位置(投放位置 投放位置,1为首页,2为分类商品页) 默认是1 |
||||
|
*/ |
||||
|
export const getHomeBannerAPI = (distributionSite = 1) => { |
||||
|
return http<BannerItem[]>({ |
||||
|
method: 'GET', |
||||
|
url: '/home/banner', |
||||
|
data: { |
||||
|
distributionSite, |
||||
|
}, |
||||
|
}) |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
/** 首页-广告区域数据类型 */ |
||||
|
export type BannerItem = { |
||||
|
/** 跳转链接 */ |
||||
|
hrefUrl: string |
||||
|
/** id */ |
||||
|
id: string |
||||
|
/** 图片链接 */ |
||||
|
imgUrl: string |
||||
|
/** 跳转类型 */ |
||||
|
type: number |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue