handoutsBox.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <view>
  3. <template v-if="handoutsId">
  4. <u-search v-if="isShowSearch" placeholder="搜索讲义名称" bg-color="#ffffff" margin="0 0 20rpx" v-model="fileName"
  5. @custom="search" @search="search"></u-search>
  6. <view class="handouts-box" v-for="item in courseHandoutsData.fileList" :key="item.fileId">
  7. <handouts-tree :canDownload="courseHandoutsData.canDownload" :isShowDownIcon="isShowDownIcon"
  8. :fileInfo="item"></handouts-tree>
  9. </view>
  10. </template>
  11. <view v-else style="text-align: center">暂无讲义</view>
  12. </view>
  13. </template>
  14. <script>
  15. import handoutsTree from "@/components/course/handoutsTree.vue";
  16. export default {
  17. name: "HandoutsBox",
  18. props: {
  19. handoutsId: {
  20. type: Number,
  21. },
  22. isShowSearch: {
  23. type: Boolean,
  24. default: true,
  25. },
  26. isShowDownIcon: {
  27. type: Boolean,
  28. default: true,
  29. },
  30. isBuy: {
  31. type: Boolean,
  32. default: true
  33. }
  34. },
  35. data() {
  36. return {
  37. fileName: "",
  38. courseHandoutsData: {},
  39. };
  40. },
  41. mounted() {
  42. this.handoutsId && this.courseHandouts();
  43. },
  44. methods: {
  45. search(val) {
  46. this.courseHandouts();
  47. },
  48. courseHandouts() {
  49. console.log("阿达")
  50. this.$api[this.isBuy ? 'courseHandouts' : 'appcommoncourseHandouts']({
  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>