| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 |
- <template>
- <view class="home">
- <view>
- <wd-drop-menu>
- <wd-drop-menu-item :options="state.addressList" v-model="state.address" />
- </wd-drop-menu>
- </view>
- <view>
- <wd-swiper :autoplay="true" :list="state.swiperList" @click="onClickSwiper" />
- </view>
- <view class="home-menu">
- <view class="home-menu-item" v-for="(item, index) in menuList" :key="index">
- <wd-img width="60rpx" height="60rpx" :src="item.icon" />
- <view class="home-menu-item-right">
- <view style="font-weight: 400;">
- {{ item.title }}
- </view>
- <view style="font-size: 24rpx;margin-top: 10rpx;">
- {{ item.text }}
- </view>
- </view>
- </view>
- </view>
- <view class="home-house">
- <view class="home-house-title">
- <view>
- 最新发布
- </view>
- <wd-icon name="arrow-right" />
- </view>
- <view class="home-house-item" v-for="(item, index) in state.houseList" :key="index"
- @click="onClickNavigate(item.id)">
- <wd-img width="220rpx" height="180rpx" radius="8rpx" mode="aspectFill" :src="item.url" />
- <view class="home-house-item-right">
- <view class="home-house-item-right-title">
- {{ item.title }}
- </view>
- <view class="home-house-item-right-text">
- {{ item.content }}
- </view>
- <view class="home-house-item-right-date">
- {{ item.date }}
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script lang="ts" setup>
- import { reactive } from 'vue';
- import { onShow } from '@dcloudio/uni-app';
- interface State {
- address: string,
- addressList: {
- label: string,
- value: string,
- }[],
- swiperList: string[],
- houseList: {
- id: string,
- url: string,
- title: string,
- content: string,
- date: string,
- }[],
- };
- const state: State = reactive({
- address: '1',
- addressList: [
- {
- label: '太保家园·郑州国际颐养社区',
- value: '1',
- },
- {
- label: '太保家园·郑州国际颐养社区2',
- value: '2',
- },
- {
- label: '太保家园·郑州国际颐养社区3',
- value: '3',
- }
- ],
- swiperList: [
- 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg',
- 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg',
- ],
- houseList: [
- {
- id: '1',
- url: 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg',
- title: '户型1户型1户型1户型1户型1户型1户型1户型1户型1户型1户型1',
- content: '老年人照料设施建筑基地应选择在工程地质条件稳定老年人照料设施建筑基地应选择在工程地质条件稳定老年人照料设施建筑基地应选择在工程地质条件稳定',
- date: '2025-02-15',
- },
- {
- id: '2',
- url: 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg',
- title: '户型2',
- content: '老年人照料设施建筑基地应选择在工程地质条件稳定',
- date: '2025-02-16',
- }
- ],
- });
- const menuList = [
- {
- icon: '/static/home/icon_towel.svg',
- title: '生活用房',
- text: '能力完好老年人',
- },
- {
- icon: '/static/home/icon_badminton.svg',
- title: '文娱与健身用房',
- text: '',
- },
- {
- icon: '/static/home/icon_file.svg',
- title: '康复与医疗用房',
- text: '',
- },
- {
- icon: '/static/home/icon_medical.svg',
- title: '服务管理用房',
- text: '',
- },
- {
- icon: '/static/home/icon_sign.svg',
- title: '交通空间',
- text: '',
- },
- {
- icon: '/static/home/icon_city.svg',
- title: '建筑细节',
- text: '',
- }
- ];
- onShow(() => {
- });
- // 点击轮播
- const onClickSwiper = () => {
- uni.navigateTo({
- url: `/pages/facility/houseDetail/index`,
- });
- }
- // 点击跳转
- const onClickNavigate = (id: string) => {
- uni.navigateTo({
- url: `/pages/facility/houseDetail/index?id=${id}`,
- });
- }
- </script>
- <style lang="scss" scoped>
- .home {
- padding: 0 20rpx;
- &-menu {
- display: flex;
- flex-wrap: wrap;
- margin-top: 20rpx;
- &-item {
- width: calc(50% - 10rpx);
- padding: 20rpx;
- border-radius: $border-radius-base;
- display: flex;
- align-items: center;
- margin-bottom: 20rpx;
- &-right {
- margin-left: 20rpx;
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- }
- &-item:nth-child(odd) {
- background: #F1EFF8;
- margin-right: 10rpx;
- }
- &-item:nth-child(even) {
- background: #FAF3F0;
- margin-left: 10rpx;
- }
- }
- &-house {
- padding: 20rpx;
- background: #FFFFFF;
- border: 2rpx solid $border-color;
- border-radius: $border-radius-base;
- margin-bottom: 20rpx;
- &-title {
- display: flex;
- justify-content: space-between;
- align-items: center;
- font-weight: bold;
- margin-bottom: 20rpx;
- }
- &-item {
- display: flex;
- padding-bottom: 20rpx;
- border-bottom: 2rpx solid $border-color;
- margin-bottom: 20rpx;
- &-right {
- flex: 1;
- margin-left: 20rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- overflow: hidden;
- &-title {
- font-weight: bold;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- &-text {
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- &-date {
- font-size: $font-size-mini;
- color: $gray-color;
- text-align: right;
- }
- }
- }
- &-item:last-child {
- border: none;
- }
- }
- }
- </style>
|