record.html 7.1 KB

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