IntroBlock.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <view :class="[
  3. 'intro-block',
  4. small ? 'small' : '',
  5. ]">
  6. <HomeTitle v-if="title" :title="title" />
  7. <view class="desc no-indent">
  8. <view v-if="address" class="navigation">
  9. <view class="address">
  10. <text class="iconfont icon-navigation"></text>
  11. <text>{{ address }}</text>
  12. </view>
  13. <view class="link" @click="emit('navTo')">
  14. 去这里 <text class="iconfont icon-go"></text>
  15. </view>
  16. </view>
  17. <view
  18. v-for="(it, k) in descItems"
  19. :key="k"
  20. :class="['entry',Boolean(it.value)?'':'hidden']"
  21. >
  22. <view class="label">{{ it.label }}</view>
  23. <view class="value">{{ it.value }}</view>
  24. </view>
  25. <slot name="lastDesc" />
  26. </view>
  27. <slot />
  28. </view>
  29. </template>
  30. <script setup lang="ts">
  31. import HomeTitle from '@/pages/parts/HomeTitle.vue';
  32. import type { PropType } from 'vue';
  33. const props = defineProps({
  34. title: {
  35. type: String,
  36. default: ''
  37. },
  38. address: {
  39. type: String,
  40. default: ''
  41. },
  42. descItems: {
  43. type: Array as PropType<Array<{ label: string, value: any }>>,
  44. default: () => []
  45. },
  46. small: {
  47. type: Boolean,
  48. default: false
  49. }
  50. })
  51. const emit = defineEmits([
  52. "navTo"
  53. ])
  54. </script>
  55. <style lang="scss">
  56. .intro-block {
  57. margin-bottom: 38rpx;
  58. &.small {
  59. margin-bottom: 0rpx;
  60. .desc{
  61. line-height: inherit;
  62. padding-bottom: 10rpx;
  63. }
  64. }
  65. .entry {
  66. display: flex;
  67. flex-direction: row;
  68. justify-content: space-between;
  69. margin-bottom: 10rpx;
  70. &.hidden {
  71. display: none;
  72. }
  73. .label {
  74. color: #666666;
  75. font-weight: 400;
  76. font-size: 30rpx;
  77. flex-shrink: 0;
  78. }
  79. .value {
  80. font-size: 30rpx;
  81. color: #312520;
  82. font-weight: 400;
  83. text-align: right;
  84. max-width: 500rpx;
  85. flex-shrink: 1;
  86. }
  87. }
  88. .sub-title{
  89. margin-left: 20rpx;
  90. margin-top: 10rpx;
  91. font-size: 35rpx;
  92. font-weight: 600;
  93. }
  94. .desc{
  95. padding: 30rpx 0;
  96. }
  97. .navigation{
  98. display: flex;
  99. align-items: center;
  100. margin-bottom: 28rpx;
  101. .address{
  102. flex:1;
  103. height: auto;
  104. background: #F9F6EB;
  105. border-radius: 28rpx;
  106. font-weight: 400;
  107. font-size: 24rpx;
  108. color: #000000;
  109. line-height: 48rpx;
  110. padding-left: 30rpx;
  111. display: flex;
  112. align-items: center;
  113. text.iconfont{
  114. display: inline-block;
  115. font-size: 36rpx;
  116. margin-right: 8rpx;
  117. }
  118. }
  119. .link{
  120. margin-left: 20rpx;
  121. color:#FF8719;
  122. }
  123. }
  124. }
  125. </style>