123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- <template>
- <view class="hotelImgList">
- <view class="tab-box">
- <view class="tab" :class="[active === index?'active':'']" @click="handleTab(index)" v-for="(item,index) in pictures" :key="index">
- {{item.name}}({{item.list.length}})
- </view>
-
- </view>
- <view>
- <!-- <view class="sub-title" :id="'the-'+index">
- {{`${item.name}(${item.list.length || 0})`}}
- </view> -->
- <view class="img-box">
- <zs-img class="img" :src="item" width="340rpx" height="340rpx" radius="full" v-for="(item,index) in list" :key="index" @click.native="preview(index)"></zs-img>
- </view>
- </view>
-
- <view class="btn-box">
- <button class="btn" type="default" @click="goIntroduce">酒店介绍</button>
- </view>
-
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- active:0,
- pictures:[]
- }
- },
- computed: {
- list() {
- if(this.pictures.length){
- console.log(this.pictures[this.active].list);
- return this.pictures[this.active].list
- }else{
- return []
- }
- }
- },
- methods: {
- preview(index){
- uni.previewImage({
- urls:this.list,
- current:index,
- indicator:'number'
- })
- },
- handleTab(key) {
- this.active = key
- uni.pageScrollTo({
- selector:`#the-${key}`
- })
- },
- goIntroduce(){
- uni.navigateTo({
- url:`./introduce?id=${this.hotelId}`
- })
- },
- },
- onLoad(options) {
- this.hotelId = options.id
- this.pictures = JSON.parse(uni.getStorageSync('hotelImgList'))
- }
- }
- </script>
- <style lang="scss" scoped>
- .hotelImgList{
- padding: 20rpx 24rpx 200rpx;
- .tab-box{
- display: flex;
- overflow-x: auto;
- .tab{
- padding: 4rpx 24rpx;
- background: #F0F0F0;
- border-radius: 8rpx 8rpx 8rpx 8rpx;
- font-size: 24rpx;
- color: #222222;
- flex-shrink: 0;
- }
- .tab+.tab{
- margin-left: 16rpx;
- }
- .tab.active{
- background: #FDECE8;
- color: #EE4320;
- }
- }
-
- .sub-title{
- font-weight: 600;
- font-size: 28rpx;
- color: #222222;
- margin-top: 20rpx;
- }
- .img-box{
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- .img{
- margin-top: 20rpx;
- }
- }
-
- .btn-box{
- position: fixed;
- bottom: 0%;
- left: 0%;
- background: #fff;
- z-index: 2;
- width: 100%;
- height: 98rpx;
- line-height: 98rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- padding: 0 0 env(safe-area-inset-bottom);
- border-top: 1rpx solid #EEEEEE;
- .btn{
- width: 702rpx;
- height: 80rpx;
- line-height: 80rpx;
- text-align: center;
- border-radius: 40rpx 40rpx 40rpx 40rpx;
- font-weight: 600;
- font-size: 28rpx;
- background: #EE4320;
- color: #fff;
- }
- }
- }
- </style>
|