zjz1993
5 years ago
13 changed files with 443 additions and 40 deletions
@ -0,0 +1,60 @@
|
||||
"use strict"; |
||||
var __extends = (this && this.__extends) || (function () { |
||||
var extendStatics = function (d, b) { |
||||
extendStatics = Object.setPrototypeOf || |
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || |
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; |
||||
return extendStatics(d, b); |
||||
}; |
||||
return function (d, b) { |
||||
extendStatics(d, b); |
||||
function __() { this.constructor = d; } |
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
||||
}; |
||||
})(); |
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { |
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; |
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); |
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; |
||||
return c > 3 && r && Object.defineProperty(target, key, r), r; |
||||
}; |
||||
var __metadata = (this && this.__metadata) || function (k, v) { |
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); |
||||
}; |
||||
exports.__esModule = true; |
||||
var TypeORM = require("typeorm"); |
||||
var common_1 = require("./common"); |
||||
var Classify = /** @class */ (function (_super) { |
||||
__extends(Classify, _super); |
||||
function Classify() { |
||||
return _super !== null && _super.apply(this, arguments) || this; |
||||
} |
||||
Classify.cache = true; |
||||
__decorate([ |
||||
TypeORM.PrimaryGeneratedColumn(), |
||||
__metadata("design:type", Number) |
||||
], Classify.prototype, "id"); |
||||
__decorate([ |
||||
TypeORM.Index({ unique: true }), |
||||
TypeORM.Column({ unique: true, nullable: true, type: "varchar", length: 20 }), |
||||
__metadata("design:type", String) |
||||
], Classify.prototype, "name"); |
||||
__decorate([ |
||||
TypeORM.Column({ nullable: true, type: "varchar", length: 100 }), |
||||
__metadata("design:type", String) |
||||
], Classify.prototype, "intro"); |
||||
__decorate([ |
||||
TypeORM.Column({ nullable: true, type: "integer" }), |
||||
__metadata("design:type", Number) |
||||
], Classify.prototype, "update_time"); |
||||
__decorate([ |
||||
TypeORM.Column({ nullable: true, type: "integer" }), |
||||
__metadata("design:type", Number) |
||||
], Classify.prototype, "create_time"); |
||||
Classify = __decorate([ |
||||
TypeORM.Entity() |
||||
], Classify); |
||||
return Classify; |
||||
}(common_1["default"])); |
||||
exports["default"] = Classify; |
||||
//# sourceMappingURL=classify.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"file":"classify.js","sourceRoot":"","sources":["../models/classify.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAmC;AACnC,mCAA6B;AAM7B;IAAsC,4BAAK;IAA3C;;IAkBA,CAAC;IAjBU,cAAK,GAAG,IAAI,CAAC;IAGpB;QADC,OAAO,CAAC,sBAAsB,EAAE;;gCACtB;IAIX;QAFC,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QAC/B,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;kCACjE;IAGb;QADC,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;mCACnD;IAGd;QADC,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;yCAChC;IAGpB;QADC,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;yCAChC;IAjBH,QAAQ;QAD5B,OAAO,CAAC,MAAM,EAAE;OACI,QAAQ,CAkB5B;IAAD,eAAC;CAAA,AAlBD,CAAsC,mBAAK,GAkB1C;qBAlBoB,QAAQ"} |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,26 @@
|
||||
import * as TypeORM from "typeorm"; |
||||
import Model from "./common"; |
||||
import JudgeState from "./judge_state"; |
||||
import Article from "./article"; |
||||
import UserPrivilege from "./user_privilege"; |
||||
|
||||
@TypeORM.Entity() |
||||
export default class Classify extends Model { |
||||
static cache = true; |
||||
|
||||
@TypeORM.PrimaryGeneratedColumn() |
||||
id: number; |
||||
|
||||
@TypeORM.Index({ unique: true }) |
||||
@TypeORM.Column({ unique: true, nullable: true, type: "varchar", length: 20 }) |
||||
name: string; |
||||
|
||||
@TypeORM.Column({ nullable: true, type: "varchar", length: 100 }) |
||||
intro: string; |
||||
|
||||
@TypeORM.Column({ nullable: true, type: "integer" }) |
||||
update_time: number; |
||||
|
||||
@TypeORM.Column({ nullable: true, type: "integer" }) |
||||
create_time: number; |
||||
} |
@ -0,0 +1,31 @@
|
||||
let Classify = syzoj.model('classify'); |
||||
|
||||
app.get('/practice', async (req, res) => { |
||||
try { |
||||
res.render('practice', { |
||||
|
||||
}) |
||||
} catch (e) { |
||||
syzoj.log(e); |
||||
res.render('error', { |
||||
err: e |
||||
}); |
||||
} |
||||
}); |
||||
|
||||
app.post('/api/practice/create', async (req, res) => { |
||||
try { |
||||
const {name, intro} = req.body; |
||||
let classify = await Classify.create({ |
||||
name, |
||||
intro, |
||||
updateTime: parseInt((new Date()).getTime() / 1000), |
||||
createTime: parseInt((new Date()).getTime() / 1000) |
||||
}); |
||||
await classify.save(); |
||||
res.send(); |
||||
} catch(e) { |
||||
res.send({ error_code: e.errno, error_msg: '创建失败' }); |
||||
} |
||||
}); |
||||
|
@ -0,0 +1,214 @@
|
||||
<% this.title = '练习' %> |
||||
<style> |
||||
.practice{ |
||||
display: flex; |
||||
width: 100%; |
||||
} |
||||
.practice .practice-main{ |
||||
width: 80%; |
||||
margin-right: 30px; |
||||
} |
||||
.practice .practice-main .practice-main-navigation{ |
||||
margin-bottom: 10px; |
||||
background-color: #efefef; |
||||
padding: 10px; |
||||
} |
||||
.practice .practice-main .practice-main-navigation .classify-card{ |
||||
width: 90px; |
||||
height: 90px; |
||||
display: inline-block; |
||||
margin: 5px; |
||||
vertical-align: top; |
||||
cursor: pointer; |
||||
background-color: red; |
||||
} |
||||
.practice .practice-main .practice-main-navigation .classify-card small{ |
||||
font-size: 12px; |
||||
color: #fff; |
||||
display: block; |
||||
} |
||||
.practice .practice-main .practice-main-navigation .classify-card .classify-name{ |
||||
text-align: center; |
||||
line-height: 50px; |
||||
color: white; |
||||
} |
||||
.practice .practice-main .practice-main-body{ |
||||
background-color: #efefef; |
||||
padding: 10px; |
||||
} |
||||
.practice .practice-main .practice-main-body .classify-card{ |
||||
margin-bottom: 20px; |
||||
} |
||||
.practice .practice-main .practice-main-body .classify-card .classify-card-title{ |
||||
margin-bottom: 10px; |
||||
} |
||||
.practice .practice-main .practice-main-body .classify-card .classify-card-description{ |
||||
border-bottom:1px solid #e4e4e4; |
||||
margin-bottom: 10px; |
||||
padding-bottom: 5px; |
||||
} |
||||
.practice .practice-main .practice-main-body .classify-card .classify-card-problem{ |
||||
border-top:1px solid #e4e4e4; |
||||
padding-top: 10px; |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
} |
||||
.practice .practice-main .practice-main-body .classify-card .classify-card-problem .problem{ |
||||
border-radius: 5px; |
||||
width: 30%; |
||||
background-color: white; |
||||
margin: 10px; |
||||
height: 100px; |
||||
overflow: hidden; |
||||
cursor: pointer; |
||||
} |
||||
.practice .practice-main .practice-main-body .classify-card .classify-card-problem .problem .problem-title{ |
||||
text-align: center; |
||||
padding: 5px 0; |
||||
color: #14a6ef; |
||||
background-color: rgba(59,180,242,.15); |
||||
border-color: #caebfb; |
||||
} |
||||
.practice .practice-main .practice-main-body .classify-card .classify-card-problem .problem .problem-info{ |
||||
font-size: 13px; |
||||
padding: 5px; |
||||
} |
||||
.practice .practice-right{ |
||||
width: 300px; |
||||
padding: 30px 10px; |
||||
height:200px; |
||||
background-color: #efefef; |
||||
} |
||||
.practice .practice-right .username{ |
||||
color:#3590D2; |
||||
} |
||||
</style> |
||||
<% include header %> |
||||
<div class="practice"> |
||||
<div class="practice-main"> |
||||
<div class="practice-main-navigation"> |
||||
<div class="classify-card"> |
||||
<small>#1</small> |
||||
<div class="classify-name">分类名字</div> |
||||
</div> |
||||
<div class="classify-card"> |
||||
<small>#1</small> |
||||
<div class="classify-name">分类名字</div> |
||||
</div> |
||||
</div> |
||||
<div class="practice-main-body"> |
||||
<div class="classify-card"> |
||||
<div class="classify-card-title"> |
||||
<h2>测试分类</h2> |
||||
</div> |
||||
<div class="classify-card-description"> |
||||
测试分类的介绍 |
||||
</div> |
||||
<div class="ui indicating progress" data-value="124" data-total="200"> |
||||
<div class="bar"> |
||||
<div class="progress"></div> |
||||
</div> |
||||
<div class="label">当前分类完成进度</div> |
||||
</div> |
||||
<div class="classify-card-problem"> |
||||
<div class="problem"> |
||||
<div class="problem-title"> |
||||
第一个问题 |
||||
</div> |
||||
<div class="problem-info"> |
||||
题目简介简介题目简介简介题目简介简介题目简介简介题目简介简介发送到发送到范德萨发士大夫撒打发斯蒂芬 |
||||
</div> |
||||
</div> |
||||
<div class="problem"> |
||||
<div class="problem-title"> |
||||
第一个问题 |
||||
</div> |
||||
<div class="problem-info"> |
||||
题目简介简介题目简介简介题目简介简介题目简介简介题目简介简介 |
||||
</div> |
||||
</div> |
||||
<div class="problem"> |
||||
<div class="problem-title"> |
||||
第一个问题 |
||||
</div> |
||||
<div class="problem-info"> |
||||
题目简介简介题目简介简介题目简介简介题目简介简介题目简介简介 |
||||
</div> |
||||
</div> |
||||
<div class="problem"> |
||||
<div class="problem-title"> |
||||
第一个问题 |
||||
</div> |
||||
<div class="problem-info"> |
||||
题目简介简介题目简介简介题目简介简介题目简介简介题目简介简介 |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="classify-card"> |
||||
<div class="classify-card-title"> |
||||
<h2>测试分类</h2> |
||||
</div> |
||||
<div class="classify-card-description"> |
||||
测试分类的介绍 |
||||
</div> |
||||
<div class="ui indicating progress" data-value="1" data-total="200"> |
||||
<div class="bar"> |
||||
<div class="progress"></div> |
||||
</div> |
||||
<div class="label">当前分类完成进度</div> |
||||
</div> |
||||
<div class="classify-card-problem"> |
||||
<div class="problem"> |
||||
<div class="problem-title"> |
||||
第一个问题 |
||||
</div> |
||||
<div class="problem-info"> |
||||
题目简介简介题目简介简介题目简介简介题目简介简介题目简介简介发送到发送到范德萨发士大夫撒打发斯蒂芬 |
||||
</div> |
||||
</div> |
||||
<div class="problem"> |
||||
<div class="problem-title"> |
||||
第一个问题 |
||||
</div> |
||||
<div class="problem-info"> |
||||
题目简介简介题目简介简介题目简介简介题目简介简介题目简介简介 |
||||
</div> |
||||
</div> |
||||
<div class="problem"> |
||||
<div class="problem-title"> |
||||
第一个问题 |
||||
</div> |
||||
<div class="problem-info"> |
||||
题目简介简介题目简介简介题目简介简介题目简介简介题目简介简介 |
||||
</div> |
||||
</div> |
||||
<div class="problem"> |
||||
<div class="problem-title"> |
||||
第一个问题 |
||||
</div> |
||||
<div class="problem-info"> |
||||
题目简介简介题目简介简介题目简介简介题目简介简介题目简介简介 |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="practice-right"> |
||||
<h1 class="username">用户名</h1> |
||||
<p>已通过数/分类总题数:5/20</p> |
||||
</div> |
||||
</div> |
||||
|
||||
<script> |
||||
function getColor() { |
||||
let colorArray =["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"]; |
||||
let color="#"; |
||||
for(let i=0;i<6;i++) { |
||||
color+=colorArray[Math.floor(Math.random()*16)]; |
||||
} |
||||
return color; |
||||
} |
||||
</script> |
||||
<% include footer %> |
Loading…
Reference in new issue