jdIndex.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view class="app-content">
  3. <view class="book-banner">
  4. <image v-if="showBanner" class="slide" :src="`${constant.imgUrl}/book/banner5.png`" mode="aspectFit"></image>
  5. </view>
  6. <view class="book-content">
  7. <view v-for="(item, index) in book" :key="index" class="book-section">
  8. <view class="category">
  9. <image class="icon" :src="`${constant.imgUrl}${item.icon}`"></image>
  10. <text class="category-text">{{item.class}}</text>
  11. </view>
  12. <view class="book-list">
  13. <view v-for="(it, idx) in item.list"
  14. :key="idx"
  15. class="book-item"
  16. :class="it.read ? 'read' : 'unread'"
  17. @click="goDetail(it)">
  18. <text :class="[it.style == 'red' ? 'red-title' : 'book-title']">{{it.title}}</text>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import { getJdBookList} from "@/api/book";
  27. export default {
  28. name: "jdIndex",
  29. components: {},
  30. mixins: [],
  31. data() {
  32. return {
  33. book: [],
  34. showBanner: true
  35. };
  36. },
  37. onShareAppMessage(res) {
  38. return {
  39. title: '销花宝教学视频(基地)',
  40. desc: "图文视频教学,带您快速上手",
  41. imageUrl: `${this.$constant.imgUrl}/logo6.png`,
  42. path: "admin/book/jdIndex",
  43. }
  44. },
  45. onLoad() {
  46. let that = this
  47. getJdBookList().then(res => {
  48. that.book = res.data.list
  49. })
  50. },
  51. methods: {
  52. init(){
  53. },
  54. goDetail(item){
  55. // 设置为已读状态
  56. item.read = true;
  57. // #ifdef MP-WEIXIN
  58. this.$util.pageTo({url: '/admin/book/detail',query:{id:item.id}})
  59. // #endif
  60. // #ifdef APP-PLUS
  61. this.$util.pageTo({url: '/admin/book/detail',query:{id:item.id}})
  62. // #endif
  63. }
  64. }
  65. };
  66. </script>
  67. <style lang="scss" scoped>
  68. .app-content {
  69. min-height: 100vh;
  70. background-color: #f5f6fa;
  71. .book-banner {
  72. width: 750upx;
  73. height: 524upx;
  74. box-shadow: 0 4upx 12upx rgba(0,0,0,0.1);
  75. .slide {
  76. width: 750upx;
  77. height: 524upx;
  78. transition: opacity 0.3s ease;
  79. }
  80. }
  81. .book-content {
  82. padding: 20upx 16upx;
  83. .book-section {
  84. background: white;
  85. border-radius: 16upx;
  86. padding: 24upx 16upx;
  87. margin-bottom: 24upx;
  88. box-shadow: 0 2upx 8upx rgba(0,0,0,0.05);
  89. .category {
  90. display: flex;
  91. align-items: center;
  92. padding-bottom: 20upx;
  93. border-bottom: 2upx solid #f0f0f0;
  94. margin-bottom: 16upx;
  95. .icon {
  96. width: 40upx;
  97. height: 40upx;
  98. margin-right: 16upx;
  99. }
  100. .category-text {
  101. font-size: 36upx;
  102. font-weight: 600;
  103. color: #333;
  104. }
  105. }
  106. .book-list {
  107. .book-item {
  108. position: relative;
  109. padding: 24upx 20upx;
  110. margin: 12upx 0;
  111. border-radius: 8upx;
  112. background: #f8f9fb;
  113. display: flex;
  114. align-items: center;
  115. .book-title {
  116. font-size: 32upx;
  117. color: #2c3e50;
  118. line-height: 1.4;
  119. }
  120. .red-title{
  121. font-size: 32upx;
  122. line-height: 1.4;
  123. font-weight: bold;
  124. color: #f00;
  125. }
  126. &::before {
  127. content: '';
  128. display: inline-block;
  129. width: 28upx;
  130. height: 28upx;
  131. background: #008000;
  132. border-radius: 50%;
  133. margin-right: 16upx;
  134. flex-shrink: 0;
  135. }
  136. // 未读样式
  137. &.unread {
  138. .book-title {
  139. font-weight: 500;
  140. color: #303133;
  141. }
  142. &::before {
  143. background: #2979ff;
  144. }
  145. }
  146. // 已读样式
  147. &.read {
  148. .book-title,
  149. .red-title {
  150. color: #909399;
  151. font-weight: normal;
  152. }
  153. &::before {
  154. background: #c0c4cc;
  155. }
  156. }
  157. }
  158. }
  159. }
  160. }
  161. }
  162. </style>