ServiceIntroCard.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <section class="service-intro-card bg-white">
  3. <header
  4. v-if="showHeader"
  5. class="service-intro-header bg-white flex flex-(items-center justify-between)"
  6. >
  7. <h5 class="service-intro-title">
  8. <slot name="title">{{ title }}</slot>
  9. </h5>
  10. <div class="service-intro-header-actions">
  11. <slot name="header-actions">
  12. <span class="header-action-item">
  13. <span class="header-action-item-text">查看服务介绍</span>
  14. <van-icon name="arrow" />
  15. </span>
  16. </slot>
  17. </div>
  18. </header>
  19. <main
  20. class="service-intro-main flex flex-(col items-center justify-center)"
  21. >
  22. <slot name="default">
  23. <p class="service-name-text">{{ serviceNameText }}</p>
  24. <p class="service-desc-text">{{ serviceDescText }}</p>
  25. <div class="action-group">
  26. <van-button
  27. class="action-button plain"
  28. type="primary"
  29. plain
  30. @click="leftButtonClick"
  31. v-if="plainButtonShow"
  32. >
  33. {{ plainButtonText }}
  34. </van-button>
  35. <van-button
  36. class="action-button"
  37. type="primary"
  38. @click="rightButtonClick"
  39. v-if="confirmButtonShow"
  40. >
  41. {{ confirmButtonText }}
  42. </van-button>
  43. </div>
  44. </slot>
  45. </main>
  46. </section>
  47. </template>
  48. <script>
  49. import { Icon, Button } from 'vant'
  50. export default {
  51. name: 'ServiceIntroCard',
  52. components: {
  53. [Icon.name]: Icon,
  54. [Button.name]: Button
  55. },
  56. props: {
  57. title: {
  58. type: String,
  59. default: '标题'
  60. },
  61. showHeader: {
  62. type: Boolean,
  63. default: false
  64. },
  65. serviceNameText: {
  66. type: String,
  67. default: '权限名称'
  68. },
  69. serviceDescText: {
  70. type: String,
  71. default: '权限介绍'
  72. },
  73. plainButtonShow: {
  74. type: Boolean,
  75. default: false
  76. },
  77. plainButtonText: {
  78. type: String,
  79. default: '了解详情'
  80. },
  81. confirmButtonShow: {
  82. type: Boolean,
  83. default: true
  84. },
  85. confirmButtonText: {
  86. type: String,
  87. default: '免费体验'
  88. }
  89. },
  90. created() {},
  91. methods: {
  92. leftButtonClick() {
  93. this.$emit('leftButtonClick')
  94. },
  95. rightButtonClick() {
  96. this.$emit('rightButtonClick')
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. .service-intro-card {
  103. border-radius: 8px;
  104. overflow: hidden;
  105. border: 1px solid rgba(0, 0, 0, 0.05);
  106. box-shadow: 0px 2px 8px 0px rgba(54, 147, 179, 0.05);
  107. }
  108. .service-intro-header {
  109. padding: 8px 16px;
  110. min-height: 36px;
  111. border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  112. background: linear-gradient(270deg, #f1d090 0%, #fae7ca 100%);
  113. }
  114. .service-intro-main {
  115. padding: 8px 24px 16px;
  116. background: linear-gradient(180deg, #fff 0%, #f4f4f4 100%);
  117. }
  118. .service-intro-title {
  119. font-size: 14px;
  120. line-height: 20px;
  121. font-weight: normal;
  122. }
  123. .service-name-text {
  124. font-size: 18px;
  125. font-weight: 700;
  126. line-height: 26px;
  127. }
  128. .service-desc-text {
  129. margin: 8px 0;
  130. color: #5f5e64;
  131. font-size: 14px;
  132. line-height: 20px;
  133. text-align: center;
  134. }
  135. .action-group {
  136. .action-button {
  137. height: 32px;
  138. font-size: 16px;
  139. &:not(:first-of-type) {
  140. margin-left: 24px;
  141. }
  142. }
  143. }
  144. </style>