grade_list.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. {extend name="public/container"}
  2. {block name="title"}{if $type}我的收藏{else}我的课程{/if}{/block}
  3. {block name='head_top'}
  4. <style>
  5. .mask .box {
  6. position: relative;
  7. }
  8. .mask .box .iconfont {
  9. color: #ffffff;
  10. font-size: 0.4rem;
  11. left: 50%;
  12. margin-left: -0.2rem;
  13. bottom: 0.3rem
  14. }
  15. .public_list .item .text {
  16. -webkit-align-self: flex-start;
  17. align-self: flex-start;
  18. }
  19. .loading {
  20. font-size: .4rem;
  21. text-align: center;
  22. color: #999;
  23. }
  24. .loaded {
  25. font-size: .28rem;
  26. line-height: .72rem;
  27. text-align: center;
  28. color: #999;
  29. }
  30. .nothing {
  31. position: absolute;
  32. top: 30%;
  33. left: 50%;
  34. width: 4rem;
  35. height: 4rem;
  36. -webkit-transform: translate(-50%, -50%);
  37. transform: translate(-50%, -50%);
  38. }
  39. </style>
  40. {/block}
  41. {block name="content"}
  42. <div v-cloak id="app">
  43. <div class="favorite">
  44. <a v-for="item in makeGradeList" :key="item.id" :href="item.path" class="item">
  45. <div class="image">
  46. <img :src="item.image">
  47. <div class="label">{{ item.type }}</div>
  48. </div>
  49. <div class="text">
  50. <div class="name">{{ item.title }}</div>
  51. <div class="label">
  52. <template v-for="(itm, idx) in item.label">
  53. <span v-if="idx < 2" :key="idx">{{ itm }}</span>
  54. </template>
  55. </div>
  56. <div class="price">
  57. <template v-if="item.is_pink">
  58. <div class="money">¥<span>{{ item.pink_money }}</span></div>
  59. <div class="group-price-icon">拼团特惠</div>
  60. <div v-if="item.types!=4" class="total">共{{item.count}}节</div>
  61. </template>
  62. <template v-else>
  63. <div v-if="item.money === '0.00'" class="free">免费</div>
  64. <div v-else class="money">¥<span>{{ item.money }}</span></div>
  65. <div v-if="item.types!=4" class="total">共{{item.count}}节</div>
  66. </template>
  67. </div>
  68. </div>
  69. </a>
  70. <div v-show="loading" class="loading">
  71. <span class="fa fa-spinner"></span>
  72. </div>
  73. <div v-if="loadend && page > 2" class="loaded">已全部加载</div>
  74. <div v-if="!gradeList.length && !loading" >
  75. {if $type}
  76. <img class="nothing" src="/wap/first/zsff/images/no_collection.png">
  77. {else}
  78. <img class="nothing" src="/wap/first/zsff/images/no_data_available.png">
  79. {/if}
  80. </div>
  81. <div style="height: 1.2rem"></div>
  82. </div>
  83. <div class="my-course" ref="app">
  84. <enter :appear="appear" @change="changeVal" :url="url" :site_name="site_name"></enter>
  85. <div class="mask" @touchmove.prevent style="z-index: 100;" v-show="isfollow">
  86. <h4>立即绑定微信公众号用户</h4>
  87. <div class="code">
  88. <img :src="codeUrl" class="image" alt="">
  89. </div>
  90. <div class="button" @click="skip">跳过</div>
  91. </div>
  92. {if !$subscribe && !empty($userInfo)}
  93. <div class="publicFollow acea-row row-between-wrapper" style="bottom: 1.2rem;">
  94. <div>关注公众号"{$Auth_site_name}",看课更方便</div>
  95. <div class="follow acea-row row-center-wrapper" @click=" is_code = true ">关注</div>
  96. </div>
  97. <div class="groupCode" v-if="is_code" v-cloak="" @click="clone">
  98. <div class="ewmCon">
  99. <div class="code"><img :src="wechat_qrcode"></div>
  100. <div class="codeTip">长按扫一扫<br>关注微信公众号<br>立马学习</div>
  101. <div class="iconfont icon-guanbi"></div>
  102. </div>
  103. </div>
  104. <div class="mask" style="align-items:center;display: flex;" v-if="is_code" @click="clone"></div>
  105. <div style="height: 1.0rem"></div>
  106. {/if}
  107. </div>
  108. <shortcut></shortcut>
  109. </div>
  110. {/block}
  111. {block name="foot"}
  112. <script>
  113. var wechat_qrcode = '{$subscribeQrcode}', type = '{$type}',site_name = '{$Auth_site_name}';
  114. require(['vue', 'helper', 'store', 'special-type', '{__WAP_PATH}zsff/js/enter.js','{__WAP_PATH}zsff/js/shortcut.js'], function (Vue, $h, storeApi, specialType) {
  115. new Vue({
  116. el: '#app',
  117. data: {
  118. site_name:site_name,
  119. navlist: [{title: '我的课程'}, {title: '我的收藏'}],
  120. loadend: false,
  121. loading: false,
  122. active: 0,
  123. gradeList: [],
  124. min: 2,
  125. page: 1,
  126. limit: 10,
  127. count: 0,
  128. codeUrl: '',
  129. appear: true,
  130. isfollow: false,
  131. url: $h.U({c: 'login', a: 'phone_check'}),
  132. wechat_qrcode: wechat_qrcode,
  133. is_code: $h.getCookie('QRCODE') ? false : true,
  134. },
  135. computed: {
  136. makeGradeList: function () {
  137. return this.gradeList.map(function (value) {
  138. if(type==1){
  139. value.types=value.type;
  140. value.type = specialType[value.type];
  141. }
  142. value.path = $h.U({c: 'special', a: 'details', q: { id: value.s_id }}) + (this.active == 0 ? '#tash' : '');
  143. return value;
  144. });
  145. }
  146. },
  147. watch: {
  148. active: function () {
  149. this.$set(this, 'gradeList', []);
  150. this.page = 1;
  151. this.loadend = false;
  152. this.getGradeList();
  153. }
  154. },
  155. mounted: function () {
  156. var that = this;
  157. storeApi.baseGet($h.U({c: 'index', a: 'login_user'}), function (res) {
  158. that.getGradeList();
  159. }, function () {
  160. that.appear = false;
  161. });
  162. if (type == 1) {
  163. this.active = 1;
  164. }
  165. },
  166. methods: {
  167. clone: function () {
  168. this.is_code = false;
  169. $h.setCookie('QRCODE', 1, 1576237948);
  170. },
  171. skip: function () {
  172. this.isfollow = false;
  173. this.appear = true;
  174. setTimeout(function () {
  175. window.location.reload();
  176. }, 800);
  177. },
  178. loginClose: function () {
  179. this.appear = true;
  180. },
  181. logComplete: function (data) {
  182. var that = this;
  183. if (!data.isfollow) {
  184. this.codeUrl = data.url;
  185. this.isfollow = true;
  186. var qcode_id = data.qcode_id;
  187. var interval = setInterval(function () {
  188. app.baseGet($h.U({c: 'index', a: 'qcode_login', q: {qcode_id: qcode_id}}), function (res) {
  189. clearInterval(interval);
  190. that.isfollow = false;
  191. setTimeout(function () {
  192. window.location.reload();
  193. }, 800);
  194. }, null, true);
  195. }, 1000);
  196. } else {
  197. that.appear = true;
  198. window.location.reload();
  199. }
  200. },
  201. //所有插件回调处理事件
  202. changeVal: function (opt) {
  203. if (typeof opt != 'object') opt = {};
  204. var action = opt.action || '';
  205. var value = opt.value || '';
  206. this[action] && this[action](value);
  207. },
  208. getTashUrl: function (id) {
  209. return $h.U({c: 'special', a: 'details', q: {id: id}}) + (this.active == 0 ? '#tash' : '');
  210. },
  211. EventUtil: function () {
  212. var that = this;
  213. that.$nextTick(function () {
  214. $h.EventUtil.listenTouchDirection(document, function () {
  215. that.loading == false && that.getGradeList();
  216. }, false);
  217. })
  218. },
  219. getGradeList: function () {
  220. var that = this;
  221. if (that.loading) return;
  222. if (that.loadend) return;
  223. that.loading = true;
  224. storeApi.baseGet($h.U({
  225. c: 'special',
  226. a: 'get_grade_list',
  227. q: {type: that.active, page: that.page, limit: that.limit}
  228. }), function (res) {
  229. var list = res.data.data.list;
  230. that.gradeList.push.apply(this.gradeList, list);
  231. this.loadend = list.length < this.limit;
  232. this.page = res.data.data.page;
  233. this.loading = false;
  234. this.$set(this, 'gradeList', this.gradeList);
  235. this.EventUtil();
  236. }.bind(this), function () {
  237. that.loading = false;
  238. });
  239. },
  240. }
  241. });
  242. })
  243. </script>
  244. {/block}