handoutsBox.vue 1.4 KB

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