grade_list.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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"}{if $type}我的收藏{else}我的课程{/if}{/block}
  12. {block name='head_top'}
  13. <style>
  14. .mask .box {
  15. position: relative;
  16. }
  17. .mask .box .iconfont {
  18. color: #ffffff;
  19. font-size: 0.4rem;
  20. left: 50%;
  21. margin-left: -0.2rem;
  22. bottom: 0.3rem
  23. }
  24. .public_list .item .text {
  25. -webkit-align-self: flex-start;
  26. align-self: flex-start;
  27. }
  28. .loading {
  29. font-size: .4rem;
  30. text-align: center;
  31. color: #999;
  32. }
  33. .loaded {
  34. font-size: .28rem;
  35. line-height: .72rem;
  36. text-align: center;
  37. color: #999;
  38. }
  39. .nothing {
  40. position: absolute;
  41. top: 50%;
  42. left: 50%;
  43. width: 4.14rem;
  44. height: 3.36rem;
  45. -webkit-transform: translate(-50%, -50%);
  46. transform: translate(-50%, -50%);
  47. }
  48. </style>
  49. {/block}
  50. {block name="content"}
  51. <div v-cloak id="app">
  52. <div :style="{ paddingTop: paddingTop + 'px' }" class="favorite">
  53. <div v-if="type" ref="tabbar" class="tabbar">
  54. <div :class="{ on: active === 1 }" @click="tab(1)">资料</div>
  55. <div :class="{ on: active === 0 }" @click="tab(0)">课程</div>
  56. </div>
  57. <div v-if="makeGradeList.length" :class="{ material: active }" class="list">
  58. <a v-for="item in makeGradeList" :key="item.id" :href="item.path">
  59. <div>
  60. <img :src="item.image" alt="">
  61. <div v-if="!active">{{type==1 ? item.types : item.type}}</div>
  62. </div>
  63. <div>
  64. <div>{{ item.title }}</div>
  65. <template v-if="active">
  66. <div :class="{ money: item.pay_type }">
  67. <template v-if="item.pay_type">
  68. ¥<span>199.00</span>
  69. </template>
  70. <template v-else>
  71. 免费
  72. </template>
  73. </div>
  74. <div>
  75. <div>{{ item.ficti + item.sales }}人已下载</div>
  76. <button type="button">去下载</button>
  77. </div>
  78. </template>
  79. <template v-else>
  80. <div v-if="item.label.length">
  81. <template v-for="(label, index) in item.label">
  82. <div v-if="index < 2" :key="index">{{ label }}</div>
  83. </template>
  84. </div>
  85. <div>
  86. <div :class="{ money: item.pay_type }">
  87. <template v-if="item.pay_type">
  88. ¥<span>{{ item.is_pink ? item.pink_money : item.money }}</span>
  89. </template>
  90. <template v-else>
  91. 免费
  92. </template>
  93. </div>
  94. <div v-if="!item.is_light && item.types !== 4">共{{ item.count }}节</div>
  95. </div>
  96. </template>
  97. </div>
  98. </a>
  99. </div>
  100. <div v-show="loading" class="loading">
  101. <span class="fa fa-spinner"></span>
  102. </div>
  103. <div v-if="loadend && gradeList.length" class="loaded">已全部加载</div>
  104. <div v-if="loadend && !gradeList.length" >
  105. {if $type}
  106. <img class="nothing" src="/wap/first/zsff/images/no_collection.png">
  107. {else}
  108. <img class="nothing" src="/wap/first/zsff/images/no_data_available.png">
  109. {/if}
  110. </div>
  111. </div>
  112. <div class="my-course" ref="app">
  113. <base-login :login-show="loginShow" :site-name="site_name" @login-close="loginClose"></base-login>
  114. <div class="mask" @touchmove.prevent style="z-index: 100;" v-show="isfollow">
  115. <h4>立即绑定微信公众号用户</h4>
  116. <div class="code">
  117. <img :src="codeUrl" class="image" alt="">
  118. </div>
  119. <div class="button" @click="skip">跳过</div>
  120. </div>
  121. {if !$subscribe && !empty($userInfo) && $is_official_account_switch}
  122. <div class="groupCode" v-if="is_code">
  123. <div class="ewmCon">
  124. <div class="code"><img :src="wechat_qrcode"></div>
  125. <div class="codeTip">扫码关注公众号</div>
  126. <div class="iconfont iconguanbi2" @click="clone"></div>
  127. </div>
  128. </div>
  129. <div class="mask" style="align-items:center;display: flex;" v-if="is_code" @click="clone"></div>
  130. <div style="height: 1.0rem"></div>
  131. {/if}
  132. </div>
  133. <quick-menu></quick-menu>
  134. </div>
  135. {/block}
  136. {block name="foot"}
  137. <script>
  138. var wechat_qrcode = '{$subscribeQrcode}', type = {$type},site_name = '{$Auth_site_name}';
  139. require(['vue', 'helper', 'store', 'special-type', 'components/base-login/index','quick'], function (Vue, $h, storeApi, specialType, BaseLogin) {
  140. new Vue({
  141. el: '#app',
  142. components: {
  143. 'base-login': BaseLogin
  144. },
  145. data: {
  146. site_name:site_name,
  147. navlist: [{title: '我的课程'}, {title: '我的收藏'}],
  148. loadend: false,
  149. loading: false,
  150. active: 0,
  151. type: type,
  152. gradeList: [],
  153. min: 2,
  154. page: 1,
  155. limit: 10,
  156. count: 0,
  157. codeUrl: '',
  158. loginShow: false,
  159. isfollow: false,
  160. url: $h.U({c: 'login', a: 'phone_check'}),
  161. wechat_qrcode: wechat_qrcode,
  162. is_code: $h.getCookie('QRCODE') ? false : true,
  163. paddingTop: 0
  164. },
  165. computed: {
  166. makeGradeList: function () {
  167. return this.gradeList.map(function (value) {
  168. if(this.type){
  169. value.types = specialType[value.type];
  170. }
  171. if ('is_light' in value) {
  172. if (value.is_light) {
  173. value.path = "{:url('special/single_details')}?id=" + value.s_id;
  174. } else {
  175. value.path = "{:url('special/details')}?id=" + value.s_id + (this.type ? '' : '#tash');
  176. }
  177. } else {
  178. value.path = "{:url('special/data_details')}?id=" + value.id;
  179. }
  180. return value;
  181. });
  182. }
  183. },
  184. watch: {
  185. active: function () {
  186. this.$set(this, 'gradeList', []);
  187. this.page = 1;
  188. this.loadend = false;
  189. this.getGradeList();
  190. }
  191. },
  192. mounted: function () {
  193. var that = this;
  194. storeApi.baseGet($h.U({c: 'index', a: 'login_user'}), function (res) {
  195. that.getGradeList();
  196. }, function () {
  197. that.loginShow = true;
  198. });
  199. if (type == 1) {
  200. this.active = 1;
  201. }
  202. this.$nextTick(function () {
  203. if (this.type) {
  204. this.paddingTop = this.$refs.tabbar.clientHeight;
  205. }
  206. });
  207. },
  208. methods: {
  209. clone: function () {
  210. this.is_code = false;
  211. $h.setCookie('QRCODE', 1, 1576237948);
  212. },
  213. skip: function () {
  214. this.isfollow = false;
  215. this.loginShow = false;
  216. setTimeout(function () {
  217. window.location.reload();
  218. }, 800);
  219. },
  220. loginClose: function (val) {
  221. this.loginShow = false;
  222. val && this.logComplete();
  223. },
  224. logComplete: function (data) {
  225. var that = this;
  226. if (!data.isfollow) {
  227. this.codeUrl = data.url;
  228. this.isfollow = true;
  229. var qcode_id = data.qcode_id;
  230. var interval = setInterval(function () {
  231. app.baseGet($h.U({c: 'index', a: 'qcode_login', q: {qcode_id: qcode_id}}), function (res) {
  232. clearInterval(interval);
  233. that.isfollow = false;
  234. setTimeout(function () {
  235. window.location.reload();
  236. }, 800);
  237. }, null, true);
  238. }, 1000);
  239. } else {
  240. that.loginShow = false;
  241. window.location.reload();
  242. }
  243. },
  244. //所有插件回调处理事件
  245. changeVal: function (opt) {
  246. if (typeof opt != 'object') opt = {};
  247. var action = opt.action || '';
  248. var value = opt.value || '';
  249. this[action] && this[action](value);
  250. },
  251. getTashUrl: function (id) {
  252. return $h.U({c: 'special', a: 'details', q: {id: id}}) + (this.active == 0 ? '#tash' : '');
  253. },
  254. EventUtil: function () {
  255. var that = this;
  256. that.$nextTick(function () {
  257. $h.EventUtil.listenTouchDirection(document, function () {
  258. that.loading == false && that.getGradeList();
  259. }, false);
  260. })
  261. },
  262. // 获取课程
  263. getGradeList: function () {
  264. var that = this;
  265. if (that.loading) return;
  266. if (that.loadend) return;
  267. that.loading = true;
  268. storeApi.baseGet($h.U({
  269. c: 'special',
  270. a: 'get_grade_list',
  271. q: {
  272. active: this.active,
  273. page: this.page,
  274. limit: this.limit
  275. }
  276. }), function (res) {
  277. var list = res.data.data.list;
  278. that.gradeList.push.apply(this.gradeList, list);
  279. this.loadend = list.length < this.limit;
  280. this.page = res.data.data.page;
  281. this.loading = false;
  282. this.$set(this, 'gradeList', this.gradeList);
  283. this.EventUtil();
  284. }.bind(this), function () {
  285. that.loading = false;
  286. });
  287. },
  288. tab: function (active) {
  289. if (this.loading) {
  290. return;
  291. }
  292. this.active = active;
  293. this.gradeList = [];
  294. this.page = 1;
  295. this.loadend = false;
  296. this.getGradeList();
  297. }
  298. }
  299. });
  300. })
  301. </script>
  302. {/block}