This commit is contained in:
2019-06-30 21:18:31 +08:00
commit db843337ce
31 changed files with 4888 additions and 0 deletions

214
page/edit.php Normal file
View File

@ -0,0 +1,214 @@
<?php include('../header.php'); ?>
<div class='edit-main'>
<style type="text/css">
.edit-main {
padding: 20px;
}
article {
margin: 0 auto;
width: 60%;
}
article > heading {
border-bottom: 1px solid #e5e5e5;
margin: 1.5em 0;
padding-bottom: 1.5em;
display: block;
overflow: auto;
}
article > heading h1 {
margin: 0;
}
.contain-floats::after {
display: block;
content: " ";
clear: left;
}
.panes {
margin-left: -30%;
margin-right: -30%;
}
.panes section {
float: left;
width: 33.33%;
height: 30em;
}
.result {
display: block;
margin-right: 1em;
height: 100%;
}
.result {
width: 100%;
}
#jsContainer, #phpContainer, #testContainer {
margin: 5px;
box-sizing: border-box;
border: 1px solid #eeeeee;
}
#phpContainer {
margin: 5px 4px 5px 4px;
}
.edit-form label {
margin-top: 10px;
}
.button-control {
height: 50px;
}
</style>
<form class="pure-form pure-form-stacked edit-form" id="edit-form">
<fieldset>
<legend><h1><?php if (isset($_GET['id'])) {
echo '编辑';
} else {
echo '添加';
} ?>题目</h1></legend>
<div class="pure-g">
<div class="pure-u-lg-1-6">
<label for="type">分类</label>
<select id="type" name="type">
<option value="1">闯关模式</option>
<option value="2">挑战赛</option>
</select>
</div>
<div class="pure-u-lg-1-6">
<label for="isAnswer" class="pure-checkbox">
是否有解答
</label>
<select id="isAnswer" name="isAnswer">
<option value="1">是</option>
<option value="0">否</option>
</select>
</div>
<div class="pure-u-lg-1-6">
<label for="difficulty">难度</label>
<select id="difficulty" name="difficulty">
<option value="1">简单</option>
<option value="2">中等</option>
<option value="3">困难</option>
</select>
</div>
<div class="pure-u-lg-1-6">
<label for="isCredit">是否有积分</label>
<select id="isCredit" name="isCredit">
<option value="1">有</option>
<option value="0">没有</option>
</select>
</div>
<div class="pure-u-lg-1-6">
<label for="language">编程语言</label>
<select id="language" name="language">
<option value="PHP">PHP</option>
<option value="HTML">HTML</option>
<option value="JAVA">JAVA</option>
</select>
</div>
</div>
<label for="name">名称</label>
<input id="name" name="name" class="pure-input-3-4" type="text">
<div class="pure-g">
<div class="pure-u-lg-1-4">
<label for="passPercent">通过率</label>
<input id="passPercent" name="passPercent" class="pure-input-1" type="text">
</div>
<div class="pure-u-lg-1-4">
<label for="tag">标签</label>
<input id="tag" name="tag" class="pure-input-1" type="text">
</div>
<div class="pure-u-lg-1-4">
<label for="credit">积分</label>
<input id="credit" name="credit" type="text" value="0" class="pure-input-1">
</div>
</div>
<label for="mark">备注</label>
<textarea id="mark" name="mark" class="pure-input-1"></textarea>
<div class='tabs tabs_default'>
<ul class='horizontal' style="margin-top: 10px;margin-bottom: 20px">
<li><a class="pure-button" href="#describeEdit">题目描述</a></li>
<li><a class="pure-button" href="#answerEdit">解答</a></li>
<li><a class="pure-button admin" href="#testCaseEdit">测试用例</a></li>
<li><a class="pure-button admin" href="#expectedResultEdit">预期结果</a></li>
</ul>
<div id='describeEdit'>
<textarea id='describe' class="pure-input-1"></textarea>
</div>
<div id='answerEdit'>
<textarea id='answer' class="pure-input-1"></textarea>
</div>
<div id='testCaseEdit'>
<textarea id="testCase" class="pure-input-1"></textarea>
</div>
<div id="expectedResultEdit">
<textarea id="expectedResult" class="pure-input-1"></textarea>
</div>
</div>
<article id="article">
<div class="panes contain-floats">
<section>
<heading>
<h1>JavaScript</h1>
</heading>
<div id="jsContainer"></div>
</section>
<section>
<heading>
<h1>PHP 主程序</h1>
</heading>
<div id="phpContainer"></div>
</section>
<section>
<heading>
<h1>PHP 测试用例</h1>
</heading>
<div id="testContainer"></div>
</section>
</div>
</article>
<div class="button-control">
<div class="pure-button" id="runMain">运行主程序</div>
<div class="pure-button" id="runUnit">运行测试用例</div>
</div>
<div id="out">
<iframe class="result" id="result"></iframe>
</div>
<button type="button" id="submitForm" style="margin-top: 20px" class="pure-button pure-button-primary">保存</button>
</fieldset>
</form>
</div>
<?php include('../footer.php'); ?>

48
page/run.php Normal file
View File

@ -0,0 +1,48 @@
<?php include('../header.php'); ?>
<div class="content" id="content">
<div id="leftPane">
<div id="container"></div>
<div class="control">
<div class="pure-button pure-button-primary" id="run">提交</div>
<div class="pure-button" id="testRun">执行代码</div>
<label for="auto" class="pure-checkbox auto">
<input id="auto" type="checkbox"> 自动执行代码
</label>
</div>
</div>
<div id="rightPane">
<div class='tabs tabs_default' style="height: 100%">
<ul class='horizontal' style="margin-top: 10px;margin-bottom: 20px">
<li><a class="pure-button" href="#describeView">题目描述</a></li>
<li><a class="pure-button" href="#answerView" id="answerViewButton">解答</a></li>
<li><a class="pure-button" href="#resultView">运行结果</a></li>
</ul>
<div id='describeView'>
<div class="cont"></div>
</div>
<div id='answerView'>
<div class="cont"></div>
</div>
<div id='resultView'>
<div class="cont">
<div class="testCase">
<h4 style="font-weight: 500;margin: 4px 0;">输入:</h4>
<div class="testCaseContent"></div>
</div>
<div class="expectedResult" style="margin-top: 10px;">
<h4 style="font-weight: 500;margin: 4px 0;">预期结果:</h4>
<div class="expectedResultContent"></div>
</div>
<div class="resultArea" style="margin-top: 10px;">
<h4 style="font-weight: 500;margin: 4px 0;">输出:</h4>
<div class="resultContent">
<iframe class="result" id="result"></iframe>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include('../footer.php'); ?>

18
page/test.php Normal file
View File

@ -0,0 +1,18 @@
<?php include('../header.php'); ?>
<div class="content" id="content">
<div id="leftPane">
<div id="container"></div>
<div class="control">
<div class="pure-button pure-button-primary" id="run">执行代码</div>
<label for="auto" class="pure-checkbox auto">
<input id="auto" type="checkbox"> 自动
</label>
</div>
</div>
<div id="rightPane">
<div id="out">
<iframe class="result" id="result"></iframe>
</div>
</div>
</div>
<?php include('../footer.php'); ?>

61
page/user.php Normal file
View File

@ -0,0 +1,61 @@
<?php include('../header.php'); ?>
<?php
//error_reporting(0);
require_once '../config.php';
require_once '../medoo.php';
use Medoo\Medoo;
$database = new Medoo($DBCONFIG);
$Allcount = $database->count("problemset", [
"type" => "1"
]);
$rows = $database->select('userinfo', '*', [
"ORDER" => [
"id" => "DESC"
]
]);
?>
<div class="user" style="padding: 10px">
<table class="pure-table" style="width: 100%;">
<thead>
<tr>
<th>#</th>
<th>头像</th>
<th>用户昵称</th>
<th>真实姓名</th>
<th>用户性别</th>
<th>进度</th>
<th>管理</th>
</tr>
</thead>
<tbody>
<?php foreach ($rows as $inx => $row) { ?>
<tr class="<?php if ($inx % 2) echo 'pure-table-odd'; ?>">
<td><?php echo $row['id'] ?></td>
<td><img src="<?php echo $row['headimgurl']; ?>" width="50"/></td>
<td><?php echo $row['nickname']; ?></td>
<td><?php echo $row['realname']; ?></td>
<td><?php if ($row['sex'] == '1') {
echo '男';
} else {
echo '女';
} ?></td>
<td><?php
$passCount = $database->count("record", [
'user_id' => $row['id'],
'is_pass' => '1'
]);
echo $passCount . '/' . $Allcount;
?></td>
<td><a href="/page/userinfo.php?id=<?php echo $row['id']; ?>" target="_blank">查看详情</a></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php include('../footer.php'); ?>

49
page/userinfo.php Normal file
View File

@ -0,0 +1,49 @@
<?php include('../header.php'); ?>
<?php
//error_reporting(0);
require_once '../config.php';
require_once '../medoo.php';
use Medoo\Medoo;
$database = new Medoo($DBCONFIG);
$rows = $database->query("SELECT
`record`.`is_pass`,
`problemset`.`id`,
`problemset`.`no`,
`problemset`.`name`,
`problemset`.`language`,
`problemset`.`type`,
`problemset`.`isAnswer`,
`problemset`.`passPercent`,
`problemset`.`difficulty`
FROM
`problemset`
LEFT JOIN `record` ON `problemset`.`id` = `record`.`problemset_id` AND `record`.`user_id` = " . $_GET['id'] . " WHERE `problemset`.`type` = '1' ORDER BY
`no`")->fetchAll();
?>
<div class="user" style="padding: 10px">
<table class="pure-table" style="width: 100%;">
<thead>
<tr>
<th>No</th>
<th>题目</th>
<th>做题状态</th>
</tr>
</thead>
<tbody>
<?php foreach ($rows as $inx => $row) { ?>
<tr class="<?php if ($inx % 2) echo 'pure-table-odd'; ?>">
<td><?php echo $row['no'] ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php if ($row['is_pass'] == '1') {
echo '<svg viewBox="0 0 1397 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="27" height="20"><path d="M1396.363636 121.018182c0 0-223.418182 74.472727-484.072727 372.363636-242.036364 269.963636-297.890909 381.672727-390.981818 530.618182C512 1014.690909 372.363636 744.727273 0 549.236364l195.490909-186.181818c0 0 176.872727 121.018182 297.890909 344.436364 0 0 307.2-474.763636 902.981818-707.490909L1396.363636 121.018182 1396.363636 121.018182zM1396.363636 121.018182" fill="#1afa29"></path></svg>';
} ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php include('../footer.php'); ?>