unified_list.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. {extend name="public/container"}
  2. {block name="title"}{$title}{/block}
  3. {block name="head_top"}
  4. <style>
  5. .studyCourse .item .info {
  6. margin-top: .06rem;
  7. font-size: .24rem;
  8. color: #999;
  9. }
  10. .studyCourse .item .info .iconfont {
  11. margin-right: .08rem;
  12. font-size: .24rem;
  13. color: #999;
  14. }
  15. .swiper-list2 .item .underline {
  16. min-width: 0;
  17. }
  18. .loading {
  19. font-size: .4rem;
  20. text-align: center;
  21. color: #999;
  22. }
  23. .loaded {
  24. font-size: .28rem;
  25. line-height: .72rem;
  26. text-align: center;
  27. color: #999;
  28. }
  29. .nothing {
  30. position: absolute;
  31. top: 30%;
  32. left: 50%;
  33. width: 4rem;
  34. height: 4rem;
  35. background: url("{__WAP_PATH}zsff/images/nothing.png") center/contain no-repeat;
  36. -webkit-transform: translate(-50%, -50%);
  37. transform: translate(-50%, -50%);
  38. }
  39. .swiper-list2 .item .pictrue img {
  40. object-fit: cover;
  41. }
  42. </style>
  43. {/block}
  44. {block name="content"}
  45. <div class="course-list index" id="app" v-cloak="" ref="index" style="-webkit-overflow-scrolling: touch;">
  46. <div class="nav" v-if="category.length">
  47. <div class="item" :class="where.cid==0 ? 'on':''" @click="where.cid=0">全部</div>
  48. <div class="item" v-for="item in category" :class="where.cid==item.id ? 'on':''" @click="where.cid=item.id">
  49. {{item.title}}</div>
  50. </div>
  51. <div class="studyCourse" ref="list">
  52. <!--小图-->
  53. <div v-if="List.length" class="swiper-list2">
  54. <a class="item acea-row" v-for="vo in List" :href="getDetails(vo.id)">
  55. <div class="pictrue">
  56. <img :src="vo.image_input">
  57. </div>
  58. <div class="underline text-pic acea-row row-column row-between">
  59. <div class="name line1" v-text="vo.title"></div>
  60. <div class="acea-row row-between-wrapper info" v-text="vo.synopsis"></div>
  61. <div class="acea-row row-between-wrapper">
  62. <div class="info">访问量:{{vo.visit ? vo.visit : '0'}}</div>
  63. <div class="info">{{vo.add_time}}</div>
  64. </div>
  65. </div>
  66. </a>
  67. </div>
  68. </div>
  69. <div v-show="loading" class="loading">
  70. <span class="fa fa-spinner"></span>
  71. </div>
  72. <div v-if="where.page > 2 && loadend" class="loaded">已全部加载</div>
  73. <div v-if="!List.length && !loading" class="nothing"></div>
  74. <shortcut></shortcut>
  75. </div>
  76. {/block}
  77. {block name='foot'}
  78. <script>
  79. var category = {$category};
  80. require(['vue', 'helper', 'store','{__WAP_PATH}zsff/js/shortcut.js'], function (Vue, $h, storeApi) {
  81. new Vue({
  82. el: '#app',
  83. data: {
  84. where: {
  85. page: 1,
  86. limit: 10,
  87. cid: 0,
  88. },
  89. category: category,
  90. loading: false,
  91. loadend: false,
  92. List: [],
  93. },
  94. watch: {
  95. 'where.cid': function (n) {
  96. this.where.page = 1;
  97. this.loadend = false;
  98. this.$set(this, 'List', []);
  99. this.get_unifiend_list();
  100. }
  101. },
  102. methods: {
  103. getDetails: function (id) {
  104. return $h.U({ c: 'article', a: 'details', q: { id: id } });
  105. },
  106. get_unifiend_list: function () {
  107. if (this.loading) return;
  108. if (this.loadend) return;
  109. this.loading = true;
  110. storeApi.baseGet($h.U({ c: 'article', a: 'get_unifiend_list', q: this.where }), function (res) {
  111. var list = res.data.data;
  112. var List = $h.SplitArray(list, this.List);
  113. this.loading = false;
  114. this.where.page = this.where.page + 1;
  115. this.loadend = list.length < this.where.limit;
  116. this.$set(this, 'List', List);
  117. this.$nextTick(function () {
  118. this.EventUtil();
  119. }.bind(this))
  120. }.bind(this), function (res) {
  121. this.loading = false;
  122. }.bind(this));
  123. },
  124. EventUtil: function () {
  125. var that = this;
  126. $h.EventUtil.listenTouchDirection(document, function () {
  127. that.loading == false && that.get_unifiend_list();
  128. }, false);
  129. }
  130. },
  131. mounted: function () {
  132. this.get_unifiend_list();
  133. }
  134. })
  135. })
  136. </script>
  137. {/block}