history.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <view class="history">
  3. <view
  4. v-for="(item,index) in history"
  5. :key="index"
  6. class="item main-left"
  7. >
  8. <view class="cover-image">
  9. <image :src="item.detail.episode.cover_img" />
  10. </view>
  11. <view class="right-box">
  12. <view class="op-group main-right cross-center">
  13. <view class="delete" @click="handleModal(item.id)">删除</view>
  14. <view class="play" @click="handlePlay(item.detail)">播放</view>
  15. </view>
  16. <view class="name">{{ item.detail.episode.name }}</view>
  17. <view class="status-box">
  18. <text class="status">{{ item.detail.episode.status_text }}</text>
  19. <text>共{{ item.detail.episode.total }}集</text>
  20. </view>
  21. <view class="record">
  22. 上次看至 <text>第{{ item.detail.sort }}集</text>
  23. </view>
  24. </view>
  25. </view>
  26. <u-modal
  27. title="确定删除"
  28. :show="modal.show"
  29. :show-cancel-button="true"
  30. @confirm="handleDelete"
  31. />
  32. </view>
  33. </template>
  34. <script>
  35. import UModal from '../../uni_modules/uview-ui/components/u-modal/u-modal'
  36. export default {
  37. components: { UModal },
  38. data() {
  39. return {
  40. limit: 10,
  41. page: 1,
  42. isMore: true,
  43. history: [],
  44. modal: {
  45. show: false,
  46. id: null
  47. }
  48. }
  49. },
  50. computed: {},
  51. methods: {
  52. handlePlay(detail) {
  53. this.$u.route({
  54. url: '/pages/episode/play',
  55. params: {
  56. id: detail.episode.id,
  57. list_id: detail.id
  58. }
  59. })
  60. },
  61. handleModal(id) {
  62. this.modal.id = id
  63. this.modal.show = true
  64. },
  65. handleDelete() {
  66. this.$loading('删除中...')
  67. this.$api.user.episode.deleteRecord(this.modal.id).then(res => {
  68. this.$hideLoading()
  69. this.getHistory()
  70. this.modal.show = false
  71. }).catch(err => {
  72. this.$hideLoading()
  73. })
  74. },
  75. getHistory() {
  76. this.$loading()
  77. this.$api.user.episode.record({ limit: this.limit, page: this.page }).then(res => {
  78. this.$hideLoading()
  79. if (res.data.length) {
  80. this.history = this.history.concat(res.data)
  81. } else {
  82. this.isMore = false
  83. }
  84. })
  85. }
  86. },
  87. onLoad() {
  88. this.getHistory()
  89. },
  90. onReachBottom(e) {
  91. if (!this.isMore) return
  92. this.page += 1
  93. this.getHistory()
  94. }
  95. }
  96. </script>
  97. <style lang="scss" scoped>
  98. .history{
  99. padding: 20rpx;
  100. color: $default-color ;
  101. font-size: 30rpx;
  102. .item{
  103. padding: 30rpx;
  104. border: 1rpx solid $primary-color;
  105. border-radius: 30rpx;
  106. margin-top: 30rpx;
  107. .cover-image{
  108. image{
  109. width: 200rpx;
  110. height: 280rpx;
  111. border-radius: 16rpx;
  112. }
  113. }
  114. .right-box{
  115. flex: 1;
  116. margin-left: 20rpx;
  117. .op-group{
  118. .delete{
  119. border: 1rpx solid #FB3651;
  120. color: #FB3651;
  121. border-radius: 30rpx;
  122. width: 140rpx;
  123. padding: 10rpx;
  124. text-align: center;
  125. margin-right: 30rpx;
  126. }
  127. .play{
  128. background: linear-gradient(90deg, #FF74B9,#6EEBE8);
  129. color: $default-color;
  130. border-radius: 30rpx;
  131. width: 140rpx;
  132. padding: 10rpx;
  133. text-align: center;
  134. }
  135. }
  136. .name{
  137. font-size: 38rpx;
  138. font-weight: 600;
  139. margin-bottom: 10rpx;
  140. margin-top: 50rpx;
  141. }
  142. .status-box{
  143. font-size: 28rpx;
  144. margin-bottom: 10rpx;
  145. color: $info-color;
  146. .status{
  147. color: $primary-color;
  148. margin-right: 14rpx;
  149. }
  150. }
  151. .record{
  152. text{
  153. color: #FB3651;
  154. }
  155. }
  156. }
  157. }
  158. }
  159. </style>