mylist.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view>
  3. <u-tabs lineColor="#C30D23" :activeStyle="{ color: '#C30D23', fontWeight: 'bold' }" :list="tabs"
  4. @click="changeCurrent" :current="current" />
  5. <view style="padding: 10px;background-color: #fff;">
  6. <My_search @onSearch="onSearch" />
  7. </view>
  8. <view style="height: 10px;" />
  9. <My_listbox ref="List" @getlist="getList">
  10. <img-list v-if="tabs[current].name == '效果图'" ref="效果图" :list="list" @addReadcount="addReadcount" />
  11. <design-list v-if="tabs[current].name == '设计实景'" ref="设计实景" :list="list" @toDetail="updateDesign" />
  12. <view v-else-if="tabs[current].name == '单品'" style="padding: 0 10px;">
  13. <product ref="单品" :list="list" />
  14. </view>
  15. <courseware v-else-if="tabs[current].name == '课件'" ref="课件" :list="list" />
  16. <commodity-list v-else-if="tabs[current].name == '商品'" ref="商品" :list="list" />
  17. </My_listbox>
  18. </view>
  19. </template>
  20. <script>
  21. import imgList from '../../pages/index/index/casePages/modules/imgList.vue';
  22. import designList from '../../components/designList.vue';
  23. import product from "../../components/collectLists/product.vue";
  24. import courseware from "../../components/collectLists/courseware.vue";
  25. import commodityList from "../../pages/index/index/modules/commodityList.vue";
  26. export default {
  27. components: { commodityList, imgList, product, courseware, designList },
  28. data() {
  29. return {
  30. current: 0,
  31. tabs: [{
  32. name: '效果图',
  33. id: "20240415164402"
  34. }, {
  35. name: '单品',
  36. id: "20240418141302"
  37. }, {
  38. name: '设计实景',
  39. id: "20240417144702"
  40. }, {
  41. name: '课件',
  42. id: "20240506100502"
  43. }, {
  44. name: '商品',
  45. id: '20240430094102'
  46. }],
  47. "content": {
  48. nocache: true,
  49. iscollect: 1,
  50. "where": {
  51. iscollect: 1,
  52. "condition": ""
  53. }
  54. },
  55. showCount: 0,
  56. list: []
  57. }
  58. },
  59. onLoad() {
  60. uni.setNavigationBarTitle({
  61. title: '我的收藏'
  62. });
  63. this.getList(true)
  64. },
  65. onShow() {
  66. if (this.showCount) this.updateList();
  67. this.showCount += 1;
  68. },
  69. methods: {
  70. getList(init = false) {
  71. let current = this.tabs[this.current];
  72. if (this.paging(this.content, init)) return;
  73. this.$Http.basic({
  74. "id": current.id,
  75. content: this.content
  76. }).then(res => {
  77. this.$refs.List.RefreshToComplete()
  78. console.log(`我收藏的${current.name}列表`, this.list)
  79. console.log(current.id)
  80. if (this.cutoff(res.msg)) return;
  81. res.data = this.$refs[current.name].handleList(res.data)
  82. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  83. this.content = this.$refs.List.paging(this.content, res)
  84. })
  85. },
  86. updateList() {
  87. let current = this.tabs[this.current];
  88. if (this.content.pageNumber && this.content.pageNumber >= 2) {
  89. let content = this.paging(this.content, true, true)
  90. this.$Http.basic({
  91. "id": current.id,
  92. content
  93. }).then(res => {
  94. console.log(`更新我收藏的${current.name}列表`, res)
  95. if (this.cutoff(res.msg)) return;
  96. res.data = this.$refs[current.name].handleList(res.data)
  97. this.list = res.data;
  98. this.$refs.List.paging(current, res, true)
  99. })
  100. }
  101. },
  102. changeCurrent({ index }) {
  103. this.current = index;
  104. this.list = [];
  105. this.getList(true)
  106. },
  107. onSearch(condition) {
  108. this.content.where.condition = condition;
  109. this.getList(true)
  110. },
  111. addReadcount(index) {
  112. this.$set(this.list[index], 'readcount', this.list[index].readcount - 0 + 1)
  113. },
  114. updateDesign(index, type = 1) {
  115. let item = this.list[index]
  116. if (type == 1) {
  117. uni.navigateTo({
  118. url: `/packageA/fullView/detail?id=${item.sat_sharematerialid}`,
  119. });
  120. } else {
  121. uni.redirectTo({
  122. url: `/packageA/fullView/detail?id=${item.sat_sharematerialid}`,
  123. });
  124. }
  125. this.$Http.setCount = function (detail) {
  126. item.collectcount = detail.collectcount;
  127. item.commentcount = detail.commentcount;
  128. item.likecount = detail.likecount;
  129. item.islike = detail.islike;
  130. item.iscollect = detail.iscollect;
  131. this.$set(this.list, index, item)
  132. }.bind(this)
  133. },
  134. },
  135. }
  136. </script>
  137. <style></style>