diff --git a/README.md b/README.md index c3820305..707fadc2 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,26 @@ ![权限分配](https://gitee.com/dlbz/shangma/raw/master/public/examples/20190524164451.png) +平均分 + +![权限分配](https://gitee.com/dlbz/shangma/raw/master/public/examples/bjavg.png) + +优秀率 + +![权限分配](https://gitee.com/dlbz/shangma/raw/master/public/examples/bjyouxiu.png) + +及格率 + +![权限分配](https://gitee.com/dlbz/shangma/raw/master/public/examples/bjjige.png) + +标准差 + +![权限分配](https://gitee.com/dlbz/shangma/raw/master/public/examples/bjbiaozhuncha.png) + +箱体图 + +![权限分配](https://gitee.com/dlbz/shangma/raw/master/public/examples/bjchayi.png) + ## 演示地址 @@ -111,6 +131,6 @@ https://www.kancloud.cn/llblax/abcd/789222 ## 下一步工作 * 继续增加统计项目 -* 以图表形式呈现统计结果 +* 以更多图表形式呈现统计结果 * 增加教师职务权限验证 * 增加学生自助查询成绩 \ No newline at end of file diff --git a/app/chengji/common.php b/app/chengji/common.php index 7e29d995..8169db1a 100644 --- a/app/chengji/common.php +++ b/app/chengji/common.php @@ -1,17 +1,5 @@ where('kaoshiid',$kaoshiid)->where('subjectid',$subjectid)->value('manfen'); - -// $manfen = floatval($manfen); -// return $manfen; -// } - // 分数验证 function manfenvalidate($defen,$manfen) { @@ -58,9 +46,102 @@ function manfenvalidate($defen,$manfen) -// 统计结果整理 + /** + * 从统计结果中获取条形统计图中需要的各项目成绩 + * + * @access public + * @param arr 统计结果 + * @param xm 要统计的项目 + * @return array 返回类型 + */ + function tiaoxingOnexiangmu($jg,$xm) + { + $chengji = array(); + $series = array(); + foreach ($jg as $key => $value) { + if($key ==0) + { + $chengji[$key][]='项目'; + foreach ($value['chengji'] as $k => $val) { + $chengji[$key][] = $val['title']; + $series[] = ['type'=>'bar']; + } + } + # code... + if( isset($value['title'])) + { + $temp = $value['school'].$value['title']; + }else{ + $temp = $value['school']; + } + $chengji[$key+1][] = $temp; + foreach ($value['chengji'] as $k => $val) { + $chengji[$key+1][] = $val[$xm]; + } + } + $data = [ + 'data'=>$chengji, + 'series'=>$series, + ]; + + return $data; + } + /** + * 从统计结果中获取条形箱体图需要的各项目成绩 + * + * @access public + * @param arr 统计结果 + * @param xm 要统计的项目 + * @return array 返回类型 + */ + function xiangti($jg) + { + + $data = array(); + $axisData = array(); + $chengji = array(); + $category = array(); + + foreach ($jg as $key => $value) { + if($key ==0) + { + foreach ($value['chengji'] as $k => $val) { + $category[$k] = $val['title']; + } + } + + foreach ($value['chengji'] as $k => $val) { + // $chengji[$k][$key]['min'] = $val['sifenwei']['min']; + // $chengji[$k][$key]['q1'] = $val['sifenwei']['q1']; + // $chengji[$k][$key]['q2'] = $val['sifenwei']['q2']; + // $chengji[$k][$key]['q3'] = $val['sifenwei']['q3']; + // $chengji[$k][$key]['max'] = $val['sifenwei']['max']; + + $chengji[$k][$key][0] = $val['sifenwei']['min']; + $chengji[$k][$key][1] = $val['sifenwei']['q1']; + $chengji[$k][$key][2] = $val['sifenwei']['q2']; + $chengji[$k][$key][3] = $val['sifenwei']['q3']; + $chengji[$k][$key][4] = $val['sifenwei']['max']; + } + + if( isset($value['title'])) + { + $temp = $value['school'].$value['title']; + }else{ + $temp = $value['school']; + } + + $axisData[] = $temp; + } + $data = [ + 'axisData'=>$axisData, + 'boxData'=>$chengji, + 'category'=>$category, + ]; + return $data; + } \ No newline at end of file diff --git a/app/chengji/controller/Bjtongji.php b/app/chengji/controller/Bjtongji.php index 6937f2dd..08cca982 100644 --- a/app/chengji/controller/Bjtongji.php +++ b/app/chengji/controller/Bjtongji.php @@ -56,11 +56,6 @@ class Bjtongji extends BaseController ],'POST'); - // $src['school'] = strToarray($src['school']); - // $src['ruxuenian'] = strToarray($src['ruxuenian']); - $src['banji'] = strToarray($src['banji']); - - if(count($src['banji'])==0) { // 获取参与考试的班级 @@ -308,6 +303,8 @@ class Bjtongji extends BaseController + + // 统计平均分优秀率及格率 public function myAvg($kaoshi) { @@ -318,32 +315,53 @@ class Bjtongji extends BaseController 'kaoshi'=>'', 'ruxuenian'=>'', 'school'=>array(), + 'banji'=>array(), + 'xiangmu'=>'', ],'POST'); - - $src['school'] = strToarray($src['school']); - $src['ruxuenian'] = strToarray($src['ruxuenian']); - - - // 获取参与考试的班级 - $kh = new \app\kaoshi\model\Kaohao; - $src['banji']= array_column($kh->cyBanji($src),'id'); + if(count($src['banji'])==0) + { + // 获取参与考试的班级 + $kh = new \app\kaoshi\model\Kaohao; + $src['banji']= array_column($kh->cyBanji($src),'id'); + } // 统计成绩 $btj = new BTJ; $data = $btj->search($src); - halt($data); + $data = tiaoxingOnexiangmu($data,$src['xiangmu']); + + return json($data); + } + + + + // 统计平均分优秀率及格率 + public function myXiangti($kaoshi) + { + // 获取参数 + $src = $this->request + ->only([ + 'kaoshi'=>'', + 'ruxuenian'=>'', + 'school'=>array(), + 'banji'=>array(), + ],'POST'); + + if(count($src['banji'])==0) + { + // 获取参与考试的班级 + $kh = new \app\kaoshi\model\Kaohao; + $src['banji']= array_column($kh->cyBanji($src),'id'); + } + + // 统计成绩 + $btj = new BTJ; + $data = $btj->search($src); + + $data = xiangti($data); - $data = [ - 'source'=>[ - ['项目', '语文', '优秀率', '及格率'], - ['一年级一班', 10, 10, 10], - ['一年级二班', 83.1, 73.4, 55.1], - ['一年级三班', 86.4, 65.2, 82.5], - ['一年级四班', 72.4, 53.9, 39.1] - ], - ]; return json($data); } diff --git a/app/chengji/controller/Njtongji.php b/app/chengji/controller/Njtongji.php index 5b48ed43..22415e47 100644 --- a/app/chengji/controller/Njtongji.php +++ b/app/chengji/controller/Njtongji.php @@ -274,6 +274,52 @@ class Njtongji extends BaseController return json($data); } + + // 统计平均分优秀率及格率 + public function myAvg($kaoshi) + { + + // 获取参数 + $src = $this->request + ->only([ + 'kaoshi'=>'', + 'ruxuenian'=>'', + 'school'=>array(), + 'xiangmu'=>'', + ],'POST'); + + // 统计成绩 + $ntj = new NTJ; + $data = $ntj->search($src); + $ntj = new \app\chengji\model\TongjiBj; + $data = tiaoxingOnexiangmu($data,$src['xiangmu']); + + return json($data); + } + + + + // 统计平均分优秀率及格率 + public function myXiangti($kaoshi) + { + // 获取参数 + $src = $this->request + ->only([ + 'kaoshi'=>'', + 'ruxuenian'=>'', + 'school'=>array(), + ],'POST'); + + + // 统计成绩 + $ntj = new NTJ; + $data = $ntj->search($src); + + $data = xiangti($data); + + return json($data); + } + } diff --git a/app/chengji/model/Tongji.php b/app/chengji/model/Tongji.php index 2e82de0c..2a70a6c4 100644 --- a/app/chengji/model/Tongji.php +++ b/app/chengji/model/Tongji.php @@ -239,6 +239,54 @@ class Tongji extends Base } + // 自己写的四分位 + public function myquartile($arr) + { + // 获取数组长度 + $length = count($arr); + if ($arr == null || $length == 0) return $result = [0=>'',1=>'',2=>'']; + + if ($length < 5) return $result = [0=>'',1=>'',2=>'']; + $result = array(); + + sort($arr); + + if ($length % 2 == 0) {//偶数 + + // Q1 + $tempNum = ($length + 1 ) * 0.25; + $temp = intval($tempNum); + $tempNum = ceil($tempNum)-$tempNum; + $result[0] = $arr[$temp-1] * (1-$tempNum) + $arr[$temp] * $tempNum; + + // Q2 + $tempNum = ($length + 1 ) * 0.5; + $temp = intval($tempNum); + $tempNum = ceil($tempNum)-$tempNum; + $result[1] = $arr[$temp-1] * (1-$tempNum) + $arr[$temp] * $tempNum; + + // Q3 + $tempNum = ($length + 1 ) * 0.75; + $temp = intval($tempNum); + $tempNum = ceil($tempNum)-$tempNum; + $result[2] = $arr[$temp-1] * (1-$tempNum) + $arr[$temp] * $tempNum; + + + + } else {//奇数 + $tempNum = ($length + 1 ) * 0.25; + $result[0] = $arr[$tempNum-1]; + $tempNum = ($length + 1 ) * 0.5; + $result[1] = $arr[$tempNum-1]; + $tempNum = ($length + 1 ) * 0.75; + $result[2] = $arr[$tempNum-1]; + + } + + return $result; + } + + // 分数段 public function fenshuduan($cj=array(),$setp=10,$manfen=100) { diff --git a/app/chengji/model/TongjiBj.php b/app/chengji/model/TongjiBj.php index 3751f8dc..0daca03b 100644 --- a/app/chengji/model/TongjiBj.php +++ b/app/chengji/model/TongjiBj.php @@ -31,12 +31,14 @@ class TongjiBj extends Base $nianji = $ksset->srcNianji($kaoshi); // 初始化统计结果 $data = array(); + // 循环年级 foreach ($nianji as $njkey => $value) { // 获取参加考试班级 $src['ruxuenian'] = $value['nianji']; $banji = $kh->cyBanji($src); $subject = $ksset->srcSubject($kaoshi,'',$value['nianji']); + // 循环班级,获取并统计成绩 foreach ($banji as $bjkey => $val) { $srcfrom = [ @@ -45,13 +47,22 @@ class TongjiBj extends Base ]; $temp = $kh->srcChengji($srcfrom); $temp = $tj->tongjiSubject($temp,$subject); + + // halt($temp); + // 循环更新或写入成绩 foreach ($temp['cj'] as $cjkey => $cj) { + // if($cjkey == 'all') + // { + // continue; + // } // 查询该班级该学科成绩是否存在 $tongjiJg = $this->where('kaoshi_id',$src['kaoshi']) ->where('banji_id',$val['id']) ->where('subject_id',$cj['id']) ->find(); + // halt('aa'); + if($tongjiJg) { $tongjiJg->kaoshi_id = $src['kaoshi']; @@ -66,10 +77,10 @@ class TongjiBj extends Base $tongjiJg->jige = $cj['jige']; $tongjiJg->max = $cj['max']; $tongjiJg->min = $cj['min']; - $tongjiJg->qian = $cj['sifenwei'][0]; - $tongjiJg->zhong = $cj['sifenwei'][1]; - $tongjiJg->hou = $cj['sifenwei'][2]; - $tongjiJg->zhong = $cj['zhongshu']; + $tongjiJg->q1 = $cj['sifenwei'][0]; + $tongjiJg->q2 = $cj['sifenwei'][1]; + $tongjiJg->q3 = $cj['sifenwei'][2]; + $tongjiJg->zhongshu = $cj['zhongshu']; $data = $tongjiJg->save(); }else{ // 重新组合统计结果 @@ -86,12 +97,11 @@ class TongjiBj extends Base 'jige'=>$cj['jige'], 'max'=>$cj['max'], 'min'=>$cj['min'], - 'qian'=>$cj['sifenwei'][0], - 'zhong'=>$cj['sifenwei'][1], - 'hou'=>$cj['sifenwei'][2], + 'q1'=>$cj['sifenwei'][0], + 'q2'=>$cj['sifenwei'][1], + 'q3'=>$cj['sifenwei'][2], 'zhongshu'=>$cj['zhongshu'], ]; - $data = $this::create($tongjiJg); } } @@ -199,6 +209,8 @@ class TongjiBj extends Base return array(); } + $kaoshi = $src['kaoshi']; + $tongjiJg = $this ->where('kaoshi_id',$src['kaoshi']) ->where('banji_id','in',$src['banji']) @@ -213,10 +225,10 @@ class TongjiBj extends Base ]); }, 'bjJieguo'=>function($query){ - $query->field('subject_id,banji_id,stu_cnt,chengji_cnt,avg,youxiu,jige') + $query->field('subject_id,banji_id,stu_cnt,chengji_cnt,avg,youxiu,jige,biaozhuncha,max,min,q1,q2,q3') ->with([ 'bjSubject'=>function($query){ - $query->field('id,lieming,jiancheng'); + $query->field('id,lieming,jiancheng,title'); }, ]) ->order(['subject_id']); @@ -227,7 +239,6 @@ class TongjiBj extends Base ->append(['banjiTitle']) ->select(); - // halt($tongjiJg->toArray()); // 初始化数组 $data = array(); @@ -235,6 +246,7 @@ class TongjiBj extends Base // 重组数据 foreach ($tongjiJg as $key => $value) { + $data[$value->banji_id]=[ 'id'=>$value->id, 'school'=>$value->bjBanji->glSchool->jiancheng, @@ -250,7 +262,16 @@ class TongjiBj extends Base 'youxiu'=>$val->youxiu, 'jige'=>$val->jige, 'cjCnt'=>$val->chengji_cnt, - 'sbjTitle'=>$val->bjSubject->jiancheng, + 'title'=>$val->bjSubject->title, + 'jiancheng'=>$val->bjSubject->jiancheng, + 'biaozhuncha'=>$val->biaozhuncha, + 'sifenwei'=>[ + 'min'=>$val->min, + 'q1'=>$val->q1, + 'q2'=>$val->q2, + 'q3'=>$val->q3, + 'max'=>$val->max, + ], ]; }else{ $data[$value->banji_id]['quanke'] = [ @@ -265,8 +286,6 @@ class TongjiBj extends Base $data = sortArrByManyField($data,'schoolpaixu',SORT_ASC,'banjipaixu',SORT_ASC); - // halt($data); - return $data; } @@ -294,20 +313,15 @@ class TongjiBj extends Base // 成绩统计结果关联 public function bjJieguo() { - return $this->hasMany('\app\chengji\model\TongjiBj','banji_id','banji_id'); + $ksid = $this->getAttr('kaoshi_id'); + return $this->hasMany('\app\chengji\model\TongjiBj','banji_id','banji_id') + ->where('kaoshi_id',$ksid); } // 获取班级名称 public function getBanjiTitleAttr() { - // $bfdate = \app\kaoshi\model\Kaoshi::where('id',$this->getAttr('kaoshi_id')) - // ->value('bfdate'); - - // $banji = new \app\teach\model\Banji; - // $title = $banji->myBanjiTitle($this->getAttr('banji_id'),$bfdate); - - // return $title; $kh = new \app\kaoshi\model\Kaohao; $src = [ 'kaoshi'=>$this->getAttr('kaoshi_id'), @@ -315,9 +329,9 @@ class TongjiBj extends Base ]; $bj = $kh->cyBanji($src); - return $bj[0]['banjiTitle']; - } + + } diff --git a/app/chengji/model/TongjiNj.php b/app/chengji/model/TongjiNj.php index be2c0d42..d2a651f5 100644 --- a/app/chengji/model/TongjiNj.php +++ b/app/chengji/model/TongjiNj.php @@ -68,10 +68,10 @@ class TongjiNj extends Base $tongjiJg->jige = $cj['jige']; $tongjiJg->max = $cj['max']; $tongjiJg->min = $cj['min']; - $tongjiJg->qian = $cj['sifenwei'][0]; - $tongjiJg->zhong = $cj['sifenwei'][1]; - $tongjiJg->hou = $cj['sifenwei'][2]; - $tongjiJg->zhong = $cj['zhongshu']; + $tongjiJg->q1 = $cj['sifenwei'][0]; + $tongjiJg->q2 = $cj['sifenwei'][1]; + $tongjiJg->q3 = $cj['sifenwei'][2]; + $tongjiJg->zhongshu = $cj['zhongshu']; $data = $tongjiJg->save(); }else{ // 重新组合统计结果 @@ -89,9 +89,9 @@ class TongjiNj extends Base 'jige'=>$cj['jige'], 'max'=>$cj['max'], 'min'=>$cj['min'], - 'qian'=>$cj['sifenwei'][0], - 'zhong'=>$cj['sifenwei'][1], - 'hou'=>$cj['sifenwei'][2], + 'q1'=>$cj['sifenwei'][0], + 'q2'=>$cj['sifenwei'][1], + 'q3'=>$cj['sifenwei'][2], 'zhongshu'=>$cj['zhongshu'], ]; @@ -159,12 +159,12 @@ class TongjiNj extends Base $query->field('id,paixu,jiancheng'); }, 'njJieguo'=>function($query) use($ruxuenian,$kaoshi){ - $query->field('subject_id,school_id,ruxuenian,stu_cnt,chengji_cnt,avg,youxiu,jige') + $query->field('subject_id,school_id,ruxuenian,stu_cnt,chengji_cnt,avg,youxiu,jige,biaozhuncha,max,min,q1,q2,q3') ->where('ruxuenian',$ruxuenian) ->where('kaoshi_id',$kaoshi) ->with([ 'njSubject'=>function($query){ - $query->field('id,lieming,jiancheng'); + $query->field('id,lieming,jiancheng,title'); }, ]) ->order(['subject_id']); @@ -195,6 +195,16 @@ class TongjiNj extends Base 'youxiu'=>$val->youxiu, 'jige'=>$val->jige, 'cjCnt'=>$val->chengji_cnt, + 'title'=>$val->njSubject->title, + 'jiancheng'=>$val->njSubject->jiancheng, + 'biaozhuncha'=>$val->biaozhuncha, + 'sifenwei'=>[ + 'min'=>$val->min, + 'q1'=>$val->q1, + 'q2'=>$val->q2, + 'q3'=>$val->q3, + 'max'=>$val->max, + ], ]; }else{ $data[$value->school_id]['quanke'] = [ @@ -235,4 +245,5 @@ class TongjiNj extends Base { return $this->hasMany('\app\chengji\model\TongjiNj','school_id','school_id'); } + } diff --git a/app/chengji/model/TongjiSch.php b/app/chengji/model/TongjiSch.php index 3d4f3fd8..610a5347 100644 --- a/app/chengji/model/TongjiSch.php +++ b/app/chengji/model/TongjiSch.php @@ -59,10 +59,10 @@ class TongjiSch extends Base $tongjiJg->jige = $cj['jige']; $tongjiJg->max = $cj['max']; $tongjiJg->min = $cj['min']; - $tongjiJg->qian = $cj['sifenwei'][0]; - $tongjiJg->zhong = $cj['sifenwei'][1]; - $tongjiJg->hou = $cj['sifenwei'][2]; - $tongjiJg->zhong = $cj['zhongshu']; + $tongjiJg->q1 = $cj['sifenwei'][0]; + $tongjiJg->q2 = $cj['sifenwei'][1]; + $tongjiJg->q3 = $cj['sifenwei'][2]; + $tongjiJg->zhongshu = $cj['zhongshu']; $data = $tongjiJg->save(); }else{ // 重新组合统计结果 @@ -79,9 +79,9 @@ class TongjiSch extends Base 'jige'=>$cj['jige'], 'max'=>$cj['max'], 'min'=>$cj['min'], - 'qian'=>$cj['sifenwei'][0], - 'zhong'=>$cj['sifenwei'][1], - 'hou'=>$cj['sifenwei'][2], + 'q1'=>$cj['sifenwei'][0], + 'q2'=>$cj['sifenwei'][1], + 'q3'=>$cj['sifenwei'][2], 'zhongshu'=>$cj['zhongshu'], ]; diff --git a/app/chengji/route/chengji.php b/app/chengji/route/chengji.php index b46a9b80..f26270dd 100644 --- a/app/chengji/route/chengji.php +++ b/app/chengji/route/chengji.php @@ -42,6 +42,7 @@ Route::group('bjtj', function () { Route::rule('dwxlsx','Bjtongji/dwBanjixls','post'); # 扫码保存 Route::rule('tongji','Bjtongji/tongji','post'); # 统计各班级成绩 Route::rule('myavg','Bjtongji/myAvg','post'); # 扫码界面 + Route::rule('myxiangti','Bjtongji/myXiangti','post'); # 扫码界面 Route::rule('digui/','Bjtongji/digui','get'); # 扫码界面 }); @@ -53,6 +54,8 @@ Route::group('njtj', function () { Route::rule('dwbiaoge/','Njtongji/dwBiaoge','get'); # 扫码保存 Route::rule('dwxlsx','Njtongji/dwNianjixlsx','post'); # 扫码保存 Route::rule('tongji','Njtongji/tongji','post'); # 统计各年级成绩 + Route::rule('myavg','Njtongji/myAvg','post'); # 扫码界面 + Route::rule('myxiangti','Njtongji/myXiangti','post'); # 扫码界面 }); // 全年级统计 diff --git a/app/chengji/view/bjtongji/biaoge.html b/app/chengji/view/bjtongji/biaoge.html index 556656f1..d933da87 100644 --- a/app/chengji/view/bjtongji/biaoge.html +++ b/app/chengji/view/bjtongji/biaoge.html @@ -1,7 +1,8 @@ {extend name=".././view/list.html" /} {block name="jsset"} - + {load href="__STATIC__/echarts/echarts.min.js" /} + {load href="__STATIC__/echarts/dataTool.js" /} {/block} {block name="nav"} @@ -43,17 +44,13 @@
{/block} {block name="echart"} - + +
+
+
+
+
+ {/block} {block name="myjs"} @@ -129,6 +126,11 @@ // 添加班级 addBanji(); + getAvg(); + getJige(); + getYouxiu(); + getBiaozhucha(); + getChayi(); //表头工具栏事件 table.on('toolbar(mytable)', function(obj){ switch(obj.event){ @@ -166,12 +168,30 @@ }; }); - // 监听表单提交 + // 监听表单提交 form.on('radio', function(data){ addBanji(); + getAvg(); + getJige(); + getYouxiu(); + getBiaozhucha(); + getChayi(); $("#srcsubmit").click(); }); + + // 监听表单提交 + form.on('checkbox', function(data){ + getAvg(); + getJige(); + getYouxiu(); + getBiaozhucha(); + getChayi(); + $("#srcsubmit").click(); + }); + + + // 添加班级列表 function addBanji(){ // 获取参数 @@ -184,140 +204,241 @@ cjgl.createCheckbox('paixu',formval,'/kaoshi/index/cybanji','banji','banTitle'); } } - }); + + // 条形统计图--平均分 + function getAvg(){ + + var id = 'myAvg'; + var url = '/chengji/bjtj/myavg'; + var val = form.val('search'); + val.xiangmu = 'avg'; + var title = '平均分'; + createTiaoxing(id,url,val,title); + } + + // 条形统计图--及格率 + function getJige(){ + + var id = 'myJige'; + var url = '/chengji/bjtj/myavg'; + var val = form.val('search'); + val.xiangmu = 'jige'; + var title = '及格率'; + createTiaoxing(id,url,val,title); + } + + // 条形统计图--优秀率 + function getYouxiu(){ + + var id = 'myYouxiu'; + var url = '/chengji/bjtj/myavg'; + var val = form.val('search'); + val.xiangmu = 'youxiu'; + var title = '优秀率'; + createTiaoxing(id,url,val,title); + } + + // 条形统计图--标准差 + function getBiaozhucha(){ + + var id = 'myBiaozhunca'; + var url = '/chengji/bjtj/myavg'; + var val = form.val('search'); + val.xiangmu = 'biaozhuncha'; + var title = '标准差'; + createTiaoxing(id,url,val,title); + } + + + // 箱线图--差异 + function getChayi(){ + var id = 'myXiangti'; + var url = '/chengji/bjtj/myxiangti'; + var val = form.val('search'); + var title = '差异'; + createXiangti(id,url,val,title); + } + +}); + + /** + * 异步获取图表中的数据 + * + * @access public + * @param id 要添加数据的div + * @param url 异步地址 + * @param val 异步时携带的参数 + * @param val 图表标题 + * @return array 返回类型 + */ + function createTiaoxing(id,url,val,title) + { + var myTiaoxing = echarts.init(document.getElementById(id)); + $.post(url,val).done(function (data) { + myTiaoxing.setOption({ + title:{ + text:title, + left: 'center', + }, + legend: { + top: '10%', + }, + grid: { + // left: '10%', + top: '20%', + // right: '10%', + // bottom: '15%' + }, + tooltip: { + feature:{ + saveAsImage:{ + show:true, + type:'png', + title:title + }, + }, + }, + dataset: { + source:data.data + }, + xAxis: {type: 'category'}, + yAxis: {}, + dataZoom: [ + { + type: 'inside', + start: 0, + end: 100 + }, + { + show: true, + height: 20, + type: 'slider', + top: '90%', + xAxisIndex: [0], + start: 0, + end: 100 + } + ], + // Declare several bar series, each will be mapped + // to a column of dataset.source by default. + series: data.series, + }); + }); + } - // // 基于准备好的dom,初始化echarts实例 - // var myAvg = echarts.init(document.getElementById('myAvg')); + /** + * 异步获取箱线图表中的数据 + * + * @access public + * @param id 要添加数据的div + * @param url 异步地址 + * @param val 异步时携带的参数 + * @param title 图表标题 + * @return array 返回类型 + */ + function createXiangti(id,url,val,title) + { + $.post(url,val).done(function (data) { + axisData = data.axisData; + category = data.category; + boxData = data.boxData; + myseries = Array(); - // // 使用刚指定的配置项和数据显示图表。 - // myAvg.setOption({ - // title: { - // text: '平均分' - // }, - // legend: {}, - // tooltip: {}, - // dataset: { - // source:[ - // ['项目', '平列', '优秀', '及格率'], - // ['一年级一班', 43.3, 85.8, 93.7], - // ['一年级二班', 83.1, 73.4, 55.1], - // ['一年级三班', 86.4, 65.2, 82.5], - // ['一年级四班', 72.4, 53.9, 39.1] - // ] - // }, - // xAxis: {type: 'category'}, - // yAxis: {}, - // series: [ - // {type: 'bar'}, - // {type: 'bar'}, - // {type: 'bar'} - // ] - // }); + for(var i in category) + { + myseries.push({ + 'name':category[i], + 'type':'boxplot', + 'data':boxData[i], + 'tooltip':{formatter: formatter}, + }); + } - // // 异步加载数据 - // $.post('/chengji/bjtj/myavg', - // {kaoshi:"{$list.kaoshi}" - // ,ruxuenian:$("input[name='ruxuenian']:checked").val() - // ,school:$("input[name='school']:checked").val() - // }).done(function (data) { - // // 填入数据 - // myAvg.setOption({ - // // xAxis: { - // // data: 'category' - // // }, - // dataset: { - // source:data.source - // }, - // series: [{ - // // 根据名字对应到相应的系列 - // // name: '销量', - // // data: data.data - // }] - // }); - // }); + // 设置初始值 + option = { + title: { + text: title, + left: 'center', + }, + legend: { + top: '10%', + // data: + }, + tooltip: { + trigger: 'item', + axisPointer: { + type: 'shadow' + } + }, + grid: { + left: '10%', + top: '20%', + right: '10%', + bottom: '15%' + }, + xAxis: { + type: 'category', + data: axisData, + boundaryGap: true, + nameGap: 30, + splitArea: { + show: true + }, + axisLabel: { + // formatter: 'expr {value}' + }, + splitLine: { + show: false + } + }, + yAxis: { + type: 'value', + name: '得分', + // min: -400, + // max: 600, + splitArea: { + show: false + } + }, + dataZoom: [ + { + type: 'inside', + start: 0, + end: 100 + }, + { + show: true, + height: 20, + type: 'slider', + top: '90%', + xAxisIndex: [0], + start: 0, + end: 100 + } + ], + series: myseries, + }; + + var myXiangti = echarts.init(document.getElementById(id)); + myXiangti.setOption(option); + }); + } - // // 基于准备好的dom,初始化echarts实例 - // var myYouxiu = echarts.init(document.getElementById('myYouxiu')); - - // // 指定图表的配置项和数据 - // var option = { - // title: { - // text: 'ECharts 入门示例' - // }, - // tooltip: {}, - // legend: { - // data:['销量'] - // }, - // xAxis: { - // data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"] - // }, - // yAxis: {}, - // series: [{ - // name: '销量', - // type: 'bar', - // data: [5, 20, 36, 10, 10, 20] - // }] - // }; - - // // 使用刚指定的配置项和数据显示图表。 - // myYouxiu.setOption(option); - // 基于准备好的dom,初始化echarts实例 - var myJige = echarts.init(document.getElementById('myJige')); - - // 指定图表的配置项和数据 - var option = { - title: { - text: 'ECharts 入门示例' - }, - tooltip: {}, - legend: { - data:['销量'] - }, - xAxis: { - data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"] - }, - yAxis: {}, - series: [{ - name: '销量', - type: 'bar', - data: [5, 20, 36, 10, 10, 20] - }] - }; - - // 使用刚指定的配置项和数据显示图表。 - myJige.setOption(option); - - // // 基于准备好的dom,初始化echarts实例 - // var myYouxiu = echarts.init(document.getElementById('a2')); - - // // 指定图表的配置项和数据 - // var option = { - // title: { - // text: 'ECharts 入门示例' - // }, - // tooltip: {}, - // legend: { - // data:['销量'] - // }, - // xAxis: { - // data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"] - // }, - // yAxis: {}, - // series: [{ - // name: '销量', - // type: 'bar', - // data: [5, 20, 36, 10, 10, 20] - // }] - // }; - - // // 使用刚指定的配置项和数据显示图表。 - // myYouxiu.setOption(option); - + function formatter(param) { + return [ + param.name, + '最低分: ' + param.data[1], + '25%: ' + param.data[2], + '50%: ' + param.data[3], + '75%: ' + param.data[4], + '最高: ' + param.data[5] + ].join('
'); + } diff --git a/app/chengji/view/njtongji/biaoge.html b/app/chengji/view/njtongji/biaoge.html index 3b588a2a..863602c0 100644 --- a/app/chengji/view/njtongji/biaoge.html +++ b/app/chengji/view/njtongji/biaoge.html @@ -1,7 +1,8 @@ {extend name=".././view/list.html" /} {block name="jsset"} - + {load href="__STATIC__/echarts/echarts.min.js" /} + {load href="__STATIC__/echarts/dataTool.js" /} {/block} {block name="nav"} @@ -27,6 +28,15 @@ {block name="table"}
{/block} +{block name="echart"} + +
+
+
+
+
+ +{/block} {block name="myjs"} {/block} \ No newline at end of file diff --git a/app/login/controller/Index.php b/app/login/controller/Index.php index 1b8b53f2..7e3480b7 100644 --- a/app/login/controller/Index.php +++ b/app/login/controller/Index.php @@ -17,13 +17,19 @@ use think\exception\ValidateException; use think\facade\Config; - class Index { + // protected $request; + + // public function __construct(Request $request) + // { + // $this->request = $request; + // } + // 显示登录界面 public function index() { - + $mobile = request()->isMobile(); // 清除cookie cookie('userid', null); cookie('username', null); @@ -34,6 +40,7 @@ class Index // 获取系统名称和版本号 $list['webtitle'] = Config::get('shangma.webtitle'); $list['version'] = Config::get('shangma.version'); + $list['mobile'] = $mobile; View::assign('list',$list); diff --git a/app/login/view/index/index.html b/app/login/view/index/index.html index 95e53322..76afc917 100644 --- a/app/login/view/index/index.html +++ b/app/login/view/index/index.html @@ -39,10 +39,12 @@
-
-
+
+ {neq name="list.mobile" value="true"} +
-
+
+ {/neq}

@@ -56,16 +58,30 @@ }).use(['sliderVerify', 'jquery', 'form'], function() { var sliderVerify = layui.sliderVerify, form = layui.form; - var slider = sliderVerify.render({ - elem: '#slider', - onOk: function(){ - //当验证通过回调 - // layer.msg("滑块验证通过"); - }, - }) + + mobile = "{$list['mobile']}"; + if(mobile!==true) + { + var slider = sliderVerify.render({ + elem: '#slider', + onOk: function(){ + //当验证通过回调 + // layer.msg("滑块验证通过"); + }, + }) + } + //监听提交 - form.on('submit(login)', function(data) { - if(slider.isOk()){ + form.on('submit(login)', function(data){ + mobile = "{$list['mobile']}"; + if(mobile == true) + { + yz = true + }else{ + yz = slider.isOk(); + } + + if(yz){ $.post("/login",data.field,function(data,status){ if(status != 'success') { @@ -92,7 +108,6 @@ } return false; }); - }) diff --git a/app/login/view/index/shangma_log.html b/app/login/view/index/shangma_log.html index 6fc4dc57..c18b49d3 100644 --- a/app/login/view/index/shangma_log.html +++ b/app/login/view/index/shangma_log.html @@ -14,6 +14,15 @@ +
@@ -40,11 +49,15 @@

V1.3.1 2020-02-12

- 修改考试设置,删除参加考试年级、学科两个数据表,增加考试设置表,修改获取参与年级、班级、学科的方法。 + 修改考试设置,删除参加考试年级、学科两个数据表,增加考试设置表,修改获取参与年级、班级、学科的方法。修改几个字段名称。
升级layui到2.5.6
重新梳理视图模板逻辑 +
+ 增加手机登录兼容 +
+ 增加图表

diff --git a/database/migrations/20200106012240_tongji_nj.php b/database/migrations/20200106012240_tongji_nj.php index 1c24a1a9..9bf24b6d 100644 --- a/database/migrations/20200106012240_tongji_nj.php +++ b/database/migrations/20200106012240_tongji_nj.php @@ -46,9 +46,9 @@ class TongjiNj extends Migrator ->addColumn('jige','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'及格']) ->addColumn('max','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'最大']) ->addColumn('min','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'最小']) - ->addColumn('qian','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'前25%']) - ->addColumn('zhong','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'中间%25']) - ->addColumn('hou','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'后面25%']) + ->addColumn('q1','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'下25%']) + ->addColumn('q2','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'中间%25']) + ->addColumn('q3','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'上面25%']) ->addColumn('zhongshu','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'众数']) ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) diff --git a/database/migrations/20200106013922_tongji_bj.php b/database/migrations/20200106013922_tongji_bj.php index f54c2e5f..f7ee5aa3 100644 --- a/database/migrations/20200106013922_tongji_bj.php +++ b/database/migrations/20200106013922_tongji_bj.php @@ -45,9 +45,9 @@ class TongjiBj extends Migrator ->addColumn('jige','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'及格']) ->addColumn('max','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'最大']) ->addColumn('min','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'最小']) - ->addColumn('qian','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'前25%']) - ->addColumn('zhong','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'中间%25']) - ->addColumn('hou','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'后面25%']) + ->addColumn('q1','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'下25%']) + ->addColumn('q2','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'中间%25']) + ->addColumn('q3','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'上面25%']) ->addColumn('zhongshu','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'众数']) ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) diff --git a/database/migrations/20200107045207_tongji_sch.php b/database/migrations/20200107045207_tongji_sch.php index 9b3c28ff..9d1d6fa7 100644 --- a/database/migrations/20200107045207_tongji_sch.php +++ b/database/migrations/20200107045207_tongji_sch.php @@ -45,9 +45,9 @@ class TongjiSch extends Migrator ->addColumn('jige','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'及格']) ->addColumn('max','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'最大']) ->addColumn('min','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'最小']) - ->addColumn('qian','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'前25%']) - ->addColumn('zhong','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'中间%25']) - ->addColumn('hou','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'后面25%']) + ->addColumn('q1','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'下25%']) + ->addColumn('q2','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'中间%25']) + ->addColumn('q3','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'上面25%']) ->addColumn('zhongshu','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>true,'comment'=>'众数']) ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) diff --git a/database/seeds/Rule.php b/database/seeds/Rule.php index cee0bf63..6822abad 100644 --- a/database/seeds/Rule.php +++ b/database/seeds/Rule.php @@ -309,6 +309,8 @@ class Rule extends Seeder ['id'=>3020302,'title'=>'班级成绩','name'=>'banjichengji','paixu'=>2,'pid'=>30203], ['title'=>'班级成绩统计','name'=>'Chengji/Bjtongji/biaoge','paixu'=>1,'pid'=>3020302], ['title'=>'下载班级成绩统计表','name'=>'chengji/Bjtongji/dwBiaoge','paixu'=>2,'pid'=>3020302], + ['title'=>'条形统计图','name'=>'chengji/Bjtongji/myavg','paixu'=>3,'pid'=>3020302], + ['title'=>'箱体图','name'=>'chengji/Bjtongji/myxiangti','paixu'=>4,'pid'=>3020302], // 年级成绩统计表 ['id'=>3020303,'title'=>'年级成绩','name'=>'nianjichengji','paixu'=>3,'pid'=>30203], ['title'=>'年级成绩统计','name'=>'Chengji/Njtongji/biaoge','paixu'=>1,'pid'=>3020303], diff --git a/public/examples/bjavg.png b/public/examples/bjavg.png new file mode 100644 index 00000000..e52347e1 Binary files /dev/null and b/public/examples/bjavg.png differ diff --git a/public/examples/bjbiaozhuncha.png b/public/examples/bjbiaozhuncha.png new file mode 100644 index 00000000..f22b1964 Binary files /dev/null and b/public/examples/bjbiaozhuncha.png differ diff --git a/public/examples/bjchayi.png b/public/examples/bjchayi.png new file mode 100644 index 00000000..53685616 Binary files /dev/null and b/public/examples/bjchayi.png differ diff --git a/public/examples/bjjige.png b/public/examples/bjjige.png new file mode 100644 index 00000000..9beb6d56 Binary files /dev/null and b/public/examples/bjjige.png differ diff --git a/public/examples/bjyouxiu.png b/public/examples/bjyouxiu.png new file mode 100644 index 00000000..bcf654f8 Binary files /dev/null and b/public/examples/bjyouxiu.png differ diff --git a/public/static/echarts/dataTool.js b/public/static/echarts/dataTool.js new file mode 100644 index 00000000..ae14be80 --- /dev/null +++ b/public/static/echarts/dataTool.js @@ -0,0 +1,872 @@ + +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('echarts')) : + typeof define === 'function' && define.amd ? define(['exports', 'echarts'], factory) : + (factory((global.dataTool = {}),global.echarts)); +}(this, (function (exports,echarts) { 'use strict'; + +/** + * @module zrender/core/util + */ + +// 用于处理merge时无法遍历Date等对象的问题 +var arrayProto = Array.prototype; +var nativeMap = arrayProto.map; + + +/** + * Those data types can be cloned: + * Plain object, Array, TypedArray, number, string, null, undefined. + * Those data types will be assgined using the orginal data: + * BUILTIN_OBJECT + * Instance of user defined class will be cloned to a plain object, without + * properties in prototype. + * Other data types is not supported (not sure what will happen). + * + * Caution: do not support clone Date, for performance consideration. + * (There might be a large number of date in `series.data`). + * So date should not be modified in and out of echarts. + * + * @param {*} source + * @return {*} new + */ + + +/** + * @memberOf module:zrender/core/util + * @param {*} target + * @param {*} source + * @param {boolean} [overwrite=false] + */ + + +/** + * @param {Array} targetAndSources The first item is target, and the rests are source. + * @param {boolean} [overwrite=false] + * @return {*} target + */ + + +/** + * @param {*} target + * @param {*} source + * @memberOf module:zrender/core/util + */ + + +/** + * @param {*} target + * @param {*} source + * @param {boolean} [overlay=false] + * @memberOf module:zrender/core/util + */ + + + + + + +/** + * 查询数组中元素的index + * @memberOf module:zrender/core/util + */ + + +/** + * 构造类继承关系 + * + * @memberOf module:zrender/core/util + * @param {Function} clazz 源类 + * @param {Function} baseClazz 基类 + */ + + +/** + * @memberOf module:zrender/core/util + * @param {Object|Function} target + * @param {Object|Function} sorce + * @param {boolean} overlay + */ + + +/** + * Consider typed array. + * @param {Array|TypedArray} data + */ + + +/** + * 数组或对象遍历 + * @memberOf module:zrender/core/util + * @param {Object|Array} obj + * @param {Function} cb + * @param {*} [context] + */ + + +/** + * 数组映射 + * @memberOf module:zrender/core/util + * @param {Array} obj + * @param {Function} cb + * @param {*} [context] + * @return {Array} + */ +function map(obj, cb, context) { + if (!(obj && cb)) { + return; + } + if (obj.map && obj.map === nativeMap) { + return obj.map(cb, context); + } + else { + var result = []; + for (var i = 0, len = obj.length; i < len; i++) { + result.push(cb.call(context, obj[i], i, obj)); + } + return result; + } +} + +/** + * @memberOf module:zrender/core/util + * @param {Array} obj + * @param {Function} cb + * @param {Object} [memo] + * @param {*} [context] + * @return {Array} + */ + + +/** + * 数组过滤 + * @memberOf module:zrender/core/util + * @param {Array} obj + * @param {Function} cb + * @param {*} [context] + * @return {Array} + */ + + +/** + * 数组项查找 + * @memberOf module:zrender/core/util + * @param {Array} obj + * @param {Function} cb + * @param {*} [context] + * @return {*} + */ + + +/** + * @memberOf module:zrender/core/util + * @param {Function} func + * @param {*} context + * @return {Function} + */ + + +/** + * @memberOf module:zrender/core/util + * @param {Function} func + * @return {Function} + */ + + +/** + * @memberOf module:zrender/core/util + * @param {*} value + * @return {boolean} + */ + + +/** + * @memberOf module:zrender/core/util + * @param {*} value + * @return {boolean} + */ + + +/** + * @memberOf module:zrender/core/util + * @param {*} value + * @return {boolean} + */ + + +/** + * @memberOf module:zrender/core/util + * @param {*} value + * @return {boolean} + */ + + +/** + * @memberOf module:zrender/core/util + * @param {*} value + * @return {boolean} + */ + + +/** + * @memberOf module:zrender/core/util + * @param {*} value + * @return {boolean} + */ + + +/** + * @memberOf module:zrender/core/util + * @param {*} value + * @return {boolean} + */ + + +/** + * Whether is exactly NaN. Notice isNaN('a') returns true. + * @param {*} value + * @return {boolean} + */ + + +/** + * If value1 is not null, then return value1, otherwise judget rest of values. + * Low performance. + * @memberOf module:zrender/core/util + * @return {*} Final value + */ + + + + + + +/** + * @memberOf module:zrender/core/util + * @param {Array} arr + * @param {number} startIndex + * @param {number} endIndex + * @return {Array} + */ + + +/** + * Normalize css liked array configuration + * e.g. + * 3 => [3, 3, 3, 3] + * [4, 2] => [4, 2, 4, 2] + * [4, 3, 2] => [4, 3, 2, 3] + * @param {number|Array.} val + * @return {Array.} + */ + + +/** + * @memberOf module:zrender/core/util + * @param {boolean} condition + * @param {string} message + */ + + +/** + * @memberOf module:zrender/core/util + * @param {string} str string to be trimed + * @return {string} trimed string + */ + + +/** + * Set an object as primitive to be ignored traversing children in clone or merge + */ + +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +/** + * This is a parse of GEXF. + * + * The spec of GEXF: + * https://gephi.org/gexf/1.2draft/gexf-12draft-primer.pdf + */ + +function parse(xml) { + var doc; + if (typeof xml === 'string') { + var parser = new DOMParser(); + doc = parser.parseFromString(xml, 'text/xml'); + } + else { + doc = xml; + } + if (!doc || doc.getElementsByTagName('parsererror').length) { + return null; + } + + var gexfRoot = getChildByTagName(doc, 'gexf'); + + if (!gexfRoot) { + return null; + } + + var graphRoot = getChildByTagName(gexfRoot, 'graph'); + + var attributes = parseAttributes(getChildByTagName(graphRoot, 'attributes')); + var attributesMap = {}; + for (var i = 0; i < attributes.length; i++) { + attributesMap[attributes[i].id] = attributes[i]; + } + + return { + nodes: parseNodes(getChildByTagName(graphRoot, 'nodes'), attributesMap), + links: parseEdges(getChildByTagName(graphRoot, 'edges')) + }; +} + +function parseAttributes(parent) { + return parent ? map(getChildrenByTagName(parent, 'attribute'), function (attribDom) { + return { + id: getAttr(attribDom, 'id'), + title: getAttr(attribDom, 'title'), + type: getAttr(attribDom, 'type') + }; + }) : []; +} + +function parseNodes(parent, attributesMap) { + return parent ? map(getChildrenByTagName(parent, 'node'), function (nodeDom) { + + var id = getAttr(nodeDom, 'id'); + var label = getAttr(nodeDom, 'label'); + + var node = { + id: id, + name: label, + itemStyle: { + normal: {} + } + }; + + var vizSizeDom = getChildByTagName(nodeDom, 'viz:size'); + var vizPosDom = getChildByTagName(nodeDom, 'viz:position'); + var vizColorDom = getChildByTagName(nodeDom, 'viz:color'); + // var vizShapeDom = getChildByTagName(nodeDom, 'viz:shape'); + + var attvaluesDom = getChildByTagName(nodeDom, 'attvalues'); + + if (vizSizeDom) { + node.symbolSize = parseFloat(getAttr(vizSizeDom, 'value')); + } + if (vizPosDom) { + node.x = parseFloat(getAttr(vizPosDom, 'x')); + node.y = parseFloat(getAttr(vizPosDom, 'y')); + // z + } + if (vizColorDom) { + node.itemStyle.normal.color = 'rgb(' + [ + getAttr(vizColorDom, 'r') | 0, + getAttr(vizColorDom, 'g') | 0, + getAttr(vizColorDom, 'b') | 0 + ].join(',') + ')'; + } + // if (vizShapeDom) { + // node.shape = getAttr(vizShapeDom, 'shape'); + // } + if (attvaluesDom) { + var attvalueDomList = getChildrenByTagName(attvaluesDom, 'attvalue'); + + node.attributes = {}; + + for (var j = 0; j < attvalueDomList.length; j++) { + var attvalueDom = attvalueDomList[j]; + var attId = getAttr(attvalueDom, 'for'); + var attValue = getAttr(attvalueDom, 'value'); + var attribute = attributesMap[attId]; + + if (attribute) { + switch (attribute.type) { + case 'integer': + case 'long': + attValue = parseInt(attValue, 10); + break; + case 'float': + case 'double': + attValue = parseFloat(attValue); + break; + case 'boolean': + attValue = attValue.toLowerCase() === 'true'; + break; + default: + } + node.attributes[attId] = attValue; + } + } + } + + return node; + }) : []; +} + +function parseEdges(parent) { + return parent ? map(getChildrenByTagName(parent, 'edge'), function (edgeDom) { + var id = getAttr(edgeDom, 'id'); + var label = getAttr(edgeDom, 'label'); + + var sourceId = getAttr(edgeDom, 'source'); + var targetId = getAttr(edgeDom, 'target'); + + var edge = { + id: id, + name: label, + source: sourceId, + target: targetId, + lineStyle: { + normal: {} + } + }; + + var lineStyle = edge.lineStyle.normal; + + var vizThicknessDom = getChildByTagName(edgeDom, 'viz:thickness'); + var vizColorDom = getChildByTagName(edgeDom, 'viz:color'); + // var vizShapeDom = getChildByTagName(edgeDom, 'viz:shape'); + + if (vizThicknessDom) { + lineStyle.width = parseFloat(vizThicknessDom.getAttribute('value')); + } + if (vizColorDom) { + lineStyle.color = 'rgb(' + [ + getAttr(vizColorDom, 'r') | 0, + getAttr(vizColorDom, 'g') | 0, + getAttr(vizColorDom, 'b') | 0 + ].join(',') + ')'; + } + // if (vizShapeDom) { + // edge.shape = vizShapeDom.getAttribute('shape'); + // } + + return edge; + }) : []; +} + +function getAttr(el, attrName) { + return el.getAttribute(attrName); +} + +function getChildByTagName(parent, tagName) { + var node = parent.firstChild; + + while (node) { + if ( + node.nodeType !== 1 + || node.nodeName.toLowerCase() !== tagName.toLowerCase() + ) { + node = node.nextSibling; + } + else { + return node; + } + } + + return null; +} + +function getChildrenByTagName(parent, tagName) { + var node = parent.firstChild; + var children = []; + while (node) { + if (node.nodeName.toLowerCase() === tagName.toLowerCase()) { + children.push(node); + } + node = node.nextSibling; + } + + return children; +} + + +var gexf = (Object.freeze || Object)({ + parse: parse +}); + +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +/* +* A third-party license is embeded for some of the code in this file: +* The method "quantile" was copied from "d3.js". +* (See more details in the comment of the method below.) +* The use of the source code of this file is also subject to the terms +* and consitions of the license of "d3.js" (BSD-3Clause, see +* ). +*/ + +/** + * Linear mapping a value from domain to range + * @memberOf module:echarts/util/number + * @param {(number|Array.)} val + * @param {Array.} domain Domain extent domain[0] can be bigger than domain[1] + * @param {Array.} range Range extent range[0] can be bigger than range[1] + * @param {boolean} clamp + * @return {(number|Array.} + */ + + +/** + * Convert a percent string to absolute number. + * Returns NaN if percent is not a valid string or number + * @memberOf module:echarts/util/number + * @param {string|number} percent + * @param {number} all + * @return {number} + */ + + +/** + * (1) Fix rounding error of float numbers. + * (2) Support return string to avoid scientific notation like '3.5e-7'. + * + * @param {number} x + * @param {number} [precision] + * @param {boolean} [returnStr] + * @return {number|string} + */ + + +/** + * asc sort arr. + * The input arr will be modified. + * + * @param {Array} arr + * @return {Array} The input arr. + */ +function asc(arr) { + arr.sort(function (a, b) { + return a - b; + }); + return arr; +} + +/** + * Get precision + * @param {number} val + */ + + +/** + * @param {string|number} val + * @return {number} + */ + + +/** + * Minimal dicernible data precisioin according to a single pixel. + * + * @param {Array.} dataExtent + * @param {Array.} pixelExtent + * @return {number} precision + */ + + +/** + * Get a data of given precision, assuring the sum of percentages + * in valueList is 1. + * The largest remainer method is used. + * https://en.wikipedia.org/wiki/Largest_remainder_method + * + * @param {Array.} valueList a list of all data + * @param {number} idx index of the data to be processed in valueList + * @param {number} precision integer number showing digits of precision + * @return {number} percent ranging from 0 to 100 + */ + + +// Number.MAX_SAFE_INTEGER, ie do not support. + + +/** + * To 0 - 2 * PI, considering negative radian. + * @param {number} radian + * @return {number} + */ + + +/** + * @param {type} radian + * @return {boolean} + */ + + +/* eslint-enable */ + +/** + * @param {string|Date|number} value These values can be accepted: + * + An instance of Date, represent a time in its own time zone. + * + Or string in a subset of ISO 8601, only including: + * + only year, month, date: '2012-03', '2012-03-01', '2012-03-01 05', '2012-03-01 05:06', + * + separated with T or space: '2012-03-01T12:22:33.123', '2012-03-01 12:22:33.123', + * + time zone: '2012-03-01T12:22:33Z', '2012-03-01T12:22:33+8000', '2012-03-01T12:22:33-05:00', + * all of which will be treated as local time if time zone is not specified + * (see ). + * + Or other string format, including (all of which will be treated as loacal time): + * '2012', '2012-3-1', '2012/3/1', '2012/03/01', + * '2009/6/12 2:00', '2009/6/12 2:05:08', '2009/6/12 2:05:08.123' + * + a timestamp, which represent a time in UTC. + * @return {Date} date + */ + + +/** + * Quantity of a number. e.g. 0.1, 1, 10, 100 + * + * @param {number} val + * @return {number} + */ + + +/** + * Exponent of the quantity of a number + * e.g., 1234 equals to 1.234*10^3, so quantityExponent(1234) is 3 + * + * @param {number} val non-negative value + * @return {number} + */ + + +/** + * find a “nice” number approximately equal to x. Round the number if round = true, + * take ceiling if round = false. The primary observation is that the “nicest” + * numbers in decimal are 1, 2, and 5, and all power-of-ten multiples of these numbers. + * + * See "Nice Numbers for Graph Labels" of Graphic Gems. + * + * @param {number} val Non-negative value. + * @param {boolean} round + * @return {number} + */ + + +/** + * This code was copied from "d3.js" + * . + * See the license statement at the head of this file. + * @param {Array.} ascArr + */ +function quantile(ascArr, p) { + var H = (ascArr.length - 1) * p + 1; + var h = Math.floor(H); + var v = +ascArr[h - 1]; + var e = H - h; + return e ? v + e * (ascArr[h] - v) : v; +} + +/** + * Order intervals asc, and split them when overlap. + * expect(numberUtil.reformIntervals([ + * {interval: [18, 62], close: [1, 1]}, + * {interval: [-Infinity, -70], close: [0, 0]}, + * {interval: [-70, -26], close: [1, 1]}, + * {interval: [-26, 18], close: [1, 1]}, + * {interval: [62, 150], close: [1, 1]}, + * {interval: [106, 150], close: [1, 1]}, + * {interval: [150, Infinity], close: [0, 0]} + * ])).toEqual([ + * {interval: [-Infinity, -70], close: [0, 0]}, + * {interval: [-70, -26], close: [1, 1]}, + * {interval: [-26, 18], close: [0, 1]}, + * {interval: [18, 62], close: [0, 1]}, + * {interval: [62, 150], close: [0, 1]}, + * {interval: [150, Infinity], close: [0, 0]} + * ]); + * @param {Array.} list, where `close` mean open or close + * of the interval, and Infinity can be used. + * @return {Array.} The origin list, which has been reformed. + */ + + +/** + * parseFloat NaNs numeric-cast false positives (null|true|false|"") + * ...but misinterprets leading-number strings, particularly hex literals ("0x...") + * subtraction forces infinities to NaN + * + * @param {*} v + * @return {boolean} + */ + +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +/** + * See: + * + * + * + * Helper method for preparing data. + * + * @param {Array.} rawData like + * [ + * [12,232,443], (raw data set for the first box) + * [3843,5545,1232], (raw datat set for the second box) + * ... + * ] + * @param {Object} [opt] + * + * @param {(number|string)} [opt.boundIQR=1.5] Data less than min bound is outlier. + * default 1.5, means Q1 - 1.5 * (Q3 - Q1). + * If 'none'/0 passed, min bound will not be used. + * @param {(number|string)} [opt.layout='horizontal'] + * Box plot layout, can be 'horizontal' or 'vertical' + * @return {Object} { + * boxData: Array.> + * outliers: Array.> + * axisData: Array. + * } + */ +var prepareBoxplotData = function (rawData, opt) { + opt = opt || []; + var boxData = []; + var outliers = []; + var axisData = []; + var boundIQR = opt.boundIQR; + var useExtreme = boundIQR === 'none' || boundIQR === 0; + + for (var i = 0; i < rawData.length; i++) { + axisData.push(i + ''); + var ascList = asc(rawData[i].slice()); + + var Q1 = quantile(ascList, 0.25); + var Q2 = quantile(ascList, 0.5); + var Q3 = quantile(ascList, 0.75); + var min = ascList[0]; + var max = ascList[ascList.length - 1]; + + var bound = (boundIQR == null ? 1.5 : boundIQR) * (Q3 - Q1); + + var low = useExtreme + ? min + : Math.max(min, Q1 - bound); + var high = useExtreme + ? max + : Math.min(max, Q3 + bound); + + boxData.push([low, Q1, Q2, Q3, high]); + + for (var j = 0; j < ascList.length; j++) { + var dataItem = ascList[j]; + if (dataItem < low || dataItem > high) { + var outlier = [i, dataItem]; + opt.layout === 'vertical' && outlier.reverse(); + outliers.push(outlier); + } + } + } + return { + boxData: boxData, + outliers: outliers, + axisData: axisData + }; +}; + +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +var version = '1.0.0'; + +// For backward compatibility, where the namespace `dataTool` will +// be mounted on `echarts` is the extension `dataTool` is imported. +// But the old version of echarts do not have `dataTool` namespace, +// so check it before mounting. +if (echarts.dataTool) { + echarts.dataTool.version = version; + echarts.dataTool.gexf = gexf; + echarts.dataTool.prepareBoxplotData = prepareBoxplotData; +} + +exports.version = version; +exports.gexf = gexf; +exports.prepareBoxplotData = prepareBoxplotData; + +}))); +//# sourceMappingURL=dataTool.js.map diff --git a/public/static/x-admin2.2/js/cjgl.js b/public/static/x-admin2.2/js/cjgl.js index 282abfe8..e4f243a9 100644 --- a/public/static/x-admin2.2/js/cjgl.js +++ b/public/static/x-admin2.2/js/cjgl.js @@ -283,8 +283,14 @@ layui.define(['table'],function(exports){ //提示:模块也可以依赖其它 url, val, function(data,status){ - cnt = data.count; - mydata = data.data; + if(data.count){ + cnt = data.count; + mydata = data.data; + }else{ + cnt = 0; + mydata = Array(); + } + if(cnt>0){ $('#'+parentId).append(''); } @@ -381,14 +387,6 @@ layui.define(['table'],function(exports){ //提示:模块也可以依赖其它 form.render(); }, - - - - - - - - }; //输出test接口 exports('cjgl', obj); diff --git a/public/static/x-admin2.2/lib/layui/sliderVerify.js b/public/static/x-admin2.2/lib/layui/sliderVerify.js index e1299fc2..540c0bb7 100644 --- a/public/static/x-admin2.2/lib/layui/sliderVerify.js +++ b/public/static/x-admin2.2/lib/layui/sliderVerify.js @@ -1 +1 @@ -layui.define(['jquery','layer','form'],function(exports){"use strict";var $=layui.jquery,form=layui.form,layer=layui.layer,device=layui.device(),sliderVerify={read:function(){var css=`.slider-item{height:38px;line-height:38px;background-color:#d0d0d0;position:relative;border:1px solid white}.slider-bg{position:absolute;width:40px;height:100%;z-index:100}.slider-btn{width:40px;height:96%;position:absolute;border:1px solid#ccc;cursor:move;text-align:center;background-color:#fff;user-select:none;color:#666;z-index:120}.slider-btn-success{font-size:26px}.slider-text{position:absolute;text-align:center;width:100%;height:100%;user-select:none;font-size:14px;color:#fff;z-index:120}.slider-error{animation:glow 800ms ease-out infinite alternate}@keyframes glow{0%{border-color:#e6e6e6}100%{border-color:#ff5722}}`,style=document.createElement('style');style.innerHTML=css;style.type='text/css';$('head link:last')[0]&&$('head link:last').after(style)||$('head').append(style)}()},dom=function(d){return d[0]},thisSliderVerify=function(){var that=this;return{isOk:function(){return that.isOk.call(that)},reset:function(){return that.reset.call(that)}}},MOD_NAME='sliderVerify',MOD_BTN='slider-btn',MOD_BG='slider-bg',MOD_TEXT='slider-text',MOD_NEXT='layui-icon-next',MOD_OK='layui-icon-ok-circle',MOD_BTN_SUCCESS='slider-btn-success',MOD_DEFAULT_BG='layui-bg-green',MOD_ERROR_BORDER='slider-error',MOD_CONFIG_TEXT='请拖动滑块验证',MOD_CONFIG_SUCCESS='验证通过',Class=function(option){var that=this;that.config=$.extend({},that.config,option);that.render()};Class.prototype.config={elem:'',onOk:null,isOk:false,isAutoVerify:true,bg:MOD_DEFAULT_BG,text:MOD_CONFIG_TEXT};Class.prototype.render=function(){var that=this,option=that.config,elem=$(option.elem);if(!elem[0])return;if(option.domid)option.domid.remove();option.domid=that.createIdNum();var sliderDom=$(`
${option.text}
`);elem.hide().after(sliderDom);option.domid=$('#'+option.domid);that.events();if(option.isAutoVerify){form.verify({sliderVerify:function(value,dom){if(!value){dom.classList.add(MOD_ERROR_BORDER);return option.text}}})}};Class.prototype.isMobile=function(){return(device.os=='ios'||device.os=='android')};Class.prototype.createIdNum=function(){return MOD_NAME+(+new Date()).toString()+(Math.random().toString()).substr(2,7)};Class.prototype.isOk=function(){return this.config.isOk};Class.prototype.error=function(msg){return layer.msg(msg,{icon:5})};Class.prototype.distance=function(){var container=this.config.container;return container.box.offsetWidth-container.btn.offsetWidth};Class.prototype.reset=function(){this.config.isOk=false;return this.render()};Class.prototype.resize=function(distance){var that=this,container=that.config.container;var distance=distance||that.distance();container.btn.style.left=distance+"px";container.bg.style.width=distance+"px"};Class.prototype.cancelTransition=function(){var container=this.config.container;this.config.domid[0].classList.remove(MOD_ERROR_BORDER);container.btn.style.transition="";container.bg.style.transition=""};Class.prototype.down=function(e){var that=this,option=that.config,container=option.container,e=e||window.event,downX=e.clientX||e.touches[0].clientX;that.cancelTransition();var move=function(e){that.move(downX,e)};that.events.move=move;if(that.isMobile()){document.addEventListener('touchmove',that.events.move)}else{document.onmousemove=move}};Class.prototype.move=function(down,e){var that=this,option=that.config,container=option.container;var e=e||window.event;let moveX=e.clientX||e.touches[0].clientX;var offsetX=moveX-down;if(offsetX>container.distance){offsetX=container.distance}else if(offsetX<0){offsetX=0}container.btn.style.left=offsetX+"px";container.bg.style.width=offsetX+"px";if(offsetX==container.distance){container.text.innerHTML=MOD_CONFIG_SUCCESS;var com=window.getComputedStyle?window.getComputedStyle(container.bg,null):container.bg.currentStyle;container.btn.style.border='1px solid '+com.backgroundColor;container.btn.style.color=com.backgroundColor;container.btn.classList.remove(MOD_NEXT);container.btn.classList.add(MOD_OK,MOD_BTN_SUCCESS);option.isOk=true;container.box.value=true;if(that.isMobile()){container.btn.removeEventListener('touchstart',that.events.down,false);document.removeEventListener('touchmove',that.events.move,false)}else{container.btn.onmousedown=null;document.onmousemove=null}option.onOk&&typeof option.onOk=='function'&&option.onOk();return}var seup=function(e){that.stop(e)};that.events.seup=seup;if(that.isMobile()){document.addEventListener('touchend',seup)}else{document.onmouseup=seup}};Class.prototype.stop=function(e){var that=this,option=that.config,container=option.container;if(that.isOk()){return}else{container.btn.style.left=0;container.bg.style.width=0;container.btn.style.transition="left 1s ease";container.bg.style.transition="width 1s ease"}document.onmousemove=null;document.onmouseup=null;if(that.isMobile()){document.removeEventListener('touchmove',that.events.move,false);document.removeEventListener('touchend',that.events.seup,false)}};Class.prototype.events=function(){var that=this,option=that.config;if(!option.domid)return that.error('创建滑块验证失败');var btn=option.domid.find('.'+MOD_BTN),bg=option.domid.find('.'+MOD_BG),text=option.domid.find('.'+MOD_TEXT),container={box:dom(option.domid),btn:dom(btn),bg:dom(bg),text:dom(text)};option.container=container;container.distance=that.distance();var down=function(e){that.down(e)};that.events.down=down;if(that.isMobile()){container.btn.addEventListener('touchstart',that.events.down)}else{container.btn.onmousedown=down}var $dom=$(window);$dom.on('resize',option.domid,function(){if(that.config.isOk){that.resize()}})};sliderVerify.render=function(option){var inst=new Class(option);return thisSliderVerify.call(inst)};exports(MOD_NAME,sliderVerify)}) \ No newline at end of file +layui.define(["jquery","layer","form"],function(s){var d=layui.jquery,b=layui.form,r=layui.layer,k=layui.device(),h={read:(function(){var u=".slider-item{height:38px;line-height:38px;background-color:#d0d0d0;position:relative;border: 1px solid white;}.slider-bg{position:absolute;width:40px;height:100%;z-index:100}.slider-btn{width:40px;height:96%;position:absolute;border:1px solid #ccc;cursor:move;text-align:center;background-color:#fff;user-select:none;color:#666;z-index:120}.slider-btn-success{font-size:26px}.slider-text{position:absolute;text-align:center;width:100%;height:100%;user-select:none;font-size:14px;color:#fff;z-index:120}.slider-error{animation:glow 800ms ease-out infinite alternate;}@keyframes glow{0%{border-color:#e6e6e6}100%{border-color:#ff5722}}",v=document.createElement("style");v.innerHTML=u;v.type="text/css";(d("head link:last")[0]&&d("head link:last").after(v))||d("head").append(v)})()},m=function(u){return u[0]},o=function(){var u=this;return{isOk:function(){return u.isOk.call(u)},reset:function(){return u.reset.call(u)},version:"1.6"}},g="sliderVerify",i="slider-btn",j="slider-bg",q="slider-text",a="layui-icon-next",t="layui-icon-ok-circle",f="slider-btn-success",n="layui-bg-green",c="slider-error",p="请拖动滑块验证",e="验证通过",l=function(u){var v=this;v.config=d.extend({},v.config,u);v.render()};l.prototype.config={elem:"",onOk:null,isOk:false,isAutoVerify:true,bg:n,text:p};l.prototype.render=function(){var w=this,u=w.config,v=d(u.elem);if(!v[0]){return}if(u.domid){u.domid.remove()}u.domid=w.createIdNum();var x=d(['
','
','
'+u.text+"
",'
'].join(""));v.hide().after(x);u.domid=d("#"+u.domid);w.events();if(u.isAutoVerify){b.verify({sliderVerify:function(y,z){if(!y){z.classList.add(c);return u.text}}})}};l.prototype.isMobile=function(){return(k.os=="ios"||k.os=="android"||k.android||k.ios)||(k.weixin&&typeof k.weixin===Boolean)};l.prototype.createIdNum=function(){return(g+(+new Date()).toString()+Math.random().toString().substr(2,7))};l.prototype.isOk=function(){return this.config.isOk};l.prototype.error=function(u){return r.msg(u,{icon:5})};l.prototype.distance=function(){var u=this.config.container;return u.box.offsetWidth-u.btn.offsetWidth};l.prototype.reset=function(){this.config.isOk=false;return this.render()};l.prototype.resize=function(w){var v=this,u=v.config.container;var w=w||v.distance();u.btn.style.left=w+"px";u.bg.style.width=w+"px"};l.prototype.cancelTransition=function(){var u=this.config.container;this.config.domid[0].classList.remove(c);u.btn.style.transition="";u.bg.style.transition=""};l.prototype.down=function(y){var x=this,w=x.config,v=w.container,y=y||window.event,z=y.clientX||y.touches[0].clientX;x.cancelTransition();var u=function(A){x.move(z,A)};x.events.move=u;if(x.isMobile()){document.addEventListener("touchmove",x.events.move)}else{document.onmousemove=u}if(navigator.userAgent.indexOf("UCBrowser")>-1){y.preventDefault()}};l.prototype.move=function(B,z){var y=this,x=y.config,v=x.container;var z=z||window.event;let moveX=z.clientX||z.touches[0].clientX;var u=moveX-B;if(u>v.distance){u=v.distance}else{if(u<0){u=0}}v.btn.style.left=u+"px";v.bg.style.width=u+"px";if(u==v.distance){v.text.innerHTML=e;var w=window.getComputedStyle?window.getComputedStyle(v.bg,null):v.bg.currentStyle;v.btn.style.border="1px solid "+w.backgroundColor;v.btn.style.color=w.backgroundColor;v.btn.classList.remove(a);v.btn.classList.add(t,f);x.isOk=true;v.box.value=true;if(y.isMobile()){v.btn.removeEventListener("touchstart",y.events.down,false);document.removeEventListener("touchmove",y.events.move,false)}else{v.btn.onmousedown=null;document.onmousemove=null}x.onOk&&typeof x.onOk=="function"&&x.onOk();return}var A=function(C){y.stop(C)};y.events.seup=A;if(y.isMobile()){document.addEventListener("touchend",A)}else{document.onmouseup=A}};l.prototype.stop=function(x){var w=this,v=w.config,u=v.container;if(w.isOk()){return}else{u.btn.style.left=0;u.bg.style.width=0;u.btn.style.transition="left 1s";u.bg.style.transition="width 1s"}document.onmousemove=null;document.onmouseup=null;if(w.isMobile()){document.removeEventListener("touchmove",w.events.move,false);document.removeEventListener("touchend",w.events.seup,false)}};l.prototype.events=function(){var z=this,y=z.config;if(!y.domid){return z.error("创建滑块验证失败")}var x=y.domid.find("."+i),w=y.domid.find("."+j),A=y.domid.find("."+q),v={box:m(y.domid),btn:m(x),bg:m(w),text:m(A)};y.container=v;v.distance=z.distance();var B=function(C){z.down(C)};z.events.down=B;if(z.isMobile()){v.btn.addEventListener("touchstart",z.events.down)}else{v.btn.onmousedown=B}var u=d(window);u.on("resize",y.domid,function(){if(z.config.isOk){z.resize()}})};h.render=function(u){var v=new l(u);return o.call(v)};s(g,h)}); \ No newline at end of file diff --git a/view/list.html b/view/list.html index 0c1c7c28..c46b18bf 100644 --- a/view/list.html +++ b/view/list.html @@ -14,7 +14,6 @@ {load href="__XADMIN__/js/xadmin.js" /} {load href="__XADMIN__/js/cookie.js" /} {load href="__XADMIN__/js/md5.min.js" /} - {load href="__STATIC__/echarts/echarts.min.js" /} {block name="jsset"}{/block}