小说小程序前端代码仓库(小程序)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

201 lines
4.6 KiB

  1. <template>
  2. <view class="work-item" @click="handleClick">
  3. <view class="cover-wrapper">
  4. <image class="cover" :src="work.cover || 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain'" mode="aspectFill"></image>
  5. <view class="tag original" v-if="work.isOriginal">原创</view>
  6. </view>
  7. <view class="info">
  8. <text class="title">{{work.title || '兽王进化:从被小萝莉召唤开始'}}</text>
  9. <view class="readers">
  10. <text class="readers-count">达成成就人{{work.readers || '8721'}}</text>
  11. </view>
  12. <!-- 状态标签 -->
  13. <view class="status-wrapper">
  14. <view class="status-tag" :class="statusClass">
  15. {{statusText}}
  16. </view>
  17. <!-- 发布状态标签 -->
  18. <view class="publish-status" v-if="work.publishStatus">
  19. <text>{{work.publishStatus || '发布审核中'}}</text>
  20. </view>
  21. </view>
  22. </view>
  23. <!-- 添加右箭头图标 -->
  24. <!-- <text class="iconfont icon-arrow">&#xe65f;</text> -->
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. props: {
  30. work: {
  31. type: Object,
  32. default: () => ({
  33. title: '兽王进化:从被小萝莉召唤开始',
  34. cover: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain',
  35. readers: '8721',
  36. status: 'ongoing',
  37. publishStatus: '发布审核中',
  38. isOriginal: true
  39. })
  40. },
  41. isManaging: {
  42. type: Boolean,
  43. default: false
  44. }
  45. },
  46. computed: {
  47. statusClass() {
  48. const statusMap = {
  49. 'draft': 'new',
  50. 'ongoing': 'ongoing',
  51. 'completed': 'completed'
  52. };
  53. return statusMap[this.work.status] || 'ongoing';
  54. },
  55. statusText() {
  56. const textMap = {
  57. 'draft': '新建',
  58. 'ongoing': '连载中',
  59. 'completed': '已完结'
  60. };
  61. return textMap[this.work.status] || '连载中';
  62. }
  63. },
  64. methods: {
  65. handleClick() {
  66. if (this.isManaging) {
  67. this.$emit('click');
  68. return;
  69. }
  70. // 跳转到章节列表页面
  71. uni.navigateTo({
  72. url: '/pages_order/novel/chapterList'
  73. });
  74. },
  75. handleDelete() {
  76. this.$emit('delete');
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. .work-item {
  83. width: 100%;
  84. display: flex;
  85. padding: 24rpx 0;
  86. border-bottom: 1rpx solid #f0f0f0;
  87. position: relative;
  88. align-items: center;
  89. .cover-wrapper {
  90. position: relative;
  91. width: 170rpx;
  92. height: 230rpx;
  93. margin-right: 20rpx;
  94. border-radius: 6rpx;
  95. overflow: hidden;
  96. flex-shrink: 0;
  97. .cover {
  98. width: 100%;
  99. height: 100%;
  100. }
  101. .tag {
  102. position: absolute;
  103. top: 0;
  104. left: 0;
  105. font-size: 20rpx;
  106. color: #fff;
  107. padding: 2rpx 8rpx;
  108. &.original {
  109. background-color: #ffa502;
  110. }
  111. }
  112. }
  113. .info {
  114. flex: 1;
  115. display: flex;
  116. flex-direction: column;
  117. .title {
  118. font-size: 28rpx;
  119. color: #333;
  120. font-weight: bold;
  121. margin-bottom: 10rpx;
  122. line-height: 1.3;
  123. overflow: hidden;
  124. text-overflow: ellipsis;
  125. display: -webkit-box;
  126. -webkit-line-clamp: 1;
  127. -webkit-box-orient: vertical;
  128. }
  129. .readers {
  130. margin-top: 20rpx;
  131. .readers-count {
  132. font-size: 24rpx;
  133. color: #999;
  134. }
  135. }
  136. .status-wrapper {
  137. flex-shrink: 0;
  138. display: flex;
  139. align-items: center;
  140. margin-top: 20rpx;
  141. .status-tag {
  142. font-size: 22rpx;
  143. padding: 4rpx 16rpx;
  144. border-radius: 20rpx;
  145. text-align: center;
  146. width: fit-content;
  147. &.new {
  148. background-color: #e8f3ff;
  149. color: #5cadff;
  150. }
  151. &.ongoing {
  152. background-color: #fff7e6;
  153. color: #ff9900;
  154. }
  155. &.completed {
  156. background-color: #f0f9eb;
  157. color: #67c23a;
  158. }
  159. }
  160. .publish-status {
  161. text {
  162. font-size: 22rpx;
  163. color: #666;
  164. background-color: #f5f5f5;
  165. padding: 4rpx 16rpx;
  166. border-radius: 20rpx;
  167. white-space: nowrap;
  168. }
  169. }
  170. }
  171. }
  172. .icon-arrow {
  173. color: #999;
  174. font-size: 16px;
  175. margin-left: 10rpx;
  176. }
  177. }
  178. </style>