record.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. {extend name="public/container"}
  2. {block name="title"}学习记录{/block}
  3. {block name="head_top"}
  4. <script src="/wap/first/zsff/js/scroll.js"></script>
  5. <script src="/wap/first/zsff/js/navbarscroll.js"></script>
  6. <style>
  7. .loading {
  8. font-size: .4rem;
  9. text-align: center;
  10. color: #999;
  11. }
  12. .loaded {
  13. font-size: .28rem;
  14. line-height: .72rem;
  15. text-align: center;
  16. color: #999;
  17. }
  18. .nothing {
  19. position: absolute;
  20. top: 30%;
  21. left: 50%;
  22. width: 4rem;
  23. height: 4rem;
  24. -webkit-transform: translate(-50%, -50%);
  25. transform: translate(-50%, -50%);
  26. }
  27. </style>
  28. {/block}
  29. {block name="content"}
  30. <div v-cloak id="app">
  31. <div class="study-record">
  32. <header>
  33. {if $homeLogo}
  34. <div class="image">
  35. <img class="img" src="{$homeLogo}">
  36. </div>
  37. {else}
  38. <div class="image">
  39. <img class="img" src="/wap/first/zsff/images/crmeb.png">
  40. </div>
  41. {/if}
  42. <form @submit.prevent="goSearch">
  43. <img src="/wap/first/zsff/images/search.png">
  44. <input v-model="search" type="search" placeholder="输入课程名称">
  45. </form>
  46. </header>
  47. <main>
  48. <div v-if="makeSpecials.length" class="goods">
  49. <a v-for="item in makeSpecials" :key="item.id" :href="item.path" class="item">
  50. <div class="image">
  51. <img :src="item.image">
  52. <div class="label">{{ item.type }}</div>
  53. </div>
  54. <div class="text">
  55. <div class="name">{{ item.title }}</div>
  56. <div class="label">
  57. <template v-for="(itm, idx) in item.label">
  58. <span v-if="idx < 2" :key="idx" class="cell">{{ itm }}</span>
  59. </template>
  60. </div>
  61. <div class="price">
  62. <template v-if="item.is_pink">
  63. <div class="money">¥<span>{{ item.pink_money }}</span></div>
  64. <div class="group-price-icon">拼团特惠</div>
  65. <div v-if="item.types!=4" class="total">共{{item.count}}节</div>
  66. </template>
  67. <template v-else>
  68. <div v-if="item.money === '0.00'" class="free">免费</div>
  69. <div v-else class="money">¥<span>{{ item.money }}</span></div>
  70. <div v-if="item.types!=4" class="total">共{{item.count}}节</div>
  71. </template>
  72. </div>
  73. </div>
  74. </a>
  75. </div>
  76. <div v-show="loading" class="loading">
  77. <span class="fa fa-spinner"></span>
  78. </div>
  79. <div v-if="loadend && specials.length" class="loaded">已全部加载</div>
  80. <div v-if="!specials.length && !loading" >
  81. <img class="nothing" src="/wap/first/zsff/images/no_data_available.png">
  82. </div>
  83. </main>
  84. </div>
  85. <shortcut></shortcut>
  86. </div>
  87. {/block}
  88. {block name='foot'}
  89. <script>
  90. require(['vue', 'helper', 'store', 'special-type', '{__WAP_PATH}zsff/js/shortcut.js'], function (Vue, $h, app, specialType) {
  91. new Vue({
  92. el: '#app',
  93. data: {
  94. specials: [],
  95. search: '',
  96. loadTitle: '',
  97. loading: false,
  98. loadend: false,
  99. limit: 10,
  100. page: 1,
  101. },
  102. computed: {
  103. makeSpecials: function () {
  104. var that = this;
  105. return that.specials.map(function (value) {
  106. value.path = $h.U({
  107. c: 'special',
  108. a: 'details',
  109. q: { id: value.id }
  110. });
  111. value.types = value.type;
  112. value.type = specialType[value.type];
  113. return value;
  114. });
  115. }
  116. },
  117. created: function () {
  118. this.getSpecialList();
  119. },
  120. methods: {
  121. goSearch: function () {
  122. this.loadend = false;
  123. this.page = 1;
  124. this.$set(this, 'specials', []);
  125. this.getSpecialList();
  126. },
  127. getSpecialList: function () {
  128. var that = this;
  129. if (that.loadend) return;
  130. if (that.loading) return;
  131. that.loading = true;
  132. that.loadTitle = '';
  133. app.baseGet($h.U({
  134. c: 'special',
  135. a: 'get_special_list',
  136. q: {
  137. subject_id: 0,
  138. search: that.search,
  139. page: that.page,
  140. limit: that.limit,
  141. type: 1
  142. }
  143. }), function (res) {
  144. var specials = res.data.data;
  145. that.loading = false;
  146. $h.SplitArray(specials, that.specials);
  147. that.loadend = specials.length < that.limit;
  148. that.loadTitle = that.loadend ? '我是有底线的' : '上拉加载更多';
  149. that.page++;
  150. that.EventUtil();
  151. }, function (res) {
  152. that.loading = false;
  153. this.loadTitle = '加载更多';
  154. });
  155. },
  156. EventUtil: function () {
  157. this.$nextTick(function () {
  158. $h.EventUtil.listenTouchDirection(document, function () {
  159. this.loading == false && this.getSpecialList();
  160. }.bind(this), false);
  161. })
  162. }
  163. }
  164. });
  165. })
  166. </script>
  167. {/block}