play.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <view class="page-content">
  3. <mx-nav-bar :title="prevData.title||'视频播放'"/>
  4. <mx-video :src="prevData.aliId" :ali-id-type="prevData.aliIdType"/>
  5. <uv-cell-group :title="prevData.node?.label">
  6. <template #title>
  7. <text class="font-bold text-sm">{{ prevData.node.label }}</text>
  8. </template>
  9. <uv-cell v-for="n in prevData.node?.children" :title="n.name" :icon="n.img"
  10. icon-style="width:28px;height:28px;border-radius:14px;" is-link
  11. class="bg-white" v-bind="getActiveBinding(n)" @click="handleClick(n)"/>
  12. </uv-cell-group>
  13. <uv-gap height="20"/>
  14. </view>
  15. </template>
  16. <script setup>
  17. import {useTransfer} from "@/hooks/useTransfer";
  18. const {prevData} = useTransfer()
  19. const getActiveBinding = function (node) {
  20. const binding = node.aliId == prevData.value.aliId
  21. ? {
  22. titleStyle: {color: 'var(--primary-color)'},
  23. rightIconStyle: {color: 'var(--primary-color)'},
  24. rightIcon: 'play-circle-fill'
  25. }
  26. : {
  27. rightIcon: 'play-circle'
  28. }
  29. return binding
  30. }
  31. const handleClick = function (node) {
  32. if (node.aliId == prevData.value.alidId) return
  33. // 切换视频播放源
  34. const {aliId, aliIdType, name: title} = node
  35. prevData.value = {aliId, aliIdType, title, node: prevData.value.node}
  36. }
  37. </script>
  38. <style scoped lang="scss">
  39. ::v-deep .uv-icon__img > div {
  40. background-size: cover !important;
  41. }
  42. </style>