audioPlayListSet.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view class="audio-play-list-set-page" @click.self="closeAttention">
  3. <view class="opt-intro-box" @click.stop="showAttention=true">
  4. <image class="icon" src="./static/icon-1.png" mode="aspectFill"/>
  5. <text>操作说明</text>
  6. </view>
  7. <view class="item" v-for="item in list" :key="item.report_chapter_id">
  8. <view>{{item.report_chapter_type_name}}</view>
  9. <switch :checked="item.is_close==0?true:false" color="#E3B377" style="transform:scale(0.9)" @change="handleStatusChange(item)"/>
  10. </view>
  11. <view class="attention-box" v-if="showAttention">
  12. <view>
  13. <text>品种</text>
  14. <text style="color:#E3B377">开启</text>
  15. <text>,表示添加到待播放列表;</text>
  16. </view>
  17. <view>
  18. <text>品种</text>
  19. <text style="color:#E3B377">关闭</text>
  20. <text>,表示从待播放列表中清除;</text>
  21. </view>
  22. <view>您可以根据自己关注的品种进行选择~</view>
  23. <image class="close-icon" src="./static/close2.png" mode="aspectFill" @click="closeAttention"/>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import {apiReportDetail,apiReportChapterAudioSet} from '@/api/report'
  29. export default {
  30. data() {
  31. return {
  32. id:0,
  33. list:[],
  34. showAttention:false,
  35. isSet:false,//是否更改过设置
  36. }
  37. },
  38. onLoad(opt){
  39. this.id=opt.reportId||0
  40. this.getDetail()
  41. const show=uni.getStorageSync('showAttention')||'';
  42. if(!show){
  43. this.showAttention=true
  44. }
  45. },
  46. onUnload(){
  47. if(this.isSet){
  48. uni.$emit('chapterAudioSet')
  49. }
  50. },
  51. methods: {
  52. getDetail(){
  53. apiReportDetail({report_id:Number(this.id)}).then(res=>{
  54. if(res.code===200){
  55. this.list=res.data.report_chapter_list||[]
  56. }
  57. })
  58. },
  59. closeAttention(){
  60. uni.setStorageSync('showAttention', 'true');
  61. this.showAttention=false
  62. },
  63. handleStatusChange(item){
  64. console.log(item);
  65. this.isSet=true
  66. apiReportChapterAudioSet({
  67. type_id:item.type_id,
  68. is_close:item.is_close==0?1:0
  69. }).then(res=>{
  70. if(res.code==200){
  71. item.is_close=item.is_close==0?1:0
  72. }
  73. })
  74. }
  75. },
  76. }
  77. </script>
  78. <style lang="scss" scoped>
  79. .audio-play-list-set-page{
  80. .item{
  81. display: flex;
  82. align-items: center;
  83. justify-content: space-between;
  84. border-bottom: 1px solid #e5e5e5;
  85. padding: 25rpx 34rpx;
  86. }
  87. .attention-box{
  88. position: fixed;
  89. top: 300rpx;
  90. right: 40rpx;
  91. z-index: 99;
  92. box-shadow: 0px 0px 10rpx 4rpx rgba(0, 0, 0, 0.16);
  93. background-color: #fff;
  94. padding: 20rpx 54rpx 20rpx 20rpx;
  95. border-radius: 4rpx;
  96. .close-icon{
  97. position: absolute;
  98. top: 50%;
  99. right: 20rpx;
  100. transform: translateY(-50%);
  101. width: 24rpx;
  102. height: 24rpx;
  103. }
  104. &::after{
  105. content: '';
  106. display: block;
  107. width: 0;
  108. height: 0;
  109. border: 10rpx solid transparent;
  110. border-bottom-color: #fff;
  111. position: absolute;
  112. top: -20rpx;
  113. right: 20rpx;
  114. }
  115. }
  116. .opt-intro-box{
  117. display: flex;
  118. justify-content: flex-end;
  119. padding-right: 34rpx;
  120. padding-top: 20rpx;
  121. padding-bottom: 20rpx;
  122. border-bottom: 1px solid #e5e5e5;
  123. .icon{
  124. width: 40rpx;
  125. height: 40rpx;
  126. }
  127. }
  128. }
  129. </style>