Ver Fonte

添加学习计划。

赵启卫 há 2 anos atrás
pai
commit
cb01edc2f0

+ 162 - 0
application/admin/controller/study/Plan.php

xqd
@@ -0,0 +1,162 @@
+<?php
+// +----------------------------------------------------------------------
+// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
+// +----------------------------------------------------------------------
+// | Author: CRMEB Team <admin@crmeb.com>
+// +----------------------------------------------------------------------
+
+namespace app\admin\controller\study;
+
+use app\admin\controller\AuthController;
+use app\admin\model\study\Plan as PlanModel;
+use app\admin\model\merchant\Merchant as MerchantModel; //可能不用
+use service\JsonService;
+use service\FormBuilder as Form;
+use think\Url;
+
+/**
+ * 讲师控制器
+ */
+class Plan extends AuthController
+{
+    /**
+     * 讲师列表展示
+     * @return
+     * */
+    public function index()
+    {
+        return $this->fetch();
+    }
+
+    /**
+     * 讲师列表获取
+     * @return
+     * */
+    public function plan_list()
+    {
+        $where = parent::getMore([
+            ['page', 1],
+            ['is_show', ''],
+            ['limit', 20],
+            ['title', ''],
+        ]);
+        return JsonService::successlayui(PlanModel::getLecturerList($where));
+    }
+
+    /**添加/编辑
+     * @param int $id
+     * @return mixed|void
+     * @throws \think\exception\DbException
+     */
+    public function create($id = 0)
+    {
+        if ($id) {
+            $plan = PlanModel::get($id);
+            if (!$plan) return JsonService::fail('学习计划不存在!');
+        } else {
+            $plan = [];
+        }
+        $this->assign(['plan' => json_encode($plan), 'id' => $id]);
+        return $this->fetch();
+    }
+
+    /**
+     * 添加和修改讲师
+     * @param int $id 修改
+     * @return JsonService
+     * */
+    public function save_plan($id = 0)
+    {
+        $data = parent::postMore([
+            ['plan_name', ''],
+            ['plan_head', ''],
+            ['label', []],
+            ['phone', ''],
+            ['explain', ''],
+            ['introduction', ''],
+            ['sort', 0],
+            ['is_show', 1],
+            ['price', 0],
+            ['sales', 0],
+            ['shelf_time', date("y-m-d H:i:s")],
+        ]);
+        $data['plan_name'] = preg_replace("#(^( |\s)+|( |\s)+$)#", "", $data['plan_name']);
+        if (!$data['plan_name']) return JsonService::fail('请输入学习计划名称');
+        if (!$data['plan_head']) return JsonService::fail('请上传封面图片');
+        //if (!count($data['label'])) return JsonService::fail('请输入标签');
+        //if (!$data['explain']) return JsonService::fail('请编辑讲师说明');
+        if (!$data['introduction']) return JsonService::fail('请编辑学习计划介绍');
+        //$data['label'] = json_encode($data['label']);
+        $data['introduction'] = htmlspecialchars($data['introduction']);
+        if ($id) {
+            PlanModel::edit($data, $id);
+            return JsonService::successful('修改成功');
+        } else {
+            //$data['add_time'] = time();
+            // 'label' => $data['label'], 'phone' => $data['phone'], 
+            if (!PlanModel::be(['plan_name' => $data['plan_name'], 'plan_head' => $data['plan_head'], 'price' => $data['price'],'sales' => $data['sales'], 'add_time' => time(), 'shelf_time' => $data['shelf_time'],  'is_del' => 0])) {
+                $res = PlanModel::set($data);
+            } else {
+                return JsonService::fail('学习计划已存在');
+            }
+            if ($res)
+                return JsonService::successful('添加成功');
+            else
+                return JsonService::fail('添加失败');
+        }
+    }
+
+    /**
+     * 设置单个产品上架|下架
+     * @param int $is_show 是否显示
+     * @param int $id 修改的主键
+     * @return JsonService
+     */
+    public function set_show($is_show = '', $id = '')
+    {
+        ($is_show == '' || $id == '') && JsonService::fail('缺少参数');
+        $info = PlanModel::get($id);
+        $info->is_show = $is_show;
+        $res = $info->save();
+        if ($res) {
+            return JsonService::successful($is_show == 1 ? '显示成功' : '隐藏成功');
+        } else {
+            return JsonService::fail($is_show == 1 ? '显示失败' : '隐藏失败');
+        }
+    }
+
+    /**
+     * 快速编辑
+     * @param string $field 字段名
+     * @param int $id 修改的主键
+     * @param string value 修改后的值
+     * @return JsonService
+     */
+    public function set_value($field = '', $id = '', $value = '')
+    {
+        ($field == '' || $id == '' || $value == '') && JsonService::fail('缺少参数');
+        $res = parent::getDataModification('plan', $id, $field, $value);
+        if ($res)
+            return JsonService::successful('保存成功');
+        else
+            return JsonService::fail('保存失败');
+    }
+
+    /**
+     * 删除讲师
+     * @param int $id 修改的主键
+     * @return json
+     * */
+    public function delete($id = 0)
+    {
+        if (!$id) return JsonService::fail('缺少参数');
+        if (PlanModel::delPlan($id))
+            return JsonService::successful('删除成功');
+        else
+            return JsonService::fail(PlanModel::getErrorInfo('删除失败'));
+    }
+}

+ 287 - 0
application/admin/model/study/Plan.php

xqd
@@ -0,0 +1,287 @@
+<?php
+// +----------------------------------------------------------------------
+// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
+// +----------------------------------------------------------------------
+// | Author: CRMEB Team <admin@crmeb.com>
+// +----------------------------------------------------------------------
+
+namespace app\admin\model\study;
+
+use traits\ModelTrait;
+use basic\ModelBasic;
+use app\admin\model\system\RecommendRelation;
+use app\admin\model\system\WebRecommendRelation;
+
+/**
+ * Class Lecturer 讲师
+ * @package app\admin\model\special
+ */
+class Plan extends ModelBasic
+{
+    use ModelTrait;
+    public function setShelfTimeAttr($val) {
+        return $val ? strtotime($val) : time();
+    }
+    public function getShelfTimeAttr($val) {
+        return $val ? date('Y-m-d H:i:s',$val) : '';
+    }
+
+    //设置where条件
+    public static function setWhere($where, $alirs = '', $model = null)
+    {
+        $model = $model === null ? new self() : $model;
+        $model = $alirs !== '' ? $model->alias($alirs) : $model;
+        $alirs = $alirs === '' ? $alirs : $alirs . '.';
+        $model = $model->where("{$alirs}is_del", 0);
+        if (isset($where['is_show']) && $where['is_show'] !== '') $model = $model->where("{$alirs}is_show", $where['is_show']);
+        if ($where['title'] && $where['title']) $model = $model->where("{$alirs}lecturer_name", 'LIKE', "%$where[title]%");
+        $model = $model->order("{$alirs}shelf_time desc");
+        return $model;
+    }
+
+
+    public static function getRecommendLecturerList($where, $lecturer)
+    {
+        $data = self::setWhere($where)->where('id', 'not in', $lecturer)->page((int)$where['page'], (int)$where['limit'])->select();
+        $data = count($data) ? $data->toArray() : [];
+        $count = self::setWhere($where)->where('id', 'not in', $lecturer)->count();
+        return compact('data', 'count');
+    }
+
+    public static function setMerWhere($where, $alirs = '', $model = null)
+    {
+        $model = $model === null ? new self() : $model;
+        $model = $alirs !== '' ? $model->alias($alirs) : $model;
+        $alirs = $alirs === '' ? $alirs : $alirs . '.';
+        $model = $model->where("{$alirs}is_del", 0);
+        if (isset($where['is_show']) && $where['is_show'] !== '') $model = $model->where("{$alirs}is_show", $where['is_show']);
+        if ($where['title'] && $where['title']) $model = $model->where("{$alirs}lecturer_name", 'LIKE', "%$where[title]%");
+        $model = $model->order("{$alirs}sort desc");
+        $model = $model->join('Merchant m', 'l.mer_id=m.id', 'left')->field('l.*,m.status,m.is_source');
+        return $model;
+    }
+
+    /**计划列表
+     * @param $where
+     * @return array
+     * @throws \think\Exception
+     */
+    public static function getLecturerList($where)
+    {
+        $data = self::setWhere($where, 'p')->page((int)$where['page'], (int)$where['limit'])->select();
+        $data = count($data) ? $data->toArray() : [];
+        $count = self::setWhere($where, 'p')->count();
+        return compact('data', 'count');
+    }
+
+    /**
+     * 删除讲师
+     * @param $id
+     * @return bool|int
+     * @throws \think\exception\DbException
+     */
+    public static function delPlan($id)
+    {
+        $plan = self::get($id);
+        if (!$plan) return self::setErrorInfo('删除的数据不存在');
+        // Special::where('is_del', 0)->where('id', $id)->update(['is_show' => 0, 'is_del' => 1]);
+        // if ($lecturer['mer_id'] > 0) {
+        //     $merchant = Merchant::get($lecturer['mer_id']);
+        //     if ($merchant) {
+        //         Merchant::where('id', $lecturer['mer_id'])->update(['is_del' => 1]);
+        //         User::where('uid', $merchant['uid'])->update(['business' => 0]);
+        //         MerchantAdmin::where('mer_id', $lecturer['mer_id'])->update(['is_del' => 1]);
+        //         DownloadModel::where(['is_del' => 0, 'mer_id' => $lecturer['mer_id']])->update(['is_show' => 0, 'is_del' => 1]);
+        //         ProductModel::where(['is_del' => 0, 'mer_id' => $lecturer['mer_id']])->update(['is_show' => 0, 'is_del' => 1]);
+        //         EventRegistrationModel::where(['is_del' => 0, 'mer_id' => $lecturer['mer_id']])->update(['is_show' => 0, 'is_del' => 1]);
+        //     }
+        // }
+        return self::where('id', $id)->update(['is_del' => 1]);
+    }
+
+    /**获取商户id
+     * @param $id
+     */
+    public static function getMerId($id)
+    {
+        return self::where('id', $id)->value('mei_id');
+    }
+
+    /**讲师课程订单
+     * @param $lecturer_id
+     */
+    public static function lecturerOrderList($where)
+    {
+        $model = self::getOrderWhere($where)->field('a.order_id,a.pay_price,a.pay_type,a.paid,a.status,a.total_price,a.refund_status,a.type,s.title,r.nickname,a.uid');
+        $data = ($data = $model->page((int)$where['page'], (int)$where['limit'])->select()) && count($data) ? $data->toArray() : [];
+
+        foreach ($data as $key => &$value) {
+            if ($value['paid'] == 0) {
+                $value['status_name'] = '未支付';
+            } else if ($value['paid'] == 1 && $value['status'] == 0 && $value['refund_status'] == 0 && $value['type'] != 2) {
+                $value['status_name'] = '已支付';
+            } else if ($value['paid'] == 1 && $value['status'] == 0 && $value['refund_status'] == 1 && $value['type'] != 2) {
+                $value['status_name'] = '退款中';
+            } else if ($value['paid'] == 1 && $value['status'] == 0 && $value['refund_status'] == 2 && $value['type'] != 2) {
+                $value['status_name'] = '已退款';
+            }
+            if ($value['nickname']) {
+                $value['nickname'] = $value['nickname'] . '/' . $value['uid'];
+            } else {
+                $value['nickname'] = '暂无昵称/' . $value['uid'];
+            }
+            if ($value['paid'] == 1) {
+                switch ($value['pay_type']) {
+                    case 'weixin':
+                        $value['pay_type_name'] = '微信支付';
+                        break;
+                    case 'yue':
+                        $value['pay_type_name'] = '余额支付';
+                        break;
+                    case 'zhifubao':
+                        $value['pay_type_name'] = '支付宝支付';
+                        break;
+                    default:
+                        $value['pay_type_name'] = '其他支付';
+                        break;
+                }
+            } else {
+                switch ($value['pay_type']) {
+                    default:
+                        $value['pay_type_name'] = '未支付';
+                        break;
+                }
+            }
+        }
+        $count = self::getOrderWhere($where)->count();
+        return compact('count', 'data');
+    }
+
+    /**条件处理
+     * @param $where
+     * @return StoreOrderModel
+     */
+    public static function getOrderWhere($where)
+    {
+        $model = StoreOrderModel::alias('a')->join('user r', 'r.uid=a.uid', 'LEFT')
+            ->join('Special s', 'a.cart_id=s.id')
+            ->where('a.type', 0)->where('a.paid', 1);
+        if ($where['lecturer_id']) {
+            $model = $model->where('s.lecturer_id', $where['lecturer_id']);
+        }
+        if ($where['data'] !== '') {
+            $model = self::getModelTime($where, $model, 'a.add_time');
+        }
+        $model = $model->order('a.id desc');
+        return $model;
+    }
+
+    /**
+     * 处理订单金额
+     * @param $where
+     * @return array
+     */
+    public static function getOrderPrice($where)
+    {
+        $price = array();
+        $price['pay_price'] = 0;//支付金额
+        $price['pay_price_wx'] = 0;//微信支付金额
+        $price['pay_price_yue'] = 0;//余额支付金额
+        $price['pay_price_zhifubao'] = 0;//支付宝支付金额
+
+        $list = self::getOrderWhere($where)->field([
+            'sum(a.total_num) as total_num',
+            'sum(a.pay_price) as pay_price',
+        ])->find()->toArray();
+        $price['total_num'] = $list['total_num'];//商品总数
+        $price['pay_price'] = $list['pay_price'];//支付金额
+        $list = self::getOrderWhere($where)->field('sum(a.pay_price) as pay_price,a.pay_type')->group('a.pay_type')->select()->toArray();
+        foreach ($list as $v) {
+            if ($v['pay_type'] == 'weixin') {
+                $price['pay_price_wx'] = $v['pay_price'];
+            } elseif ($v['pay_type'] == 'yue') {
+                $price['pay_price_yue'] = $v['pay_price'];
+            } elseif ($v['pay_type'] == 'zhifubao') {
+                $price['pay_price_zhifubao'] = $v['pay_price'];
+            } else {
+                $price['pay_price_other'] = $v['pay_price'];
+            }
+        }
+        $price['order_sum'] = self::getOrderWhere($where)->count();
+        return $price;
+    }
+
+    public static function getBadge($where)
+    {
+        $price = self::getOrderPrice($where);
+        return [
+            [
+                'name' => '订单数量',
+                'field' => '件',
+                'count' => $price['order_sum'],
+                'background_color' => 'layui-bg-blue',
+                'col' => 4
+            ],
+            [
+                'name' => '售出课程',
+                'field' => '件',
+                'count' => $price['total_num'],
+                'background_color' => 'layui-bg-blue',
+                'col' => 4
+            ],
+            [
+                'name' => '订单金额',
+                'field' => '元',
+                'count' => $price['pay_price'],
+                'background_color' => 'layui-bg-blue',
+                'col' => 4
+            ],
+            [
+                'name' => '微信支付金额',
+                'field' => '元',
+                'count' => $price['pay_price_wx'],
+                'background_color' => 'layui-bg-blue',
+                'col' => 4
+            ],
+            [
+                'name' => '余额支付金额',
+                'field' => '元',
+                'count' => $price['pay_price_yue'],
+                'background_color' => 'layui-bg-blue',
+                'col' => 4
+            ],
+            [
+                'name' => '支付宝支付金额',
+                'field' => '元',
+                'count' => $price['pay_price_zhifubao'],
+                'background_color' => 'layui-bg-blue',
+                'col' => 4
+            ]
+        ];
+    }
+
+    /**生成讲师
+     * @param $data
+     * @param $mer_id
+     * @return object
+     */
+    public static function addLecturer($data, $mer_id)
+    {
+        $array = [
+            'mer_id' => $mer_id,
+            'lecturer_name' => $data['merchant_name'],
+            'lecturer_head' => $data['merchant_head'],
+            'phone' => $data['link_tel'],
+            'label' => $data['label'],
+            'introduction' => $data['introduction'],
+            'explain' => $data['explain'],
+            'add_time' => time()
+        ];
+        $res = self::set($array);
+        return $res;
+    }
+}

+ 271 - 0
application/admin/view/study/plan/create.php

xqd
@@ -0,0 +1,271 @@
+{extend name="public/container"}
+{block name='head_top'}
+<style>
+    .layui-form-item .study-label i{display: inline-block;width: 18px;height: 18px;font-size: 18px;color: #fff;}
+    .layui-form-item .label-box p{line-height: inherit;}
+    .m-t-5{margin-top:5px;}
+    #app .layui-barrage-box{margin-bottom: 10px;margin-top: 10px;margin-left: 10px;border: 1px solid #0092DC;border-radius: 5px;cursor: pointer;position: relative;}
+    #app .layui-barrage-box.border-color{border-color: #0bb20c;}
+    #app .layui-barrage-box .del-text{position: absolute;top: 0;left: 0;background-color: rgba(0,0,0,0.5);color: #ffffff;width: 92%;text-align: center;}
+    #app .layui-barrage-box p{padding:5px 5px; }
+    #app .layui-empty-text{text-align: center;font-size: 18px;}
+    #app .layui-empty-text p{padding: 10px 10px;}
+    .edui-default .edui-for-image .edui-icon {background-position: -380px 0px;}
+    .layui-form-item .study-label {width: 50px;float: left;height: 30px;line-height: 38px;margin-left: 10px;margin-top: 5px;border-radius: 5px;background-color: #0092DC;text-align: center;}
+    .layui-form-item .study-label i {display: inline-block;width: 18px;height: 18px;font-size: 18px;color: #fff;}
+    .layui-form-item .label-box {border: 1px solid;border-radius: 10px;position: relative;padding: 10px;height: 30px;color: #fff;background-color: #393D49;text-align: center;cursor: pointer;display: inline-block;line-height: 10px;}
+    .layui-form-item .label-box p {line-height: inherit;}
+</style>
+<script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/ueditor/third-party/zeroclipboard/ZeroClipboard.js"></script>
+<script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/ueditor/ueditor.config.js"></script>
+<script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/ueditor/ueditor.all.min.js"></script>
+<script src="{__PLUG_PATH}reg-verify.js"></script>
+{/block}
+{block name="content"}
+<div class="layui-fluid" id="app" v-cloak>
+    <div class="layui-card">
+        <div class="layui-card-header">{{id ? '编辑学习计划':'添加学习计划'}}</div>
+        <div class="layui-card-body">
+            <form action="" class="layui-form">
+                <div class="layui-form-item">
+                    <div class="layui-form-item required">
+                        <label class="layui-form-label">名称:</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="plan_name" v-model.trim="formData.plan_name" required autocomplete="off" placeholder="请输入学习计划名称" maxlength="8" class="layui-input">
+                        </div>
+                    </div>
+                    <!-- <div class="layui-form-item required">
+                        <label class="layui-form-label">领域:</label>
+                        <div class="layui-input-inline">
+                            <input type="text" v-model.trim="label" :disabled="formData.label.length === 3" name="price_min" required autocomplete="off" placeholder="请输入领域" maxlength="6" class="layui-input">
+                        </div>
+                        <div class="layui-input-inline" style="width: auto;">
+                            <button type="button" :class="[formData.label.length === 3 ? 'layui-btn-disabled' : 'layui-btn-normal', 'layui-btn']" :disabled="formData.label.length === 3" @click="addLabrl" ><i class="layui-icon layui-icon-add-1" style="margin-right: 0;font-size: 18px;"></i></button>
+                        </div>
+                        <div class="layui-form-mid layui-word-aux">每个领域1-6个字,可添加1-3个领域,点击“+”按钮添加输入的领域,点击已添加领域可删除</div>
+                    </div> -->
+                    <div v-if="formData.label.length" class="layui-form-item">
+                        <div class="layui-input-block">
+                            <button v-for="item in formData.label" :key="item" type="button" class="layui-btn layui-btn-normal layui-btn-sm" @click="delLabel(item)">{{item}}</button>
+                        </div>
+                    </div>
+                    <div class="layui-form-item required">
+                        <label class="layui-form-label">封面图片:(200*200)</label>
+                        <div class="layui-input-block">
+                            <div class="upload-image-box" v-if="formData.plan_head" >
+                                <img :src="formData.plan_head" alt="">
+                                <div class="mask"  style="display: block">
+                                    <p>
+                                        <i class="fa fa-eye" @click="look(formData.plan_head)"></i>
+                                        <i class="fa fa-trash-o" @click="delect('plan_head')"></i>
+                                    </p>
+                                </div>
+                            </div>
+                            <div class="upload-image" v-show="!formData.plan_head" @click="upload('plan_head')">
+                                <div class="fiexd"><i class="fa fa-plus"></i></div>
+                                <p>选择图片</p>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="layui-form-item">
+                        <label class="layui-form-label required">原价:</label>
+                        <div class="layui-input-inline">
+                            <input type="mumber" name="price" v-model.trim="formData.price" required autocomplete="off"   placeholder="请输入原价" class="layui-input">
+                        </div>
+                    </div>
+                    <div class="layui-form-item">
+                        <label class="layui-form-label required">现价:</label>
+                        <div class="layui-input-inline">
+                            <input type="mumber" name="sales" v-model.trim="formData.sales" required autocomplete="off"   placeholder="请输入现价" class="layui-input">
+                        </div>
+                    </div>
+                    <div class="layui-form-item required">
+                        <label class="layui-form-label">上架时间:</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="shelf_time" id="shelf_time" v-model.trim="formData.shelf_time" required autocomplete="off"   placeholder="上架时间,越晚越靠前" class="layui-input">
+                        </div>
+                    </div>
+                    <!-- <div class="layui-form-item submit">
+                        <label class="layui-form-label">排序:</label>
+                        <div class="layui-input-inline">
+                            <input type="number" name="sort" v-model="formData.sort" min="0" max="9999" class="layui-input" v-sort>
+                        </div>
+                    </div> -->
+                    <div class="layui-form-item required">
+                        <label class="layui-form-label">介绍:</label>
+                        <div class="layui-input-block">
+                            <textarea id="editor">{{formData.introduction}}</textarea>
+                        </div>
+                    </div>
+                    <div class="layui-form-item">
+                        <label class="layui-form-label">状态:</label>
+                        <div class="layui-input-block">
+                            <input type="radio" name="is_show" value="1" title="显示" v-model="formData.is_show" lay-filter="is_show" >
+                            <input type="radio" name="is_show" value="0" title="隐藏" v-model="formData.is_show" lay-filter="is_show">
+                        </div>
+                    </div>
+                    <div class="layui-form-item submit">
+                        <div class="layui-input-block">
+                            <button class="layui-btn layui-btn-normal" type="button" @click="save">{{id ? '立即修改':'立即提交'}}</button>
+                            <button class="layui-btn layui-btn-primary clone" type="button" @click="clone_form">取消</button>
+                        </div>
+                    </div>
+            </form>
+        </div>
+    </div>
+</div>
+<script type="text/javascript" src="{__ADMIN_PATH}js/layuiList.js"></script>
+{/block}
+{block name='script'}
+<script>
+    var id={$id}, plan=<?=isset($plan) ? $plan : []?>;
+    var shelf_time = "<?php echo date("Y-m-d H:i:s")?>";
+    require(['vue','helper','zh-cn','request','plupload','aliyun-oss','OssUpload'],function(Vue,$h) {
+        new Vue({
+            el: "#app",
+            directives: {
+                sort: {
+                    bind: function (el, binding, vnode) {
+                        var vm = vnode.context;
+                        el.addEventListener('change', function () {
+                            if (!this.value || this.value < 0) {
+                                vm.formData.sort = 0;
+                            } else if (this.value > 9999) {
+                                vm.formData.sort = 9999;
+                            } else {
+                                vm.formData.sort = parseInt(this.value);
+                            }
+                        });
+                    }
+                }
+            },
+            data: {
+                formData:{
+                    plan_name:plan.plan_name || '',
+                    plan_head: plan.plan_head || '',
+                    introduction: plan.introduction || '',
+                    label: plan.label || [],
+                    explain: plan.explain || '',
+                    sort:Number(plan.sort) || 0,
+                    price:Number(plan.price) || 0,
+                    sales:Number(plan.sales) || 0,
+                    shelf_time: plan.shelf_time || shelf_time,
+                    is_show:plan.is_show || 1
+                },
+                label: '',
+            },
+            methods:{
+                //查看图片
+                look: function (pic) {
+                   parent.$eb.openImage(pic);
+                },
+                //上传图片
+                upload: function (key, count) {
+                    ossUpload.createFrame('请选择图片', {fodder: key, max_count: count === undefined ? 0 : count},{w:800,h:550});
+                },
+                // 删除领域
+                delLabel: function (label) {
+                    this.formData.label.splice(this.formData.label.indexOf(label), 1);
+                },
+                // 添加领域
+                addLabrl: function () {
+                    if (this.label) {
+                        var length = this.formData.label.length;
+                        for (var i = 0; i < length; i++) {
+                            if (this.formData.label[i] == this.label) return layList.msg('请勿重复添加');
+                        }
+                        this.formData.label.push(this.label);
+                        this.label = '';
+                    }
+                },
+                clone_form: function () {
+                    var that = this;
+                    if (parseInt(id) == 0) {
+                        parent.layer.closeAll();
+                    }
+                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
+                    parent.layer.close(index); //再执行关闭
+                },
+                save:function () {
+                    var that=this;
+                    that.formData.introduction = that.ue.getContent();
+                    that.$nextTick(function () {
+                        if (!that.formData.plan_name) return layList.msg('请输入学习计划名称');
+                        if (!that.formData.plan_head) return layList.msg('请上传封面图片');
+                        if (!that.formData.introduction) return layList.msg('请输入讲师介绍');
+                        layList.loadFFF();
+                        layList.basePost(layList.U({a: 'save_plan', q: {id: id}}), that.formData, function (res) {
+                            layList.loadClear();
+                            if (parseInt(id) == 0) {
+                                layList.layer.confirm('添加成功,您要继续添加吗?', {
+                                    btn: ['继续添加', '立即提交']
+                                }, function (index) {
+                                    layList.layer.close(index);
+                                }, function (index) {
+                                    layList.layer.close(index);
+                                    var index = parent.layer.getFrameIndex(window.name);
+                                    parent.layer.close(index);
+                                });
+                            } else {
+                                layList.msg('修改成功', function () {
+                                    parent.layer.closeAll();
+                                })
+                            }
+                        }, function (res) {
+                            layList.msg(res.msg);
+                            layList.loadClear();
+                        });
+                    })
+                },
+                delect:function(key){
+                    var that=this;
+                    that.formData[key]='';
+                },
+                changeIMG: function (key, value, multiple) {
+                    if (multiple) {
+                        var that = this;
+                        value.map(function (v) {
+                            that.formData[key].push({pic: v, is_show: false});
+                        });
+                        this.$set(this.formData, key, this.formData[key]);
+                    } else {
+                        this.$set(this.formData, key, value);
+                    }
+                },
+            },
+            mounted:function () {
+                var that=this;
+                window.changeIMG = that.changeIMG;
+                //选择图片插入到编辑器中
+                window.insertEditor = function(list,fodder){
+                    that.ue.execCommand('insertimage', list);
+                };
+                layList.date({
+                    elem: '#shelf_time', type: 'datetime', done: function (value) {
+                        that.formData.shelf_time = value;
+                    }
+                });
+                this.$nextTick(function () {
+                    layList.form.render();
+                    //实例化编辑器
+                    UE.registerUI('选择图片', function (editor, uiName) {
+                        var btn = new UE.ui.Button({
+                            name: uiName,
+                            title: uiName,
+                            cssRules: 'background-position: -380px 0;',
+                            onclick: function() {
+                                ossUpload.createFrame(uiName, { fodder: editor.key }, { w: 800, h: 550 });
+                            }
+                        });
+                        return btn;
+                    });
+                    that.ue = UE.getEditor('editor');
+                });
+                layList.form.on('radio(is_show)',function (data) {
+                    that.formData.is_show=data.value;
+                });
+            }
+        })
+    })
+</script>
+{/block}

+ 304 - 0
application/admin/view/study/plan/index.php

xqd
@@ -0,0 +1,304 @@
+{extend name="public/container"}
+{block name="content"}
+<div class="layui-fluid">
+    <div class="layui-card">
+        <div class="layui-card-header">学习计划</div>
+        <div class="layui-card-body">
+            <form class="layui-form layui-form-pane" action="">
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <label class="layui-form-label">学习计划</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="title" class="layui-input" placeholder="学习计划名称">
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label">计划状态</label>
+                        <div class="layui-input-inline">
+                            <select name="is_show">
+                                <option value="">全部</option>
+                                <option value="1">显示</option>
+                                <option value="0">不显示</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <div class="layui-input-inline">
+                            <button class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="search" lay-filter="search">
+                                <i class="layui-icon layui-icon-search"></i>搜索
+                            </button>
+                        </div>
+                    </div>
+                </div>
+            </form>
+            <div class="layui-btn-container">
+                <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" data-type="add">
+                    <i class="layui-icon layui-icon-add-1"></i>添加学习计划
+                </button>
+                <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" data-type="refresh">
+                    <i class="layui-icon layui-icon-refresh-1"></i>刷新
+                </button>
+            </div>
+            <table id="List" lay-filter="List"></table>
+            <script type="text/html" id="price">
+                <p>{{d.price}} / {{d.sales}}</p>
+            </script>
+            <script type="text/html" id="is_show">
+                <input type='checkbox' name='id' lay-skin='switch' value="{{d.id}}" lay-filter='is_show' lay-text='显示|不显示'  {{ d.is_show == 1 ? 'checked' : '' }}>
+            </script>
+            <script type="text/html" id="plan_head">
+                <img width="50" height="50" lay-event='open_image' src="{{d.plan_head}}">
+            </script>
+            
+            <script type="text/html" id="act">
+                <button type="button" class="layui-btn layui-btn-normal layui-btn-xs" onclick="dropdown(this)">
+                    <i class="layui-icon">&#xe625;</i>操作
+                </button>
+                <ul class="layui-nav-child layui-anim layui-anim-upbit">
+                    <li>
+                        <a href="javascript:void(0)" lay-event="edit">
+                            <i class="iconfont icon-bianji"></i> 步骤管理
+                        </a>
+                    </li>
+                    <li>
+                        <a href="javascript:void(0)" lay-event="edit">
+                            <i class="iconfont icon-bianji"></i> 编辑计划
+                        </a>
+                    </li>
+                    <li>
+                        <a lay-event='delstor' href="javascript:void(0)">
+                            <i class="iconfont icon-shanchu"></i> 删除计划
+                        </a>
+                    </li>
+                </ul>
+            </script>
+        </div>
+    </div>
+</div>
+<script src="{__ADMIN_PATH}js/layuiList.js"></script>
+{/block}
+{block name="script"}
+<script>
+    var $ = layui.jquery;
+    var layer = layui.layer;
+    //实例化form
+    layList.form.render();
+    //加载列表
+    layList.tableList({o:'List', done:function () {
+        $('.layui-btn').on('mouseover', function (event) {
+            var target = event.target;
+            var type = target.dataset.type;
+            if ('recommend' === type) {
+                layer.tips('点击即可取消此推荐', target, {
+                    tips: [1, '#0093dd']
+                });
+            }
+        });
+
+        $('.layui-btn').on('mouseout', function (event) {
+            var target = event.target;
+            var type = target.dataset.type;
+            if ('recommend' === type) {
+                layer.closeAll();
+            }
+        });
+    }},"{:Url('plan_list')}",function (){
+        return [
+            {field: 'id', title: '编号', align: 'center'},
+            {field: 'plan_name', title: '计划名称',align: 'left'},
+            {field: 'plan_head', title: '计划封面',templet:'#plan_head',align:'center',minWidth:84},
+            {field: 'price', title: '原价/现价',align: 'center',templet:'#price'},
+            {field: 'shelf_time', title: '上架时间',align:'center'},
+            {field: 'is_show', title: '计划状态',templet:'#is_show',align: 'center',minWidth:92},
+            {field: 'right', title: '操作',align:'center',toolbar:'#act',minWidth:81},
+        ];
+    });
+    //下拉框
+    $(document).click(function (e) {
+        $('.layui-nav-child').hide();
+    })
+    function dropdown(that){
+        var oEvent = arguments.callee.caller.arguments[0] || event;
+        oEvent.stopPropagation();
+        var offset = $(that).offset();
+        var top=offset.top-$(window).scrollTop();
+        var index = $(that).parents('tr').data('index');
+        $('.layui-nav-child').each(function (key) {
+            if (key != index) {
+                $(this).hide();
+            }
+        })
+        if($(document).height() < top+$(that).next('ul').height()){
+            $(that).next('ul').css({
+                'padding': 10,
+                'top': - ($(that).parent('td').height() / 2 + $(that).height() + $(that).next('ul').height()/2),
+                'min-width': 'inherit',
+                'position': 'absolute'
+            }).toggle();
+        }else{
+            $(that).next('ul').css({
+                'padding': 10,
+                'top':$(that).parent('td').height() / 2 + $(that).height(),
+                'min-width': 'inherit',
+                'position': 'absolute'
+            }).toggle();
+        }
+    }
+    //自定义方法
+    var action= {
+        set_value: function (field, id, value) {
+            layList.baseGet(layList.Url({
+                a: 'set_value',
+                q: {field: field, id: id, value: value}
+            }), function (res) {
+                layList.msg(res.msg);
+            });
+        },
+    }
+    //查询
+    layList.search('search',function(where){
+        layList.reload(where,true);
+    });
+    //快速编辑
+    // layList.edit(function (obj) {
+    //     var id=obj.data.id,value=obj.value;
+    //     switch (obj.field) {
+    //         case 'sort':
+    //             if (value.trim()) {
+    //                 if (isNaN(value.trim())) {
+    //                     layList.msg('请输入正确的数字');
+    //                 } else {
+    //                     if (value.trim() < 0) {
+    //                         layList.msg('排序不能小于0');
+    //                     } else if (value.trim() > 9999) {
+    //                         layList.msg('排序不能大于9999');
+    //                     } else if (parseInt(value.trim()) != value.trim()) {
+    //                         layList.msg('排序不能为小数');
+    //                     } else {
+    //                         action.set_value('sort', id, value.trim());
+    //                     }
+    //                 }
+    //             } else {
+    //                 layList.msg('排序不能为空');
+    //             }
+    //             break;
+    //     }
+    // });
+    //监听并执行排序
+    //layList.sort(['id','sort'],true);
+    //点击事件绑定
+    layList.tool(function (event,data,obj) {
+        switch (event) {
+            case 'delstor':
+                var url=layList.U({a:'delete',q:{id:data.id}});
+                $eb.$swal('delete',function(){
+                    $eb.axios.get(url).then(function(res){
+                        if(res.status == 200 && res.data.code == 200) {
+                            $eb.$swal('success',res.data.msg);
+                            obj.del();
+                        }else
+                            return Promise.reject(res.data.msg || '删除失败')
+                    }).catch(function(err){
+                        $eb.$swal('error',err);
+                    });
+                })
+                break;
+            case 'open_image':
+                $eb.openImage(data.plan_head);
+                break;
+            case 'open_images':
+                $eb.openImage(data.image);
+                break;
+            case 'edit':
+                layer.open({
+                    type: 2,
+                    title: '编辑计划',
+                    content: '{:Url('create')}?id=' + data.id,
+                    area: ['100%', '100%'],
+                    maxmin: true
+                });
+                break;
+            case 'reset_pwd':
+                var url=layList.U({c:'merchant.merchant',a:'reset_pwd',q:{id:data.mer_id}});
+                $eb.$swal('delete',function(){
+                    $eb.axios.post(url).then(function(res){
+                        if(res.data.code == 200) {
+                            window.location.reload();
+                            $eb.$swal('success', res.data.msg);
+                        }else
+                            $eb.$swal('error',res.data.msg||'操作失败!');
+                    });
+                },{'title':'您确定重置选择讲师后台的密码吗?','text':'重置后的密码为1234567','confirm':'您确定重置密码吗?'});
+                break;
+            case 'modify_success':
+                var url=layList.U({c:'merchant.merchant',a:'modify',q:{id:data.mer_id,status:1}});
+                $eb.$swal('delete',function(){
+                    $eb.axios.get(url).then(function(res){
+                        if(res.status == 200 && res.data.code == 200) {
+                            window.location.reload();
+                            $eb.$swal('success',res.data.msg);
+                        }else
+                            return Promise.reject(res.data.msg || '删除失败')
+                    }).catch(function(err){
+                        $eb.$swal('error',err);
+                    });
+                },{'title':'您确定要修改讲师后台的状态吗?','text':'请谨慎操作!','confirm':'是的,我要修改'});
+                break;
+            case 'modify_error':
+                var url=layList.U({c:'merchant.merchant',a:'modify',q:{id:data.mer_id,status:0}});
+                $eb.$swal('delete',function(){
+                    $eb.axios.get(url).then(function(res){
+                        if(res.status == 200 && res.data.code == 200) {
+                            window.location.reload();
+                            $eb.$swal('success',res.data.msg);
+                        }else
+                            return Promise.reject(res.data.msg || '删除失败')
+                    }).catch(function(err){
+                        $eb.$swal('error',err);
+                    });
+                },{'title':'您确定要修改讲师后台的状态吗?','text':'请谨慎操作!','confirm':'是的,我要修改'});
+                break;
+        }
+    })
+    //是否显示快捷按钮操作
+    layList.switch('is_show',function (odj,value) {
+        if(odj.elem.checked==true){
+            layList.baseGet(layList.Url({a:'set_show',p:{is_show:1,id:value}}),function (res) {
+                layList.msg(res.msg);
+            });
+        }else{
+            layList.baseGet(layList.Url({a:'set_show',p:{is_show:0,id:value}}),function (res) {
+                layList.msg(res.msg);
+            });
+        }
+    });
+    $(document).on('click', '.layui-btn', function (event) {
+        var type = $(this).data('type');
+        var id = $(this).data('id');
+        if (type === 'mercreate') {
+            layer.open({
+                type: 2,
+                title: '生成讲师后台',
+                content: "{:Url('mercreate')}?id=" + id,
+                area: ['800px', '700px'],
+                end: function () {
+                    location.reload();
+                }
+            });
+        } else if (type === 'add') {
+            layer.open({
+                type: 2,
+                title: '添加学习计划',
+                content: "{:Url('create')}",
+                area: ['100%', '100%'],
+                maxmin: true,
+                end: function () {
+                    location.reload();
+                }
+            });
+        } else if (type === 'refresh') {
+            layList.reload();
+        }
+    });
+</script>
+{/block}

+ 3 - 3
application/wap/view/first/special/grade_special.html

xqd
@@ -52,16 +52,16 @@
     }
 
     .favorite {
-        padding-top: .9rem;
+        padding-top: .11rem;
     }
 </style>
 {/block}
 {block name="content"}
 <div v-cloak id="app">
     <div class="favorite">
-        <div class="tabbar">
+        <!-- <div class="tabbar">
             <div v-for="item in tabs" :key="item.value">{{ item.name }}</div>
-        </div>
+        </div> -->
         <div v-if="gradeList.length" class="list">
             <a v-for="item in gradeList" :key="item.id" :href="item.path">
                 <div>