history.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. history: [],
  41. modal: {
  42. show: false,
  43. id: null
  44. }
  45. }
  46. },
  47. computed: {},
  48. methods: {
  49. handlePlay(detail) {
  50. this.$u.route({
  51. url: '/pages/episode/play',
  52. params: {
  53. id: detail.episode.id,
  54. list_id: detail.id
  55. }
  56. })
  57. },
  58. handleModal(id) {
  59. this.modal.id = id
  60. this.modal.show = true
  61. },
  62. handleDelete() {
  63. this.$loading('删除中...')
  64. this.$api.user.episode.deleteRecord(this.modal.id).then(res => {
  65. this.$hideLoading()
  66. this.getHistory()
  67. this.modal.show = false
  68. }).catch(err => {
  69. this.$hideLoading()
  70. })
  71. },
  72. getHistory() {
  73. this.$loading()
  74. this.$api.user.episode.record().then(res => {
  75. this.$hideLoading()
  76. this.history = res.data
  77. })
  78. }
  79. },
  80. onLoad() {
  81. this.getHistory()
  82. }
  83. }
  84. </script>
  85. <style lang="scss" scoped>
  86. .history{
  87. padding: 20rpx;
  88. color: $default-color ;
  89. font-size: 30rpx;
  90. .item{
  91. padding: 30rpx;
  92. border: 1rpx solid $primary-color;
  93. border-radius: 30rpx;
  94. margin-top: 30rpx;
  95. .cover-image{
  96. image{
  97. width: 200rpx;
  98. height: 280rpx;
  99. border-radius: 16rpx;
  100. }
  101. }
  102. .right-box{
  103. flex: 1;
  104. margin-left: 20rpx;
  105. .op-group{
  106. .delete{
  107. border: 1rpx solid #FB3651;
  108. color: #FB3651;
  109. border-radius: 30rpx;
  110. width: 140rpx;
  111. padding: 10rpx;
  112. text-align: center;
  113. margin-right: 30rpx;
  114. }
  115. .play{
  116. background: linear-gradient(90deg, #FF74B9,#6EEBE8);
  117. color: $default-color;
  118. border-radius: 30rpx;
  119. width: 140rpx;
  120. padding: 10rpx;
  121. text-align: center;
  122. }
  123. }
  124. .name{
  125. font-size: 38rpx;
  126. font-weight: 600;
  127. margin-bottom: 10rpx;
  128. margin-top: 50rpx;
  129. }
  130. .status-box{
  131. font-size: 28rpx;
  132. margin-bottom: 10rpx;
  133. color: $info-color;
  134. .status{
  135. color: $primary-color;
  136. margin-right: 14rpx;
  137. }
  138. }
  139. .record{
  140. text{
  141. color: #FB3651;
  142. }
  143. }
  144. }
  145. }
  146. }
  147. </style>