-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
310 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Score extends Model | ||
{ | ||
public $timestamps = false; | ||
protected $guarded = []; | ||
} |
33 changes: 33 additions & 0 deletions
33
database/migrations/2017_12_06_142125_create_scores_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateScoresTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('scores', function (Blueprint $table) { | ||
$table->increments('id'); | ||
$table->string('student_id'); | ||
$table->text('student_scores'); | ||
$table->string('time'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('scores'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
html{ | ||
height:100%; | ||
font-size:62.5%; | ||
} | ||
|
||
|
||
.header{ | ||
width: 100%; | ||
height: 6rem; | ||
padding-top: 2.5rem; | ||
position: relative; | ||
} | ||
|
||
.header div{ | ||
display: inline; | ||
color: #1E9FFF; | ||
} | ||
|
||
.header .back{ | ||
padding-left: 3%; | ||
float: left; | ||
} | ||
|
||
.header .score{ | ||
top: 1.7rem; | ||
left: auto; | ||
float: right; | ||
padding-right: 42.5%; | ||
font-size: 4rem; | ||
position: relative; | ||
} | ||
|
||
#score_list{ | ||
width: 85%; | ||
position: relative; | ||
top: 3.5rem; | ||
margin: 0 auto; | ||
} | ||
|
||
.layui-collapse{ | ||
margin-top: 2rem; | ||
border-radius: 1.5rem; | ||
height: 10rem; | ||
border: none; | ||
} | ||
|
||
.layui-colla-title{ | ||
background-color: #1E9FFF; | ||
border-radius: 1.5rem; | ||
color: white; | ||
height: 10rem; | ||
font-size: 5rem; | ||
text-align: center; | ||
line-height: 10rem; | ||
} | ||
|
||
.layui-colla-item{ | ||
margin-top: 5rem; | ||
} | ||
|
||
.layui-colla-icon{ | ||
font-size: 5rem; | ||
} | ||
|
||
.layui-colla-content{ | ||
border-top: none; | ||
background: #fff; | ||
border-radius: 1.5rem; | ||
} | ||
.layui-table td{ | ||
font-size: 4rem; | ||
line-height: 9rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
layui.use(['element'], function(){ | ||
var layer = layui.layer; | ||
var element = layui.element; | ||
|
||
|
||
ajax(xh); //执行向后台加载数据 | ||
|
||
//监听返回链接 | ||
$('#back').click(function () { | ||
location.href = url1; | ||
}); | ||
|
||
|
||
|
||
function ajax(xh) { | ||
$.ajax({ | ||
type: 'POST', | ||
url: url, | ||
data: { | ||
xh: xh | ||
}, | ||
headers: { | ||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | ||
}, | ||
dataType: "json", | ||
success:function (data) { | ||
var content = data; | ||
var html = ''; | ||
|
||
//统计json条数 | ||
function JSONLength(obj) { | ||
var size = 0, key; | ||
for (key in obj) { | ||
if (obj.hasOwnProperty(key)) size++; | ||
} | ||
return size; | ||
} | ||
|
||
//获取学期总数 | ||
var arr = new Array(); | ||
var j=0; | ||
for (var i=0; i<JSONLength(content); i++){ | ||
if (j==0 || arr[j-1] != content[i].course_year+content[i].course_term ){ | ||
arr[j] = content[i].course_year+content[i].course_term; | ||
j++; | ||
} | ||
} | ||
|
||
|
||
//动态生成多个成绩面板 | ||
for (var i=0; i<arr.length; i++){ | ||
|
||
html += '<div class="layui-colla-item">'+'<h2 class="layui-colla-title">'+arr[i].substring(0,9)+'学年 第'+arr[i].substring(9,10)+'学期'+'</h2>'+'<div class="layui-colla-content">'+'<table class="layui-table">'+ | ||
'<tr>'+ | ||
'<td>课程</td>'+ | ||
'<td>分数</td>'+ | ||
'<td>绩点</td>'+ | ||
'<td>学分</td>'+ | ||
'</tr>'; | ||
|
||
for(var j=0; j<JSONLength(content); j++){ | ||
|
||
if (arr[i] == content[j].course_year+content[j].course_term){ | ||
html += '<tr>'+ | ||
'<td>'+content[j].course_name+'</td>'+ | ||
'<td>'+content[j].course_score+'</td>'+ | ||
'<td>'+content[j].course_points+'</td>'+ | ||
'<td>'+content[j].course_credit+'</td>'+ | ||
'</tr>' | ||
} | ||
|
||
} | ||
html +='</table>'+'</div>'+'</div>'; | ||
} | ||
|
||
$('#colla').html(html); //嵌入HTML中 | ||
element.init('collapse'); //重新加载面板 | ||
|
||
} | ||
}) | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta http-equiv="content-type" content="text/html;charset=utf-8" /> | ||
<meta name="keywords" content="成绩清单"/> | ||
<meta name="csrf-token" content="{{ csrf_token() }}"> | ||
<meta name="description" content="成绩清单" /> | ||
<title>成绩清单</title> | ||
<link rel="stylesheet" href="{{ asset('public/js/layui/css/layui.css') }}" type="text/css" > | ||
<link rel="stylesheet" href="{{ asset('public/css/score.css') }}" type="text/css"> | ||
</head> | ||
<style type="text/css"> | ||
</style> | ||
<body style="background: rgb(236, 239, 246);"> | ||
|
||
<!--顶部--> | ||
<div class="header"> | ||
<div class="back" id="back"><i class="layui-icon" style="font-size: 7rem;"></i></div> | ||
<div class="score">成绩清单</div> | ||
</div> | ||
|
||
|
||
<!--各学期的成绩--> | ||
<div id="score_list"> | ||
<div class="layui-collapse"> | ||
<div id="colla"> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script src="{{ asset('public/js/layui/layui.js') }}"></script> | ||
<script src="{{ asset('public/js/jquery.min.js') }}"></script> | ||
<script src="{{ asset('public/js/jquery.cookie.js') }}"></script> | ||
<script type="text/javascript" src="{{ asset('public/js/score.js') }}"></script> | ||
<script> | ||
var url = '{{ url('chengji') }}'; //后台请求数据 | ||
var url1 = '{{ url('index') }}'; //主页面 | ||
var xh = '{{ $xh }}'; //学号 | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters