product-content.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view class="detail-content">
  3. <!-- Tab 1 Content: Product Details -->
  4. <view v-show="currentTab === 0">
  5. <!-- Basic Info List -->
  6. <view class="section-title">基本信息</view>
  7. <view class="info-list">
  8. <view class="info-item"><text class="label">书名:</text><text>{{ product.title }}</text></view>
  9. <view class="info-item"><text class="label">作者:</text><text>{{ product.authorFull }}</text></view>
  10. <view class="info-item"><text class="label">出版社:</text><text>{{ product.publisher }}</text></view>
  11. <view class="info-item"><text class="label">出版日期:</text><text>{{ product.publishDate }}</text></view>
  12. <view class="info-item"><text class="label">ISBN:</text><text>{{ product.isbn }}</text></view>
  13. <view class="info-item"><text class="label">纸张:</text><text>胶版纸</text></view>
  14. <view class="info-item"><text class="label">开本:</text><text>16开</text></view>
  15. </view>
  16. <u-gap height="30"></u-gap>
  17. <!-- Intro Section -->
  18. <view class="section-title">内容简介</view>
  19. <view class="text-content">
  20. {{ product.intro }}
  21. </view>
  22. <u-gap height="30"></u-gap>
  23. <!-- Catalog Section -->
  24. <view class="section-title">目录</view>
  25. <view class="text-content">
  26. {{ product.catalog }}
  27. </view>
  28. <!-- Product Tips Component -->
  29. <ProductTips :content="tipsContent"></ProductTips>
  30. </view>
  31. <!-- Tab 2 Content: Related Books -->
  32. <view v-show="currentTab === 1">
  33. <RelatedBooks :books="relatedBooksList" @click="onBookClick"></RelatedBooks>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import ProductTips from '../product-tips/index.vue'
  39. import RelatedBooks from '../related-books/index.vue'
  40. export default {
  41. name: 'ProductContent',
  42. components: {
  43. ProductTips,
  44. RelatedBooks
  45. },
  46. props: {
  47. currentTab: {
  48. type: Number,
  49. default: 0
  50. },
  51. product: {
  52. type: Object,
  53. default: () => ({})
  54. },
  55. tipsContent: {
  56. type: Array,
  57. default: () => []
  58. },
  59. relatedBooksList: {
  60. type: Array,
  61. default: () => []
  62. }
  63. },
  64. methods: {
  65. onBookClick(book) {
  66. this.$emit('bookClick', book);
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .detail-content {
  73. background: #fff;
  74. padding: 30rpx;
  75. min-height: 500rpx;
  76. border-radius: 24rpx 24rpx 0 0; /* Added based on context */
  77. margin-top: 20rpx; /* Added based on context */
  78. .section-title {
  79. font-size: 32rpx;
  80. font-weight: bold;
  81. margin-bottom: 30rpx;
  82. color: #333;
  83. position: relative;
  84. padding-left: 20rpx;
  85. &:before {
  86. content: '';
  87. position: absolute;
  88. left: 0;
  89. top: 8rpx;
  90. width: 6rpx;
  91. height: 30rpx;
  92. background: #38C248;
  93. border-radius: 4rpx;
  94. }
  95. }
  96. .info-list {
  97. .info-item {
  98. display: flex;
  99. margin-bottom: 20rpx;
  100. font-size: 28rpx;
  101. line-height: 1.5;
  102. .label {
  103. color: #999;
  104. width: 150rpx;
  105. flex-shrink: 0;
  106. }
  107. text:last-child {
  108. color: #333;
  109. flex: 1;
  110. }
  111. }
  112. }
  113. .text-content {
  114. font-size: 28rpx;
  115. color: #666;
  116. line-height: 1.8;
  117. text-align: justify;
  118. }
  119. }
  120. </style>