list.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <view class="app-container">
  3. <!-- 背景 -->
  4. <view class="bg" :style="{ 'background': `url(${data.channelPic})no-repeat 100% / cover` }" />
  5. <!-- 跳转App -->
  6. <open-app @open="open" />
  7. <!-- 详情 -->
  8. <view class="detail">
  9. <img :src="data.channelPic" />
  10. <view class="content">
  11. <view class="title">{{ data.aliasName }}</view>
  12. <view class="num">
  13. <text class="tips">{{ data.channelTypeText }}</text>
  14. <text>{{ data.count }}个{{ data.channelTypeText }}</text>
  15. </view>
  16. <view class="info">
  17. <text v-if="data.description">{{ data.description }}</text>
  18. <text v-else>暂无描述</text>
  19. <uni-icons />
  20. </view>
  21. </view>
  22. </view>
  23. <!-- 列表 -->
  24. <view class="list" v-if="list.length > 0">
  25. <view class="item" v-for="item in list" :key="item.audioId" @click="open">
  26. <img class="logo" :src="item.audioPic" />
  27. <view class="title">
  28. <text>{{ item.audioName }}</text>
  29. <text>{{ item.audioInfo }}</text>
  30. </view>
  31. <img class="play" src="@/static/share/playbtn.png" @click.stop="open" />
  32. </view>
  33. </view>
  34. <view class="no-data" v-else>
  35. <img src="@/static/share/empty.png" style="width: 240rpx; height:240rpx" />
  36. <view style="">暂无频道内容哦</view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import { channelAudioPage, channelDetail } from '@/api/share'
  42. export default {
  43. data() {
  44. return {
  45. form: {
  46. pageNum: 1,
  47. pageSize: 10
  48. },
  49. list: [],
  50. total: 0,
  51. data: {}
  52. }
  53. },
  54. onLoad(e) {
  55. if (e.userId) {
  56. this.form.userId = e.userId
  57. this.form.channelId = e.channelId
  58. // 频道详情
  59. channelDetail({
  60. channelId: e.channelId,
  61. userId: e.userId
  62. }).then(res => {
  63. if (res.data.code === 0) {
  64. this.data = res.data
  65. }
  66. })
  67. this.getList()
  68. }
  69. },
  70. onReachBottom() {
  71. if (this.list.length < this.total) {
  72. this.form.pageSize += 10
  73. this.getList()
  74. }
  75. },
  76. methods: {
  77. // 列表
  78. getList() {
  79. channelAudioPage(this.form).then(res => {
  80. if (res.data.code === 0) {
  81. this.list = res.data.records
  82. this.total = res.data.total
  83. }
  84. })
  85. },
  86. // 下一页
  87. // getNav(item) {
  88. // let url = this.data.channelType === 1 || this.data.channelType === 3 ? `/pages/share/controls?channelType=${this.data.channelType}&audioId=${item.audioId}` : `/pages/share/detail?audioId=${item.audioId}`
  89. // uni.navigateTo({
  90. // url: url
  91. // })
  92. // },
  93. // 打开app
  94. open() {
  95. this.openApp(`?page=/mobile/channelSinglePage&channel=${this.data.channelId}&channelId=${this.data.id}`)
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .bg {
  102. position: absolute;
  103. top: 0;
  104. left: 0;
  105. width: 100%;
  106. height: 450rpx;
  107. filter: brightness(0.5) blur(16px);
  108. z-index: -1;
  109. }
  110. .detail {
  111. display: flex;
  112. margin-top: 48rpx;
  113. img {
  114. width: 240rpx;
  115. height: 240rpx;
  116. border-radius: 16rpx;
  117. }
  118. .content {
  119. width: calc(100% - 272rpx);
  120. margin-left: 32rpx;
  121. display: flex;
  122. flex-direction: column;
  123. justify-content: space-between;
  124. .title {
  125. font-weight: 600;
  126. margin-bottom: 10rpx;
  127. overflow: hidden;
  128. text-overflow: ellipsis;
  129. white-space: nowrap;
  130. }
  131. .num {
  132. display: flex;
  133. flex-direction: column;
  134. font-size: 24rpx;
  135. color: rgba(255, 255, 255, 0.7);
  136. .tips {
  137. color: rgba(255, 255, 255, 0.7);
  138. font-size: 22rpx;
  139. border: 1px solid rgba(255, 255, 255, 0.15);
  140. border-radius: 20rpx;
  141. padding: 2rpx 16rpx;
  142. width: fit-content;
  143. margin-bottom: 10rpx;
  144. }
  145. }
  146. .info {
  147. width: 400rpx;
  148. color: rgba(255, 255, 255, 0.7);
  149. font-size: 24rpx;
  150. position: relative;
  151. text {
  152. display: block;
  153. width: 360rpx;
  154. overflow: hidden;
  155. display: -webkit-box;
  156. -webkit-box-orient: vertical;
  157. -webkit-line-clamp: 3;
  158. }
  159. }
  160. .info::after {
  161. content: '\e6b5';
  162. font-family: uniicons;
  163. position: absolute;
  164. right: 0rpx;
  165. top: 5%;
  166. }
  167. }
  168. }
  169. .list {
  170. margin-top: 80rpx;
  171. .item:last-child {
  172. margin: 0;
  173. }
  174. .item {
  175. margin: 32rpx 0;
  176. height: 160rpx;
  177. position: relative;
  178. .logo {
  179. width: 160rpx;
  180. height: 160rpx;
  181. position: absolute;
  182. top: 0;
  183. left: 0;
  184. border-radius: 16rpx;
  185. }
  186. .title {
  187. position: absolute;
  188. top: 50%;
  189. left: 180rpx;
  190. transform: translate(0, -50%);
  191. display: flex;
  192. flex-direction: column;
  193. text:first-child {
  194. font-size: 28rpx;
  195. width: 360rpx;
  196. overflow: hidden;
  197. text-overflow: ellipsis;
  198. white-space: nowrap;
  199. }
  200. text:last-child {
  201. font-size: 24rpx;
  202. color: rgba(255, 255, 255, 0.4);
  203. width: 360rpx;
  204. overflow: hidden;
  205. display: -webkit-box;
  206. -webkit-box-orient: vertical;
  207. -webkit-line-clamp: 3;
  208. }
  209. }
  210. .play {
  211. width: 48rpx;
  212. height: 48rpx;
  213. position: absolute;
  214. top: 50%;
  215. right: 0;
  216. transform: translate(0, -50%);
  217. }
  218. }
  219. }
  220. .no-data {
  221. text-align: center;
  222. margin-top: 200rpx;
  223. color: rgba(255, 255, 255, 0.7);
  224. font-size: 24rpx;
  225. }
  226. </style>