Yizhan-app/pages/device/property.vue

144 lines
3.0 KiB
Vue

<template>
<view class="first_main" :style="{height: screenHeight + 'px'}">
<nav-bar title='物业服务'></nav-bar>
<view class="content">
<view class="list_scoll">
<view class="unit_item" v-for="(item,index) in listData" :key="index" @click="jumpDetail(item)" :style="{background: backList[index]}" v-if="item.visible">
<view class="">{{item.name}}</view>
<view class="unit_item_img">
<image :src="item.icon "></image>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {callbackRequest} from '@/common/util.js';
import {propertyList} from '@/common/api.js';
import navBar from "@/components/navBar/index.vue";
export default {
components: {
navBar
},
data() {
return {
listData: [],
screenHeight: '',
backList:[
'linear-gradient( 159deg, #E7F7FF 0%, #FFFFFF 100%)',
'linear-gradient( 159deg, #F0FCE9 0%, #FFFFFF 100%)',
'linear-gradient( 156deg, #FFF7E5 0%, #FFFFFF 100%)',
'linear-gradient( 155deg, #E7F7FF 0%, #FFFFFF 100%)',
]
}
},
onLoad() {
if(uni.getStorageSync('propertyRouter')) {
this.listData = uni.getStorageSync('propertyRouter')
}
this.screenHeight = uni.getSystemInfoSync().safeArea.height
const eventChannel = this.getOpenerEventChannel();
eventChannel.on('routerChange', (data) => {
this.listData = data.data
uni.setStorageSync('propertyRouter',data.data)
})
console.log(this.listData)
},
onShow() {
},
methods: {
back() {
uni.navigateBack()
},
jumpDetail(item) {
uni.navigateTo({
url: item.path
})
},
getData() {
let params = {
method:propertyList,
currentPage: 1,
isDeleted: "0",
limit: 1000,
serviceType: ""
}
callbackRequest(params).then((res) => {
if (res.returnCode == 1) {
this.listData = res.returnData.records
}else{
uni.showToast({title: res.returnMsg,icon: 'none'});
}
})
}
}
}
</script>
<style scoped lang="scss">
.content {
height: calc(100% - 100rpx);
width: 100%;
background-image: url('@/static/firstaid/wuye.png');
background-size: 100% 392rpx;
background-repeat: no-repeat;
}
.first_main {
width: 100vw;
background-color: #F2F6FA;
padding-top: 100rpx;
}
.content ::-webkit-scrollbar {
width: 0;
height: 0;
}
.first_main ::-webkit-scrollbar {
width: 0;
height: 0;
}
.list_scoll {
position: fixed;
top: 414rpx;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
padding: 20rpx 24rpx;
box-sizing: border-box;
overflow: auto;
}
.unit_item {
width: calc(50% - 12rpx);
height: 160rpx;
border-radius: 20rpx 20rpx 20rpx 20rpx;
border: 2rpx solid #FFFFFF;
margin-bottom: 24rpx;
display: flex;
align-items: center;
justify-content: space-around;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 32rpx;
color: #0E1A24;
text-align: center;
font-style: normal;
text-transform: none;
}
.unit_item_img {
width: 88rpx;
height: 88rpx;
image {
display: block;
width: 100%;
height: 100%;
}
}
</style>