school.vue 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <My_listbox ref="List" @getlist="getList" :isShowEmpty="false" :bottomHeight="70">
  3. <view class="box">
  4. <navigator class="nav-box" v-for="item in list" :key="item.sat_courseware_classid"
  5. :url="'/packageA/course/index?id=' + item.sat_courseware_classid + '&classname=' + item.classname"
  6. hover-class="navigator-hover">
  7. <image v-if="item.cover" class="image" :src="item.cover" mode="aspectFill" lazy-load="false" />
  8. <text v-else>{{ item.classname }}</text>
  9. </navigator>
  10. <navigator class="nav-box" v-for="item in appList" :key="item.name" :url="item.path"
  11. hover-class="navigator-hover">
  12. <block v-if="item.cover">
  13. <image class="image" :src="item.cover" mode="aspectFill" lazy-load="false" />
  14. </block>
  15. <text v-else>{{ item.remark }}</text>
  16. </navigator>
  17. </view>
  18. </My_listbox>
  19. </template>
  20. <script>
  21. export default {
  22. data() {
  23. return {
  24. updatePage: true,
  25. list: [],
  26. appList: [],
  27. "content": {
  28. "parentid": 0,
  29. "where": {
  30. "isenable": 1
  31. }
  32. }
  33. }
  34. },
  35. methods: {
  36. init(callBack) {
  37. try {
  38. this.appList = this.getApps('商学院')
  39. } catch (error) {
  40. console.log("未获取到授权信息")
  41. }
  42. this.getList().then(res => {
  43. this.updatePage = false;
  44. callBack()
  45. })
  46. },
  47. getList(init = false) {
  48. return new Promise((resolve, reject) => {
  49. if (this.paging(this.content, init)) return resolve();
  50. this.$Http.basic({
  51. "id": "20221102143302",
  52. content: this.content
  53. }).then(res => {
  54. console.log("课程分类", res)
  55. this.$refs.List.RefreshToComplete()
  56. resolve()
  57. if (this.cutoff(res.msg)) return;
  58. res.data = res.data.map(v => {
  59. v.cover = v.attinfos.length ? this.getSpecifiedImage(v.attinfos.find(s => s.usetype == "avatar")) : uni.getStorageSync("site").logo || '';
  60. return v
  61. });
  62. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  63. this.content = this.$refs.List.paging(this.content, res)
  64. })
  65. })
  66. }
  67. },
  68. }
  69. </script>
  70. <style lang="scss">
  71. .box {
  72. padding: 0 10px;
  73. box-sizing: border-box;
  74. display: flex;
  75. justify-content: space-between;
  76. flex-wrap: wrap;
  77. .nav-box {
  78. width: 172.5px;
  79. height: 92px;
  80. flex-shrink: 0;
  81. margin-top: 10px;
  82. .image {
  83. width: 100%;
  84. height: 100%;
  85. }
  86. }
  87. }
  88. </style>