index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <view class="home">
  3. <view>
  4. <wd-drop-menu>
  5. <wd-drop-menu-item :options="state.addressList" v-model="state.address" />
  6. </wd-drop-menu>
  7. </view>
  8. <view>
  9. <wd-swiper :autoplay="true" :list="state.swiperList" @click="onClickSwiper" />
  10. </view>
  11. <view class="home-menu">
  12. <view class="home-menu-item" v-for="(item, index) in menuList" :key="index">
  13. <wd-img width="60rpx" height="60rpx" :src="item.icon" />
  14. <view class="home-menu-item-right">
  15. <view style="font-weight: 400;">
  16. {{ item.title }}
  17. </view>
  18. <view style="font-size: 24rpx;margin-top: 10rpx;">
  19. {{ item.text }}
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="home-house">
  25. <view class="home-house-title">
  26. <view>
  27. 最新发布
  28. </view>
  29. <wd-icon name="arrow-right" />
  30. </view>
  31. <view class="home-house-item" v-for="(item, index) in state.houseList" :key="index"
  32. @click="onClickNavigate(item.id)">
  33. <wd-img width="220rpx" height="180rpx" radius="8rpx" mode="aspectFill" :src="item.url" />
  34. <view class="home-house-item-right">
  35. <view class="home-house-item-right-title">
  36. {{ item.title }}
  37. </view>
  38. <view class="home-house-item-right-text">
  39. {{ item.content }}
  40. </view>
  41. <view class="home-house-item-right-date">
  42. {{ item.date }}
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <script lang="ts" setup>
  50. import { reactive } from 'vue';
  51. import { onShow } from '@dcloudio/uni-app';
  52. interface State {
  53. address: string,
  54. addressList: {
  55. label: string,
  56. value: string,
  57. }[],
  58. swiperList: string[],
  59. houseList: {
  60. id: string,
  61. url: string,
  62. title: string,
  63. content: string,
  64. date: string,
  65. }[],
  66. };
  67. const state: State = reactive({
  68. address: '1',
  69. addressList: [
  70. {
  71. label: '太保家园·郑州国际颐养社区',
  72. value: '1',
  73. },
  74. {
  75. label: '太保家园·郑州国际颐养社区2',
  76. value: '2',
  77. },
  78. {
  79. label: '太保家园·郑州国际颐养社区3',
  80. value: '3',
  81. }
  82. ],
  83. swiperList: [
  84. 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg',
  85. 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg',
  86. ],
  87. houseList: [
  88. {
  89. id: '1',
  90. url: 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg',
  91. title: '户型1户型1户型1户型1户型1户型1户型1户型1户型1户型1户型1',
  92. content: '老年人照料设施建筑基地应选择在工程地质条件稳定老年人照料设施建筑基地应选择在工程地质条件稳定老年人照料设施建筑基地应选择在工程地质条件稳定',
  93. date: '2025-02-15',
  94. },
  95. {
  96. id: '2',
  97. url: 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg',
  98. title: '户型2',
  99. content: '老年人照料设施建筑基地应选择在工程地质条件稳定',
  100. date: '2025-02-16',
  101. }
  102. ],
  103. });
  104. const menuList = [
  105. {
  106. icon: '/static/home/icon_towel.svg',
  107. title: '生活用房',
  108. text: '能力完好老年人',
  109. },
  110. {
  111. icon: '/static/home/icon_badminton.svg',
  112. title: '文娱与健身用房',
  113. text: '',
  114. },
  115. {
  116. icon: '/static/home/icon_file.svg',
  117. title: '康复与医疗用房',
  118. text: '',
  119. },
  120. {
  121. icon: '/static/home/icon_medical.svg',
  122. title: '服务管理用房',
  123. text: '',
  124. },
  125. {
  126. icon: '/static/home/icon_sign.svg',
  127. title: '交通空间',
  128. text: '',
  129. },
  130. {
  131. icon: '/static/home/icon_city.svg',
  132. title: '建筑细节',
  133. text: '',
  134. }
  135. ];
  136. onShow(() => {
  137. });
  138. // 点击轮播
  139. const onClickSwiper = () => {
  140. uni.navigateTo({
  141. url: `/pages/facility/houseDetail/index`,
  142. });
  143. }
  144. // 点击跳转
  145. const onClickNavigate = (id: string) => {
  146. uni.navigateTo({
  147. url: `/pages/facility/houseDetail/index?id=${id}`,
  148. });
  149. }
  150. </script>
  151. <style lang="scss" scoped>
  152. .home {
  153. padding: 0 20rpx;
  154. &-menu {
  155. display: flex;
  156. flex-wrap: wrap;
  157. margin-top: 20rpx;
  158. &-item {
  159. width: calc(50% - 10rpx);
  160. padding: 20rpx;
  161. border-radius: $border-radius-base;
  162. display: flex;
  163. align-items: center;
  164. margin-bottom: 20rpx;
  165. &-right {
  166. margin-left: 20rpx;
  167. display: flex;
  168. flex-direction: column;
  169. justify-content: center;
  170. }
  171. }
  172. &-item:nth-child(odd) {
  173. background: #F1EFF8;
  174. margin-right: 10rpx;
  175. }
  176. &-item:nth-child(even) {
  177. background: #FAF3F0;
  178. margin-left: 10rpx;
  179. }
  180. }
  181. &-house {
  182. padding: 20rpx;
  183. background: #FFFFFF;
  184. border: 2rpx solid $border-color;
  185. border-radius: $border-radius-base;
  186. margin-bottom: 20rpx;
  187. &-title {
  188. display: flex;
  189. justify-content: space-between;
  190. align-items: center;
  191. font-weight: bold;
  192. margin-bottom: 20rpx;
  193. }
  194. &-item {
  195. display: flex;
  196. padding-bottom: 20rpx;
  197. border-bottom: 2rpx solid $border-color;
  198. margin-bottom: 20rpx;
  199. &-right {
  200. flex: 1;
  201. margin-left: 20rpx;
  202. display: flex;
  203. flex-direction: column;
  204. justify-content: space-between;
  205. overflow: hidden;
  206. &-title {
  207. font-weight: bold;
  208. white-space: nowrap;
  209. overflow: hidden;
  210. text-overflow: ellipsis;
  211. }
  212. &-text {
  213. display: -webkit-box;
  214. -webkit-box-orient: vertical;
  215. -webkit-line-clamp: 2;
  216. overflow: hidden;
  217. text-overflow: ellipsis;
  218. }
  219. &-date {
  220. font-size: $font-size-mini;
  221. color: $gray-color;
  222. text-align: right;
  223. }
  224. }
  225. }
  226. &-item:last-child {
  227. border: none;
  228. }
  229. }
  230. }
  231. </style>