瀏覽代碼

学习计划 按步骤播放

赵启卫 2 年之前
父節點
當前提交
d734a487a7

+ 15 - 8
application/admin/view/user/user/index.php

xqd xqd xqd xqd
@@ -132,6 +132,12 @@
                 </div>
                 <div class="layui-col-md12">
                     <div class="layui-btn-group conrelTable">
+                        <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" data-type="sendspecial">
+                            <i class="layui-icon">&#xe609;</i>赠送专题
+                        </button>
+                        <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" data-type="sendplan">
+                            <i class="layui-icon">&#xe609;</i>赠送学习计划
+                        </button>
                         <!-- <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" data-type="set_custom">
                             <i class="layui-icon">&#xe609;</i>发送客服图文消息
                         </button>
@@ -209,11 +215,6 @@
                                     <i class="fa fa-paste"></i>赠送试卷
                                 </a>
                             </li>
-                            <li>
-                                <a href="javascript:void(0);" onclick="$eb.createModalFrame('赠送学习计划','{:Url('sendplan')}?uid='+{{d.uid}},{w:1000})">
-                                    <i class="fa fa-paste"></i>赠送学习计划
-                                </a>
-                            </li>
                         </ul>
                     </script>
                 </div>
@@ -298,9 +299,7 @@
             {type:'checkbox'},
             {field: 'uid', title: 'UID', align: 'center',width:70},
             {field: 'avatar', title: '头像', event:'open_image', align: 'center', templet: '#avatar'},
-            {field: 'nickname', title: '昵称',templet:"#nickname",align: 'center'},
-            {field: 'realname', title: '姓名',align: 'center'},
-            {field: 'comment', title: '备注',align: 'center'},
+            {field: 'nickname', title: '姓名',templet:"#nickname",align: 'center'},
             // {field: 'levelType', title: '身份',align: 'center',width:'6%'},
             // {field: 'user_type', title: '用户类型',width:'6%',align:'center'},
             {field: 'phone', title: '手机号',align: 'center'},
@@ -377,6 +376,14 @@
     });
 
     var action={
+        sendspecial:function(){
+            var ids=layList.getCheckData().getIds('uid');
+            console.log(ids);
+        },
+        sendplan:function(){
+            var ids=layList.getCheckData().getIds('uid');
+            console.log(ids);
+        },
         set_status_f:function () {
             var ids=layList.getCheckData().getIds('uid');
             if(ids.length){

+ 57 - 4
application/wap/controller/Studyplan.php

xqd xqd
@@ -66,17 +66,22 @@ class Studyplan extends AuthController{
         $planinfo = Plan::get($id);
         if (!$planinfo) $this->failed('参数错误,无法访问', Url::build('index/index'));
         $planinfo['introduction'] = htmlspecialchars_decode($planinfo['introduction']);
-        $steps = PlanSteps::where('is_del', 0)->where('pid', $id)->order('sort asc')->select();
+        $steps = PlanSteps::where('is_del', 0)->where('pid', $id)->order('sort asc')->select()->toArray();
         $stepids = [];
         $isPay = 0;
         $buyinfo = PlanBuy::where('planid', $id)->where('uid', $this->uid)->where('is_del', 0)->find();
         if ($buyinfo) {
             $isPay = 1;
         }
+        $stepsList = [];
+        $itemsList = [];
         foreach($steps as $v){
+            $stepsList[$v['id']] = $v;
+            $itemsList[$v['id']] = [];
             $stepids[] = $v['id'];
         }
-        $itemsList = [];
+        
+        
         $join = [
             ['special s', 's.id = it.cid and s.is_del = 0 and s.status = 1']
         ];
@@ -86,17 +91,65 @@ class Studyplan extends AuthController{
             ->where('stepsid', 'in', $stepids)
             ->order('sort asc')
             ->select();
+        //$specialids = [];
         foreach ($items as $v) {
             $v['count'] = SpecialModel::numberChapters($v['type'], $v['id']);
             $itemsList[$v['stepsid']][] = $v->toArray();
+            //$specialids[] = $v['id'];
         }
-
+        
+        //标记计划步骤是否完成学习
+        $isopen = 1;
+        foreach ($itemsList as $key => &$v) {
+            $isend = 1;
+            foreach($v as $k1 => &$v1) {
+                //
+                $join = [
+                    ['SpecialWatch sw', 'sw.special_id = ss.special_id and sw.task_id = ss.source_id and sw.uid = ' . $this->uid, 'left'],
+                ];
+                $order = 'sort desc,id desc';
+                if ($v1['sort_order']) {
+                    $order = 'sort asc, id asc';
+                }
+                $specialWatchList = SpecialSource::alias('ss')->field('ss.*, sw.viewing_time,sw.percentage')
+                    ->join($join)
+                    ->where('ss.special_id', '=', $v1['id'])
+                    ->order($order)
+                    ->select();
+                foreach($specialWatchList as $v2){
+                    $v1['tasklist'][$v2['special_id']][] = $v2->toArray();
+                    if ($v2['percentage'] < 98 && $isend == 1) $isend = 0;
+                }
+                //echo $isend . '---' . $v1['id'];
+                if ($isend == 1) {
+                    //判断是否有考试
+                    $join = [
+                        ['ExaminationRecord er', 'er.test_id = r.relation_id and er.uid = ' . $this->uid, 'left'],
+                    ];
+                    $examlist = Relation::alias('r')->where('r.relationship_id', $v1['id'])->where('r.relationship', 2)
+                    ->field('r.relation_id as test_id, er.score')->join($join)->select();
+                    if ($examlist) {
+                        foreach ($examlist as $item) {
+                            if ($item['score'] < 60) {
+                                $isend = 0;
+                            }
+                        }
+                    }
+                }
+            }
+            $stepsList[$key]['isopen'] = $isopen;
+            if ($isend == 0) {
+                $isopen = 0;
+            }
+            //$stepsList[$key]['isend'] = $isend;
+        }
+        $stepsList = array_values($stepsList);
         //微信支付相关代码
         $user_level = !$this->uid ? 0 : $this->userInfo;
         $this->assign('is_member', isset($user_level['level']) ? $user_level['level'] : 0);
 
         $this->assign('isPay', $isPay);
-        $this->assign('steps', json_encode($steps));
+        $this->assign('steps', json_encode($stepsList));
         $this->assign('itemsList', json_encode($itemsList));
         $this->assign('planinfo', json_encode($planinfo));
         

+ 12 - 3
application/wap/view/first/studyplan/details.html

xqd xqd xqd
@@ -113,7 +113,13 @@
                                     <div>
                                         <div style="font-weight:bolder; ">{{ item.title }}</div>
                                         <div style="color:gray; ">{{ item.abstract }}</div>
-                                        <div style="color:gray;">共 {{item.count}} 节</div>
+                                        <div style="display: flex;">
+                                            <div style="color:gray; flex:1;">共 {{item.count}} 节</div>
+                                            <div style="float:right;" v-if="is_pay">
+                                                <input class="zybt" @click="specialDetails(item.id)" v-if="is_pay && item1.isopen" value="开始学习" type="button"/>
+                                                <input class="zybt" v-if="!item1.isopen" value="请完成上一步骤" type="button"/>
+                                            </div>
+                                        </div>
                                     </div>
                                 </div>
                             </li>
@@ -143,11 +149,11 @@
                 <div>客服</div>
             </div>
         </a> -->
-        <div class="wrap">
+        <div class="wrap" v-if="!is_pay">
             <div class="video_footer_btn acea-row">
                 <div class="video_footer_btn_right acea-row on">
                     <span @click="OpenPay()" v-if="!is_pay" class="acea-row row-center-wrapper video_footer_btn_left_pic" style="flex: 1;">购买学习</span>
-                    <span @click="study()" v-if="is_pay" class="acea-row row-center-wrapper video_footer_btn_left_pic" style="flex: 1;">开始学习</span>
+                    <!-- <span @click="study()" v-if="is_pay" class="acea-row row-center-wrapper video_footer_btn_left_pic" style="flex: 1;">开始学习</span> -->
                 </div>
             </div>
         </div>
@@ -230,6 +236,9 @@
                 study: function (){
                     return window.location.href=$h.U({ c: 'studyplan', a: 'gotoStudy', q: {id: this.planinfo.id } });
                 },
+                specialDetails:function(id){
+                    return window.location.href=$h.U({ c: 'special', a: 'details', q: {id:  id} });
+                },
                 // 点击遮罩层
                 maskClick: function () {
                     this.dialogShow = false;

+ 1 - 1
application/wap/view/first/studyplan/index.html

xqd
@@ -51,7 +51,7 @@
                         <div class="price-wrap">
                             <div class="price" @click="planDetails(item.id)">¥<span>{{ item.sales }}</span></div>
                             <div>
-                                <input class="zybt" @click="study(item.id)" v-if="item.isbuy" value="开始学习" type="button"/>
+                                <input class="zybt" @click="planDetails(item.id)" v-if="item.isbuy" value="开始学习" type="button"/>
                                 <input class="zybt" @click="OpenPay(item)" v-if="!item.isbuy" value="购买学习" type="button"/>
                             </div>
                         </div>