teacher_list.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. {extend name="public/container"}
  2. {block name="title"}讲师列表{/block}
  3. {block name="head_top"}
  4. <style>
  5. .list .item {
  6. display: -webkit-box;
  7. display: -webkit-flex;
  8. display: flex;
  9. -webkit-box-align: center;
  10. -webkit-align-items: center;
  11. align-items: center;
  12. position: relative;
  13. height: 2rem;
  14. padding: 0 .3rem;
  15. }
  16. .list .item::after {
  17. content: "";
  18. position: absolute;
  19. right: 0;
  20. bottom: 0;
  21. left: 1.49rem;
  22. border-bottom: 1px solid #f2f2f2;
  23. }
  24. .list .item .img {
  25. width: 1.3rem;
  26. height: 1.3rem;
  27. border-radius: 50%;
  28. }
  29. .list .item .text {
  30. -webkit-box-flex: 1;
  31. -webkit-flex: 1;
  32. flex: 1;
  33. min-width: 0;
  34. margin-left: .22rem;
  35. }
  36. .list .item .name {
  37. overflow: hidden;
  38. white-space: nowrap;
  39. text-overflow: ellipsis;
  40. font-weight: bold;
  41. font-size: .3rem;
  42. line-height: .42rem;
  43. color: #282828;
  44. }
  45. .list .item .label {
  46. display: -webkit-box;
  47. display: -webkit-flex;
  48. display: flex;
  49. -webkit-box-align: center;
  50. -webkit-align-items: center;
  51. align-items: center;
  52. margin-top: .06rem;
  53. }
  54. .list .item .label .cell {
  55. height: .34rem;
  56. padding: 0 .12rem;
  57. border-radius: .04rem;
  58. background-color: #fff7e6;
  59. font-size: .22rem;
  60. line-height: .34rem;
  61. color: #feb720;
  62. }
  63. .list .item .label .cell ~ .cell {
  64. margin-left: .1rem;
  65. }
  66. .list .item .attr {
  67. margin-top: .09rem;
  68. font-size: .26rem;
  69. line-height: .37rem;
  70. color: #385270;
  71. }
  72. .empty {
  73. margin-top: 2rem;
  74. font-size: .28rem;
  75. text-align: center;
  76. color: #999;
  77. }
  78. .empty .img {
  79. width: 4.14rem;
  80. height: 2.4rem;
  81. }
  82. .loading {
  83. font-size: .4rem;
  84. text-align: center;
  85. color: #999;
  86. }
  87. .loaded {
  88. font-size: .28rem;
  89. line-height: .72rem;
  90. text-align: center;
  91. color: #999;
  92. }
  93. </style>
  94. {/block}
  95. {block name="content"}
  96. <div v-cloak id="app">
  97. <div v-if="lecturerList.length" class="list">
  98. <a v-for="(item, index) in lecturerList" :key="index" class="item" :href="$h.U({c:'special',a:'teacher_detail'})+'?id=' + item.id">
  99. <img class="img" :src="item.lecturer_head">
  100. <div class="text">
  101. <div class="name">{{ item.lecturer_name }}</div>
  102. <div v-if="item.label.length" class="label">
  103. <template v-for="(itm, idx) in item.label">
  104. <div v-if="idx < 3" :key="idx" class="cell">{{ itm }}</div>
  105. </template>
  106. </div>
  107. <div class="attr">{{ item.study }}人学习 | {{ item.curriculum }}课时</div>
  108. </div>
  109. </a>
  110. <div v-show="loading" class="loading">
  111. <span class="fa fa-spinner"></span>
  112. </div>
  113. <div v-if="finished" class="loaded">{{loadTitle}}</div>
  114. </div>
  115. <div v-else-if="finished" class="empty">
  116. <img class="img" src="/wap/first/zsff/images/empty-box.png">
  117. <div>暂无讲师</div>
  118. </div>
  119. <shortcut></shortcut>
  120. </div>
  121. {/block}
  122. {block name="foot"}
  123. <script>
  124. require(['vue', 'store', 'helper', '{__WAP_PATH}zsff/js/shortcut.js'], function (Vue, storeApi, $h) {
  125. var vm = new Vue({
  126. el: '#app',
  127. data: {
  128. loading: false,
  129. finished: false,
  130. page: 1,
  131. limit: 10,
  132. lecturerList: []
  133. },
  134. created: function () {
  135. this.getLecturerList();
  136. },
  137. mounted: function () {
  138. this.$nextTick(function () {
  139. var that = this;
  140. $h.EventUtil.listenTouchDirection(document, function () {
  141. that.getLecturerList();
  142. });
  143. });
  144. },
  145. methods: {
  146. // 讲师列表
  147. getLecturerList: function () {
  148. var that = this;
  149. if (this.loading || this.finished) {
  150. return;
  151. }
  152. that.loading = true;
  153. $h.loadFFF();
  154. storeApi.baseGet($h.U({
  155. c: 'Special',
  156. a: 'lecturerList',
  157. q: {
  158. page: that.page++,
  159. limit: that.limit
  160. }
  161. }), function (res) {
  162. var arr = res.data.data;
  163. that.loading = false;
  164. $h.loadClear();
  165. that.lecturerList = that.lecturerList.concat(arr);
  166. that.finished = arr.length < that.limit;
  167. that.loadTitle = that.finished ? '已全部加载' : '上拉加载更多';
  168. }, function (res) {
  169. $h.loadClear();
  170. that.loadTitle = '上拉加载更多';
  171. that.loading = false;
  172. });
  173. }
  174. }
  175. });
  176. });
  177. </script>
  178. {/block}