Files
2024-03-21 15:54:39 +08:00

161 lines
3.4 KiB
Vue

<template>
<view class="index" >
<view class="indexontents flex-between">
<view class="onecontent_item flex-colum-start" v-for="(item,index) in list" :key="index"
@click="previewImage(index,item)">
<image class="onecontent_itemimage" :src="item.img" mode="aspectFill"></image>
<!-- <text class="onecontent_itemtext">{{list.title}}</text>
<view class="onecontent_item_absolute flex-start">
<u-icon name="photo" color="#fff" size="18"></u-icon>
<text class="onecontent_item_absolute_text">
{{item.count}}
</text>
</view> -->
</view>
</view>
<view v-if="list.length==0 && is_end == true" class="flex-colum">
<image :src="bgnothave" mode="widthFix">
</image>
</view>
<u-loadmore :status="form.status" />
<bottombbar :valuebbar='1'></bottombbar>
</view>
</template>
<script>
import bottombbar from '@/components/bottombbar.vue'
export default {
components: {
bottombbar
},
data() {
return {
bgnothave:uni.getStorageSync('bgnothave'),
is_end: false,
list: [],
form: {
page: 1,
status: 'loadmore',
},
}
},
onReachBottom() {
this.indexworks()
},
onLoad() {
uni.setNavigationBarTitle({
title: uni.cache.get('details_id').title + '图册'
});
},
onShow() {
if (uni.getStorageSync('loginuser') != 0) {
this.indexworks()
}
},
methods: {
eeInfo(e) { //跳转
uni.pro.navigateTo('task/taskInfo',{
id:e.id
})
},
previewImage(imgIndex, urls) {
console.log(urls)
uni.previewImage({
current: imgIndex,
urls: [urls.img],
success:(res)=>{
console.log(res)
}
});
},
async indexworks() {
let res = await this.api.indexworks({
store_id: uni.getStorageSync('store_id'),
page: this.form.page,
service_type_id: this.swiperCurrent
})
if (res.length == 0) {
this.is_end = true
this.form.status = 'nomore'
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res];
if (res.length == 10) {
this.form.status = 'loading';
} else {
this.is_end = true;
this.form.status = 'nomore';
}
}, 500)
}
},
}
}
</script>
<style lang="scss">
page {
background: #F9F9F9;
}
.index {
padding: 10rpx 28rpx;
.indexontents {
width: 100%;
.onecontent_item {
position: relative;
width: 49%;
margin-top: 16rpx;
.onecontent_itemimage {
width: 332rpx;
height: 346rpx;
}
.onecontent_itemtext {
margin-top: 8rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
}
.onecontent_item_absolute {
padding: 8rpx 24rpx;
position: absolute;
top: 290rpx;
right: 16rpx;
background: rgba(45, 42, 42, 0.35);
border-radius: 28rpx;
.onecontent_item_absolute_text {
margin-left: 10rpx;
font-size: 16rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #FFFFFF;
}
}
}
}
.flex-colum_image {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
text {
margin-top: 30rpx;
font-size: 32rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #666666;
}
}
}
</style>