handoutsBox.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. this.$api
  60. .courseHandouts({
  61. handoutsId: this.handoutsId,
  62. fileName: this.fileName,
  63. })
  64. .then((res) => {
  65. this.courseHandoutsData = res.data.data;
  66. });
  67. },
  68. },
  69. components: {
  70. handoutsTree,
  71. },
  72. };
  73. </script>
  74. <style lang="scss" scoped>
  75. .handouts-box {
  76. border-radius: 20rpx;
  77. background: #ffffff;
  78. margin-bottom: 20rpx;
  79. }
  80. </style>