You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

147 lines
3.2 KiB

<template>
<view class="wrap">
<view class="stabar"></view>
<view class="mainwrap">
<view class="topcont">
<img :src="topImg"></img>
</view>
<view class="banbox">
<swiper style="height: 100%;" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000" :circular="true">
<swiper-item v-for="(item, i) in swiperList" :key="i">
<navigator style="height: 100%;" class="swiper-item">
<img :src="item"></img>
</navigator>
</swiper-item>
</swiper>
</view>
<view class="itembox">
<span v-for="(item,i) in sceneList" :key="i" @click="navClickHandler(item)"><img :src="item" class="scene-img"></image></span>
</view>
</view>
<view class="footbox">
<tabbar :page="page"></tabbar>
</view>
<!-- <view class="index-background">
<image :src="topImg"></image>
</view>
<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000" :circular="true">
<swiper-item v-for="(item, i) in swiperList" :key="i">
<navigator class="swiper-item">
<image :src="item"></image>
</navigator>
</swiper-item>
</swiper>
<view class="scene-list">
<view class="scene-item" v-for="(item,i) in sceneList" :key="i" @click="navClickHandler(item)">
<image :src="item" class="scene-img"></image>
</view>
</view>
<tabbar :page="page"></tabbar> -->
</view>
</template>
<script>
import tabbar from "@/components/tabbar/tabbar.vue";
import { mapMutations, mapState } from 'vuex'
export default {
data() {
return {
page: "",
//顶部图片
topImg: "",
leftImg: "",
rightImg: "",
//轮播图数据列表
swiperList: [],
//场景入口
sceneList: []
};
},
computed: {
...mapState('m_user', ['token'])
},
onLoad() {
this.getSwiperList();
this.checkLogin()
},
onShow() {
this.page= "home"
},
methods: {
async getSwiperList() {
const {
data: res
} = await uni.$http.post('/small/customImage/listAll',{page:"home"})
if (!res.success) return uni.$showMsg()
res.data.forEach(item => {
item.uploadPath = uni.$http.baseUrl + item.uploadPath
if (item.position === "top") {
this.topImg = item.uploadPath
} else if (item.position.indexOf("banner") !=-1) {
this.swiperList.push(item.uploadPath)
} else if (item.position.indexOf("bottom") !=-1) {
this.sceneList.push(item.uploadPath)
}
})
// uni.$showMsg('数据请求成功!')
},
navClickHandler(item) {
uni.navigateTo({
url: '/subpkg/list/list'
})
},
checkLogin() {
if(this.token === "") {
uni.reLaunch({
url: '/subpkg/login/login',
})
}
},
},
components: {tabbar}
}
</script>
<style lang="scss">
@import url("@/static/base_css.css");
// .index-background {
// image {
// height: 270rpx;
// width: 100%;
// }
// }
// swiper {
// height: 630rpx;
// .swiper-item,
// image {
// width: 100%;
// height: 100%;
// border-radius: 4px;
// }
// }
// .scene-list {
// display: flex;
// justify-content: space-around;
// margin: 5px 0;
// }
// .scene-img {
// width: 358rpx;
// height: 290rpx;
// border-radius: 8px;
// }
</style>