小说小程序前端代码仓库(小程序)
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.

194 lines
4.2 KiB

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