grade_special.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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. <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. .favorite {
  49. padding-top: .11rem;
  50. }
  51. </style>
  52. {/block}
  53. {block name="content"}
  54. <div v-cloak id="app">
  55. <div class="favorite">
  56. <!-- <div class="tabbar">
  57. <div v-for="item in tabs" :key="item.value">{{ item.name }}</div>
  58. </div> -->
  59. <div v-if="gradeList.length" class="list">
  60. <a v-for="item in gradeList" :key="item.id" :href="item.path">
  61. <div>
  62. <img :src="item.image">
  63. <div>{{ item.typeName }}</div>
  64. </div>
  65. <div>
  66. <div>{{ item.title }}</div>
  67. <div v-if="item.label.length">
  68. <template v-for="(label, index) in item.label">
  69. <div v-if="index < 2" :key="index">{{ label }}</div>
  70. </template>
  71. </div>
  72. <div>
  73. <div :class="{ money: item.pay_type }">
  74. <template v-if="item.pay_type">
  75. ¥<span>{{ item.is_pink ? item.pink_money : item.money }}</span>
  76. </template>
  77. <template v-else>
  78. 免费
  79. </template>
  80. </div>
  81. <div v-if="!item.is_light && item.types !== 4">共{{ item.count }}节</div>
  82. </div>
  83. </div>
  84. </a>
  85. </div>
  86. <div v-show="loading" class="loading">
  87. <span class="fa fa-spinner"></span>
  88. </div>
  89. <div v-if="loadend && gradeList.length" class="loaded">已全部加载</div>
  90. <div v-if="loadend && !gradeList.length" >
  91. <!-- <img class="nothing" src="/wap/first/zsff/images/no_collection.png"> -->
  92. <img class="nothing" src="/wap/first/zsff/images/no_data_available.png">
  93. </div>
  94. </div>
  95. <div class="my-course" ref="app">
  96. <base-login :login-show="loginShow" :site-name="site_name" @login-close="loginClose"></base-login>
  97. <div class="mask" @touchmove.prevent style="z-index: 100;" v-show="isfollow">
  98. <h4>立即绑定微信公众号用户</h4>
  99. <div class="code">
  100. <img :src="codeUrl" class="image" alt="">
  101. </div>
  102. <div class="button" @click="skip">跳过</div>
  103. </div>
  104. {if !$subscribe && !empty($userInfo) && $is_official_account_switch}
  105. <div class="groupCode" v-if="is_code">
  106. <div class="ewmCon">
  107. <div class="code"><img :src="wechat_qrcode"></div>
  108. <div class="codeTip">扫码关注公众号</div>
  109. <div class="iconfont iconguanbi2" @click="clone"></div>
  110. </div>
  111. </div>
  112. <div class="mask" style="align-items:center;display: flex;" v-if="is_code" @click="clone"></div>
  113. <div style="height: 1.0rem"></div>
  114. {/if}
  115. </div>
  116. <quick-menu></quick-menu>
  117. </div>
  118. {/block}
  119. {block name="foot"}
  120. <script>
  121. var wechat_qrcode = '{$subscribeQrcode}', site_name = '{$Auth_site_name}';
  122. require(['vue', 'helper', 'store', 'special-type', 'components/base-login/index','quick'], function (Vue, $h, storeApi, specialType, BaseLogin) {
  123. new Vue({
  124. el: '#app',
  125. components: {
  126. 'base-login': BaseLogin
  127. },
  128. data: {
  129. site_name:site_name,
  130. navlist: [{title: '我的课程'}, {title: '我的收藏'}],
  131. loadend: false,
  132. loading: false,
  133. active: 0,
  134. // type: type,
  135. gradeList: [],
  136. min: 2,
  137. page: 1,
  138. limit: 10,
  139. count: 0,
  140. codeUrl: '',
  141. loginShow: false,
  142. isfollow: false,
  143. url: $h.U({c: 'login', a: 'phone_check'}),
  144. wechat_qrcode: wechat_qrcode,
  145. is_code: $h.getCookie('QRCODE') ? false : true,
  146. tabs: [
  147. {
  148. name: '我的课程',
  149. value: 1
  150. }
  151. ]
  152. },
  153. created: function () {
  154. var that = this;
  155. storeApi.baseGet($h.U({c: 'index', a: 'login_user'}), function () {
  156. that.getGradeList();
  157. }, function () {
  158. that.loginShow = true;
  159. });
  160. },
  161. methods: {
  162. clone: function () {
  163. this.is_code = false;
  164. $h.setCookie('QRCODE', 1, 1576237948);
  165. },
  166. skip: function () {
  167. this.isfollow = false;
  168. this.loginShow = false;
  169. setTimeout(function () {
  170. window.location.reload();
  171. }, 800);
  172. },
  173. loginClose: function (val) {
  174. this.loginShow = false;
  175. val && this.logComplete();
  176. },
  177. logComplete: function (data) {
  178. var that = this;
  179. if (!data.isfollow) {
  180. this.codeUrl = data.url;
  181. this.isfollow = true;
  182. var qcode_id = data.qcode_id;
  183. var interval = setInterval(function () {
  184. app.baseGet($h.U({c: 'index', a: 'qcode_login', q: {qcode_id: qcode_id}}), function (res) {
  185. clearInterval(interval);
  186. that.isfollow = false;
  187. setTimeout(function () {
  188. window.location.reload();
  189. }, 800);
  190. }, null, true);
  191. }, 1000);
  192. } else {
  193. that.loginShow = false;
  194. window.location.reload();
  195. }
  196. },
  197. //所有插件回调处理事件
  198. changeVal: function (opt) {
  199. if (typeof opt != 'object') opt = {};
  200. var action = opt.action || '';
  201. var value = opt.value || '';
  202. this[action] && this[action](value);
  203. },
  204. getTashUrl: function (id) {
  205. return $h.U({c: 'special', a: 'details', q: {id: id}}) + (this.active == 0 ? '#tash' : '');
  206. },
  207. EventUtil: function () {
  208. var that = this;
  209. that.$nextTick(function () {
  210. $h.EventUtil.listenTouchDirection(document, function () {
  211. that.loading == false && that.getGradeList();
  212. }, false);
  213. })
  214. },
  215. // 获取课程
  216. getGradeList: function () {
  217. var that = this;
  218. if (that.loading) return;
  219. if (that.loadend) return;
  220. that.loading = true;
  221. storeApi.baseGet($h.U({
  222. c: 'special',
  223. a: 'get_my_grade_list',
  224. q: {
  225. page: this.page,
  226. limit: this.limit
  227. }
  228. }), function (res) {
  229. var list = res.data.data.list;
  230. list.forEach(function (item) {
  231. var path = "{:url('special/details')}";
  232. var typeName = '图文';
  233. if (item.types === 2 || item.light_type === 2) {
  234. typeName = '音频';
  235. } else if (item.types === 3 || item.light_type === 3) {
  236. typeName = '视频';
  237. } else if (item.types === 4) {
  238. typeName = '直播';
  239. } else if (item.types === 5) {
  240. typeName = '专栏';
  241. }
  242. if (item.light_type) {
  243. path = "{:url('special/single_details')}";
  244. }
  245. item.path = path + '?id=' + item.s_id;
  246. item.typeName = typeName;
  247. });
  248. that.gradeList = that.gradeList.concat(list);
  249. that.loadend = that.limit > list.length;
  250. that.page = res.data.data.page;
  251. that.loading = false;
  252. that.EventUtil();
  253. }, function () {
  254. that.loading = false;
  255. });
  256. },
  257. // 切换
  258. tab: function (value) {
  259. if (this.loading) {
  260. return;
  261. }
  262. this.active = value;
  263. this.gradeList = [];
  264. this.page = 1;
  265. this.loadend = false;
  266. this.getGradeList();
  267. }
  268. }
  269. });
  270. })
  271. </script>
  272. {/block}