描述:修改

This commit is contained in:
SelfRidicule 2024-03-14 15:31:25 +08:00
parent 17225a83a4
commit fa4ee7faf1
3 changed files with 28 additions and 11 deletions

View File

@ -0,0 +1,11 @@
import {
request
} from '../selfRequest';
// 轮播图
export function visitorCarouselRq() {
return request({
url: '/api/visitor/carousel',
method: "get",
});
}

View File

@ -10,6 +10,10 @@ import {
userProfile userProfile
} from "../../api/user/user.js" } from "../../api/user/user.js"
import {
visitorCarouselRq
} from "../../api/index/index.js"
Page({ Page({
data: { data: {
@ -148,19 +152,21 @@ Page({
}, },
], ],
bannerList: [{ bannerList: [],
bg: '/profile/static/index/banner/1.jpg',
url: ''
}, {
bg: '/profile/static/index/banner/2.jpg',
url: ''
}, {
bg: '/profile/static/index/banner/3.jpg',
url: ''
}],
userDetail: {}, userDetail: {},
}, },
onLoad() {
let _this = this;
// 轮播图
visitorCarouselRq().then(res => {
console.log('visitorCarouselRq', res);
_this.setData({
bannerList: res.data
})
})
},
// 切换tabbar // 切换tabbar
switchTab(e) { switchTab(e) {
const data = e.currentTarget.dataset const data = e.currentTarget.dataset

View File

@ -16,7 +16,7 @@
<!-- 轮播图 --> <!-- 轮播图 -->
<swiper class='swiper-box' indicator-dots autoplay interval="3000" duration="1000" circular='true'> <swiper class='swiper-box' indicator-dots autoplay interval="3000" duration="1000" circular='true'>
<swiper-item wx:for="{{bannerList}}" wx:key="index"> <swiper-item wx:for="{{bannerList}}" wx:key="index">
<image class="img" src="{{IMG_NAME + item.bg}}" mode="aspectFill"></image> <image class="img" src="{{IMG_NAME + item.bannerImg}}" mode="aspectFill"></image>
</swiper-item> </swiper-item>
</swiper> </swiper>
</view> </view>