workModel.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <div class="workModel">
  3. <van-sticky>
  4. <van-nav-bar
  5. title="训练曲目"
  6. left-arrow
  7. @click-left="close"
  8. />
  9. </van-sticky>
  10. <base-list @onDetail="onDetail" v-if="index == 1" />
  11. <classify @onDetail="onDetail" v-if="index == 2" />
  12. <accompaniment-modal v-if="index == 3" :id="id" @onSelectMusic="onSelectMusic" :searchSubjectId="searchSubjectId" />
  13. <!-- <div class="button-group-popup">
  14. <span class="btn" @click="close">关闭</span>
  15. </div> -->
  16. </div>
  17. </template>
  18. <script>
  19. import BaseList from './baseList'
  20. import Classify from './classify'
  21. import AccompanimentModal from './accompanimentModal'
  22. export default {
  23. props: ["searchSubjectId"],
  24. name: 'workModel',
  25. components: { BaseList, Classify, AccompanimentModal },
  26. data() {
  27. return {
  28. index: 1,
  29. id: null,
  30. }
  31. },
  32. methods: {
  33. onDetail(option) {
  34. if(option.path == 'classify') {
  35. this.index = 2
  36. } else if(option.path == 'list') {
  37. this.index = 3
  38. this.id = option.id
  39. }
  40. },
  41. onSelectMusic(item) {
  42. this.index = 1
  43. this.close()
  44. this.$emit('onSelectMusic', item)
  45. },
  46. close() {
  47. if(this.index == 1) {
  48. this.$emit('close')
  49. } else {
  50. this.index = 1
  51. }
  52. document.querySelector('.van-popup').scrollTop = 0
  53. }
  54. }
  55. }
  56. </script>
  57. <style lang="less" scoped>
  58. @import url("../../../assets/commonLess/variable.less");
  59. .button-group-popup {
  60. position: fixed;
  61. bottom: 0;
  62. padding: 0.1rem 0;
  63. width: 100%;
  64. text-align: center;
  65. background-color: #ffffff;
  66. .btn {
  67. line-height: 0.5rem;
  68. display: inline-block;
  69. border: 1px solid @mColor;
  70. border-radius: 0.4rem;
  71. color: @mColor;
  72. background: #fff;
  73. font-size: 0.18rem;
  74. width: 90%;
  75. &.primary {
  76. color: #fff;
  77. background: @mColor;
  78. }
  79. }
  80. .btn + .btn {
  81. margin-left: 0.1rem;
  82. }
  83. }
  84. /deep/.van-nav-bar .van-icon {
  85. color: #212121
  86. }
  87. </style>