health-knowledge-popup.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <view class="kb-popup-overlay" v-if="visible" @tap="close">
  3. <view class="kb-popup-content" @tap.stop>
  4. <view class="kb-popup-header">
  5. <text class="kb-popup-title">{{ data.itemName || '' }}</text>
  6. <text class="kb-popup-close" @tap="close">×</text>
  7. </view>
  8. <scroll-view class="kb-popup-body" scroll-y>
  9. <view class="kb-field" v-if="data.category">
  10. <text class="kb-field-label">分类</text>
  11. <text class="kb-field-value">{{ data.category }}</text>
  12. </view>
  13. <view class="kb-field" v-if="data.normalRange">
  14. <text class="kb-field-label">正常范围</text>
  15. <text class="kb-field-value">{{ data.normalRange }}</text>
  16. </view>
  17. <view class="kb-field" v-if="data.description">
  18. <text class="kb-field-label">说明</text>
  19. <text class="kb-field-value">{{ data.description }}</text>
  20. </view>
  21. <view class="kb-field" v-if="data.suggestion">
  22. <text class="kb-field-label">相关建议</text>
  23. <text class="kb-field-value">{{ data.suggestion }}</text>
  24. </view>
  25. <view class="kb-empty" v-if="!data.itemName">
  26. <text>暂无相关说明</text>
  27. </view>
  28. </scroll-view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. props: {
  35. visible: { type: Boolean, default: false },
  36. data: { type: Object, default: function() { return {} } }
  37. },
  38. methods: {
  39. close: function() {
  40. this.$emit('close')
  41. }
  42. }
  43. }
  44. </script>
  45. <style scoped>
  46. .kb-popup-overlay {
  47. position: fixed;
  48. top: 0; left: 0; right: 0; bottom: 0;
  49. background: rgba(0,0,0,0.5);
  50. z-index: 999;
  51. display: flex;
  52. align-items: center;
  53. justify-content: center;
  54. }
  55. .kb-popup-content {
  56. width: 600rpx;
  57. max-height: 70vh;
  58. background: #fff;
  59. border-radius: 24rpx;
  60. overflow: hidden;
  61. display: flex;
  62. flex-direction: column;
  63. }
  64. .kb-popup-header {
  65. display: flex;
  66. justify-content: space-between;
  67. align-items: center;
  68. padding: 30rpx 30rpx 20rpx;
  69. border-bottom: 1rpx solid #f0f0f0;
  70. }
  71. .kb-popup-title {
  72. font-size: 32rpx;
  73. font-weight: 600;
  74. color: #333;
  75. flex: 1;
  76. word-break: break-all;
  77. }
  78. .kb-popup-close {
  79. font-size: 40rpx;
  80. color: #999;
  81. padding: 0 10rpx;
  82. }
  83. .kb-popup-body {
  84. padding: 20rpx 30rpx 30rpx;
  85. max-height: 50vh;
  86. }
  87. .kb-field {
  88. margin-bottom: 20rpx;
  89. }
  90. .kb-field-label {
  91. font-size: 26rpx;
  92. color: #999;
  93. display: block;
  94. margin-bottom: 6rpx;
  95. }
  96. .kb-field-value {
  97. font-size: 28rpx;
  98. color: #333;
  99. line-height: 1.6;
  100. word-break: break-all;
  101. white-space: normal;
  102. }
  103. .kb-empty {
  104. text-align: center;
  105. color: #ccc;
  106. padding: 40rpx 0;
  107. font-size: 28rpx;
  108. }
  109. </style>