handoutsBox.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <view>
  3. <template v-if="courseHandoutsData.handoutsId">
  4. <u-search
  5. v-if="isShowSearch"
  6. placeholder="搜索讲义名称"
  7. bg-color="#ffffff"
  8. margin="0 0 20rpx"
  9. v-model="fileName"
  10. @custom="search"
  11. @search="search"
  12. ></u-search>
  13. <view
  14. class="handouts-box"
  15. v-for="item in courseHandoutsData.fileList"
  16. :key="item.fileId"
  17. >
  18. <handouts-tree
  19. :canDownload="courseHandoutsData.canDownload"
  20. :isShowDownIcon="isShowDownIcon"
  21. :fileInfo="item"
  22. ></handouts-tree>
  23. </view>
  24. </template>
  25. <view v-else style="text-align: center">暂无讲义</view>
  26. </view>
  27. </template>
  28. <script>
  29. import handoutsTree from "@/components/course/handoutsTree.vue";
  30. export default {
  31. name: "HandoutsBox",
  32. props: {
  33. handoutsId: {
  34. type: Number,
  35. },
  36. isShowSearch: {
  37. type: Boolean,
  38. default: true,
  39. },
  40. isShowDownIcon: {
  41. type: Boolean,
  42. default: true,
  43. },
  44. },
  45. data() {
  46. return {
  47. fileName: "",
  48. courseHandoutsData: {},
  49. };
  50. },
  51. mounted() {
  52. this.courseHandouts();
  53. },
  54. methods: {
  55. search(val) {
  56. this.courseHandouts();
  57. },
  58. courseHandouts() {
  59. if (!this.handoutsId) {
  60. return;
  61. }
  62. this.$api
  63. .courseHandouts({
  64. handoutsId: this.handoutsId,
  65. fileName: this.fileName,
  66. })
  67. .then((res) => {
  68. this.courseHandoutsData = res.data.data;
  69. });
  70. },
  71. },
  72. components: {
  73. handoutsTree,
  74. },
  75. };
  76. </script>
  77. <style lang="scss" scoped>
  78. .handouts-box {
  79. border-radius: 20rpx;
  80. background: #ffffff;
  81. margin-bottom: 20rpx;
  82. }
  83. </style>