detail.wxml 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <!--pages/detail/detail.wxml-->
  2. <view class="container" wx:if="{{!loading && content}}">
  3. <!-- 封面和基本信息 -->
  4. <view class="header">
  5. <view class="cover-wrapper">
  6. <image
  7. class="cover"
  8. src="{{content.coverUrl}}"
  9. mode="aspectFill"
  10. lazy-load="{{true}}"
  11. binderror="onCoverError"
  12. wx:if="{{content.coverUrl}}"
  13. ></image>
  14. <view class="cover-placeholder" wx:else>
  15. <text class="cover-text">{{content.title}}</text>
  16. </view>
  17. </view>
  18. <view class="info">
  19. <view class="title">{{content.title}}</view>
  20. <view class="author">作者:{{content.author || '未知'}}</view>
  21. <view class="meta">
  22. <text class="type">{{content.contentType === 1 ? '电子书' : '听书'}}</text>
  23. <text class="chapters">{{content.totalChapters || 0}}章</text>
  24. <text class="status">{{content.status === 1 ? '连载中' : '已完结'}}</text>
  25. </view>
  26. <view class="publisher" wx:if="{{content.publisher}}">
  27. 出版社:{{content.publisher}}
  28. </view>
  29. </view>
  30. </view>
  31. <!-- 简介 -->
  32. <view class="description">
  33. <view class="section-title">简介</view>
  34. <view class="desc-text">{{content.description || '暂无简介'}}</view>
  35. </view>
  36. <!-- 章节列表 -->
  37. <view class="chapter-section" wx:if="{{chapters.length > 0}}">
  38. <view class="section-title">
  39. <text>目录</text>
  40. <text class="chapter-count">共{{chapters.length}}章</text>
  41. </view>
  42. <view class="chapter-list" wx:if="{{showChapterList}}">
  43. <view
  44. class="chapter-item"
  45. wx:for="{{chapters}}"
  46. wx:key="chapterId"
  47. wx:for-item="chapter"
  48. wx:for-index="index"
  49. data-index="{{index}}"
  50. bindtap="selectChapter"
  51. >
  52. <text class="chapter-number">{{index + 1}}</text>
  53. <text class="chapter-title">{{chapter.chapterTitle || chapter.title}}</text>
  54. <text class="chapter-free" wx:if="{{chapter.isFree === 1}}">免费</text>
  55. </view>
  56. </view>
  57. <view class="chapter-preview" wx:else>
  58. <view
  59. class="chapter-item"
  60. wx:for="{{chapters}}"
  61. wx:key="chapterId"
  62. wx:for-item="chapter"
  63. wx:for-index="index"
  64. data-index="{{index}}"
  65. bindtap="selectChapter"
  66. >
  67. <text class="chapter-number">{{index + 1}}</text>
  68. <text class="chapter-title">{{chapter.chapterTitle || chapter.title}}</text>
  69. <text class="chapter-free" wx:if="{{chapter.isFree === 1}}">免费</text>
  70. </view>
  71. </view>
  72. </view>
  73. <!-- 无章节提示 -->
  74. <view class="no-chapters" wx:if="{{!loading && chapters.length === 0}}">
  75. <text>暂无章节</text>
  76. </view>
  77. <!-- 操作按钮 -->
  78. <view class="actions">
  79. <button class="action-btn" bindtap="toggleBookshelf">
  80. <text class="btn-icon">{{inBookshelf ? '✓' : '+'}}</text>
  81. <text>{{inBookshelf ? '已在书架' : '加入书架'}}</text>
  82. </button>
  83. <button class="action-btn primary" bindtap="startRead">
  84. {{contentType === 1 ? '开始阅读' : '开始听书'}}
  85. </button>
  86. <button class="action-btn" bindtap="toggleChapterList" wx:if="{{chapters.length > 0}}">
  87. {{showChapterList ? '收起' : '目录'}}
  88. </button>
  89. </view>
  90. </view>
  91. <view class="loading" wx:if="{{loading}}">
  92. <text>加载中...</text>
  93. </view>