123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- <!-- +---------------------------------------------------------------------- -->
- <!-- | CRMEB [ CRMEB赋能开发者,助力企业发展 ] -->
- <!-- +---------------------------------------------------------------------- -->
- <!-- | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. -->
- <!-- +---------------------------------------------------------------------- -->
- <!-- | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 -->
- <!-- +---------------------------------------------------------------------- -->
- <!-- | Author: CRMEB Team <admin@crmeb.com> -->
- <!-- +---------------------------------------------------------------------- -->
- {extend name="public/container"}
- {block name="title"}{/block}
- {block name="head_top"}
- <style>
- .free{margin-top:.1rem;font-weight:400;font-size:.22rem;line-height:.38rem;color:#FF6B00;}
- .nothing {
- width: 4.14rem;
- height: 3.36rem;
- /* -webkit-transform: translate(-50%, -50%);
- transform: translate(-50%, -50%); */
- }
- body {
- padding-bottom: 1.1rem;
- padding-bottom: calc(1.1rem + constant(safe-area-inset-bottom));
- padding-bottom: calc(1.1rem + env(safe-area-inset-bottom));
- }
- </style>
- <script src="/wap/first/zsff/js/scroll.js"></script>
- <script src="/wap/first/zsff/js/navbarscroll.js"></script>
- {/block}
- {block name="content"}
- <div v-cloak id="app" class="goodsClass">
- <div class="header" style="height: 1rem;">
- <div class="search acea-row row-middle">
- <div class="pictrue">{if $homeLogo}<img src="{$homeLogo}">{else}<img src="/wap/first/zsff/images/crmeb.png">{/if}</div>
- <form class="form" @submit.prevent="goSearch">
- <label class="label">
- <img class="img" src="/wap/first/zsff/images/search.png">
- <input class="input" v-model="search" placeholder="输入课程名称">
- </label>
- <input class="submit" type="submit" value="搜索">
- </form>
- </div>
- <div v-if="gradeCate.length" style="display: none;" id="wrapper" class="wrapper">
- <div class="scroller">
- <ul>
- <li v-for="item in gradeCate" :key="item.id" :data-id="item.id">
- <a href="javascript:" v-text="item.name"></a>
- </li>
- </ul>
- </div>
- </div>
- </div>
- <div v-if="bigcateco" style="margin: 10px; color: gray;">
- {{bigcateco}}
- </div>
- <div v-if="subjectCate.length" id="nav" class="nav">
- <div class="scroller">
- <ul>
- <li v-for="item in subjectCate" :key="item.id" :data-id="item.id" class="item">
- <a href="javascript:">
- <div class="pictrue"><img :src="item.pic"></div>
- <div class="name" v-text="item.name"></div>
- </a>
- </li>
- </ul>
- </div>
- </div>
- <div v-if="smailcatco" style="margin: 10px; color: gray;">
- {{smailcatco}}
- </div>
- <div class="public_list_big goodList">
- <a v-for="item in updateSpecialList" :key="item.id" :href="item.is_light ? '{:url('special/single_details')}?id=' + item.id : '{:url('special/details')}?id=' + item.id" class="item acea-row">
- <div class="pictrue">
- <img :src="item.image" :alt="item.title">
- <div class="label">{{ item.special_type }}</div>
- </div>
- <div class="text">
- <div class="title acea-row row-middle">
- <div class="name line1" v-text="item.title"></div>
- </div>
- <div class="labelList">
- <span class="labelItem" v-for="label in item.label">{{label}}</span>
- </div>
- <div class="acea-row row-middle row-between">
- <div>
- <div class="money" v-if="item.money > 0">¥<span>{{item.money}}</span></div>
- <div class="free" v-else>免费</div>
- <span v-if="!item.is_light && item.type!=4" class="total">共{{item.count}}节</span>
- </div>
- <div class="num">{{item.browse_count}}人已学习</div>
- </div>
- </div>
- </a>
- </div>
- <div v-if="loadend && !specialList.length" style="text-align:center;padding-top:20px;">
- <img class="nothing" src="/wap/first/zsff/images/no_data_available.png">
- </div>
- <p v-else class="loading-line" style="background-color: #fff;">
- <span v-show="loading" class="fa fa-spinner loadingpic" style="font-size: 0.4rem;"></span>
- <span v-text="loadTitle">加载更多</span>
- </p>
- <div v-if="cate_id == 64">
- {include file="public/store_menu"}
- </div>
- <quick-menu v-if="cate_id != 64"></quick-menu>
- </div>
- {/block}
- {block name="foot"}
- <script>
- var cate_id = {$cate_id};
- var subject_id = {$subject_id};
- require(['vue', 'axios', 'helper', 'special-type', 'quick'], function (Vue, axios, $h, specialType, quick) {
- var vm = new Vue({
- el: '#app',
- data: {
- gradeCate: [],
- subjectCate: [],
- specialList: [],
- gradeId: -1,
- subjectId: -1,
- search: '',
- loadTitle: '',
- page: 1,
- limit: 10,
- loading: false,
- loadend: false,
- count: 0,
- bigcateco:'',
- smailcatco:'',
- webtitle:'',
- cate_id: cate_id,
- },
- computed: {
- updateSpecialList: function () {
- return this.specialList.map(function (value) {
- value.special_type = specialType[value.type];
- return value;
- });
- }
- },
- created: function () {
- this.getCateList();
- },
- mounted: function () {
- this.$nextTick(function () {
- $h.EventUtil.listenTouchDirection(document, function () {
- this.getSpecialList();
- //this.getSubject();
- }.bind(this), false);
- });
- },
- methods: {
- goSearch: function () {
- this.loadend = false;
- this.page = 1;
- this.gradeId = 0;
- this.$set(this, 'specialList', []);
- this.getSpecialList();
- },
- // 获取导航数据
- getCateList: function () {
- this.loading = true;
- that = this;
- /* 获取主分类*/
- if (cate_id > 0) {
- axios.get("{:url('special/get_subject_info')}", {
- params: {
- id: cate_id,
- }
- }).then(function(res) {
- //that.webtitle = res.data.data.name;
- document.title = res.data.data.name;
- that.bigcateco = res.data.data.co;
- });
- }
- if (subject_id > 0) {
- axios.get("{:url('special/get_subject_info')}", {
- params: {
- id: subject_id,
- }
- }).then(function(res) {
- that.smailcatco = res.data.data.co;
- });
- }
- axios.get("{:url('special/get_grade_cate')}").then(function (res) {
- vm.loading = false;
- var resData = res.data;
- if (resData.code === 200) {
- vm.gradeCate = resData.data;
- vm.gradeCate.unshift({
- id: 0,
- name: '全部'
- });
- var defaultSelect = 0;
- for (var i = 0; i < vm.gradeCate.length; i++) {
- if (vm.gradeCate[i].id === cate_id) {
- defaultSelect = i;
- break;
- }
- }
- vm.$nextTick(function () {
- $('#wrapper').navbarscroll({
- defaultSelect: defaultSelect,
- scrollerWidth: 5,
- fingerClick: 1,
- endClickScroll: function (elem) {
- var id = $(elem).data('id');
- vm.count++;
- if (vm.gradeId === id) {
- return;
- }
- vm.gradeId = id;
- if (vm.gradeId) {
- vm.getSubject();
- } else {
- vm.subjectCate = [];
- vm.specialList = [];
- vm.subjectId = 0;
- vm.loading = false;
- vm.loadend = false;
- vm.page = 1;
- vm.getSpecialList();
- }
- }
- });
- });
- } else {
- $h.pushMsg(resData.msg);
- }
- }).catch(function () {
- vm.loading = false;
- });
- },
- // 二级导航
- getSubject: function () {
- var subjectCate = [{
- id: 0,
- name: '全部',
- pic: '{__WAP_PATH}zsff/images/all.png',
- grade_id: this.gradeId
- }];
- this.subjectCate = [];
- this.specialList = [];
- this.subjectId = -1;
- for (var i = 0; i < this.gradeCate.length; i++) {
- if (this.gradeId === this.gradeCate[i].id) {
- subjectCate = subjectCate.concat(this.gradeCate[i].children);
- break;
- }
- }
- this.subjectCate = subjectCate;
- var defaultSelect = 0;
- if (this.count === 1) {
- for (let j = 0; j < this.subjectCate.length; j++) {
- if (this.subjectCate[j].id === subject_id) {
- defaultSelect = j;
- break;
- }
- }
- }
- this.$nextTick(function () {
- $('#nav').navbarscroll({
- defaultSelect: defaultSelect,
- scrollerWidth: 5,
- fingerClick: 1,
- endClickScroll: function (elem) {
- var id = $(elem).data('id');
- if (vm.subjectId === id) {
- return;
- }
- vm.subjectId = id;
- vm.specialList = [];
- vm.loadend = false;
- vm.page = 1;
- vm.getSpecialList();
- }
- });
- });
- },
- // 课程列表
- getSpecialList: function () {
- if (this.loading || this.loadend) {
- return;
- };
- that = this;
- this.loading = true;
- this.loadTitle = '';
- axios.get("{:url('special/get_special_list')}", {
- params: {
- grade_id: this.gradeId,
- subject_id: this.subjectId,
- search: this.search,
- page: this.page++,
- limit: this.limit
- }
- }).then(function (res) {
- vm.loading = false;
- var resData = res.data;
- if (resData.code === 200) {
- var data = resData.data;
- vm.specialList = vm.specialList.concat(data);
- vm.loadend = vm.limit > data.length ? true : false;
- vm.loadTitle = vm.loadend ? '已全部加载完' : '上拉加载更多';
- } else {
- $h.pushMsg(resData.msg);
- }
- }).catch(function () {
- vm.loading = false;
- });
- }
- }
- });
- })
- </script>
- {/block}
|