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.
127 lines
2.7 KiB
127 lines
2.7 KiB
<template>
|
|
<view>
|
|
<!-- 轮播图 -->
|
|
<swiper :indicator-dots="false" :autoplay="true" :interval="3000" :duration="1000" :circular="true">
|
|
<swiper-item v-for="(item, i) in swiperList" :key="i">
|
|
<!-- <view class="swiper-item">
|
|
<image :src="item.image_src"></image>
|
|
</view> -->
|
|
<navigator class="swiper-item">
|
|
<image :src="item"></image>
|
|
</navigator>
|
|
</swiper-item>
|
|
</swiper>
|
|
<!-- 搜索 -->
|
|
<!-- <my-search></my-search> -->
|
|
<view class="search">
|
|
<view class="search-title">请选择演练场景</view>
|
|
<view class="my-search-container">
|
|
<uni-search-bar class="my-search-box" @confirm="search" @input="input" cancel-button="none"></uni-search-bar>
|
|
</view>
|
|
</view>
|
|
<!-- 场景区域 -->
|
|
<view class="nav-list">
|
|
<view class="nav-item" v-for="(item, i) in sceneList" :key="i">
|
|
<image :src="item" class="nav-img"></image>
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
name:"",
|
|
//轮播图数据列表
|
|
swiperList: [],
|
|
//轮播图数据列表
|
|
sceneList: []
|
|
};
|
|
},
|
|
onLoad() {
|
|
this.getSwiperList();
|
|
this.getSceneList()
|
|
},
|
|
methods: {
|
|
|
|
async getSwiperList() {
|
|
const {
|
|
data: res
|
|
} = await uni.$http.post('/small/customImage/listAll',{page:'site'})
|
|
if (!res.success) return uni.$showMsg()
|
|
|
|
res.data.forEach(item=>{
|
|
item.uploadPath = uni.$http.baseUrl +item.uploadPath
|
|
this.swiperList.push(item.uploadPath)
|
|
})
|
|
|
|
uni.$showMsg('数据请求成功!')
|
|
},
|
|
async getSceneList() {
|
|
|
|
const {
|
|
data: res
|
|
} = await uni.$http.post('/small/scene/manage/listAll',{name:this.name})
|
|
if (!res.success) return uni.$showMsg()
|
|
this.sceneList = []
|
|
res.data.forEach(item=>{
|
|
item.uploadPath = uni.$http.baseUrl +item.uploadPath
|
|
this.sceneList.push(item.uploadPath)
|
|
})
|
|
|
|
uni.$showMsg('数据请求成功!')
|
|
},
|
|
objToParams(obj){
|
|
let arr = [];
|
|
for (let key in obj) {
|
|
arr.push(`${key}=${obj[key]}`);
|
|
}
|
|
return arr.join('&')
|
|
},
|
|
input(e){
|
|
clearTimeout(this.timer)
|
|
|
|
this.timer = setTimeout(() => {
|
|
this.name = e
|
|
this.getSceneList()
|
|
}, 500)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
swiper {
|
|
height: 330rpx;
|
|
|
|
.swiper-item,
|
|
image {
|
|
width: 99.8%;
|
|
margin-left: 0.1%;
|
|
height: 100%;
|
|
align-items: center;
|
|
border-radius: 10px;
|
|
}
|
|
}
|
|
.nav-list {
|
|
justify-content: space-around;
|
|
margin: 12px 0;
|
|
|
|
.nav-img {
|
|
width: 100%;
|
|
height: 140rpx;
|
|
margin-bottom: 10rpx;
|
|
border-radius: 10px;
|
|
}
|
|
}
|
|
|
|
.search-title{
|
|
font-family: 'Courier New', Courier, monospace;
|
|
color: #67676a;
|
|
margin-left: 8px;
|
|
margin-top: 6px;
|
|
}
|
|
|
|
</style>
|
|
|