collect.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="content">
  3. <view v-if="curTab == 2" class="pageCon"><course-list :flag="1" :list="list"></course-list></view>
  4. <!-- <view v-if="curTab == 2" class="pageCon"><goods :flag="1" :list="list"></goods></view> -->
  5. <view v-if="curTab == 3" class="pageThr"><hotgods :flag="1" :list="list"></hotgods></view>
  6. </view>
  7. </template>
  8. <script>
  9. import courseList from '../../index/components/knowVidList.vue';
  10. import hotgods from '../../../pagesA/mall/componets/hotgodlist.vue';
  11. export default {
  12. components: {
  13. courseList,
  14. hotgods
  15. },
  16. data() {
  17. return {
  18. type:1, // 1=收藏 2下载 3.点赞
  19. curTab:2 ,// 1=商品 2=文档 3=视频
  20. list: [
  21. // { image: '/static/img/pro/indnotice.png', name: '知识过关', path: '/pages/knowledge/knowledge' },
  22. // { image: '/static/img/pro/indnotice.png', name: '知识过关', path: '/pages/knowledge/knowledge' },
  23. // { image: '/static/img/pro/indnotice.png', name: '知识过关', path: '/pages/knowledge/knowledge' },
  24. ],
  25. status:'loadmore',
  26. page:1,
  27. pagenum:10,
  28. };
  29. },
  30. onPullDownRefresh() {
  31. setTimeout(res => {
  32. uni.stopPullDownRefresh();
  33. }, 1000);
  34. },
  35. onReachBottom() {
  36. if (this.status == 'nomore') return;
  37. this.status = 'loadmore';
  38. this.page = ++this.page;
  39. this.getInfoList();
  40. },
  41. onLoad(opt) {
  42. this.type=opt.type||1;
  43. if(this.type==1){
  44. uni.setNavigationBarTitle({
  45. title:'我的收藏'
  46. })
  47. }else if(this.type==2){
  48. uni.setNavigationBarTitle({
  49. title:'我的下载'
  50. })
  51. }else if(this.type==3){
  52. uni.setNavigationBarTitle({
  53. title:'我的点赞'
  54. })
  55. }
  56. this.getInfoList();
  57. },
  58. methods: {
  59. getInfoList() {
  60. let url=this.type==1?'collection/getCollectionList':this.type==2?'user/myDownList':'user/getTeamList';
  61. this.$api
  62. .request(url, {
  63. type:this.curTab,
  64. page: this.page,
  65. limit: this.pagenum
  66. })
  67. .then(data => {
  68. if (data.code == '200') {
  69. this.list = this.list.concat(data.data);
  70. if (data.data.length < this.pagnum) {
  71. this.status = 'nomore';
  72. }
  73. } else {
  74. this.$api.toast(data.msg);
  75. }
  76. });
  77. },
  78. toNext(url) {
  79. uni.navigateTo({
  80. url: url
  81. });
  82. }
  83. }
  84. };
  85. </script>
  86. <style lang="scss" scoped>
  87. .pageCon {
  88. padding: 20rpx 30rpx;
  89. }
  90. .pageThr {
  91. padding: 20rpx 0;
  92. }
  93. </style>