index.vue 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <div class="flex flex-col h-[600px]">
  3. <div class="flex-auto flex overflow-hidden">
  4. <el-tabs v-model="currentType" class="flex-auto px-[var(--app-content-padding)]">
  5. <!-- 我的创作 -->
  6. <el-tab-pane label="我的创作" v-loading="loading" name="mine">
  7. <el-row v-if="mySongList.length" :gutter="12">
  8. <el-col v-for="song in mySongList" :key="song.id" :span="24">
  9. <songCard v-bind="song"/>
  10. </el-col>
  11. </el-row>
  12. <el-empty v-else description="暂无音乐"/>
  13. </el-tab-pane>
  14. <!-- 试听广场 -->
  15. <el-tab-pane label="试听广场" v-loading="loading" name="square">
  16. <el-row v-if="squareSongList.length" v-loading="loading" :gutter="12">
  17. <el-col v-for="song in squareSongList" :key="song.id" :span="24">
  18. <songCard v-bind="song"/>
  19. </el-col>
  20. </el-row>
  21. <el-empty v-else description="暂无音乐"/>
  22. </el-tab-pane>
  23. </el-tabs>
  24. <!-- songInfo -->
  25. <songInfo v-bind="squareSongList[0]" class="flex-none"/>
  26. </div>
  27. <audioBar class="flex-none"/>
  28. </div>
  29. </template>
  30. <script lang="ts" setup>
  31. import songCard from './songCard/index.vue'
  32. import songInfo from './songInfo/index.vue'
  33. import audioBar from './audioBar/index.vue'
  34. defineOptions({ name: 'Index' })
  35. const currentType = ref('mine')
  36. // loading 状态
  37. const loading = ref(false)
  38. const mySongList = ref<Recordable[]>([])
  39. const squareSongList = ref<Recordable[]>([])
  40. /*
  41. *@Description: 调接口生成音乐列表
  42. *@MethodAuthor: xiaohong
  43. *@Date: 2024-06-27 17:06:44
  44. */
  45. function generateMusic (formData: Recordable) {
  46. console.log(formData);
  47. loading.value = true
  48. setTimeout(() => {
  49. mySongList.value = Array.from({ length: 20 }, (_, index) => {
  50. return {
  51. id: index,
  52. audioUrl: '',
  53. videoUrl: '',
  54. title: '我走后',
  55. imageUrl: 'https://www.carsmp3.com/data/attachment/forum/201909/19/091020q5kgre20fidreqyt.jpg',
  56. desc: 'Metal, symphony, film soundtrack, grand, majesticMetal, dtrack, grand, majestic',
  57. date: '2024年04月30日 14:02:57',
  58. lyric: `<div class="_words_17xen_66"><div>大江东去,浪淘尽,千古风流人物。
  59. </div><div>故垒西边,人道是,三国周郎赤壁。
  60. </div><div>乱石穿空,惊涛拍岸,卷起千堆雪。
  61. </div><div>江山如画,一时多少豪杰。
  62. </div><div>
  63. </div><div>遥想公瑾当年,小乔初嫁了,雄姿英发。
  64. </div><div>羽扇纶巾,谈笑间,樯橹灰飞烟灭。
  65. </div><div>故国神游,多情应笑我,早生华发。
  66. </div><div>人生如梦,一尊还酹江月。</div></div>`
  67. }
  68. })
  69. loading.value = false
  70. }, 3000)
  71. }
  72. defineExpose({
  73. generateMusic
  74. })
  75. </script>
  76. <style lang="scss" scoped>
  77. :deep(.el-tabs) {
  78. display: flex;
  79. flex-direction: column;
  80. .el-tabs__content{
  81. padding: 0 7px;
  82. overflow: auto;
  83. }
  84. }
  85. </style>