icesui后台框架 for tp5.1

浏览:954 最后更新:2018-02-09 16:01 分类:类库 关键字: composer icesui tp5.1
使用方法composer require yirius/icesui

最新的完整包包含sql的文件大小25M,附件无法上传,请加群641289652下载

如果是下载的归档文件,请注意:
归档文件不是最新版本,请您下载后运行cmd窗口或者term窗口
然后运行composer update,将thinkphp和icesui更新到最新版本
然后修改一下database.php内的数据库连接参数
然后运行php think icescommand:init
会自动安装数据库
如果提示错误,请打开vendor/yirius/icesui/icescommand/Init.php,将execute函数内的文件都复制到你可以访问的文件内,然后访问该网址就可以自动插入数据库

如果还存在问题, 请直接下载https://github.com/top-think/think
最新的thinkphp5.1,然后运行composer require yirius/icesui

必须使用虚拟域名才可以预览
后台访问方式为yourdomain/icesui/manage

composer安装完成之后,可以在config文件夹下面新建icesui.php
内容如下,为简单配置,即将更新use think\facade\Env;
return [
    'config' => [
        'home_path' => "icesui/welcome",
        'view_assets' => "/icesui/assets",//如果不是虚拟域名,需要修改这个参数
        'links' => [
            'style' => [],
            'prescript' => [],
            'script' => []
        ],
        'manage' => [
            'url' => "/icesui/manage",
            'get' => "/icesui/login",
            'post' => "/icesui/doLogin",
            'out' => "/icesui/logout",
            'title' => 'icesui后台框架 for tp5.1',
            'span' => 'made by Yirius',
            'afterLogin' => function($userinfo, $status){

            }
        ]
    ],
    'upload' => [
        'config' => [
            'imageSize' => "2048000",
            'imageExt' => "jpg,png,gif,bmp,jpeg",
            'videoSize' => "102400000",
            'videoExt' => "flv,swf,mkv,avi,rm,rmvb,mpeg,mpg,ogg,ogv,mov,wmv,mp4,webm,mp3,wav,mid",
            'fileSize' => "51200000",
            'fileExt' => "rar,zip,tar,gz,7z,bz2,cab,iso,doc,docx,xls,xlsx,ppt,pptx,pdf,txt,md,xml",
            'prefix' => "/uploads/",
            'path' =>  Env::get("root_path") . DS . 'public' . DS . 'uploads' . DS,
            'scraw' => [
                'prefix' => "/uploads/scraw/",
                'path' => Env::get("root_path") . DS . 'public' . DS . 'uploads' . DS . "scraw" . DS,
                'ext' => "jpg"
            ]
        ],
        'afterUpload' => function($data){

        }
    ]
];
列表的使用方式if($this->request->isPost()){
            $collegeClass = new CollegeClass();
            return $collegeClass->AutoTable("id,name,createtime", ['did' => $did]);
        }
        if($this->request->isDelete()){
            $collegeDepartment = new CollegeStudent();

            $ids = explode(",", input('param.')['ids']);
            foreach($ids as $i => $v){
                if($collegeDepartment->where('clid', $v)->count()){
                    $this->error("编号为" . $v . "的数据无法删除,旗下存在对应的学生");
                }
            }
            $collegeClass = new CollegeClass();
            $collegeClass->AutoDelete();
        }
        $collegeModel = new College();
        $collegeInfo = $collegeModel->where('id', $cid)->find();
        $collegeAcademy = new CollegeAcademy();
        $academyInfo = $collegeAcademy->where('id', $aid)->find();
        $collegeDepartment = new CollegeDepartment();
        $departmentInfo = $collegeDepartment->where('id', $did)->find();

        $listBuilder = new TableBuilder();
        return $listBuilder
            ->setPageTitle($collegeInfo['name'] . "/" . $academyInfo['name'] . "/" . $departmentInfo['name'])
            ->addTableColmun("编号", "id")
            ->addTableColmun("名称", "name")
            ->setTableBtn(<<<HTML
<a href="/college/index/classesadd/cid/{$cid}/aid/{$aid}/did/{$did}" target="_blank" data-iframe class="btn btn-success btn-sm" style="margin-right: 10px;">新增</a>
HTML
)
            ->setTableBtn("delete")
            ->addTableColmun("操作", null, false, <<<HTML
return '<a href="/college/index/classesadd/cid/{$cid}/aid/{$aid}/did/{$did}/id/'+objects.id+'.html" target="_blank" data-iframe class="btn btn-primary btn-sm" style="margin-right: 10px;">编辑</a><a href="/college/index/students/clid/'+objects.id+'.html" target="_blank" data-iframe class="btn btn-danger btn-sm" style="margin-right: 10px;">人员管理</a><a href="/college/index/collegenews/type/4/belongid/'+objects.id+'.html" target="_blank" data-iframe class="btn btn-info btn-sm">资讯</a>';
HTML
            )
            ->table();
表单界面的使用方式public function add($id = 0){
        $collegeModel = new College();
        if($this->request->isPost()){
            $post = input('post.');
            $post['grades'] = json_encode($post['grades']);
            $collegeModel->AutoSave($post);
        }

        $value = $id == 0?[]:$collegeModel->where('id', $id)->find();
        if(!empty($value['grades'])){
            $value['grades'] = json_decode($value['grades'], true);
        }

        $formBuilder = new FormBuilder();
        return $formBuilder
            ->setFormValue($value)
            ->addText("高校名称", "name")//文字输入框
            ->addSelect("高校省份", "province", [
              ['text' => "北京市", 'value' => "1"]
            ])//下拉选择框
            ->addDate("高校城市", "city")//日期选择器
            ->addDateRange("高校城市", "city")//日期区间选择器
            ->addTime("高校地址", "address")//时间选择器
            ->addTimeRange("高校地址", "address")//时间区间选择器
            ->addWebUploader("高校地址", "address")//文件上传选择器
            ->addUeditor("高校地址", "address")//富文本选择器
            ->addControl("college@index/list", "录取分数区间", "grades", '', [
                'options' => Zone::getProvince()
            ])
            ->form();
    }
欢迎大家加群提出问题完善


群号:641289652
评论( 相关
后面还有条评论,点击查看>>