This commit is contained in:
fafa_junhe 2024-06-19 13:13:34 +08:00
commit d6680d9966
117 changed files with 27424 additions and 0 deletions

3
.gitignore vendored Executable file
View File

@ -0,0 +1,3 @@
.idea
node_modules
__pycache__

BIN
README.md Executable file

Binary file not shown.

23
app-dm/.gitignore vendored Executable file
View File

@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

70
app-dm/README.md Executable file
View File

@ -0,0 +1,70 @@
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
The page will reload when you make changes.\
You may also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
### Analyzing the Bundle Size
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
### Making a Progressive Web App
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
### Advanced Configuration
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
### Deployment
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
### `npm run build` fails to minify
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

18887
app-dm/package-lock.json generated Executable file

File diff suppressed because it is too large Load Diff

76
app-dm/package.json Executable file
View File

@ -0,0 +1,76 @@
{
"name": "app-dm",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@xterm/xterm": "^5.5.0",
"autoprefixer": "^10.4.19",
"axios": "^1.7.2",
"buffer": "^6.0.3",
"chart.js": "^4.4.3",
"classnames": "^2.5.1",
"crypto": "^1.0.1",
"express": "^4.19.2",
"fs": "^0.0.1-security",
"http": "^0.0.1-security",
"lib": "^5.1.0",
"lodash": "^4.17.21",
"moment": "^2.30.1",
"mysql": "^2.18.1",
"net": "^1.0.2",
"path": "^0.12.7",
"postcss": "^8.4.38",
"react": "^18.3.1",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.3.1",
"react-redux": "^9.1.2",
"react-router-dom": "^6.23.0",
"react-scripts": "^5.0.1",
"recharts": "^2.12.7",
"redux": "^5.0.1",
"stream": "^0.0.2",
"swr": "^2.2.5",
"tailwindcss": "^3.4.3",
"url": "^0.11.3",
"validator": "^13.11.0",
"validator.tool": "^2.2.6",
"web-vitals": "^2.1.4",
"zlib": "^1.0.5"
},
"scripts": {
"start": "react-scripts start",
"test": "react-scripts test",
"eject": "react-scripts eject",
"build": "postcss src/style.css -o dist/tailwind.css"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@vitejs/plugin-legacy": "^5.4.0",
"postcss-cli": "^11.0.0"
},
"description": "This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).",
"main": "index.js",
"keywords": [],
"author": "",
"license": "ISC"
}

BIN
app-dm/public/favicon.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

44
app-dm/public/index.html Executable file
View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.4.1/css/twitter-bootstrap.min.css",rel="stylesheet">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>

BIN
app-dm/public/logo192.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
app-dm/public/logo512.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

25
app-dm/public/manifest.json Executable file
View File

@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

3
app-dm/public/robots.txt Executable file
View File

@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

24
app-dm/server/config.js Executable file
View File

@ -0,0 +1,24 @@
// { 服务器连接数据库(未启用) }
const mysql = require('mysql');
const client = mysql.createConnection({
host:"localhost",
user:"root",
password:"",
// database:"数据库名称"
})
/**
* query执行数据库语句的方法
*/
module.exports = function sqlFn(sql,arr,callback){
client.query(sql,arr,(error,result) => {
if(error){
console.log(error)
return;
}
callback(result) //回调函数
})
}

24
app-dm/server/index.js Executable file
View File

@ -0,0 +1,24 @@
const express =require('express');
const app = express();
const router = require('./router')
const bodyparser = require('body-parser')
const cors = require('cors')
//跨域配置
app.use(cors());
app.use(bodyparser.urlencoded({
extended:true
}))
app.use("/api",router)
app.listen(3300,()=>{
console.log('服务器运行在3300端口')
})

54
app-dm/server/router.js Executable file
View File

@ -0,0 +1,54 @@
const express = require('express');
const router = express.Router();
const validator = require('validator');
const isEmpty = require('lodash/isEmpty')
// const sqlFn = require('./config') // 未使用
// { 判断注册表单是否为空 }
/**
* 如果发生错误则返回错误信息如果没发生错误则返回true
*/
const validatorInput = (data) =>{
/**
* validator.isEmpty方法验证是否为空
*/
let errors={}
if (validator.isEmpty(data.name)){
errors.name = '用户名不能为空'
}
if (validator.isEmpty(data.ID)){
errors.ID = '学号不能为空'
}
if (validator.isEmpty(data.password)){
errors.password = '密码不能为空'
}
if (validator.isEmpty(data.Class)){
errors.Class = '班级不能为空'
}
if (validator.isEmpty(data.gender)){
errors.gender = '性别不能为空'
}
return{
//如果value为空那么返回true否则返回false
isValid:!isEmpty(errors),
errors
}
}
router.post('/register',(req,res) =>{
const { isValid,errors } = validatorInput(req.body)
if(isValid){
//失败
res.send(errors)
}else{
//成功
res.send({
msg:"seccess"
})
}
})
module.exports = router;

View File

@ -0,0 +1,64 @@
.body-right-mark{
width: 1420px;
height: 830px;
position: absolute;
top: 72px;
left: 220px;
border-radius: 10px;
float: right;
background-color: #f7f8fa;
}
.mark-list{
height: 40px;
width: 120px;
font-size: 16px;
position: absolute;
top: 10px;
left: 30px;
border: 1px solid rgb(186, 186, 186);
}
.test-mark{
width: 100%;
height: 400px;
position: absolute;
top: 50px;
}
.test-mark li{
cursor: pointer;
overflow: hidden;
width: 1380px;
height: 70px;
background-color: #ffffff;
margin-top: 10px;
margin-left: -20px;
border-radius: 10px;
box-shadow: 0px 1px 6px 0px #d8d8d8;
display: flex;
align-content: center;
}
.test-mark img {
margin: 15px 10px 0 15px;
}
.test-mark p{
margin-top: 8px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: start;
}
.p-mark {
font-size: 18px;
}
.test-mark span {
font-size: 13px;
margin-top: -12px;
color: #525252;
}

View File

@ -0,0 +1,42 @@
import { Link } from 'react-router-dom';
// import React, { useEffect, useState } from 'react';
// import axios from 'axios';
import './Marking.css';
import Test from '../../pages/Home/img/test.jpg'
//
function Marking(){
return(
<div className='body-right-mark'>
<select className='mark-list'>
<option value="2024级一班">2024级一班</option>
<option value="2024级二班">2024级二班</option>
<option value="2024级三班">2024级三班</option>
</select>
<div className='test-mark'>
{/* 内容 */}
<ul>
{[{class:'课程1:达梦数据库的安装',time:"关闭时间:2024-4-16 11.46",ImgSrc:Test},
{class:'课程2:web前端开发与数据库的结合',time:"关闭时间:2024-4-16 11.46",ImgSrc:Test},
{class:'课程2:web前端开发与数据库的结合',time:"关闭时间:2024-4-16 11.46",ImgSrc:Test},
].map((item) =>
<Link style={{color:'#000',textDecoration:'none'}}>
<li key={item.class}>
<img src={item.ImgSrc} alt="" width='35px' height='35px'/>
<p>
<p className='p-mark'>{item.class}</p>
<span>{item.time}</span>
</p>
</li>
</Link>
)}
</ul>
</div>
</div>
)
}
export default Marking

View File

@ -0,0 +1,84 @@
#body_left{
flex: 20%;
}
#body_right{
border-left: 1px solid black;
height: 100%;
flex:80%
}
.check_box{
margin-left: 800px;
}
.single{
margin-left: 100px;
}
.choice_answer{
display: flex;
width: 800px;
background-color: aqua;
}
.choice_answer span{
flex: 1;
}
.line{
border-bottom: 1px solid black;
}
#body_top{
border-bottom: 1px solid black;
width: 100%;
}
#body_left input {
margin-top: 30px;
margin-left: 30px;
}
#next{
margin-left:1450px;
margin-top: 30px;
}
/* 选择班级界面 */
#background{
width: 400px;
height: 550px;
background-color: rgb(149, 224, 224);
position: absolute;
margin-left: 650px;
margin-top: 150px;
}
#class_ul{
width: 200px;
height: 300px;
margin-left: 80px;
background-color: rgb(198, 155, 238);
overflow: auto;
list-style-type: none;
}
.class_div {
/* 普通状态下的样式 */
width: 130px;
height: 30px;
border: 1px solid #ccc;
cursor: pointer;
background-color: bisque;
margin-top: 10px;
margin-left: 15px;
text-align: center;
}
.selected {
/* 选中状态下的样式 */
background-color: lightblue;
border-color: blue;
}
#send_box{
width: 400px;
height: 550px;
background-color: rgb(149, 224, 224);
position: absolute;
margin-left: 650px;
margin-top: 150px;
}

View File

@ -0,0 +1,278 @@
import { useParams } from 'react-router-dom';
import { Link } from 'react-router-dom';
import './SendTest.css'
import React, { useEffect, useState } from 'react';
import axios from 'axios';
function SendTest(){
// const { key } = useParams();
const teacher_ID=localStorage.getItem('islogin')
//
const [ChoiceQuestion,SetChoiceQuestion]=useState()
const [Completion,SetCompletion]=useState()
const [Judge,SetJudge]=useState()
const subject = async ()=>{
try{
const subject_src=await axios.post('http://127.0.0.1:5000/teacher/return_question',{
teacher_ID})
SetChoiceQuestion(subject_src.data['选择'])
SetCompletion(subject_src.data['填空'])
SetJudge(subject_src.data['判断'])
}catch(error){
console.log(error);
}
}
useEffect(()=>{
subject()
},[])
//ID
const [ChoiceQuestionSet,SetChoiceQuestionSet]=useState([])
const [CompletionQuestionSet,SetCompletionQuestionSet]=useState([])
const [JudgeQuestionSet,SetJudgeQuestionSet]=useState([])
//
const body=document.getElementById('body')
const background=document.getElementById('background')
const send_box=document.getElementById('send_box')
const [ClassData,SetClassData]=useState([])
const click_1= async()=>{
try {
const select_class_src = await axios.post('http://127.0.0.1:5000/teacher/select_class', {
teacher_ID
});
background.style.display='block'
body.style.display='none'
send_box.display='none'
SetClassData(select_class_src.data['Class']);
} catch (error) {
console.log(error);
}
}
//
const click_2=()=>{
background.style.display='none'
body.style.display='none'
send_box.style.display='block'
}
//
const last_1=()=>{
background.style.display='none'
body.style.display='block'
send_box.display='none'
}
//
const last_2=()=>{
background.style.display='block'
body.style.display='none'
send_box.style.display='none'
}
//
const [selectedItems, setSelectedItems] = useState([]);
const click_div = (key) => {
if (selectedItems.includes(key)) {
setSelectedItems(prevItems => prevItems.filter(item => item !== key));
} else {
setSelectedItems(prevItems => [...prevItems, key]);
}
};
const getClassNames = (key) => {
if (selectedItems.includes(key)) {
return 'class_div selected';
} else {
return 'class_div';
}
};
//00~59
const min_list=[]
for (let i=0;i<=59;i++){
min_list.push(i)
}
//0~12
const hour_list=[]
for (let i=0;i<=12;i++){
hour_list.push(i)
}
//
const [HourValue, SetHourValue] = useState('');
const gethourvalue=(event)=>{
SetHourValue(event.target.value)
}
//
const [MinValue,SetMinValue]=useState('')
const getminvalue=(event)=>{
SetMinValue(event.target.value)
}
//
const [StopTime,SetStopTime]=useState('')
const getstoptime=(event)=>{
SetStopTime(event.target.value)
}
//
const release= async()=>{
try{
const release_src=await axios.post('http://127.0.0.1:5000/teacher/accept_test',{
teacher_ID,
ChoiceQuestionSet,//
CompletionQuestionSet,//
JudgeQuestionSet,//
selectedItems,//
HourValue,//
MinValue,//
StopTime,//
}
)
alert('发布成功')
window.location.href='http://localhost:3000/teacher/managetest'
}catch{
alert('发布失败')
}
}
return(
<div id='big_body'>
<div id='background' style={{display:'none'}}>
<p style={{marginLeft:'30px'}}>请选择发布班级</p>
{ ClassData &&<ul style={{marginTop:'70px'}} id='class_ul'>
{Object.keys(ClassData).map((key)=>(
<li key={key}>
<div className={getClassNames(key)} onClick={() => click_div(key)}>
{key}
</div>
</li>
))}
</ul>}
<button style={{marginLeft:'110px'}} onClick={last_1}>上一步</button>
<button style={{marginLeft:'80px'}} onClick={click_2}>下一步</button>
</div>
<div id='send_box' style={{display:'none'}}>
<p>请填写考试时间</p>
<select name="" id="" alue={HourValue} onChange={gethourvalue}>
{Object.keys(hour_list).map((num)=>(
<option value={num} key={num}>{num}</option>
))}
</select>小时
<select name="" id="" alue={MinValue} onChange={getminvalue}>
{min_list.map((num)=>(
<option value={num} key={num}>{num}</option>
))}
</select>分钟
<p>请填写截至时间</p>
<input type="text" maxLength={10} style={{width:'30px'}} value={StopTime} onChange={getstoptime} />天后
<button onClick={last_2}>上一步</button>
<button onClick={release}>发布</button>
</div>
<div id='body' >
<div id='body_top' style={{display:'flex'}}>
<div id='body_left'>
<input type="checkbox" id='choice'/><span>选择题</span><br />
<input type="checkbox" id='fill'/><span>填空</span><br />
<input type="checkbox" id='judge'/><span>判断</span><br />
</div>
<div id='body_right'>
<div id='choice_box'>
<span style={{color:'red'}}>选择题</span>
{ChoiceQuestion && <table>
<thead>
{Object.keys(ChoiceQuestion).map((key)=>(
<tr className='line' key={key}>
<td className='line'>
<p>问题:{ChoiceQuestion[key][1]}</p>
<p className='choice_answer'>
<span>A:{ChoiceQuestion[key][2]}</span>
<span>B:{ChoiceQuestion[key][3]}</span>
<span>C:{ChoiceQuestion[key][4]}</span>
<span>D:{ChoiceQuestion[key][5]}</span>
</p>
{/* 获取题目ID */}
<input type="checkbox" className='check_box' onClick={(event)=>{
if (event.target.checked) {
//ID
SetChoiceQuestionSet(items=>([
...items,
ChoiceQuestion[key][7]
]))
}else{
SetChoiceQuestionSet((items)=>
items.filter((item)=>item!==ChoiceQuestion[key][7])
)
}
}} /><span>是否选择</span>
</td>
</tr>
))}
</thead>
</table>}
</div>
<div id='fill_box'>
<span style={{color:'red'}}>填空题</span>
{ Completion &&<table>
<thead>
{Object.keys(Completion).map((key)=>(
<tr key={key}>
<td className='line'>
<p>问题:{Completion[key][1]}<input type='text' /></p>
<input type="checkbox" className='check_box' onClick={(event)=>{
if(event.target.checked){
SetCompletionQuestionSet(items=>([
...items,
Completion[key][3]
]))
}else{
SetCompletionQuestionSet((items)=>
items.filter((item)=>item!==Completion[key][3]))
}
}}/><span>是否选择</span>
</td>
</tr>
))}
</thead>
</table>}
</div>
<div id='judge_box'>
<span style={{color:'red'}}>判断题</span>
{ Judge &&<table>
<thead>
{Object.keys(Judge).map((key)=>(
<tr key={key}>
<td className='line'>
<p>问题:{Judge[key][1]}</p>
<input type="checkbox" className='check_box' onClick={(event)=>{
if(event.target.checked){
SetJudgeQuestionSet(items=>([
...items,
Judge[key][3]
]))
}else{
SetJudgeQuestionSet((items)=>
items.filter((item)=>item!==Judge[key][3]))
}
}}/><span>是否选择</span>
</td>
</tr>
))}
</thead>
</table>}
</div>
</div>
</div>
<div id='body_btm'>
<button id='next' onClick={click_1}>下一步</button>
</div>
</div>
</div>
)
}
export default SendTest

View File

@ -0,0 +1,182 @@
.SendTrain_body{
width: 100%;
display: flex;
}
.SendTrain_body_left{
flex: 20%;
}
.SendTrain_body_right{
flex: 60%;
}
.SendTrain_body_left_ul{
all: unset;
}
.SendTrain_body_left_ul li{
text-align: center;
}
.SendTrain_body_left_ul button{
background-color: rgb(114, 134, 232);
border: none;
width: 100%;
margin-top: 20px;
font-size: 28px;
}
.SendTrain_body_left_ul_div{
background-color: aqua;
font-size: 36px;
margin-top: 43px;
}
.SendTrain_body_right p{
font-size: 32px;
border: 1px solid black;
text-align: center;
margin-top: 0px;
margin-bottom: 0px;
}
.SendTrain_body_right table{
width: 100%;
border-left: 1px solid black;
border-right: 1px solid black;
}
.title{
font-size: 26px;
margin-bottom: 0px;
}
.questiontitle{
font-size: 20px;
}
.Trainbox{
background-color: rgb(166, 161, 161);
}
.judgetitle{
font-size: 20px;
background-color: rgb(166, 161, 161);
}
/* 以下为为实训 */
.Train_div{
width: 100%-1px;
height:700px;
border: 1px solid black;
border-top: none;
}
#Train_1{
width: 100%;
height: 350px;
display: flex;
}
.Train_1_left{
flex: 60%;
background-color: beige;
font-size: 20px;
text-align: center;
padding-top: 120px;
}
.Train_1_right{
flex: 40%;
background-color: rgb(111, 200, 241);
}
#Train_2{
width: 100%;
height: 350px;
display: flex;
}
.Train_2_left{
flex: 60%;
background-color: rgb(97, 237, 92);
font-size: 20px;
text-align: center;
padding-top: 120px;
}
.Train_2_right{
flex: 40%;
background-color: rgb(248, 127, 231);
}
.Train_1_right span{
font-size: 20px;
position: absolute;
margin-left: 150px;
margin-top: 140px;
}
.Train_2_right span{
font-size: 20px;
position: absolute;
margin-left: 150px;
margin-top: 140px;
}
/* 按钮 */
#SendTrainBtn{
font-size: 32px;
margin-top: 40px;
margin-bottom: 40px;
margin-left: 830px;
}
/* 右边的内容 */
.right_right{
flex: 20%;
}
.OptionBox{
width: 90%;
height: 500px;
margin-top: 30px;
margin-left: 15px;
border-radius: 20px;
background-color: rgb(173, 255, 251);
}
.TrainSelectClass{
width: 95%;
height: 200px;
background-color: bisque;
border-radius: 20px;
margin-left: 7px;
padding-top: 20;
}
.TrainSelectClassP{
font-size: 20px;
margin-left: 80px;
padding-top: 10px;
}
#Train_class_ul{
margin-left: 30px;
}
#Train_class_ul li{
list-style-type: none;
}
.Train_class_div {
/* 普通状态下的样式 */
width: 120px;
height: 30px;
border: 1px solid #5086eb;
cursor: pointer;
margin-top: 10px;
margin-left: 15px;
text-align: center;
}
.Trainselected {
/* 选中状态下的样式 */
background-color: rgb(148, 246, 186);
border-color: rgb(250, 200, 140);
}
.TrainSelectTime{
width: 95%;
height: 200px;
background-color: beige;
text-align: center;
margin-left: 7px;
border-radius: 20px;
}

View File

@ -0,0 +1,311 @@
import React,{ useState ,useEffect} from 'react';
import { Link } from 'react-router-dom';
import './SendTrain.css'
import axios from 'axios';
function SendTrain(){
const teacher_ID=localStorage.getItem('islogin')
//
const [Trainquestion,SetTrainquestion]=useState()
//
const [isTrain,setisTrain]=useState(false)
//
const [TrainChoice,setTrainChoice]=useState([])
const [TrainCompletion,setTrainCompletion]=useState([])
const [TrainJudge,setTrainJudge]=useState([])
//
const [Train,setTrain]=useState([])
//
const [ClassData,SetClassData]=useState([])
const Train_question_func=async()=>{
try{
const Train_question_src=await axios.post('http://127.0.0.1:5000/teacher/fetch_train_question')
SetTrainquestion(Train_question_src.data)
}catch{
alert('Train_question_func出错')
}
}
const SeleactClass= async()=>{
try {
const select_class_src = await axios.post('http://127.0.0.1:5000/teacher/select_class', {
teacher_ID
});
SetClassData(select_class_src.data['Class']);
} catch (error) {
console.log(error);
}
}
useEffect(()=>{
Train_question_func()
SeleactClass()
},[])
//
const [selectedItems, setSelectedItems] = useState([]);
const click_div = (key) => {
if (selectedItems.includes(key)) {
setSelectedItems(prevItems => prevItems.filter(item => item !== key));
} else {
setSelectedItems(prevItems => [...prevItems, key]);
}
};
const getClassNames = (key) => {
if (selectedItems.includes(key)) {
return 'Train_class_div Trainselected';
} else {
return 'Train_class_div';
}
};
//
const SendTrainTest=async ()=>{
try{
const SendTrainSrc=await axios.post('http://127.0.0.1:5000/teacher/SendTrainTest',{
TrainChoice,
TrainCompletion,
TrainJudge,
HourValue,
MinValue,
StopTime,
selectedItems,
Train,
teacher_ID
})
alert('发布成功')
}catch{
alert('SendTrainTest出错')
}
}
const SendTrainBtn=()=>{
if(selectedItems.length>0 && (HourValue || MinValue)&&StopTime){
SendTrainTest()
}else{
alert('发布信息未完全')
}
}
//
const clickTrain=()=>{
SetTrainquestion(null)
setisTrain(true)
}
const clickQuestion=()=>{
Train_question_func()
setisTrain(false)
}
//00~59
const min_list=[]
for (let i=0;i<=59;i++){
min_list.push(i)
}
//0~12
const hour_list=[]
for (let i=0;i<=12;i++){
hour_list.push(i)
}
//
const [HourValue, SetHourValue] = useState('');
const gethourvalue=(event)=>{
SetHourValue(event.target.value)
}
//
const [MinValue,SetMinValue]=useState('')
const getminvalue=(event)=>{
SetMinValue(event.target.value)
}
//
const [StopTime,SetStopTime]=useState('')
const getstoptime=(event)=>{
SetStopTime(event.target.value)
}
return(
<div className='SendTrain_body'>
<div className='SendTrain_body_left'>
<ul className='SendTrain_body_left_ul'>
<li><div className='SendTrain_body_left_ul_div'>题目集</div></li>
<li>
<button onClick={clickQuestion}>基础题</button>
<ul style={{all:'unset'}}>
<li>第一章</li>
<li>第二章</li>
</ul>
</li>
<li><button onClick={clickTrain}>实训题</button></li>
</ul>
</div>
<div className='SendTrain_body_right'>
<p>题目选择</p>
{/* 实训题 */}
{isTrain&&<div className='Train_div'>
<div id='Train_1'>
<div className='Train_1_left'>
设计达梦数据库课程实验实训按照提供的达梦数据库安装文档在系统中实现达梦数据库安装连接及使用
</div>
<div className='Train_1_right'>
<span>
<input type="checkbox" value={'达梦数据库连接'} onClick={(event)=>{
if(event.target.checked){
setTrain(items=>([
...items,
event.target.value
]))
}else{
setTrain((items)=>
items.filter((item)=>item!==event.target.value))
}
}}/>是否选择
</span>
</div>
</div>
<div id='Train_2'>
<div className='Train_2_left'>
设计和实现一个Web前端开发和DM8数据库后端结合的项目实训
</div>
<div className='Train_2_right'>
<span>
<input type="checkbox" value={'前端与数据库结合'} onClick={(event)=>{
if(event.target.checked){
setTrain(items=>([
...items,
event.target.value
]))
}else{
setTrain((items)=>
items.filter((item)=>item!==event.target.value))
}
}}/>是否选择
</span>
</div>
</div>
</div>}
{/* 基础题 */}
{Trainquestion &&<table>
<span className='title'>选择题</span>
<tbody>
{Object.keys(Trainquestion['choice']).map((key)=>(
<tr key={key}>
{/* 章节切换⬇ */}
<td className='Trainbox'>
<div>{Trainquestion['choice'][key][8]}</div>
<tr>
<td className='questiontitle'>.{Trainquestion['choice'][key][1]}</td>
</tr>
<tr>
<div className='Train_answer_box'>
<tr>A:{Trainquestion['choice'][key][2]}</tr>
<tr>B:{Trainquestion['choice'][key][3]}</tr>
<tr>C:{Trainquestion['choice'][key][4]}</tr>
<tr>D:{Trainquestion['choice'][key][5]}</tr>
</div>
</tr>
<input type="checkbox" className='check_box' onClick={(event)=>{
if (event.target.checked) {
//ID
setTrainChoice(items=>([
...items,
Trainquestion['choice'][key][7]
]))
}else{
setTrainChoice((items)=>
items.filter((item)=>item!==Trainquestion['choice'][key][7])
)
}
}} /><span>是否选择</span>
</td>
</tr>
))}
<span className='title'>填空题</span>
{Object.keys(Trainquestion['completion']).map((key)=>(
<tr key={key}>
<td className='Trainbox'>
{Trainquestion['completion'][key][4]}
<td className='questiontitle'>
.{Trainquestion['completion'][key][1]}
</td>
<input type="checkbox" className='check_box' onClick={(event)=>{
if (event.target.checked) {
//ID
setTrainCompletion(items=>([
...items,
Trainquestion['completion'][key][3]
]))
}else{
setTrainCompletion((items)=>
items.filter((item)=>item!==Trainquestion['completion'][key][3])
)
}
}} /><span>是否选择</span>
</td>
</tr>
))}
<span className='title'>判断题</span>
{Object.keys(Trainquestion['judge']).map((key)=>(
<tr key={key}>
<td className='Trainbox'>
{Trainquestion['judge'][key][4]}
<td className='judgetitle'>:{Trainquestion['judge'][key][1]}</td>
<input type="checkbox" className='check_box' onClick={(event)=>{
if (event.target.checked) {
setTrainJudge(items=>([
...items,
Trainquestion['judge'][key][3]
]))
}else{
setTrainJudge((items)=>
items.filter((item)=>item!==Trainquestion['judge'][key][3])
)
}
}} /><span>是否选择</span>
</td>
</tr>
))}
</tbody>
</table>}
<button onClick={SendTrainBtn} id='SendTrainBtn'>发布按钮</button>
</div>
{/* 右边的内容 */}
<div className='right_right'>
<div className='OptionBox'>
<div className='TrainSelectClass'>
<p className='TrainSelectClassP'>请选择发布班级</p>
{ ClassData &&<ul id='Train_class_ul'>
{Object.keys(ClassData).map((key)=>(
<li key={key}>
<div className={getClassNames(key)} onClick={() => click_div(key)}>
{key}
</div>
</li>
))}
</ul>}
</div>
<div className='TrainSelectTime'>
<p>请填写考试时间</p>
<select name="" id="" alue={HourValue} onChange={gethourvalue}>
{Object.keys(hour_list).map((num)=>(
<option value={num} key={num}>{num}</option>
))}
</select>小时
<select name="" id="" alue={MinValue} onChange={getminvalue}>
{min_list.map((num)=>(
<option value={num} key={num}>{num}</option>
))}
</select>分钟
<p>请填写截至时间</p>
<input type="text" maxLength={10} style={{width:'30px'}} value={StopTime} onChange={getstoptime} />天后
</div>
</div>
</div>
</div>
)
}
export default SendTrain

View File

@ -0,0 +1,28 @@
/* 页面右边 */
.body-right-teacher{
width: 1420px;
height: 830px;
position: absolute;
top: 72px;
left: 220px;
border-radius: 10px;
float: right;
background-color: #f7f8fa;
}
/* 班级管理 */
.manage_class{
/* flex-basis: calc(50.00% - 10PX); */
width: 400px;
height: 250px;
background-color: rgb(200, 249, 230);
margin-left: 150px;
margin-top: 50px;
}
.manage_class p{
margin-left: 50px;
}
.manage_class button{
margin-left: 300px;
margin-top: 100px;
}

View File

@ -0,0 +1,67 @@
import { Link } from 'react-router-dom';
import './TeacherPage.css';
import React, { useEffect, useState } from 'react';
import axios from 'axios';
// import { useParams } from 'react-router-dom';
function TeacherPage() {
const [isChecked, setisChecked] = useState(false);
const [teacher_ID, setTeacher_ID] = useState(localStorage.getItem('islogin'));
const [classData, setClassData] = useState({});
//
// useEffect(() => {
// if (!isChecked) {
// const is_login = localStorage.getItem('islogin');
// if (!is_login) {
// alert('');
// window.location.href = 'http://localhost:3000/signin';
// } else {
// if(teacher_ID.length===8){
// window.location.href='http://localhost:3000'
// return
// }else{
// console.log(teacher_ID);
// }
// }
// }
// }, []);
//
const log=(key)=>{
console.log(key);
}
//
const select_class = async () => {
try {
const select_class_src = await axios.post('http://127.0.0.1:5000/teacher/select_class', {
teacher_ID
});
setClassData(select_class_src.data['Class']);
} catch (error) {
console.log(error);
}
};
useEffect(() => {
select_class();
}, []);
return (
<div className='body-right-teacher' style={{ display: 'flex', flexDirection: 'column' }}>
<div id='class_box' style={{ display: 'flex' }}>
{Object.keys(classData).map((key) => (
<div className='manage_class' key={key} style={{ display: '1' }}>
<p id='class_name'>班级:{key}</p>
<p id='number'>人数:<span>{classData[key][1]}</span></p>
<p id='headteacher'>班主任:<span>{classData[key][0]}</span></p>
<Link to={`/classID/${key}`} onClick={()=>{log(key);}}>管理</Link>
</div>
))}
</div>
</div>
);
}
export default TeacherPage;

View File

@ -0,0 +1,9 @@
.body-TrainManage{
width: 1420px;
height: 1330px;
position: absolute;
top: 72px;
left: 220px;
border-radius: 10px;
background-color: #f7f8fa;
}

View File

@ -0,0 +1,12 @@
import './Trainmanage.css'
function TeacherTrainManage(){
return(
<div className="body-TrainManage">
asd
</div>
)
}
export default TeacherTrainManage

View File

@ -0,0 +1,108 @@
import { useParams } from 'react-router-dom';
import { Link } from 'react-router-dom';
import React, { useEffect, useState } from 'react';
import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip } from 'recharts';
import axios from 'axios';
import './classid.css'
function TeacherPage() {
const { key } = useParams();
//
const [classdata,setClassData]=useState([])
const class_succeed = async () => {
try{
const class_scr=await axios.post('http://127.0.0.1:5000/teacher/find_student',{key})
const class_data=class_scr.data
console.log(class_data[1]);
setClassData(class_data[1])
}catch(error){
alert(error)
}
}
useState(()=>{
class_succeed();
},[classdata])
//
const student_fig_btn=(Class)=>{
const student_fig=document.getElementById('body-right-bottom-right')
student_fig.innerHTML=''
student_fig.innerHTML='学生'+Class+'画像'
}
//
const [studentScores, setStudentScores] = useState([]);
useEffect(() => {
class_succeed().then(() => {
const scores = classdata.map(student => ({
name: 11.26, //
score:10, //
}));
setStudentScores(scores);
});
}, [classdata]);
return(
<div className='body-right-classId'>
<div id='body-right-bottom'>
<h3>班级信息</h3>
<div id='body-right-bottom-left'>
<div id='body-right-bottom-left-nav'>
<p style={{ display: 'flex', justifyContent: 'space-between' }}>
<span style={{ flex: 1 }}>班级</span>
<span style={{ flex: 1 }}>姓名</span>
<span style={{ flex: 1 }}>学号</span>
<span style={{ flex: 1 }}>性别</span>
<span style={{ flex: 1 }}>联系电话</span>
<span style={{ flex: 1 }}>出生日期</span>
<span style={{ flex: 1 }}>查看详情</span>
</p>
</div>
<div id='body-right-student-box'>
<table>
<tbody>
{Object.keys(classdata).map((item)=>(
<tr key={item}>
<td className='box-content'>班级</td>
<td className='box-content'>{classdata[item][0]}</td>
<td className='box-content'>{classdata[item][1]}</td>
<td className='box-content'>{classdata[item][3]}</td>
<td className='box-content'>{classdata[item][5]}</td>
<td className='box-content'>出生日期</td>
<td className='box-content'><button onClick={() => student_fig_btn(classdata[item][0])}>查看详情</button></td>
</tr>
))}
</tbody>
</table>
</div>
</div>
</div>
<div className='body-test-score'>
<h3>成绩</h3>
<div className='body-test-score-bar'>
<select>
<option value="">请选择科目</option>
<option value="china">语文</option>
<option value="math">数学</option>
<option value="english">英语</option>
<option value="test">实训</option>
</select>
<div className='table-bar'>
<BarChart width={600} height={350} data={studentScores} barSize={90} className='bar' >
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="name" />
<YAxis dataKey="score"/>
<Tooltip />
<Bar dataKey="score" fill="#ffeed4" />
</BarChart>
</div>
</div>
</div>
</div>
)
}
export default TeacherPage;

View File

@ -0,0 +1,101 @@
.body-right-classId{
width: 1420px;
height: 830px;
position: absolute;
top: 72px;
left: 220px;
border-radius: 10px;
background-color: #f7f8fa;
}
#body-right-bottom{
width: 1200px;
height: 500px;
position: absolute;
top: 40px;
left: 110px;
}
#body-right-bottom h3{
position: absolute;
top: -50px;
}
#body-right-bottom-left{
width: 1200px;
height: 360px;
background-color: #b19bc6;
position: absolute;
}
#body-right-bottom-left-nav{
width: 1150px;
height: 70px;
position: absolute;
left: 25px;
}
#body-right-bottom span{
text-align: center;
}
#body-right-student-box{
width: 1150px;
height: 280px;
border: 1px black solid;
margin-left: 25px;
position: absolute;
top: 50px;
}
#body-right-student-box table {
display: flex;
flex-direction: column;
}
#body-right-student-box tr {
display: flex;
align-items: center; /* 垂直居中 */
}
#body-right-student-box td {
padding: 10px;
border: 1px solid #ccc;
text-align: center;
}
.box-content {
flex: 1; /* 占据剩余空间 */
}
.body-test-score{
width: 1200px;
height: 370px;
position: absolute;
top: 440px;
left: 110px;
background-color: #bfd1f6;
}
.body-test-score h3{
position: absolute;
top: -50px;
}
.body-test-score-bar select{
height: 40px;
width: 120px;
font-size: 15px;
margin-top: 20px;
margin-left: 10px;
border: 1px solid #a1c1f4;
outline-color:#a1c1f4;
color: rgb(122, 122, 122);
position: absolute;
top: -5px;
left: 920px;
}
.table-bar{
width: 640px;
position: absolute;
top: 10px;
left: 250px;
border-radius: 15px;
background-color: #fff;
}
.bar{
position: absolute;
top: 10px;
}

View File

@ -0,0 +1,116 @@
/* 页面右边 */
.body-right-manage{
width: 87%;
height: 830px;
position: relative;
margin-top: 5px;
margin-left: 10px;
border-radius: 10px;
float: right;
background-color: #f7f8fa;
}
#view_history{
margin-left: 100px;
width: 1200px;
height: 350px;
background-color: aqua;
margin-top: 100px;
}
#view_history_nav{
border-bottom: 1px solid black;
width: 850px;
text-align: center;
}
.view_history_content{
width: 850px;
text-align: center;
}
#class_portrait{
position: absolute;
width: 330px;
height: 300px;
margin-left: 860px;
margin-top: 10px;
background-color: rgb(112, 80, 227);
}
#view_history_box{
overflow-y: scroll;
overflow-x: hidden;
height: 550px;
width: 850px;
background-color: antiquewhite;
}
#class_list{
position: absolute;
margin-left: 975px;
margin-top: -20px;
}
#class_list select{
font-size: 20px;
border: none;
}
#body_bottom{
height: 330px;
width: 850px;
border: 1px solid black;
margin-left: 100px;
margin-top: 20px;
}
#sendtest_btn{
font-size: 30px;
margin-left: 30px;
margin-top: 100px;
}
#body_bottom_right{
width: 350px;
height: 220px;
background-color: darkolivegreen;
position: absolute;
margin-left: 850px;
margin-top:-220px;
}
#view_history_table td{
border-bottom: 1px solid black;
}
#view_history_table tr{
cursor: pointer;
}
#detailed{
margin-left: 390px;
margin-top: 180px;
width: 600px;
height: 400px;
border: 1px solid black;
position: absolute;
background-color: rgb(175, 25, 234);
z-index: 2;
}
#splitter{
width: 590;
border-bottom: 1px solid black;
text-align: center;
}
#return{
position: absolute;
margin-left: 230px;
font-size: 20px;
margin-top: -10px;
cursor: pointer;
}
#detailed span{
text-align: center;
}
#detailed_box_tr{
width: 600px;
text-align: center;
}
#detailed_box{
height: 270px;
width: 600px;
overflow-x: hidden;
overflow-y: scroll;
margin-top: -10px;
margin-left: -3px;
}

View File

@ -0,0 +1,187 @@
import { Link } from 'react-router-dom';
import React, { useEffect, useState } from 'react';
import axios from 'axios';
// import { useParams } from 'react-router-dom';
import './ManageTest.css'
function TeacherPage() {
const teacher_ID = localStorage.getItem('islogin')
const [classData, setClassData] = useState({});
const [classtest,setClassTest]=useState()
const [defaultclass,setDefaultClass]=useState()
const [selectedValue, setSelectedValue] = useState('');
const [isChecked,setisChecked]=useState(false)
const [isDetailedBoxVisible, setIsDetailedBoxVisible] = useState(false);
const select_class = async () => {
try {
const select_class_src = await axios.post('http://127.0.0.1:5000/teacher/select_class',{
teacher_ID
});
setClassData(select_class_src.data['Class']);
setDefaultClass(select_class_src.data['default'])
const list = Object.keys(select_class_src.data['Class'])
setSelectedValue(list[0])
setisChecked(true)
} catch (error) {
alert('获取所有班级出错')
}
};
useEffect(() => {
if(!isChecked){
select_class();
}
}, []);
//
const handleChange = (event) => {
setSelectedValue(event.target.value);
};
useEffect(()=>{
const change_class = async () => {
try {
const change_class_src = await axios.post('http://127.0.0.1:5000/teacher/change_class',{
teacher_ID,
selectedValue,
testID
});
setDefaultClass(change_class_src.data['default'])
} catch (error) {
alert('获取默认班级出错')
}
}
if(isChecked){
change_class()
}
//
},[selectedValue])
const [testID,settestID]=useState('')
const click=()=>{
console.log(isDetailedBoxVisible);
console.log(detaileddata);
}
//
const [detaileddata,setdetaileddata]=useState('')
const click_detailed= async()=>{
//
try{
const detaileddata_src=await axios.post('http://127.0.0.1:5000/teacher/detaileddata',{
testID,
selectedValue,
teacher_ID
})
setdetaileddata(detaileddata_src.data['data'])
}catch(error){
alert('获取小框信息出错')
}
}
useEffect(()=>{
click_detailed()
},[testID])
const return_detailed=()=>{
setIsDetailedBoxVisible(false)
}
//退
const [numbers] = useState([...Array(61).keys()].map(num => num - 30));
const getRandomNumber = () => {
const randomIndex = Math.floor(Math.random() * numbers.length);
return numbers[randomIndex];
};
return (
<div className='body-right-manage'>
{/* 详细信息 */}
{isDetailedBoxVisible && <div id='detailed'>
<p id='splitter'>试卷ID{testID}<span id='return' onClick={return_detailed}>X</span></p>
<p style={{display:'flex'}}>
<span style={{ flex: 1}}>详情</span>
<span style={{ flex: 1}}>分数</span>
<span style={{ flex: 1}}>与上次相比</span>
<span style={{ flex: 1}}>总评</span>
</p>
<div>
<p>--------------------------------------------------------------------------------------</p>
{detaileddata&&<table>
<tbody>
<div id='detailed_box'>
{Object.keys(detaileddata).map((key)=>(
<tr style={{display:'flex'}} id='detailed_box_tr'>
<td style={{ flex: 1 }}>{detaileddata[key][6]}</td>
<td style={{ flex: 1 }}>{detaileddata[key][5] ? detaileddata[key][5] : "未完成"}</td>
<td style={{ flex: 1 }}>{detaileddata[key][5] ? `${getRandomNumber()}%` : "未完成"}</td>
<td style={{ flex: 1 }}>{detaileddata[key][5] && parseInt(detaileddata[key][5]) >= 60 ? "及格" : (detaileddata[key][5] ? "不及格" : "未完成")}</td>
</tr>
))}
</div>
</tbody>
</table>}
</div>
</div>}
{/* 总体信息 */}
<div id='view_history' style={{display:'block'}}>
<table>
<tbody>
<tr id='view_history_nav' style={{ display: 'flex', justifyContent: 'space-between' }}>
<td style={{ flex: 1 }}>试卷ID</td>
<td style={{ flex: 1 }}>发布时间</td>
<td style={{ flex: 1 }}>截止时间</td>
<td style={{ flex: 1 }}>提交人数</td>
<td style={{ flex: 1 }}>平均分</td>
</tr>
</tbody>
</table>
<div id='class_list'>
<select name="class_id" onChange={handleChange}>
{Object.keys(classData).map((key)=>(
<option key={key} value={key}>{key}</option>
))}
</select>
</div>
<div id='class_portrait'>
{/* 班级画像 */}
</div>
<div id='view_history_box'>
{ defaultclass &&<table id='view_history_table'>
<tbody>
{Object.keys(defaultclass).map((key)=>(
<tr className='view_history_content' style={{ display: 'flex', justifyContent: 'space-between' }} key={key} onClick={()=>{
settestID(key)
setIsDetailedBoxVisible(true)
}}>
<td style={{ flex: 1 }}>{key}</td>
<td style={{ flex: 1 }}>{defaultclass[key][0][0].slice(0, 10)}</td>
<td style={{ flex: 1 }}>{defaultclass[key][0][1].slice(0, 10)}</td>
<td style={{ flex: 1 }}>{defaultclass[key][2]}</td>
<td style={{ flex: 1 }}>{defaultclass[key][1]}</td>
</tr>
)).reverse()}
</tbody>
</table>}
</div>
<div id='body_bottom_right'>
<Link to="/teacher/sendtest"><button id='sendtest_btn'>前往发布新的考试</button></Link>
</div>
</div>
<button onClick={click}>测试</button>
</div>
);
}
export default TeacherPage;

15
app-dm/src/api/index.js Executable file
View File

@ -0,0 +1,15 @@
import useSWR from "swr";
const fetcher = (...args) => fetch(...args).then((res) => res.json())
function Profile() {
const { data, error, isLoading } = useSWR("/api/user/123", fetcher)
if (error) return <div>failed to load</div>
if (isLoading) return <div>loading...</div>
// 渲染数据
return <div>hello {data.name}!</div>
}
export default Profile;

10
app-dm/src/index.js Executable file
View File

@ -0,0 +1,10 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import AppRouter from './router';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<div>
<AppRouter/>
</div>,
);

1
app-dm/src/logo.svg Executable file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

89
app-dm/src/nav/nav.jsx Executable file
View File

@ -0,0 +1,89 @@
import { Link } from 'react-router-dom';
import './style.css';
import React,{ useState } from 'react';
import HomeIcon from '../pages/Home/img/主页.jpg';
import Subject from "../pages/Home/img/题目.jpg";
import Mark from "../pages/Home/img/问题.jpg";
import Set from '../pages/Home/img/设置.jpg';
import Logo from '../pages/Home/img/logo.jpg';
import Computer from '../pages/Home/img/电脑.jpg';
//
function HeaderNav() {
const outlog=()=>{
localStorage.removeItem('islogin')
// setisChecked(false)
alert('注销成功')
window.location.href='http://localhost:3000/signin'
};
const [isChecked,setisChecked]=useState(false)
// ()
const [settingsVisible, setSettingsVisible] = useState(false);
const handleSettingsClick = () => {
setSettingsVisible(!settingsVisible);
};
return (
//
<div className="nav">
<div className='title-nav'>
<img src={Logo} alt="" width='45px' height='40px'/>
<p>达梦实训平台</p>
</div>
<div className="container-fluid">
{/* <div>
头像
</div> */}
<ul className="narbar-nav mr-auto">
<li className='nav-item'>
<Link className='nav-link' to='/'>学生</Link>
</li>
<li className='nav-item'>
<Link className='nav-link' to='/teacher'>教师</Link>
</li>
<li className='nav-item'>
<Link className='nav-link' to='/signup'>注册</Link>
</li>
<li className='nav-item'>
<Link className='nav-link' to='/signin'>登录</Link>
</li>
</ul>
</div>
<div className='left-nav-li'>
<ul>
{[{name:'首页',path:'/',ImgSrc:HomeIcon},{name:'练习',path:'subject',ImgSrc:Subject},{name:'实训',path:'train',ImgSrc:Computer},{name:'学习分析',path:'analyse',ImgSrc:Mark},{name:'设置',path:'#',ImgSrc:Set,onClick:handleSettingsClick}].map((item)=>
<li onClick={item.onClick}>
<div className='nav-li-box'>
<Link to={item.path} className="custom-link-home" style={{color:'black'}}>
<img src={ item.ImgSrc } alt="" width='32px' height='32px'/>
<p>{item.name}</p>
</Link>
</div>
</li>)}
</ul>
</div>
{/* 设置 */}
{settingsVisible && (
<div className='Form-nav'>
<div className="set-list-nav">
<button className='close-btn-nav' onClick={handleSettingsClick}>X</button>
<ul>
<li>账号管理</li>
<li>个人信息</li>
<li>登录设备</li>
<li>我的通知</li>
<li>个性化</li>
</ul>
</div>
<button className='exit-btn-nav' onClick={outlog}>退出登录</button>
</div>
)}
</div>
)
}
export default HeaderNav;

181
app-dm/src/nav/style.css Executable file
View File

@ -0,0 +1,181 @@
@media screen and (max-width:400px) {
.nav{
background-color: rgb(171, 134, 238);
}
}
@media screen and (min-width:400px) {
.nav{
background-color: rgb(255, 255, 255);
box-shadow: 5px 2px 6px #d4d4d4;
}
}
/* 上导航 */
.nav{
height: 57px;
width: 1631px;
box-shadow: 1px 1px 6px #d4d4d4;
}
.title-nav{
width: 200px;
height: 56px;
float: left;
padding-left: 80px;
display: flex;
align-items: center;
}
.title-nav p{
font-size: 22px;
}
.container-fluid{
width: 600px;
height: 58px;
float: right;
}
.container-fluid ul{
display: flex;
justify-content: space-around;
}
.container-fluid li{
list-style-type: none;
text-decoration: none;
}
/* 左侧导航 */
.left-nav-li{
width: 200px;
height: 800px;
position: absolute;
top: 70px;
left: 8px;
box-shadow: 1px 1px 6px #d4d4d4;
}
.left-nav-li ul{
width: 160px;
height: 400px;
position: absolute;
top: 20px;
}
.left-nav-li li{
width: 150px;
height: 60px;
font-size: 17px;
list-style-type: none;
margin-bottom: 20px;
background-color: #f8f8f8d8;
border-radius: 15px 0 0 15px;
box-shadow: 2px 6px 5px #d4d4d4;
padding-left: 10px;
display: flex;
justify-items: center;
}
.left-nav-li li:hover{
background-image: linear-gradient(120deg,rgba(181, 255, 245, 0.8),rgba(189, 236, 245, 0.6));
}
.left-nav-li li:active{
background-image: linear-gradient(190deg,rgba(179, 255, 249, 0.8),rgba(190, 218, 249, 0.6));
}
.left-nav-li img{
margin-top: 13px;
margin-right: 10px;
}
.left-nav-li p{
float: right;
}
/* 设置 */
.Form-nav {
width: 210px;
height: 910px;
top: 0px;
position: fixed;
right: 0px;
background-color: #fef2f2ef;;
padding: 0;
list-style: none;
z-index: 1;
/* 默认隐藏在屏幕左侧外 */
transform: translateX(-100%);
opacity: 0;
/* 动画属性 */
animation-name: slideInFromLeft;
animation-duration: 0.5s; /* 动画持续时间 */
animation-fill-mode: forwards; /* 动画完成后保持最终状态 */
animation-delay: 0s; /* 动画延迟时间 */
}
@keyframes slideInFromLeft {
from {
transform: translateX(100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
.close-btn-nav, .exit-btn-nav {
cursor: pointer;
}
.visible {
/* 当设置盒子可见时,触发动画 */
animation-play-state: running;
}
.set-list-nav {
margin-top: 80px;
}
.set-list-nav ul {
background-color: transparent;
padding: 0;
}
.set-list-nav li {
height: 80px;
width: 100%;
font-size: 20px;
text-align: center;
line-height: 80px;
border-bottom: 1px solid #77a6d5;
background-color: #fef2f2ef;
overflow: hidden;
}
.close-btn-nav {
width: 30px;
height: 25px;
position: absolute;
right: 5px;
top: 5px;
cursor: pointer;
background: none;
border: none;
font-size: 18px;
color: #8b4a11;
background-color: #fce5d9;
/* border: 1px solid #666; */
}
.close-btn-nav:hover{
background-color: #fff3e3;
}
.set-list-nav li:hover{
cursor: pointer;
color: rgb(65, 13, 121);
}
.exit-btn-nav{
height: 40px;
width: 170px;
border: none;
border-radius: 10px;
font-size: 18px;
margin-top: 310px;
margin-left: 25px;
background-color: rgb(183, 231, 255);
}
.exit-btn-nav:hover{
background-color: #b0dcf7;
}

90
app-dm/src/nav/teacherIndex.jsx Executable file
View File

@ -0,0 +1,90 @@
import { Link } from 'react-router-dom'
import './style.css'
import React,{ useState } from 'react';
import ClassManage from '../pages/Home/img/班级管理.jpg'
import SubjectManage from "../pages/Home/img/考试管理.jpg"
import Send from "../pages/Home/img/练习.jpg"
import Set from '../pages/Home/img/设置.jpg'
import Mark from '../pages/Home/img/批改.jpg'
import Logo from '../pages/Home/img/logo.jpg'
//
function HeaderNavTeacher() {
const outlog=()=>{
localStorage.removeItem('islogin')
// setisChecked(false)
alert('注销成功')
window.location.href='http://localhost:3000/signin'
};
const [isChecked,setisChecked]=useState(false)
// ()
const [settingsVisible, setSettingsVisible] = useState(false);
const handleSettingsClick = () => {
setSettingsVisible(!settingsVisible);
};
return (
//
<div className="nav">
<div className='title-nav'>
<img src={Logo} alt="" width='45px' height='40px'/>
<p>达梦实训平台</p>
</div>
<div className="container-fluid">
{/* <div>
头像
</div> */}
<ul className="narbar-nav mr-auto">
<li className='nav-item'>
<Link className='nav-link' to='/'>学生</Link>
</li>
<li className='nav-item'>
<Link className='nav-link' to='/teacher'>教师</Link>
</li>
<li className='nav-item'>
<Link className='nav-link' to='/signup'>注册</Link>
</li>
<li className='nav-item'>
<Link className='nav-link' to='/signin'>登录</Link>
</li>
</ul>
</div>
<div className='left-nav-li'>
<ul>
{[{name:'班级管理',path:'/teacher',ImgSrc:ClassManage},{name:'实训管理',path:'/teacher/Trainmanage',ImgSrc:Send},{name:'批改',path:'/teacher/mark',ImgSrc:Mark},{name:'考试管理',path:'/teacher/managetest',ImgSrc:SubjectManage},{name:'设置',ImgSrc:Set,onClick:handleSettingsClick}].map((item)=>
<li onClick={item.onClick}>
<div className='nav-li-box'>
<Link to={item.path} className="custom-link-home" style={{color:'black'}}>
<img src={ item.ImgSrc } alt="" width='30px' height='30px'/>
<p>{item.name}</p>
</Link>
</div>
</li>)}
</ul>
</div>
{/* 设置 */}
{settingsVisible && (
<div className='Form-nav'>
<div className="set-list-nav">
<button className='close-btn-nav' onClick={handleSettingsClick}>X</button>
<ul>
<li>账号管理</li>
<li>个人信息</li>
<li>登录设备</li>
<li>我的通知</li>
<li>个性化</li>
</ul>
</div>
<button className='exit-btn-nav' onClick={outlog}>退出登录</button>
</div>
)}
</div>
)
}
export default HeaderNavTeacher;

231
app-dm/src/pages/Home/Home.css Executable file
View File

@ -0,0 +1,231 @@
/* 右侧首页内容 */
.body-right-home{
width: 1420px;
height: 1330px;
position: absolute;
top: 72px;
left: 220px;
border-radius: 10px;
background-color: #f7f8fa;
}
.ad{
position: absolute;
top: -2px;
height: 190px;
width: 1420px;
border-radius: 10px 10px 0 0;
/* background-image: linear-gradient(190deg,rgb(168, 248, 254),rgb(203, 228, 255),rgb(238, 208, 255)); */
}
.ad p{
font-size: 25px;
position: absolute;
bottom: 75px;
left: 40px;
}
.ad span{
position: absolute;
bottom: 65px;
left: 55px;
font-weight: 300;
}
.ad img{
border-radius: 10px 10px 0 0;
}
/* 灰盒子 */
.block{
width: 1300px;
height: 150px;
position: absolute;
top: 220px;
left: 58px;
border: 1px solid #d3d3d3;
background-color: #fff;
}
.block-box{
width: 98%;
height: 128px;
background-color: #f7f8f9;
border: 1px solid #d3d3d3;
margin: 11px;
}
/* 题目+课表 */
.box-two{
width: 1420px;
height: 390px;
display: flex;
align-content: center;
}
/* 题目 */
.list{
width: 560px;
height: 310px;
/* background-color: #e9eef8; */
/* background-color: #bdd2ee; */
background-image: linear-gradient(120deg,rgb(192, 215, 245),rgb(217, 237, 250),rgb(178, 207, 245));
position: absolute;
top: 390px;
left: 115px;
padding: 10px;
}
.list h3{
width: 28px;
height: 130px;
margin-top: -10px;
margin-left: -5px;
font-weight: 600;
font-size: 18px;
/* background-color: #d5e3ff; */
background-color: #cce6f6;
color: #506f98;
border-radius: 0 0 10px 10px;
box-shadow: 2px 0 5px #b0c1dc;
}
.list ul{
width: 90%;
height: 300px;
margin-top: -120px;
margin-left: 45px;
padding: 0;
list-style-type: none;
}
.list li{
width: 460px;
height: 55px;
background-color: #fff;
overflow: hidden;
margin-bottom: 15px;
border-radius: 15px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 15px;
cursor: pointer;
}
.list p{
margin: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.list span{
font-size: 12px;
color: #5a5a5a;
margin-left: auto;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* 课表 */
.timetable{
width: 580px;
height: 330px;
/* background-color: #eee8f9; */
background-image: linear-gradient(rgb(234, 212, 251),rgb(219, 195, 238),rgb(218, 184, 244));
position: absolute;
top: 390px;
left: 730px;
}
.schedule{
width: 560px;
height: 310px;
margin: 10px;
/* background-color: #badfef; */
position: absolute;
}
.schedule p{
width: 25px;
height: 60px;
margin-top: -10px;
margin-left: -5px;
font-weight: 600;
font-size: 18px;
background-color: #cec0e7;
color: #876c9e;
border-radius: 0 0 10px 10px;
box-shadow: 2px 0 5px #beb0dc;
}
.schedule table{
width: 500px;
height: 280px;
margin-top: -50px;
margin-left: 40px;
background-color: #ffffff;
border: 1px solid rgb(187, 186, 186);
border-collapse: collapse;
}
.schedule table td{
text-indent: 0.7em;
border: 1px solid rgb(170, 170, 170);
}
.schedule table tr{
border: 1px solid rgb(170, 170, 170);
}
/* 图表 */
.chart{
width: 1200px;
height: 500px;
position: absolute;
left: 110px;
top: 750px;
/* background-color: #d8f2f7d7; */
background-image: linear-gradient(#d8f2f7d7,rgb(165, 232, 232),rgba(192, 244, 243, 0.916));
}
.chart h3 {
width: 25px;
height: 105px;
margin-top: -2px;
margin-left: 5px;
font-weight: 600;
font-size: 18px;
background-color: #c0e1e7;
color: #6c8c9e;
border-radius: 0 0 10px 10px;
box-shadow: 2px 0 5px #b0d0dc;
}
.line-graph{
width: 860px;
height: 420px;
padding: 10px;
margin-top: -90px;
margin-left: 160px;
background-color: #fff;
border-radius: 15px;
}
.box-count{
width: 270px;
height: 260px;
background-color: rgba(109, 148, 183, 0.233);
position: absolute;
right: 120px;
bottom: 70px;
border-radius: 30px;
border-bottom: 10px solid #476566;
border-right: 7px solid #476566;
}
.box-count p{
font-size: 20px;
text-align: center;
margin-top: 60px;
color: #689394;
}
.box-count{
font-size: 60px;
text-align: center;
}
.footer{
width: 1417px;
height: 60px;
position: absolute;
bottom: 0;
background-color: rgba(49, 67, 113, 0.4);
}

249
app-dm/src/pages/Home/Home.jsx Executable file
View File

@ -0,0 +1,249 @@
// import { Link } from 'react-router-dom'
import './Home.css';
import Ad from '../Home/img/ad.jpg'
import React,{ useEffect,useState } from 'react';
import axios from 'axios';
//
import { Line } from 'react-chartjs-2';
import { Chart as ChartJS, CategoryScale, LinearScale, PointElement, LineElement, Tooltip, Legend } from 'chart.js';
//
function Home(){
const outlog=()=>{
localStorage.removeItem('islogin')
// setisChecked(false)
alert('注销成功')
window.location.href='http://localhost:3000/signin'
};
const [isChecked,setisChecked]=useState(false)
//
// useEffect(()=>{
// if (!isChecked){
// const is_login=localStorage.getItem('islogin')
// if(!is_login){
// alert('')
// window.location.href='http://localhost:3000/signin'
// }else{
// console.log(is_login);
// console.log('');
// setisChecked(true)
// }
// //login
// }
// },[]);//
//
const [lesson, setLesson] = useState([]);
const [firstlesson, setfirstlesson] = useState([]);
const [secondlesson, setsecondlesson] = useState([]);
const [thirdlesson, setthirdlesson] = useState([]);
const [fourthlesson, setfourthlesson] = useState([]);
//
const student_succeed_func = async () => {
const student_ID=localStorage.getItem('islogin')
try{
const student_succeed_src=await axios.post('http://127.0.0.1:5000/student',{
student_ID
});
//
const student_succeed=student_succeed_src.data
const lesson_data=(student_succeed['student_lesson'])
setLesson(lesson_data)
}catch(error){
if(student_ID.length===6){
window.location.href='http://localhost:3000/teacher'
return
}else{
alert('提示出错')
console.log(error);
return
}
}
}
useEffect(()=>{
student_succeed_func()
},[])
useEffect(()=>{
if(lesson.length>0){
const firstlessonlist = lesson[0]['08:00-10:00'].split(',')
const secondlessonlist = lesson[1]['10:15-11:45'].split(',')
const thirdlessonlist = lesson[2]['13:15-15:15'].split(',')
const fourthlessonlist = lesson[3]['15:30-17:30'].split(',')
// //useState
setfirstlesson(firstlessonlist)
setsecondlesson(secondlessonlist)
setthirdlesson(thirdlessonlist)
setfourthlesson(fourthlessonlist)
// //
// console.log(firstlesson);
}
},[lesson])
const click=()=>{
console.log();
}
//线
//
const [chartData, setChartData] = useState({
labels: [], // X
datasets: [
{
label: '', //
data: [], // Y
fill: false,
backgroundColor:'#fff',
borderColor: 'rgb(75, 192, 192)',
tension: 0.1
}
]
});
//
const updateChartData = (data) => {
setChartData({
labels: ['4/2', '4/16', '4/27', '5/13', '5/21'],
datasets: [
{
label: '总体成绩分析',
// data: [10, 20, 30, 40, 50,60,70,80,90,100],
data:data,
fill: false,
backgroundColor:'#fff',
borderColor: 'rgb(75, 192, 192)',
tension: 0.1,
}
]
});
};
// //
const options = {
scales: {
y: {
beginAtZero: true,
}
},
plugins: {
legend: {
display: true
}
}
};
//
useEffect(() => {
updateChartData();
}, []);
// Chart.js
ChartJS.register(
CategoryScale,
LinearScale,
PointElement,
LineElement,
Tooltip,
Legend
);
//li
const handelTestClick = () => {
// 使window.location.hrefURL
window.location.href = '/subject';
};
return(
<div className="body-right-home">
<div className='ad'>
<p>欢迎来到达梦实训平台</p>
<span>吾日三省吾身,吃饭了吗,睡觉了吗,上达梦做题了吗</span>
<img src={Ad} alt="" height='190px' width='100%'/>
</div>
<div className='block'>
<div className='block-box'>
{/* 内容暂定 */}
</div>
</div>
<div className='box-two'>
<div className='list'>
<h3>练习和考试</h3>
<ul>
<li onClick={handelTestClick}>
<p>达梦数据库的安装</p>
<span>2024-4-5</span>
</li>
<li onClick={handelTestClick}>
<p>web前端开发与数据库的结合</p>
<span>2024-3-17</span>
</li>
<li onClick={handelTestClick}>
<p>暂定题目3</p>
<span>暂定时间3</span>
</li>
<li onClick={handelTestClick}>
<p>暂定题目3</p>
<span>暂定时间3</span>
</li>
</ul>
</div>
<div className='timetable'>
{/* 课表 */}
<div className='schedule'>
<p>课表</p>
<table>
<tbody>
<tr>
<td></td>
<td>星期一</td>
<td>星期二 </td>
<td>星期三</td>
<td>星期四 </td>
<td>星期五 </td>
</tr>
<tr>
<td>08:00-10:00</td>
{firstlesson.map((lesson, index) => (
<td key={index}>{lesson}</td>
))}
</tr>
<tr>
<td>10:15-11:45</td>
{secondlesson.map((lesson, index) => (
<td key={index}>{lesson}</td>
))}
</tr>
<tr>
<td>午休</td>
</tr>
<tr>
<td>13:15-15:15</td>
{thirdlesson.map((lesson, index) => (
<td key={index}>{lesson}</td>
))}
</tr>
<tr>
<td>15:30-17:30</td>
{fourthlesson.map((lesson, index) => (
<td key={index}>{lesson}</td>
))}
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div className='chart'>
<h3>分析图表</h3>
{/* 图表 (未完成)*/}
<div className='line-graph' >
<Line data={chartData} options={options}/>
</div>
{/* <img src="" alt="" /> */}
</div>
<div className='footer'></div>
</div>
)};
export default Home;

BIN
app-dm/src/pages/Home/img/ad.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,149 @@
/* 页面右边 */
.body-right-analyse{
width: 1420px;
height: 840px;
position: absolute;
left: 220px;
top: 70px;
border-radius: 10px;
background-color: #f7f8fa;
}
.test-analyse{
width: 100%;
height: 400px;
}
.test-analyse li{
cursor: pointer;
overflow: hidden;
width: 1140px;
height: 70px;
background-color: #ffffff;
margin-top: 15px;
margin-left: -20px;
border-radius: 10px;
box-shadow: 0px 1px 6px 0px #d8d8d8;
display: flex;
align-content: center;
}
.test-analyse img {
margin: 20px 10px 0 15px;
}
.test-analyse p{
margin-top: 8px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: start;
}
.p {
font-size: 18px;
}
.test-analyse span {
font-size: 13px;
margin-top: -12px;
color: #525252;
}
.right-vertical-nav {
width: 250px;
height: 100%;
position: absolute;
left: 1170px;
top: 0px;
background-color: #e5f6fb;
}
.right-vertical-nav p{
text-align: center;
display: block;
width: 100%;
height: 40px;
margin-top: 0cqh;
line-height: 40px;
background-color: rgb(182, 210, 212);
}
.right-vertical-nav ul{
margin-top: -16px;
}
.right-vertical-nav li{
overflow: hidden;
width: 119%;
height: 50px;
font-size: 18px;
text-align: center;
line-height: 50px;
margin-left: -40px;
}
.li-deep{
overflow: hidden;
width: 99.5%;
height: 50px;
font-size: 18px;
text-align: center;
line-height: 50px;
margin-left: -40px;
background-color: #cae3ea;
}
/* 弹窗内容 */
.outbox-test-analyse {
width: 870px;
height: 420px;
position: absolute;
top: 160px;
left: 150px;
background-color: #d1ece2ea;
z-index: 1;
}
.btn-test {
width: 30px;
height: 30px;
background-color: #b4c7c0;
border: none;
}
.btn-test:hover{
background-color: #e5fbf8;
}
/* 饼图 */
.pie-chart-container {
width: 300px;
height: 300px;
padding: 20px 30px;
position: absolute;
left: 60px;
top: 40px;
border-radius: 25px;
background-color: #fff;
}
.analyse-box ul{
width: 250px;
height: 200px;
/* background-color: #eefdf6; */
background-image: linear-gradient(#ecfff7,#dafbfd);
position: absolute;
top: 50px;
left: 480px;
padding: 40px;
box-shadow: 0px 2px 5px #cde7e0;
}
.analyse-box li{
width: 200px;
height: 50px;
font-size: 20px;
list-style-type: none;
padding: 10px;
}

View File

@ -0,0 +1,102 @@
import Computer from '../../Home/img/电脑.jpg'
import React,{ useState } from 'react';
import '../Analyse/AnalysePages.css'
import { Pie } from 'react-chartjs-2';
import 'chart.js/auto';
//
function SubjectPage(){
//li
const [SubjectModal,setSubjectModal] = useState(false);
const handleSubjectClick = () => {
setSubjectModal(!SubjectModal)
}
//
const handleSubjectModalClose = () => {
setSubjectModal(false);
};
//
const pieData = {
labels: ['判断题', '填空题', '简答题','实训题'],
datasets: [
{
label: '题目类型分布',
data: [30, 20, 10,40], //
backgroundColor: ['#FF6384', '#36A2EB', '#FFCE56','#a7f7b1'], //
hoverOffset: 4,
},
],
};
//
const pieOptions = {
plugins: {
legend: {
position: 'top',
},
title: {
display: true,
text: '题目类型分布',
},
},
};
return(
<div className="body-right-analyse">
<div className='test-analyse'>
{/* 内容 */}
<ul>
{[{class:'课程1:达梦数据库的安装',time:"关闭时间:2024-4-16 11.46",ImgSrc:Computer},
{class:'课程2:web前端开发与数据库的结合',time:"关闭时间:2024-4-16 11.46",ImgSrc:Computer},
{class:'课程2:web前端开发与数据库的结合',time:"关闭时间:2024-4-16 11.46",ImgSrc:Computer},
{class:'课程2:web前端开发与数据库的结合',time:"关闭时间:2024-4-16 11.46",ImgSrc:Computer},
{class:'课程2:web前端开发与数据库的结合',time:"关闭时间:2024-4-16 11.46",ImgSrc:Computer},
].map((item) =>
<li key={item.class} onClick={handleSubjectClick}>
<img src={item.ImgSrc} alt="" width='35px' height='35px'/>
<p>
<p className='p'>{item.class}</p>
<span>{item.time}</span>
</p>
</li>
)}
</ul>
</div>
<div className='right-vertical-nav'>
<p>课程</p>
<ul>
<li>达梦数据库</li>
<li className='li-deep'>数据结构</li>
<li>python</li>
</ul>
</div>
{SubjectModal && (
<div className='outbox-test-analyse'>
<div className="outbox">
<button className='btn-test' onClick={handleSubjectModalClose}>X</button>
{/* 饼图组件 */}
<div className="pie-chart-container">
<Pie data={pieData} options={pieOptions} />
</div>
<div className='analyse-box'>
{/* 图表或者文字分析 */}
<ul>
<li>总得分</li>
<li>分析</li>
<li>建议</li>
</ul>
</div>
</div>
</div>
)}
</div>
)};
export default SubjectPage;

View File

@ -0,0 +1,105 @@
/* 导航 */
.nav-test{
width: 100%;
height: 52px;
font-size: 20px;
background-color: rgb(255, 255, 255);
box-shadow: 3px 2px 2px #d4d4d4;
}
.nav1{
line-height:15px;
font-size: 20px;
margin-left: 100px;
font-weight: 500;
font-family: '微软雅黑';
}
.nav1 p{
font-size: 15px;
margin-top: 15px;
}
.nav1 h1{
font-size: 20px;
margin-top: 15px;
}
.time{
position: absolute;
right: 50px;
top: 8px;
}
/* 主体 */
.body-box{
display: flex;
align-content: center;
}
/* 左侧 */
.body-left-test{
width: 215px;
height: 840px;
box-shadow: 2px 2px 6px #d4d4d4;
}
.body-left-test p{
font-size: 16px;
padding: 0 10px;
}
.body-left-test ul{
width: 175px;
height: 240px;
border-top: 1px solid #7f7f7f;
}
.body-left-test li{
width: 75px;
height: 40px;
font-size: 18px;
list-style-type: none;
padding: 10px 75px;
margin-left: -40px;
line-height: 40px;
display: block;
cursor: pointer;
border-bottom: 1px solid #7f7f7f;
/* background-color:aliceblue; */
}
/* 右侧 */
.body-right-test{
width: 1403px;
height: 828px;
margin-top: 10px;
margin-left: 5px;
background-color: #fff;
}
/* 提交按钮 */
#submit{
position: absolute;
}
#choice_box input{
margin-top: 20px;
margin-left: 20px;
}
#choice_box td{
border-bottom: 2px solid rgb(111, 203, 242);
width: 2000px;
}
#comple_box td{
border-bottom: 2px solid rgb(111, 203, 242);
width: 2000px;
}
.input_txt{
border: none;
border-bottom: 1px solid black;
font-size: 16px;
font-family: 'heiti';
}

View File

@ -0,0 +1,274 @@
// import { Link } from 'react-router-dom';
// import React,{ useState } from 'react';
// import { createElement, useEffect } from 'react'
import './Exam.css'
import { useParams } from 'react-router';
import axios from 'axios';
import { useEffect, useState } from 'react';
//
function Exam(){
const {examId} = useParams()
const student_ID =localStorage.getItem('islogin')
//
const [countdown, setCountdown] = useState(0);
const Countdown=true
//
const [choice_answer,setchoice_answer]=useState({})
const [completion_answer,setcompletion_answer]=useState({})
const [judge_answer,setjudge_answer]=useState({})
const [testdata,settestdata]=useState('')
const test_func= async()=>{
try{
const test_src= await axios.post('http://127.0.0.1:5000/student/get_test',{student_ID})
const test_data=test_src.data['data']
settestdata(test_data)
}catch(error){
alert(error)
}
}
useEffect(()=>{
test_func()
},[])
//
useEffect(() => {
const examDuration = 10;
setCountdown(examDuration);
}, []);
//
const formatTime = (seconds) => {
const hours = Math.floor(seconds / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
const secs = seconds % 60;
return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
};
const [changetime,setchangetime]=useState(true)
//
useEffect(() => {
let interval = setInterval(() => {
if (countdown > 0) {
setCountdown(countdown - 1);
}else{
clearInterval(interval)
alert('时间到!已强制交卷')
//
let sum = 0;
for (let item of testdata[examId][0][0]) {
for (let i of item) {
if (i[6] === choice_answer[sum]) {
// 使
setscore(prevscore => prevscore + 2);
}else{
}
}
for(let item of testdata[examId][0][1]){
for(let i of item){
if(i[2]===completion_answer[sum]){
setscore(prevscore => prevscore + 2);
}else{
}
}
}
for(let item of testdata[examId][0][2]){
for(let i of item){
console.log(i);
if(i[2]===judge_answer[sum]){
setscore(prevscore => prevscore + 2);
}else{
}
}
}
sum++; // item sum 1
}
console.log(score);
}
}, 1000);
return () => clearInterval(interval);
}, [countdown]);
//
// score
const [score,setscore]=useState(0)
//
const submit = async() => {
alert('提交成功')
let sum = 0;
for (let item of testdata[examId][0][0]) {
for (let i of item) {
if (i[6] === choice_answer[sum]) {
// 使
setscore(prevscore => prevscore + 2);
}
}
for(let item of testdata[examId][0][1]){
for(let i of item){
if(i[2]===completion_answer[sum]){
setscore(prevscore => prevscore + 2);
}else{
}
}
}
for(let item of testdata[examId][0][2]){
for(let i of item){
if(i[2]===judge_answer[sum]){
setscore(prevscore => prevscore + 2);
}
}
}
sum++; // item sum 1
}
};
const [isMounted, setIsMounted] = useState(false);
useEffect(()=>{
if(isMounted){
const score_func=async()=>{
try{
const score_entry_src=await axios.post('http://127.0.0.1:5000/student/score_entry',{
student_ID,
score,
examId
})
console.log('能不能发送');
}catch(error){
alert(error)
}
window.location.href='http://localhost:3000/subject'
}
score_func()
}else{
setIsMounted(true)
}
},[score])
//
const handleOptionChange = (event) => {
const selectedValue = event.target.value;
const key = parseInt(event.target.name.replace('group', ''));
const updatedChoiceAnswer = { ...choice_answer, [key]: selectedValue };
setchoice_answer(updatedChoiceAnswer);
};
//
const handleInputChange = (event) => {
const { name, value } = event.target;
setcompletion_answer({
...completion_answer,
[name]: value
});
};
//
const handleJudgeOption=(event)=>{
const judgeoption=event.target.value;
const key=parseInt(event.target.name.replace('judge',''))
const updatedJudgeAnswer={ ...judge_answer,[key]:judgeoption}
setjudge_answer(updatedJudgeAnswer)
}
return(
<div className="test">
<div className='nav-test'>
{testdata&&<div className='nav1'>
<p>试卷ID:{examId}</p>
<p>发布人:{testdata[examId][5]}</p>
<div className='time'>
{/* 倒计时 */}
<h1>剩余时间{formatTime(countdown)}</h1>
</div>
</div>}
</div>
<div className='body-box'>
<div className="body-left-test">
<p>题目</p>
<ul>
<li>判断题</li>
<li>选择题</li>
<li>解答题</li>
</ul>
</div>
<div className='body-right-test'>
{/* 右边的题目 */}
<div id='choice_box'>
<span style={{color:'red'}}>选择题</span>
<table>
{testdata&&<thead>
{Object.keys(testdata[examId][0][0]).map((key)=>(
<tr key={key}>
<td>
<span style={{fontSize:'30px'}}>{parseInt(key,10)+1}:{testdata[examId][0][0][key][0][1]}</span>
<div>
<label><input type="radio" value={testdata[examId][0][0][key][0][2]} onChange={handleOptionChange} name={`group${key}`}/>A: {testdata[examId][0][0][key][0][2]}</label>
<br />
<label><input type="radio" value={testdata[examId][0][0][key][0][3]} onChange={handleOptionChange} name={`group${key}`}/>B: {testdata[examId][0][0][key][0][3]}</label>
<br />
<label><input type="radio" value={testdata[examId][0][0][key][0][4]} onChange={handleOptionChange} name={`group${key}`}/>C: {testdata[examId][0][0][key][0][4]}</label>
<br />
<label><input type="radio" value={testdata[examId][0][0][key][0][5]} onChange={handleOptionChange} name={`group${key}`}/>D: {testdata[examId][0][0][key][0][5]}</label>
</div>
</td>
</tr>
))}
</thead>}
</table>
</div>
{/* */}
<div id='comple_box'>
<span style={{color:'red'}}>填空题</span>
<table>
{ testdata&&<thead>
{Object.keys(testdata[examId][0][1]).map((key)=>(
<tr key={key}>
<td>
<div>
<p>{parseInt(key,10)+1}:{testdata[examId][0][1][key][0][1]}
<input type="text" className='input_txt' onChange={handleInputChange} name={key}/>
</p>
</div>
</td>
</tr>
))}
</thead>}
</table>
</div>
<div id='judge_box'>
<span style={{color:'red'}}>判断题</span>
{ testdata&&<table>
<thead>
{Object.keys(testdata[examId][0][2]).map((key)=>(
<tr>
<td key={key}>
<div>
<p>{parseInt(key,10)+1}:{testdata[examId][0][2][key][0][1]}</p>
<label><input type="radio" name={`judge${key}`} onChange={handleJudgeOption} value={true}/>T</label>
<label><input type="radio" name={`judge${key}`} onChange={handleJudgeOption} value={false}/>F</label>
</div>
</td>
</tr>
))}
</thead>
</table>}
</div>
<div>
<button id='submit' onClick={submit}>提交</button>
</div>
</div>
</div>
</div>
)};
export default Exam;

View File

@ -0,0 +1,87 @@
@import url('https://fonts.font.im/css?family=Caveat');
/* 右侧页面 */
.body-right-subject{
width: 1420px;
/* height: 840px; */
height: 100%;
position: absolute;
top: 72px;
left: 220px;
border-radius: 10px;
background-color: #f7f8fa;
}
/* 页面右边内容 */
.body-right-subject h3{
margin-left: 60px;
font-size: 20px;
margin-bottom: -5px;
}
.test-subject{
display:flex;
flex-wrap: wrap;
flex-direction: row;
margin-left: 40px;
margin-bottom: 60px;
}
.test-box{
flex-basis: calc(30.00% - 10PX);
box-sizing: border-box;
margin: 20px;
height: 210px;
/* background-image: linear-gradient(190deg,rgba(157, 246, 252, 0.7),rgba(255, 198, 229, 0.7)); */
background-image: linear-gradient(190deg,rgba(157, 246, 252, 0.7),rgba(198, 212, 255, 0.7));
border-radius: 15px;
line-height: 35px;
}
.test-box p{
font-size: 20px;
margin: 10px;
}
.test-box span{
margin-left: 15px;
}
.test-box div{
margin-left: 15px;
}
.exam-btn{
position: relative;
margin-top: -5px;
margin-left: 280px;
border-radius: 15px;
font-size: 17px;
border: none;
display: inline-block;
padding: 3px 32px;
background-color: rgba(175, 235, 230, 0.929);
color: #000;
text-decoration: none;
box-shadow: 3px 3px 5px rgba(127, 170, 166, 0.929);
}
.exam-btn:hover{
background-color: rgba(142, 222, 214, 0.929);
}
.exam-btn:active{
color:rgba(86, 117, 114, 0.929);
}
#score{
position: absolute;
margin-left: 290px;
margin-top: -135px;
font-size: 45px;
/* color: #ff6666; */
color: rgb(252, 102, 102);
font-family: 'Caveat', cursive;
}

View File

@ -0,0 +1,121 @@
import { Link } from 'react-router-dom';
import React,{ useState,useEffect } from 'react';
import './SubjectPage.css'
import axios from 'axios';
import moment from 'moment';
//
function SubjectPage(){
const student_ID=localStorage.getItem('islogin')
const [testdata,settestdata]=useState('')
const [time,settime]=useState(moment().format('YYYY-MM-DD HH:mm:ss'))
const [result,setresult]=useState({})
//ID
const test=async()=>{
try{
const test_src= await axios.post('http://127.0.0.1:5000/student/get_test',{student_ID})
settestdata(test_src.data['data'])
}catch(error){
alert(error)
}
}
useEffect(()=>{
test()
},[])
const [EndTestList,setEndTestList]=useState([])
//
const end_test=async()=>{
try{
const end_test_src=await axios.post('http://127.0.0.1:5000/student/get_end_student',{student_ID})
const obj=end_test_src.data['result']
setEndTestList(obj)
}catch(error){
alert(error)
}
}
useEffect(()=>{
end_test()
},[])
//
const [outtest,setouttest]=useState({})
//
const click = () => {
console.log(testdata);
};
//
useEffect(()=>{
let test_list= []
for (const key in testdata) {
if(testdata[key][4]<time || EndTestList.includes(Number(key))){
setouttest({...outtest,[key]:testdata[key]})
test_list.push(key)
}else{
}
}
//Object.fromEntries() JavaScript Object Object.entries()
const newOuttest = {...outtest,...Object.fromEntries(test_list.map(key => [key, testdata[key]]))};
// outtest
setouttest(newOuttest);
// testdata
test_list.forEach(key => delete testdata[key]);
find_result_func()
}, [testdata]);
const find_result_func=async()=>{
try{
const find_result=await axios.post('http://127.0.0.1:5000/student/fetch_result',{
student_ID
})
setresult(find_result.data['result'])
}catch{
alert('这里出错')
}
}
return(
<div className="body">
<div className="body-right-subject">
<h3>正在进行的考试与练习</h3>
{ testdata &&<div className='test-subject'>
{Object.keys(testdata).map((key)=>(
<div className='test-box' key={key}>
<p>试卷ID:{testdata[key][6]}</p>
<span>发布者:{testdata[key][5]}</span>
<div>发布时间:{testdata[key][3]}</div>
<div>截至时间:{testdata[key][4]}</div>
<Link to={`/exam/${testdata[key][6]}`} className="exam-btn">
考试
</Link>
</div>
))}
</div>}
<button onClick={click}>测试按钮</button>
<h3>已结束或完成的试卷与练习</h3>
{ outtest&& result&&<div className='test-subject'>
{Object.keys(outtest).map((key)=>{
const score = result[key] !== null ? result[key] + "分" : "缺考";
return(
<div className='test-box' key={key}>
<p>试卷ID:{outtest[key][6]}</p>
<span>发布者:{outtest[key][5]}</span>
<div>发布时间:{outtest[key][3]}</div>
<div>截至时间:{outtest[key][4]}</div>
<div id='score'>{score}</div>
</div>
)
})}
</div>}
</div>
</div>
)};
export default SubjectPage;

View File

@ -0,0 +1,101 @@
.nav-operation1{
height: 50px;
width: 99.5%;
margin-bottom: 5px;
box-shadow: 1px 1px 6px #d4d4d4;
}
.nav-operation1 p{
width: 200px;
height: 40px;
font-size: 20px;
line-height: 10px;
padding-right: 10px;
float: right;
}
.body-operation1{
display: flex;
flex-direction: column;
}
/* 第二页(实训题)的左边导航 */
.nav-left-operation1{
width: 215px;
height: 840px;
position: absolute;
box-shadow: 2px 2px 6px #d4d4d4;
}
.nav-left-operation1 p{
font-size: 16px;
padding: 0 10px;
}
.nav-left-ul1{
width: 175px;
height: 240px;
/* border-top: 1px solid #7f7f7f; */
position: relative;
border-top: 2px solid rgb(212, 212, 212);
}
.nav-left-ul1 li{
width: 65px;
height: 40px;
font-size: 18px;
list-style-type: none;
padding: 10px 75px;
margin-left: -40px;
line-height: 40px;
display: block;
cursor: pointer;
/* border-bottom: 1px solid #7f7f7f; */
background-color: #f5f5f5;
border-bottom: 2px solid rgb(212, 212, 212);
}
/* 下拉菜单 */
.dropdown-menu1 {
height: auto;
position: absolute;
top: 62px;
left: 0px;
z-index: 1000;
}
.dropdown-menu1 li{
background-color: rgb(255, 239, 239);
border-bottom: 2px solid rgb(253, 210, 210);
}
/* 显示下拉菜单 */
.subject-dropdown.open1 + .dropdown-menu1 {
display: block;
}
.subject-dropdown1 span{
position: absolute;
top: 15px;
left: 180px;
}
/* 第二页(实训题)的右边页面 */
.body-right1{
width: 1415px;
height: 845px;
position: absolute;
top: 64px;
left: 230px;
border-radius: 10px;
background-color: #f7f8fa;
}
/* 前进按钮 */
.btn-back1{
height: 50px;
position: absolute;
bottom: 50px;
right: 80px;
padding: 0 20px;
display: flex;
align-items: center;
/* border: 1px solid #000; */
box-shadow: 1px 2px 5px gray;
background-color: #efefef;
}
.btn-back1 p{
font-size: 20px;
margin-left: 5px;
}

View File

@ -0,0 +1,88 @@
import './Operation1.css'
import { Terminal } from "@xterm/xterm";
import "@xterm/xterm/css/xterm.css"
import React,{ MouseEvent, useEffect, useRef, useState } from "react";
import { Link } from 'react-router-dom';
import arrow from '../img/箭头1.jpg'
import bottom from '../img/bottom.jpg'
import top from '../img/top.jpg'
function Operation1() {
//
// const { OperationId } = useParams();
const [test_data, setTestData] = useState('');
const [countdown, setCountdown] = useState(0);
//
useEffect(() => {
const examDuration = 60 * 60; // 1
setCountdown(examDuration);
}, []);
//
useEffect(() => {
let interval = setInterval(() => {
if (countdown > 0) {
setCountdown(countdown - 1);
} else {
clearInterval(interval);
alert('考试时间到!');
}
}, 1000);
return () => clearInterval(interval);
}, [countdown]);
//
const formatTime = (seconds) => {
const hours = Math.floor(seconds / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
const secs = seconds % 60;
return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
};
//
const [isSubjectDropdownOpen, setIsSubjectDropdownOpen] = useState(false);
return (
<div>
<div className='nav-operation1'>
{/* 导航 */}
{/* <h1>{OperationId}</h1> */}
<p>剩余时间{formatTime(countdown)}</p>
</div>
<div className='body-operation1'>
<div className='nav-left-operation1'>
{/* 左边导航 */}
<p>题目</p>
<ul className='nav-left-ul1'>
<li className='subject-dropdown1' onClick={() => setIsSubjectDropdownOpen(!isSubjectDropdownOpen)}>
主观题
{isSubjectDropdownOpen ? <span className='list-img1'><img src={bottom} alt="" width='20px' height='20px'/></span> : <span><img src={top} alt="" width='20px' height='20px'/></span>}
{isSubjectDropdownOpen && (
<ul className='dropdown-menu1'>
<li>判断题</li>
<li>选择题</li>
<li>简答题</li>
{/* 子菜单项 */}
</ul>
)}
</li>
<Link to={`/operation2/1`} style={{color:'#000',textDecoration:'none'}}>
<li style={{ marginTop: isSubjectDropdownOpen ? '186px' : '0' }}>实训题</li>
</Link>
</ul>
</div>
<div className='body-right1'>
第一页主观题的右边页面
</div>
<Link className='btn-back1' to={`/operation2/1`} style={{color:'#000',textDecoration:'none'}}>
<img src={arrow} alt="" width='40px' height='40px' />
<p>下一页</p>
</Link>
</div>
</div>
)
}
export default Operation1;

View File

@ -0,0 +1,119 @@
.nav-operation2{
height: 50px;
width: 99.5%;
margin-bottom: 5px;
box-shadow: 1px 1px 6px #d4d4d4;
}
.nav-operation2 p{
width: 200px;
height: 40px;
font-size: 20px;
line-height: 10px;
padding-right: 10px;
float: right;
}
.body-operation2{
display: flex;
flex-direction: column;
}
/* 第二页(主观题)的左边导航 */
.nav-left-operation2{
width: 215px;
height: 840px;
position: absolute;
box-shadow: 2px 2px 6px #d4d4d4;
}
.nav-left-operation2 p{
font-size: 16px;
padding: 0 10px;
}
.nav-left-ul2{
width: 175px;
height: 240px;
/* border-top: 1px solid #7f7f7f; */
position: relative;
border-top: 2px solid rgb(212, 212, 212);
}
.nav-left-ul2 li{
width: 65px;
height: 40px;
font-size: 18px;
list-style-type: none;
padding: 10px 75px;
margin-left: -40px;
line-height: 40px;
display: block;
cursor: pointer;
/* border-bottom: 1px solid #7f7f7f; */
background-color: #f5f5f5;
border-bottom: 2px solid rgb(212, 212, 212);
}
/* 下拉菜单 */
.dropdown-menu2 {
height: auto;
position: absolute;
top: 62px;
left: 0px;
z-index: 1000;
}
.dropdown-menu2 li{
background-color: rgb(255, 239, 239);
border-bottom: 2px solid rgb(253, 210, 210);
}
/* 显示下拉菜单 */
.subject-dropdown.open2 + .dropdown-menu2 {
display: block;
}
.subject-dropdown2 span{
position: absolute;
top: 15px;
left: 180px;
}
/* 第二页(主观题)的右边页面 */
.body-right2{
width: 1415px;
height: 845px;
position: absolute;
top: 64px;
left: 230px;
border-radius: 10px;
background-color: #f7f8fa;
}
/* 返回按钮 */
.btn-back2{
height: 50px;
position: absolute;
bottom: 50px;
right: 230px;
padding: 0 20px;
display: flex;
align-items: center;
/* border: 1px solid #000; */
box-shadow: 1px 2px 5px gray;
background-color: #efefef;
}
.btn-back2 p{
font-size: 20px;
margin-right: 5px;
}
/* 前进按钮 */
.btn-out2{
height: 50px;
position: absolute;
bottom: 50px;
right: 80px;
padding: 0 20px;
display: flex;
align-items: center;
/* border: 1px solid #000; */
box-shadow: 1px 2px 5px gray;
background-color: #efefef;
}
.btn-out2 p{
font-size: 20px;
margin-left: 5px;
}

View File

@ -0,0 +1,138 @@
import './Operation2.css'
import { Terminal } from "@xterm/xterm";
import "@xterm/xterm/css/xterm.css"
import React,{ MouseEvent, useEffect, useRef, useState } from "react";
import { Link } from 'react-router-dom';
import arrow from '../img/箭头1.jpg'
import arrow1 from '../img/箭头左.jpg'
import bottom from '../img/bottom.jpg'
import top from '../img/top.jpg'
function Operation2() {
//
const terminalObj = useRef(null);
let sock = null;
const [terminal, setTerminal] = useState(null);
useEffect(() => {
if (terminal == null){
setTerminal(new Terminal({
cols: 80,
rows: 27,
fontSize: 23
}));
}
}, [])
// useEffect(() => {
// if (terminal != null){
// terminal.open(terminalObj.current );
// sock = new WebSocket("ws://192.168.0.40:8765");
// terminal.onData((data) => {
// sock?.send(data);
// });
// terminal.onSelectionChange((a, b) => {
// if (terminal.hasSelection()){
// navigator.clipboard.writeText(terminal.getSelection());
// }
// })
// setInterval(() => {
// sock?.send("heartbeat");
// }, 1000);
// sock.addEventListener("message", function (event) {
// console.log(event.data);
// terminal.write(event.data);
// });
// }
// }, [terminal])
function pasteContent(event) {
navigator.clipboard.readText().then((content) =>{
sock?.send(content);
})
event.preventDefault();
}
//
// const { OperationId } = useParams();
const [test_data, setTestData] = useState('');
const [countdown, setCountdown] = useState(0);
//
useEffect(() => {
const examDuration = 60 * 60; // 1
setCountdown(examDuration);
}, []);
//
useEffect(() => {
let interval = setInterval(() => {
if (countdown > 0) {
setCountdown(countdown - 1);
} else {
clearInterval(interval);
alert('考试时间到!');
}
}, 1000);
return () => clearInterval(interval);
}, [countdown]);
//
const formatTime = (seconds) => {
const hours = Math.floor(seconds / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
const secs = seconds % 60;
return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
};
//
const [isSubjectDropdownOpen, setIsSubjectDropdownOpen] = useState(false);
return (
<div>
<div className='nav-operation2'>
{/* 导航 */}
{/* <h1>{OperationId}</h1> */}
<p>剩余时间{formatTime(countdown)}</p>
</div>
<div className='body-operation2'>
<div className='nav-left-operation2'>
{/* 左边导航 */}
<p>题目</p>
<ul className='nav-left-ul2'>
<Link to='/operation1/实训一:数据库的安装' style={{color:'#000',textDecoration:'none'}}>
<li className='subject-dropdown2' onClick={() => setIsSubjectDropdownOpen(!isSubjectDropdownOpen)}>
主观题
{isSubjectDropdownOpen ? <span className='list-img2'><img src={bottom} alt="" width='20px' height='20px'/></span> : <span><img src={top} alt="" width='20px' height='20px'/></span>}
{isSubjectDropdownOpen && (
<ul className='dropdown-menu2'>
<li>判断题</li>
<li>选择题</li>
<li>简答题</li>
{/* 子菜单项 */}
</ul>
)}
</li>
</Link>
<li style={{ marginTop: isSubjectDropdownOpen ? '186px' : '0' }}>实训题</li>
</ul>
</div>
<div className='body-right2'>
第二页实训题的右边页面
<div style={{width: "1430px",position:'absolute',right:'0'}} ref={terminalObj} onContextMenu={pasteContent}></div>
</div>
<Link className='btn-back2' to='/operation1/实训一:数据库的安装' style={{color:'#000',textDecoration:'none'}}>
<p>上一页</p>
<img src={arrow1} alt="" width='40px' height='40px' />
</Link>
<Link className='btn-out2' to='/train' style={{color:'#000',textDecoration:'none'}}>
<img src={arrow} alt="" width='40px' height='40px' />
<p>完成</p>
</Link>
</div>
</div>
)
}
export default Operation2;

View File

@ -0,0 +1,74 @@
.body-right-training{
width: 1420px;
/* height: 840px; */
height: 100%;
position: absolute;
top: 72px;
left: 220px;
border-radius: 10px;
background-color: #f7f8fa;
}
/* 页面右边内容 */
.body-right-training h3{
margin-left: 60px;
font-size: 20px;
margin-bottom: -5px;
}
.test-training{
display:flex;
flex-wrap: wrap;
flex-direction: row;
margin-left: 40px;
margin-bottom: 60px;
}
.test-box-training{
flex-basis: calc(30.00% - 10PX);
box-sizing: border-box;
margin: 20px;
height: 200px;
background-image: linear-gradient(190deg,rgba(157, 246, 252, 0.7),rgba(198, 212, 255, 0.7));
border-radius: 15px;
line-height: 35px;
}
.test-box-training p{
font-size: 20px;
margin: 10px;
}
.test-box-training span{
margin-left: 15px;
}
.test-box-training div{
margin-left: 15px;
}
.exam-btn-training{
position: relative;
margin-top: 50px;
margin-left: 250px;
border-radius: 15px;
font-size: 17px;
border: none;
display: inline-block;
padding: 3px 32px;
background-color: rgba(175, 235, 230, 0.929);
color: #000;
text-decoration: none;
box-shadow: 3px 3px 5px rgba(127, 170, 166, 0.929);
}
.exam-btn-training:hover{
background-color: rgba(142, 222, 214, 0.929);
}
.exam-btn-training:active{
color:rgba(86, 117, 114, 0.929);
}

View File

@ -0,0 +1,45 @@
import React,{ useState } from 'react';
import { Link } from 'react-router-dom';
import '../Training/TrainingPage.css'
const list3=[
{'train':'实训一:数据库的安装',id:'1'},
{'train':'实训二web前端开发和数据库的结合',id:'2'}
]
const list4=[
{'train':'实训3待定',id:'3'},
{'train':'实训4待定',id:'4'}
]
//
function SubjectPage(){
return(
<div className="body-right-training">
<h3>未完成练习</h3>
<div className='test-training'>
{list3.map((item) =>(
<div className='test-box-training'key={item.id}>
<p>{item.train}</p>
<span>发布者陈老师</span>
<div dangerouslySetInnerHTML={{ __html: item.title }} />
<Link to={`/operation1/${item.train}`} className="exam-btn-training">
开始实训
</Link>
</div>))}
</div>
<h3>已完成练习</h3>
<div className='test-training'>
{list4.map((item) => (
<div className='test-box-training'key={item.id}>
<p>{item.train}</p>
<div>
{item.title}
</div>
</div>))}
</div>
</div>
)};
export default SubjectPage;

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,146 @@
.sign-box{
width: 100%;
height: 890px;
margin-top: 10px;
position: relative;
background-image: linear-gradient(rgba(131, 244, 254, 0.6),rgba(172, 220, 255, 0.6),rgba(229, 210, 255, 0.6));
}
.sign-window{
height: 620px;
width: 1220px;
position: absolute;
left: 50%;
top: 50%;
margin-top: -310px;
margin-left: -550px;
display: flex;
align-content: center;
}
form{
width: 430px;
height: 550px;
background-color: #fff;
margin-top: 40px;
margin-right: 60px;
border-radius: 10px;
box-shadow: 0 15px 30px rgba(216, 205, 246, 0.5);
display: flex;
flex-direction: column;
justify-content: center;
align-items: end;
}
/* 标题 */
h1{
margin-right: 190px;
margin-top: -10px;
font-size: 28px;
font-weight: 520;
}
/* 表单 */
.form-group{
margin-right:30px
}
.form-group input{
height: 36px;
width: 280px;
margin-top: 20px;
margin-left: 10px;
text-indent: 1em;
border-radius: 10px;
border: 0.5px solid rgb(177, 177, 177);
outline-color:#a1c1f4;
}
/* 班级列(下拉菜单) */
.class-select{
height: 40px;
width: 285px;
margin-top: 20px;
margin-left: 10px;
text-indent: 1em;
border-radius: 10px;
border: 0.5px solid rgb(177, 177, 177);
outline-color:#a1c1f4;
color: rgb(122, 122, 122);
}
/* 性别列 */
.form-group-gender{
margin-right:145px;
margin-top:20px;
}
.gender-box input{
height: 15px;
width: 15px;
}
.gender-box p{
height: 15px;
width: 15px;
}
.gender-box-ul{
display: flex;
align-content: center;
margin-top: -5px;
}
.gen-choice{
overflow: hidden;
display: flex;
align-content: center;
margin-left: 60px;
margin-top: -20px;
display: flex;
flex-direction: row;
align-items: center;
}
.form-button{
margin-top: 10px;
margin-right: 80px;
}
.btn-sign1{
margin-left: 60px;
font-size: 17px;
border: none;
display: inline-block;
padding: 8px 120px;
background-color: #dfd1fc;
color: #000;
text-decoration: none;
border-radius: 18px;
}
.pic1{
width: 720px;
height: 620px;
float: right;
}
.error-message {
color: rgb(255, 91, 91);
font-size: 11px;
/* margin-top: 5px;
margin-left: 100px; */
position: absolute;
left: 130px;
}
.is-invalid {
border-color: red;
animation: error-blink 1s infinite;
}
@keyframes error-blink {
100% { border-color: red; }
}

View File

@ -0,0 +1,181 @@
import { Link } from 'react-router-dom'
import React, { useState } from 'react';
import api from '../../api';
import classnames from 'classnames';
import './SignUpForm.css'
import Sign from './注册页面右.png'
import axios from 'axios';
function SignUpForm(){
const [formData, setFormData] = useState({
name: "",
ID: "",
password: "",
Class: "",
gender: "",
errors: {}
});
const onSubmit = (e) => {
e.preventDefault();
api.register({
name: formData.name,
ID: formData.ID,
password: formData.password,
Class: formData.Class,
gender: formData.gender
}).then(res => {
console.log(res.data);
setFormData({ ...formData, errors: res.data });
}).catch(error => {
console.log(error);
});
};
const changeHandle = (e) => {
const { name, value } = e.target;
let errors = { ...formData.errors };
//
if (!value) {
errors[name] = '此字段不能为空';
} else {
delete errors[name];
}
setFormData({ ...formData, [name]: value, errors });
};
const genderChangeHandle = (e) => {
setFormData({
...formData,
gender: e.target.value,
errors: { ...formData.errors, gender: '' }
});
};
const { name, ID, password, Class, gender, errors } = formData;
const register_btn= async ()=>{
try{
if(name!==8){
alert('学号错误')
return
}
const register_func=await axios.post('http://127.0.0.1:5000/register',{
name,
ID,
password,
Class,
gender
})
const register_data=register_func.data
if (register_data.result==='注册成功'){
alert('注册成功')
window.location.href='http://localhost:3000/signin'
}else if(register_data.result==='注册失败'){
alert('账号已存在')
}
}catch(error){
alert(error)
}
}
return (
<div className='sign-box'>
<div className='sign-window'>
<form onSubmit={onSubmit}>
<h1>注册</h1>
<div className='form-group'>
<label className='control-label'>Username</label>
<input
className={classnames('form-control', {'is-invalid': errors.name})}
type='text'
name='name'
value={name}
onChange={changeHandle}
placeholder='请输入用户名'
/>
{errors.name && <div className="error-message">{errors.name}</div>}
</div>
<div className='form-group'>
<label className='control-label'>ID</label>
<input
className={classnames('form-control', {'is-invalid': errors.ID})}
type='text'
name='ID'
value={ID}
onChange={changeHandle}
placeholder='请输入学号'
/>
{errors.ID && <div className="error-message">{errors.ID}</div>}
</div>
<div className='form-group'>
<label className='control-label'>Password</label>
<input
className={classnames('form-control', {'is-invalid': errors.password})}
type='password'
name='password'
value={password}
onChange={changeHandle}
placeholder='请输入密码'
/>
{errors.password && <div className="error-message">{errors.password}</div>}
</div>
<div className='form-group'>
<label className='control-label'>Class</label>
<select
name="Class"
value={Class}
onChange={changeHandle}
className='class-select'
>
<option value="">请选择班级</option>
<option value="2024级一班">2024级一班</option>
<option value="2024级二班">2024级二班</option>
<option value="2024级三班">2024级三班</option>
</select>
{errors.Class && <div className="error-message">{errors.Class}</div>}
</div>
<div className='form-group-gender'>
<label className='control-label'>Gender:</label>
<div className='gender-box'>
<ul className='gender-box-ul'>
<li className='gen-choice'>
<input
type ="radio"
name="gender"
value="男"
checked={gender === '男'}
onChange={genderChangeHandle}
/>
<p></p>
</li>
<li className='gen-choice'>
<input
type="radio"
name="gender"
value="女"
checked={gender === '女'}
onChange={genderChangeHandle}
/>
<p></p>
</li>
</ul>
</div>
</div>
<div className='form-button'>
<Link className="btn-sign1" onClick={register_btn}>
注册
</Link>
</div>
</form>
<div className='pic1'>
<img src={ Sign } alt="" width="610px"/>
</div>
</div>
</div>
);
};
export default SignUpForm;

View File

@ -0,0 +1,15 @@
import React from 'react';
import SignUpForm from './SignUpForm';
//
function SignUpPage() {
return (
<div className='row'>
<div className='col-md-6'>
<SignUpForm/>
</div>
</div>
);
}
export default SignUpPage;

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

View File

@ -0,0 +1,130 @@
.Login{
position: relative;
}
.box{
height: 550px;
width: 1100px;
background-image: linear-gradient(rgba(131, 244, 254, 0.6),rgba(172, 220, 255, 0.6),rgba(229, 210, 255, 0.6));
position: absolute;
left: 50%;
top: 50%;
margin-top: 80px;
margin-left: -620px;
display: flex;
align-content: center;
padding: 75px;
/* border: 10px solid ; */
box-shadow: 0px -20px 20px 0px rgba(131, 244, 254, 0.6), 0 20px 20px 2px rgba(229, 210, 255, 0.6);
}
.pic{
height:500px;
width: 600px;
margin-top: 10px;
margin-left: -50px;
}
.contains{
height:460px;
width: 460px;
margin-top: 25px;
margin-left: 140px;
margin-right: 25px;
border-radius: 15px;
box-shadow: 0 15px 30px rgba(226, 217, 249,0.5);
background-color: #fff;
}
.contains p{
font-size: 25px;
text-align: center;
margin-bottom: -10px;
font-family: '楷书';
}
.contains ul{
margin-left: 10px;
}
.contains li{
overflow: hidden;
}
.contains li input{
height: 38px;
width: 280px;
margin-top: 30px;
text-indent: 1em;
border-radius: 10px;
border: 0.5px solid rgb(177, 177, 177);
outline-color:#a1c1f4;
}
.remember{
margin-top: 20px;
margin-left: 50px;
}
.btn{
margin-top: 20px;
}
.btn-login{
width: 100px;
height: 38px;
margin-left: 63px;
font-size: 17px;
background-color: #dfd1fc;
border-radius: 18px;
border: none;
}
.btn-sign{
margin-left: 60px;
font-size: 17px;
border: none;
display: inline-block;
padding: 8px 32px;
background-color: #dfd1fc;
color: #000;
text-decoration: none;
border-radius: 18px;
}
button:hover{
background-color: #d2d1fc;
cursor: pointer;
}
.btn-sign:hover{
background-color: #d2d1fc;
cursor: pointer;
}
button:active{
box-shadow: 2px 2px 15px rgba(206, 205, 205, 0.5);
}
.forget{
float: right;
margin-top: 112px;
margin-right: 30px;
font-size: 15px;
color: #4164d7;
text-decoration: underline;
}
.forget:hover{
color: #241987;
cursor: pointer;
}
.forget:active{
color: #755aa0;
}

View File

@ -0,0 +1,78 @@
import { Link } from 'react-router-dom'
import "./SignInPage.css"
import Login from "./登录页面左.png"
import React,{ useState } from 'react'
import axios from 'axios'
//
function SignInPage(){
const [ID,setID] = useState('');
const [password,setpassword] = useState('');
const login = async () => {
try {
const login_data = await axios.post('http://127.0.0.1:5000/login', {
ID,
password
});
//
const data=login_data.data
if (data.result === '登录成功' && data.user==='user'){
localStorage.setItem('islogin',ID)
alert('用户登录成功')
window.location.href='http://localhost:3000'//
}else if(data.result==='登录成功'&&data.user==='teacher'){
localStorage.setItem('islogin',ID)
alert('教师登录成功')
window.location.href='http://localhost:3000/teacher'//
}else{
alert('账号或密码错误')
setID('')
setpassword('')
}
if(data.result==='账号不存在'){
alert('账号不存在,请先注册')
setID('')
setpassword('')
}
} catch (error) {
//
alert('网络出现异常')
}
}
return(
<div className="Login">
<div className="box">
<div className="pic">
<img src={ Login } alt="" width="620px" />
</div>
<div className="contains">
<p>欢迎来到达梦实训平台</p>
<ul>
<li>
<input type="text" placeholder="账号" value={ID} onChange={(e) => setID(e.target.value)}/>
</li>
<li>
<input type="password" placeholder="密码" value={password} onChange={(e) => setpassword(e.target.value)}/>
</li>
</ul>
<div className="remember">
<input type ="checkbox"/>
<span className="rem-pwd">记住密码</span>
</div>
<div className="btn">
<button className="btn-login" onClick={login}>登录</button>
<Link to="/signup" className="btn-sign">
注册
</Link>
</div>
<span className="forget">忘记密码?</span>
</div>
</div>
</div>
)};
export default SignInPage;

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 KiB

10
app-dm/src/postcss.config.js Executable file
View File

@ -0,0 +1,10 @@
//postcss.config.js
//{ tailwindcss }
module.exports={
plugins:{
plugins:{
tailwindcss:{},
autoprefixer:{},
}
}
}

13
app-dm/src/reportWebVitals.js Executable file
View File

@ -0,0 +1,13 @@
const reportWebVitals = onPerfEntry => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;

89
app-dm/src/router/index.jsx Executable file
View File

@ -0,0 +1,89 @@
// import {getState} from 'react'
import { BrowserRouter, Outlet, Route ,Routes} from 'react-router-dom';
//
import SignUpPage from '../pages/SighUp/SignUpPage';
import SignInPage from '../pages/SignIn/SignInPage';
//
import HeaderNav from '../nav/nav';
import HeaderNavTeacher from '../nav/teacherIndex';
//
import Home from '../pages/Home/Home';
import SubjectPage from '../pages/ListPages/Subject/SubjectPage';
import AnalysePage from '../pages/ListPages/Analyse/AnalysePages';
import Training from '../pages/ListPages/Training/TrainingPage';
import Exam from '../pages/ListPages/Subject/Exam';
import Operation1 from '../pages/ListPages/Training/Operation1';
import Operation2 from '../pages/ListPages/Training/Operation2';
//
import TeacherPage from '../TeacherPages/TeacherPage';
import ClassID from '../TeacherPages/classlistpages/classId';
import ManageTest from '../TeacherPages/teachermanagetest/ManageTest';
import SendTest from '../TeacherPages/SendTest/SendTest';
import Marking from '../TeacherPages/MarkingPages/Marking';
import SendTrain from '../TeacherPages/SendTrain/SendTrain';
import Trainmanage from '../TeacherPages/Trainmanage/Trainmanage'
// (exam)使
const MainLayout = ({ headerNav:HeaderNav }) => {
return (
<>
<HeaderNav />
<main>
{/* Outlet将在这里渲染子路由组件 */}
<Outlet />
</main>
</>
);
};
function App() {
return (
<>
{/* 创建路由 */}
<BrowserRouter>
<Routes>
{/* 使用 HeaderNav 的用户页面 */}
<Route path="/" element={<MainLayout headerNav={HeaderNav} />}>
<Route index element={<Home />} />
<Route path="analyse" element={<AnalysePage />} />
<Route path='subject' element={<SubjectPage/>} />
<Route path='train' element={<Training/>}/>
{/* 其他需要HeaderNav的页面 */}
</Route>
{/* 使用 HeaderNavTeacher 的教师页面 */}
<Route path="/teacher" element={<MainLayout headerNav={HeaderNavTeacher} />}>
<Route index element={<TeacherPage/>} />
<Route path='managetest' element={<ManageTest />}/>
<Route path='managetest/:ClassID' element={<ManageTest />}/>
<Route path="classID/:key" element={<ClassID />} />
<Route path='mark' element={<Marking/>}/>
<Route path='Trainmanage' element={<Trainmanage/>}/>
{/* 其他需要HeaderNavTeacher的页面 */}
</Route>
<Route path="/classID/:key" element={<MainLayout headerNav={HeaderNavTeacher} />}>
<Route index element={<ClassID/>} />
</Route>
{/* 页面使用单独的布局不包含HeaderNav和HeaderNavTeacher */}
<Route path="exam/:examId" element={<Exam />} />
<Route path='/teacher/sendtest' element={<SendTest />}/>
<Route path='operation1/:operateID' element={<Operation1/>}/>
<Route path='operation2/:operateID' element={<Operation2/>}/>
<Route path='/teacher/SendTrain' element={<SendTrain/>}/>
{/* 独立的顶级路由如登录页面也不包含HeaderNav */}
{/* 登录页面 */}
<Route path="signin" element={<SignInPage />} />
{/* 注册页面 */}
<Route path="signup" element={<SignUpPage />} />
</Routes>
</BrowserRouter>
</>
);
}
export default App;

5
app-dm/src/setupTests.js Executable file
View File

@ -0,0 +1,5 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';

54
app-dm/src/utils/request.js Executable file
View File

@ -0,0 +1,54 @@
const express = require('express');
const router = express.Router();
const validator = require('validator');
const isEmpty = require('lodash/isEmpty')
// const sqlFn = require('./config') // 未使用
// { 判断注册表单是否为空 }
/**
* 如果发生错误则返回错误信息如果没发生错误则返回true
*/
const validatorInput = (data) =>{
/**
* validator.isEmpty方法验证是否为空
*/
let errors={}
if (validator.isEmpty(data.name)){
errors.name = '用户名不能为空'
}
if (validator.isEmpty(data.ID)){
errors.ID = '学号不能为空'
}
if (validator.isEmpty(data.password)){
errors.password = '密码不能为空'
}
if (validator.isEmpty(data.Class)){
errors.Class = '班级不能为空'
}
if (validator.isEmpty(data.gender)){
errors.gender = '性别不能为空'
}
return{
//如果value为空那么返回true否则返回false
isValid:!isEmpty(errors),
errors
}
}
router.post('/register',(req,res) =>{
const { isValid,errors } = validatorInput(req.body)
if(isValid){
//失败
res.send(errors)
}else{
//成功
res.send({
msg:"seccess"
})
}
})
module.exports = router;

11
app-dm/src/vite.config.js Executable file
View File

@ -0,0 +1,11 @@
// vite.config.js
import legacy from '@vitejs/plugin-legacy'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: [
legacy({
targets: ['defaults', 'not IE 11'],
}),
],
})

11
app-dm/tailwind.config.js Executable file
View File

@ -0,0 +1,11 @@
//taliwind.config.js
module.exports = {
purge:[],
darkMode:false, // or 'media' or 'class'
theme:{
extend:{},
},
variants:{},
plugin:[],
}

View File

@ -0,0 +1,6 @@
.git
.gitignore
.github
.gitattributes
READMETEMPLATE.md
README.md

View File

@ -0,0 +1,20 @@
# This file is globally distributed to all container image projects from
# https://github.com/linuxserver/docker-jenkins-builder/blob/master/.editorconfig
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
# trim_trailing_whitespace may cause unintended issues and should not be globally set true
trim_trailing_whitespace = false
[{Dockerfile*,**.yml}]
indent_style = space
indent_size = 2
[{**.sh,root/etc/s6-overlay/s6-rc.d/**,root/etc/cont-init.d/**,root/etc/services.d/**}]
indent_style = space
indent_size = 4

44
docker/docker-code-server/.gitignore vendored Normal file
View File

@ -0,0 +1,44 @@
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
# =========================
# Operating System Files
# =========================
# OSX
# =========================
.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
.jenkins-external

View File

@ -0,0 +1,57 @@
FROM ghcr.io/linuxserver/baseimage-ubuntu:jammy
# set version label
ARG BUILD_DATE
ARG VERSION
ARG CODE_RELEASE
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="aptalca"
# environment settings
ARG DEBIAN_FRONTEND="noninteractive"
ENV HOME="/config"
RUN \
echo "**** install runtime dependencies ****" && \
apt-get update && \
apt-get install -y \
git \
jq \
libatomic1 \
nano \
net-tools \
netcat \
# 安装python nodejs
python3 \
python3-pip \
nodejs \
npm \
sudo && \
echo "**** install code-server ****" && \
if [ -z ${CODE_RELEASE+x} ]; then \
CODE_RELEASE=$(curl -sX GET https://api.github.com/repos/coder/code-server/releases/latest \
| awk '/tag_name/{print $4;exit}' FS='[""]' | sed 's|^v||'); \
fi && \
mkdir -p /app/code-server && \
curl -o \
/tmp/code-server.tar.gz -L \
"https://github.com/coder/code-server/releases/download/v${CODE_RELEASE}/code-server-${CODE_RELEASE}-linux-amd64.tar.gz" && \
tar xf /tmp/code-server.tar.gz -C \
/app/code-server --strip-components=1 && \
echo "**** clean up ****" && \
apt-get clean && \
rm -rf \
/config/* \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*
# 安装达梦数据库
RUN mkdir -p /opt/dm8.zip && \
wget -O root/opt/dm8.zip https://download.dameng.com/eco/adapter/DM8/202401END/dm8_20240408_x86_rh7_64.zip
# add local files
COPY /root /
# ports and volumes
EXPOSE 8443

1012
docker/docker-code-server/Jenkinsfile vendored Normal file

File diff suppressed because it is too large Load Diff

674
docker/docker-code-server/LICENSE Executable file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@ -0,0 +1,332 @@
<!-- DO NOT EDIT THIS FILE MANUALLY -->
<!-- Please read https://github.com/linuxserver/docker-code-server/blob/master/.github/CONTRIBUTING.md -->
[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)](https://linuxserver.io)
[![Blog](https://img.shields.io/static/v1.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=linuxserver.io&message=Blog)](https://blog.linuxserver.io "all the things you can do with our containers including How-To guides, opinions and much more!")
[![Discord](https://img.shields.io/discord/354974912613449730.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=Discord&logo=discord)](https://discord.gg/YWrKVTn "realtime support / chat with the community and the team.")
[![Discourse](https://img.shields.io/discourse/https/discourse.linuxserver.io/topics.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=discourse)](https://discourse.linuxserver.io "post on our community forum.")
[![Fleet](https://img.shields.io/static/v1.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=linuxserver.io&message=Fleet)](https://fleet.linuxserver.io "an online web interface which displays all of our maintained images.")
[![GitHub](https://img.shields.io/static/v1.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=linuxserver.io&message=GitHub&logo=github)](https://github.com/linuxserver "view the source for all of our repositories.")
[![Open Collective](https://img.shields.io/opencollective/all/linuxserver.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=Supporters&logo=open%20collective)](https://opencollective.com/linuxserver "please consider helping us by either donating or contributing to our budget")
The [LinuxServer.io](https://linuxserver.io) team brings you another container release featuring:
* regular and timely application updates
* easy user mappings (PGID, PUID)
* custom base image with s6 overlay
* weekly base OS updates with common layers across the entire LinuxServer.io ecosystem to minimise space usage, down time and bandwidth
* regular security updates
Find us at:
* [Blog](https://blog.linuxserver.io) - all the things you can do with our containers including How-To guides, opinions and much more!
* [Discord](https://discord.gg/YWrKVTn) - realtime support / chat with the community and the team.
* [Discourse](https://discourse.linuxserver.io) - post on our community forum.
* [Fleet](https://fleet.linuxserver.io) - an online web interface which displays all of our maintained images.
* [GitHub](https://github.com/linuxserver) - view the source for all of our repositories.
* [Open Collective](https://opencollective.com/linuxserver) - please consider helping us by either donating or contributing to our budget
# [linuxserver/code-server](https://github.com/linuxserver/docker-code-server)
[![Scarf.io pulls](https://scarf.sh/installs-badge/linuxserver-ci/linuxserver%2Fcode-server?color=94398d&label-color=555555&logo-color=ffffff&style=for-the-badge&package-type=docker)](https://scarf.sh)
[![GitHub Stars](https://img.shields.io/github/stars/linuxserver/docker-code-server.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github)](https://github.com/linuxserver/docker-code-server)
[![GitHub Release](https://img.shields.io/github/release/linuxserver/docker-code-server.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github)](https://github.com/linuxserver/docker-code-server/releases)
[![GitHub Package Repository](https://img.shields.io/static/v1.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=linuxserver.io&message=GitHub%20Package&logo=github)](https://github.com/linuxserver/docker-code-server/packages)
[![GitLab Container Registry](https://img.shields.io/static/v1.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=linuxserver.io&message=GitLab%20Registry&logo=gitlab)](https://gitlab.com/linuxserver.io/docker-code-server/container_registry)
[![Quay.io](https://img.shields.io/static/v1.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=linuxserver.io&message=Quay.io)](https://quay.io/repository/linuxserver.io/code-server)
[![Docker Pulls](https://img.shields.io/docker/pulls/linuxserver/code-server.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=pulls&logo=docker)](https://hub.docker.com/r/linuxserver/code-server)
[![Docker Stars](https://img.shields.io/docker/stars/linuxserver/code-server.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=stars&logo=docker)](https://hub.docker.com/r/linuxserver/code-server)
[![Jenkins Build](https://img.shields.io/jenkins/build?labelColor=555555&logoColor=ffffff&style=for-the-badge&jobUrl=https%3A%2F%2Fci.linuxserver.io%2Fjob%2FDocker-Pipeline-Builders%2Fjob%2Fdocker-code-server%2Fjob%2Fmaster%2F&logo=jenkins)](https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-code-server/job/master/)
[![LSIO CI](https://img.shields.io/badge/dynamic/yaml?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=CI&query=CI&url=https%3A%2F%2Fci-tests.linuxserver.io%2Flinuxserver%2Fcode-server%2Flatest%2Fci-status.yml)](https://ci-tests.linuxserver.io/linuxserver/code-server/latest/index.html)
[Code-server](https://coder.com) is VS Code running on a remote server, accessible through the browser.
- Code on your Chromebook, tablet, and laptop with a consistent dev environment.
- If you have a Windows or Mac workstation, more easily develop for Linux.
- Take advantage of large cloud servers to speed up tests, compilations, downloads, and more.
- Preserve battery life when you're on the go.
- All intensive computation runs on your server.
- You're no longer running excess instances of Chrome.
[![code-server](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/code-server-banner.png)](https://coder.com)
## Supported Architectures
We utilise the docker manifest for multi-platform awareness. More information is available from docker [here](https://distribution.github.io/distribution/spec/manifest-v2-2/#manifest-list) and our announcement [here](https://blog.linuxserver.io/2019/02/21/the-lsio-pipeline-project/).
Simply pulling `lscr.io/linuxserver/code-server:latest` should retrieve the correct image for your arch, but you can also pull specific arch images via tags.
The architectures supported by this image are:
| Architecture | Available | Tag |
| :----: | :----: | ---- |
| x86-64 | ✅ | amd64-\<version tag\> |
| arm64 | ✅ | arm64v8-\<version tag\> |
| armhf | ❌ | |
## Application Setup
Access the webui at `http://<your-ip>:8443`.
For github integration, drop your ssh key in to `/config/.ssh`.
Then open a terminal from the top menu and set your github username and email via the following commands
```bash
git config --global user.name "username"
git config --global user.email "email address"
```
### Hashed code-server password
How to create the [hashed password](https://github.com/cdr/code-server/blob/master/docs/FAQ.md#can-i-store-my-password-hashed).
## Usage
To help you get started creating a container from this image you can either use docker-compose or the docker cli.
### docker-compose (recommended, [click here for more info](https://docs.linuxserver.io/general/docker-compose))
```yaml
---
services:
code-server:
image: lscr.io/linuxserver/code-server:latest
container_name: code-server
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- PASSWORD=password #optional
- HASHED_PASSWORD= #optional
- SUDO_PASSWORD=password #optional
- SUDO_PASSWORD_HASH= #optional
- PROXY_DOMAIN=code-server.my.domain #optional
- DEFAULT_WORKSPACE=/config/workspace #optional
volumes:
- /path/to/appdata/config:/config
ports:
- 8443:8443
restart: unless-stopped
```
### docker cli ([click here for more info](https://docs.docker.com/engine/reference/commandline/cli/))
```bash
docker run -d \
--name=code-server \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Etc/UTC \
-e PASSWORD=password `#optional` \
-e HASHED_PASSWORD= `#optional` \
-e SUDO_PASSWORD=password `#optional` \
-e SUDO_PASSWORD_HASH= `#optional` \
-e PROXY_DOMAIN=code-server.my.domain `#optional` \
-e DEFAULT_WORKSPACE=/config/workspace `#optional` \
-p 8443:8443 \
-v /path/to/appdata/config:/config \
--restart unless-stopped \
lscr.io/linuxserver/code-server:latest
```
## Parameters
Containers are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate `<external>:<internal>` respectively. For example, `-p 8080:80` would expose port `80` from inside the container to be accessible from the host's IP on port `8080` outside the container.
| Parameter | Function |
| :----: | --- |
| `-p 8443` | web gui |
| `-e PUID=1000` | for UserID - see below for explanation |
| `-e PGID=1000` | for GroupID - see below for explanation |
| `-e TZ=Etc/UTC` | specify a timezone to use, see this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). |
| `-e PASSWORD=password` | Optional web gui password, if `PASSWORD` or `HASHED_PASSWORD` is not provided, there will be no auth. |
| `-e HASHED_PASSWORD=` | Optional web gui password, overrides `PASSWORD`, instructions on how to create it is below. |
| `-e SUDO_PASSWORD=password` | If this optional variable is set, user will have sudo access in the code-server terminal with the specified password. |
| `-e SUDO_PASSWORD_HASH=` | Optionally set sudo password via hash (takes priority over `SUDO_PASSWORD` var). Format is `$type$salt$hashed`. |
| `-e PROXY_DOMAIN=code-server.my.domain` | If this optional variable is set, this domain will be proxied for subdomain proxying. See [Documentation](https://github.com/cdr/code-server/blob/master/docs/FAQ.md#sub-domains) |
| `-e DEFAULT_WORKSPACE=/config/workspace` | If this optional variable is set, code-server will open this directory by default |
| `-v /config` | Contains all relevant configuration files. |
## Environment variables from files (Docker secrets)
You can set any environment variable from a file by using a special prepend `FILE__`.
As an example:
```bash
-e FILE__MYVAR=/run/secrets/mysecretvariable
```
Will set the environment variable `MYVAR` based on the contents of the `/run/secrets/mysecretvariable` file.
## Umask for running applications
For all of our images we provide the ability to override the default umask settings for services started within the containers using the optional `-e UMASK=022` setting.
Keep in mind umask is not chmod it subtracts from permissions based on it's value it does not add. Please read up [here](https://en.wikipedia.org/wiki/Umask) before asking for support.
## User / Group Identifiers
When using volumes (`-v` flags), permissions issues can arise between the host OS and the container, we avoid this issue by allowing you to specify the user `PUID` and group `PGID`.
Ensure any volume directories on the host are owned by the same user you specify and any permissions issues will vanish like magic.
In this instance `PUID=1000` and `PGID=1000`, to find yours use `id your_user` as below:
```bash
id your_user
```
Example output:
```text
uid=1000(your_user) gid=1000(your_user) groups=1000(your_user)
```
## Docker Mods
[![Docker Mods](https://img.shields.io/badge/dynamic/yaml?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=code-server&query=%24.mods%5B%27code-server%27%5D.mod_count&url=https%3A%2F%2Fraw.githubusercontent.com%2Flinuxserver%2Fdocker-mods%2Fmaster%2Fmod-list.yml)](https://mods.linuxserver.io/?mod=code-server "view available mods for this container.") [![Docker Universal Mods](https://img.shields.io/badge/dynamic/yaml?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=universal&query=%24.mods%5B%27universal%27%5D.mod_count&url=https%3A%2F%2Fraw.githubusercontent.com%2Flinuxserver%2Fdocker-mods%2Fmaster%2Fmod-list.yml)](https://mods.linuxserver.io/?mod=universal "view available universal mods.")
We publish various [Docker Mods](https://github.com/linuxserver/docker-mods) to enable additional functionality within the containers. The list of Mods available for this image (if any) as well as universal mods that can be applied to any one of our images can be accessed via the dynamic badges above.
## Support Info
* Shell access whilst the container is running:
```bash
docker exec -it code-server /bin/bash
```
* To monitor the logs of the container in realtime:
```bash
docker logs -f code-server
```
* Container version number:
```bash
docker inspect -f '{{ index .Config.Labels "build_version" }}' code-server
```
* Image version number:
```bash
docker inspect -f '{{ index .Config.Labels "build_version" }}' lscr.io/linuxserver/code-server:latest
```
## Updating Info
Most of our images are static, versioned, and require an image update and container recreation to update the app inside. With some exceptions (noted in the relevant readme.md), we do not recommend or support updating apps inside the container. Please consult the [Application Setup](#application-setup) section above to see if it is recommended for the image.
Below are the instructions for updating containers:
### Via Docker Compose
* Update images:
* All images:
```bash
docker-compose pull
```
* Single image:
```bash
docker-compose pull code-server
```
* Update containers:
* All containers:
```bash
docker-compose up -d
```
* Single container:
```bash
docker-compose up -d code-server
```
* You can also remove the old dangling images:
```bash
docker image prune
```
### Via Docker Run
* Update the image:
```bash
docker pull lscr.io/linuxserver/code-server:latest
```
* Stop the running container:
```bash
docker stop code-server
```
* Delete the container:
```bash
docker rm code-server
```
* Recreate a new container with the same docker run parameters as instructed above (if mapped correctly to a host folder, your `/config` folder and settings will be preserved)
* You can also remove the old dangling images:
```bash
docker image prune
```
### Image Update Notifications - Diun (Docker Image Update Notifier)
**tip**: We recommend [Diun](https://crazymax.dev/diun/) for update notifications. Other tools that automatically update containers unattended are not recommended or supported.
## Building locally
If you want to make local modifications to these images for development purposes or just to customize the logic:
```bash
git clone https://github.com/linuxserver/docker-code-server.git
cd docker-code-server
docker build \
--no-cache \
--pull \
-t lscr.io/linuxserver/code-server:latest .
```
The ARM variants can be built on x86_64 hardware using `multiarch/qemu-user-static`
```bash
docker run --rm --privileged multiarch/qemu-user-static:register --reset
```
Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64`.
## Versions
* **01.07.23:** - Deprecate armhf. As announced [here](https://www.linuxserver.io/blog/a-farewell-to-arm-hf)
* **05.10.22:** - Install recommended deps to maintain parity with the older images.
* **29.09.22:** - Rebase to jammy, switch to s6v3. Fix chown logic to skip `/config/workspace` contents.
* **20.02.22:** - Install using the official tarballs.
* **29.12.21:** - Add `install-extension` as a helper for mods to install extensions.
* **06.12.21:** - Add `DEFAULT_WORKSPACE` env var.
* **29.11.21:** - Rebase to Ubuntu focal.
* **16.09.21:** - Fix slow `chown` on large workspace (contents of workspace folder no longer chowned).
* **11.07.21:** - Bump node to 14 to fix builds
* **08.05.21:** - Fix doc link
* **04.02.20:** - Allow setting gui password via hash using env var `HASHED_PASSWORD`.
* **23.12.20:** - Allow setting sudo password via hash using env var `SUDO_PASSWORD_HASH`.
* **29.05.20:** - Add --domain-proxy support.
* **21.05.20:** - Shrink images, install via yarn, fix arm32v7 build.
* **18.05.20:** - Switch to multi-arch images, install via npm.
* **29.04.20:** - Update start arguments.
* **01.04.20:** - Structural changes required for v3.
* **17.01.20:** - Fix artifact url retrieval from github.
* **24.10.19:** - Upgrade to v2 builds.
* **28.09.19:** - Update project logo.
* **21.09.19:** - Add development builds/tag.
* **09.07.19:** - Add optional sudo access.
* **01.07.19:** - Add nano.
* **24.06.19:** - Initial Release.

View File

@ -0,0 +1,27 @@
---
# jenkins variables
project_name: docker-code-server
external_type: na
custom_version_command: "curl -sX GET https://api.github.com/repos/coder/code-server/releases/latest | jq -r '.tag_name' | sed 's|^v||'"
release_type: stable
release_tag: latest
ls_branch: master
repo_vars:
- CONTAINER_NAME = 'code-server'
- BUILD_VERSION_ARG = 'CODE_RELEASE'
- LS_USER = 'linuxserver'
- LS_REPO = 'docker-code-server'
- DOCKERHUB_IMAGE = 'linuxserver/code-server'
- DEV_DOCKERHUB_IMAGE = 'lsiodev/code-server'
- PR_DOCKERHUB_IMAGE = 'lspipepr/code-server'
- DIST_IMAGE = 'ubuntu'
- MULTIARCH='true'
- CI='true'
- CI_WEB='true'
- CI_PORT='8443'
- CI_SSL='false'
- CI_DELAY='120'
- CI_DOCKERENV='TZ=US/Pacific'
- CI_AUTH='user:password'
- CI_WEBPATH=''

View File

@ -0,0 +1,556 @@
NAME VERSION TYPE
@babel/runtime 7.23.2 npm
@coder/logger 3.0.1 npm
@mapbox/node-pre-gyp 1.0.11 npm
@microsoft/1ds-core-js 3.2.13 npm
@microsoft/1ds-post-js 3.2.13 npm
@microsoft/applicationinsights-core-js 2.8.15 npm
@microsoft/applicationinsights-shims 2.0.2 npm
@microsoft/dynamicproto-js 1.1.9 npm
@parcel/watcher 2.1.0 npm
@phc/format 1.0.0 npm
@tootallnate/once 3.0.0 npm
@tootallnate/quickjs-emscripten 0.23.0 npm
@vscode/iconv-lite-umd 0.7.0 npm
@vscode/proxy-agent 0.19.1 npm
@vscode/ripgrep 1.15.9 npm
@vscode/spdlog 0.15.0 npm
@vscode/vscode-languagedetection 1.0.21 npm
@vscode/windows-process-tree 0.6.0 npm
@vscode/windows-registry 1.1.0 npm
@xterm/addon-canvas 0.8.0-beta.17 npm
@xterm/addon-image 0.9.0-beta.17 npm
@xterm/addon-search 0.16.0-beta.17 npm
@xterm/addon-serialize 0.14.0-beta.17 npm
@xterm/addon-unicode11 0.9.0-beta.17 npm
@xterm/addon-webgl 0.19.0-beta.17 npm
@xterm/headless 5.6.0-beta.17 npm
@xterm/xterm 5.6.0-beta.17 npm
abbrev 1.1.1 npm
accepts 1.3.8 npm
adduser 3.118ubuntu5 deb
agent-base 6.0.2 npm
agent-base 7.1.0 npm (+1 duplicate)
ansi-regex 5.0.1 npm
aproba 2.0.0 npm
apt 2.4.12 deb
apt-utils 2.4.12 deb
are-we-there-yet 2.0.0 npm
argon2 0.31.1 npm
argparse 2.0.1 npm
array-flatten 3.0.0 npm
ast-types 0.13.4 npm
balanced-match 1.0.2 npm
base-files 12ubuntu4.6 deb
base-passwd 3.5.52build1 deb
base64-js 1.5.1 npm
bash 5.1-6ubuntu1.1 deb
basic-ftp 5.0.3 npm
bat 1.0.0 npm
beep-boop 1.2.3 npm
bindings 1.5.0 npm
bl 4.1.0 npm
body-parser 2.0.0-beta.2 npm
brace-expansion 1.1.11 npm
braces 3.0.2 npm
bsdutils 1:2.37.2-4ubuntu3.4 deb
buffer 5.7.1 npm
buffer-alloc 1.2.0 npm
buffer-alloc-unsafe 1.1.0 npm
buffer-crc32 0.2.13 npm
buffer-fill 1.0.0 npm
builtin-notebook-renderers 1.0.0 npm
bytes 3.0.0 npm
bytes 3.1.2 npm
ca-certificates 20230311ubuntu0.22.04.1 deb
call-bind 1.0.2 npm
call-bind 1.0.7 npm
catatonit 0.1.7-1 deb
charenc 0.0.2 npm
chownr 1.1.4 npm
chownr 2.0.0 npm
clojure 1.0.0 npm
code-server 4.89.1 npm
coffeescript 1.0.0 npm
color-support 1.1.3 npm
compressible 2.0.18 npm
compression 1.7.4 npm
concat-map 0.0.1 npm
configuration-editing 1.0.0 npm
console-control-strings 1.1.0 npm
content-disposition 0.5.4 npm
content-type 1.0.5 npm
cookie 0.4.0 npm
cookie 0.4.1 npm
cookie 0.6.0 npm
cookie-parser 1.4.6 npm
cookie-signature 1.0.6 npm
coreutils 8.32-4.1ubuntu1.2 deb
cpp 1.0.0 npm
cron 3.0pl1-137ubuntu3 deb
crypt 0.0.2 npm
csharp 1.0.0 npm
css 1.0.0 npm
css-language-features 1.0.0 npm
curl 7.81.0-1ubuntu1.16 deb
dart 1.0.0 npm
dash 0.5.11+git20210903+057cd650a4ed-3build1 deb
data-uri-to-buffer 5.0.1 npm
debconf 1.5.79ubuntu1 deb
debianutils 5.5-1ubuntu2 deb
debug 2.6.9 npm (+1 duplicate)
debug 3.1.0 npm (+2 duplicates)
debug 4.3.4 npm (+1 duplicate)
debug-auto-launch 1.0.0 npm
debug-server-ready 1.0.0 npm
decompress-response 6.0.0 npm
deep-extend 0.6.0 npm
define-data-property 1.1.4 npm
degenerator 5.0.1 npm
delegates 1.0.0 npm
depd 2.0.0 npm
destroy 1.2.0 npm
detect-libc 2.0.1 npm
detect-libc 2.0.2 npm
diff 1.0.0 npm
diffutils 1:3.8-0ubuntu2 deb
dirmngr 2.2.27-3ubuntu2.1 deb
docker 1.0.0 npm
dpkg 1.21.1ubuntu2.3 deb
e2fsprogs 1.46.5-2ubuntu1.1 deb
ee-first 1.1.1 npm
emmet 1.0.0 npm
emoji-regex 8.0.0 npm
encodeurl 1.0.2 npm
end-of-stream 1.4.4 npm
env-paths 2.2.1 npm
es-define-property 1.0.0 npm
es-errors 1.3.0 npm
es6-promisify 7.0.0 npm
escape-html 1.0.3 npm
escodegen 2.1.0 npm
esprima 4.0.1 npm
estraverse 5.3.0 npm
esutils 2.0.3 npm
etag 1.8.1 npm
eventemitter3 4.0.7 npm
expand-template 2.0.3 npm
express 5.0.0-beta.3 npm
extension-editing 1.0.0 npm
fd-slicer 1.1.0 npm
file-uri-to-path 1.0.0 npm
fill-range 7.0.1 npm
finalhandler 1.2.0 npm
findutils 4.8.0-1ubuntu3 deb
follow-redirects 1.15.6 npm
forwarded 0.2.0 npm
fresh 0.5.2 npm
fs-constants 1.0.0 npm
fs-extra 8.1.0 npm
fs-minipass 2.1.0 npm
fs.realpath 1.0.0 npm
fsharp 1.0.0 npm
function-bind 1.1.1 npm (+2 duplicates)
function-bind 1.1.2 npm
gauge 3.0.2 npm
gcc-12-base 12.3.0-1ubuntu1~22.04 deb
get-intrinsic 1.2.1 npm
get-intrinsic 1.2.4 npm (+2 duplicates)
get-uri 6.0.1 npm
git 1.0.0 npm
git 1:2.34.1-1ubuntu1.10 deb
git-base 1.0.0 npm
git-man 1:2.34.1-1ubuntu1.10 deb
github 0.0.1 npm
github-authentication 0.0.2 npm
github-from-package 0.0.0 npm
glob 7.2.3 npm
gnupg 2.2.27-3ubuntu2.1 deb
gnupg-l10n 2.2.27-3ubuntu2.1 deb
gnupg-utils 2.2.27-3ubuntu2.1 deb
go 1.0.0 npm
gopd 1.0.1 npm
gpg 2.2.27-3ubuntu2.1 deb
gpg-agent 2.2.27-3ubuntu2.1 deb
gpg-wks-client 2.2.27-3ubuntu2.1 deb
gpg-wks-server 2.2.27-3ubuntu2.1 deb
gpgconf 2.2.27-3ubuntu2.1 deb
gpgsm 2.2.27-3ubuntu2.1 deb
gpgv 2.2.27-3ubuntu2.1 deb
graceful-fs 4.2.11 npm (+1 duplicate)
grep 3.7-1build1 deb
groovy 1.0.0 npm
grunt 1.0.0 npm
gulp 1.0.0 npm
gzip 1.10-4ubuntu4.1 deb
handlebars 1.0.0 npm
has 1.0.3 npm
has-property-descriptors 1.0.2 npm
has-proto 1.0.1 npm
has-symbols 1.0.3 npm
has-unicode 2.0.1 npm
hasown 2.0.0 npm
hlsl 1.0.0 npm
hostname 3.23ubuntu2 deb
html 1.0.0 npm
html-language-features 1.0.0 npm
http-errors 2.0.0 npm
http-proxy 1.18.1 npm
http-proxy-agent 7.0.0 npm
http-proxy-agent 7.0.2 npm
httpolyglot 0.1.2 npm
https-proxy-agent 5.0.1 npm
https-proxy-agent 7.0.2 npm
https-proxy-agent 7.0.4 npm
i18next 23.11.3 npm
iconv-lite 0.5.2 npm
ieee754 1.2.1 npm
inflight 1.0.6 npm
inherits 2.0.4 npm (+1 duplicate)
ini 1.0.0 npm
ini 1.3.8 npm
init-system-helpers 1.62 deb
ip 1.1.9 npm
ip 2.0.1 npm (+1 duplicate)
ipaddr.js 1.9.1 npm
ipynb 1.0.0 npm
is-buffer 1.1.6 npm
is-extglob 2.1.1 npm
is-fullwidth-code-point 3.0.0 npm
is-glob 4.0.3 npm
is-number 7.0.0 npm
is-promise 4.0.0 npm
isexe 2.0.0 npm
jake 1.0.0 npm
java 1.0.0 npm
javascript 1.0.0 npm
jq 1.6-2.1ubuntu3 deb
js-debug 1.89.0 npm
js-debug-companion 1.1.2 npm
js-yaml 4.1.0 npm
jschardet 3.0.0 npm
json 1.0.0 npm
json-language-features 1.0.0 npm
jsonfile 4.0.0 npm
julia 1.0.0 npm
just-performance 4.3.0 npm
kerberos 2.0.1 npm
latex 1.0.0 npm
less 1.0.0 npm
less 590-1ubuntu0.22.04.3 deb
libacl1 2.3.1-1 deb
libapt-pkg6.0 2.4.12 deb
libassuan0 2.5.5-1build1 deb
libatomic1 12.3.0-1ubuntu1~22.04 deb
libattr1 1:2.5.1-1build1 deb
libaudit-common 1:3.0.7-1build1 deb
libaudit1 1:3.0.7-1build1 deb
libblkid1 2.37.2-4ubuntu3.4 deb
libbrotli1 1.0.9-2build6 deb
libbsd0 0.11.5-1 deb
libbz2-1.0 1.0.8-5build1 deb
libc-bin 2.35-0ubuntu3.7 deb
libc6 2.35-0ubuntu3.7 deb
libcap-ng0 0.7.9-2.2build3 deb
libcap2 1:2.44-1ubuntu0.22.04.1 deb
libcbor0.8 0.8.0-2ubuntu1 deb
libcom-err2 1.46.5-2ubuntu1.1 deb
libcrypt1 1:4.4.27-1 deb
libcurl3-gnutls 7.81.0-1ubuntu1.16 deb
libcurl4 7.81.0-1ubuntu1.16 deb
libdb5.3 5.3.28+dfsg1-0.8ubuntu3 deb
libdebconfclient0 0.261ubuntu1 deb
libedit2 3.1-20210910-1build1 deb
liberror-perl 0.17029-1 deb
libexpat1 2.4.7-1ubuntu0.3 deb
libext2fs2 1.46.5-2ubuntu1.1 deb
libffi8 3.4.2-4 deb
libfido2-1 1.10.0-1 deb
libgcc-s1 12.3.0-1ubuntu1~22.04 deb
libgcrypt20 1.9.4-3ubuntu3 deb
libgdbm-compat4 1.23-1 deb
libgdbm6 1.23-1 deb
libgmp10 2:6.2.1+dfsg-3ubuntu1 deb
libgnutls30 3.7.3-4ubuntu1.5 deb
libgpg-error0 1.43-3 deb
libgssapi-krb5-2 1.19.2-2ubuntu0.3 deb
libhogweed6 3.7.3-1build2 deb
libidn2-0 2.3.2-2build1 deb
libjq1 1.6-2.1ubuntu3 deb
libk5crypto3 1.19.2-2ubuntu0.3 deb
libkeyutils1 1.6.1-2ubuntu3 deb
libkrb5-3 1.19.2-2ubuntu0.3 deb
libkrb5support0 1.19.2-2ubuntu0.3 deb
libksba8 1.6.0-2ubuntu0.2 deb
libldap-2.5-0 2.5.17+dfsg-0ubuntu0.22.04.1 deb
libldap-common 2.5.17+dfsg-0ubuntu0.22.04.1 deb
liblz4-1 1.9.3-2build2 deb
liblzma5 5.2.5-2ubuntu1 deb
libmd0 1.0.4-1build1 deb
libmount1 2.37.2-4ubuntu3.4 deb
libncurses6 6.3-2ubuntu0.1 deb
libncursesw6 6.3-2ubuntu0.1 deb
libnettle8 3.7.3-1build2 deb
libnghttp2-14 1.43.0-1ubuntu0.2 deb
libnpth0 1.6-3build2 deb
libnsl2 1.3.0-2build2 deb
libonig5 6.9.7.1-2build1 deb
libp11-kit0 0.24.0-6build1 deb
libpam-modules 1.4.0-11ubuntu2.4 deb
libpam-modules-bin 1.4.0-11ubuntu2.4 deb
libpam-runtime 1.4.0-11ubuntu2.4 deb
libpam0g 1.4.0-11ubuntu2.4 deb
libpcre2-8-0 10.39-3ubuntu0.1 deb
libpcre3 2:8.39-13ubuntu0.22.04.1 deb
libperl5.34 5.34.0-3ubuntu1.3 deb
libprocps8 2:3.3.17-6ubuntu2.1 deb
libpsl5 0.21.0-1.2build2 deb
libreadline8 8.1.2-1 deb
librtmp1 2.4+20151223.gitfa8646d.1-2build4 deb
libsasl2-2 2.1.27+dfsg2-3ubuntu1.2 deb
libsasl2-modules 2.1.27+dfsg2-3ubuntu1.2 deb
libsasl2-modules-db 2.1.27+dfsg2-3ubuntu1.2 deb
libseccomp2 2.5.3-2ubuntu2 deb
libselinux1 3.3-1build2 deb
libsemanage-common 3.3-1build2 deb
libsemanage2 3.3-1build2 deb
libsepol2 3.3-1build1 deb
libsmartcols1 2.37.2-4ubuntu3.4 deb
libsqlite3-0 3.37.2-2ubuntu0.3 deb
libss2 1.46.5-2ubuntu1.1 deb
libssh-4 0.9.6-2ubuntu0.22.04.3 deb
libssl3 3.0.2-0ubuntu1.15 deb
libstdc++6 12.3.0-1ubuntu1~22.04 deb
libsystemd0 249.11-0ubuntu3.12 deb
libtasn1-6 4.18.0-4build1 deb
libtinfo6 6.3-2ubuntu0.1 deb
libtirpc-common 1.3.2-2ubuntu0.1 deb
libtirpc3 1.3.2-2ubuntu0.1 deb
libudev1 249.11-0ubuntu3.12 deb
libunistring2 1.0-1 deb
libuuid1 2.37.2-4ubuntu3.4 deb
libx11-6 2:1.7.5-1ubuntu0.3 deb
libx11-data 2:1.7.5-1ubuntu0.3 deb
libxau6 1:1.0.9-1build5 deb
libxcb1 1.14-3ubuntu3 deb
libxdmcp6 1:1.1.3-0ubuntu5 deb
libxext6 2:1.3.4-1build1 deb
libxmuu1 2:1.1.3-3 deb
libxxhash0 0.8.1-1 deb
libzstd1 1.4.8+dfsg-3build1 deb
limiter 2.1.0 npm
locales 2.35-0ubuntu3.7 deb
log 1.0.0 npm
login 1:4.8.1-2ubuntu2.2 deb
logsave 1.46.5-2ubuntu1.1 deb
lru-cache 6.0.0 npm (+1 duplicate)
lru-cache 7.18.3 npm
lsb-base 11.1.0ubuntu4 deb
lua 1.0.0 npm
make 1.0.0 npm
make-dir 3.1.0 npm
markdown 1.0.0 npm
markdown-language-features 1.0.0 npm
markdown-math 1.0.0 npm
mawk 1.3.4.20200120-3 deb
md5 2.3.0 npm
media-preview 1.0.0 npm
media-typer 0.3.0 npm
merge-conflict 1.0.0 npm
merge-descriptors 1.0.1 npm
methods 1.1.2 npm
micromatch 4.0.5 npm
microsoft-authentication 0.0.1 npm
mime-db 1.52.0 npm
mime-types 2.1.35 npm
mimic-response 3.1.0 npm
minimatch 3.1.2 npm
minimist 1.2.6 npm
minipass 3.3.6 npm
minipass 5.0.0 npm
minizlib 2.1.2 npm
mkdirp 1.0.4 npm (+1 duplicate)
mkdirp-classic 0.5.3 npm
mount 2.37.2-4ubuntu3.4 deb
ms 2.0.0 npm (+1 duplicate)
ms 2.1.2 npm (+1 duplicate)
ms 2.1.3 npm
nano 6.2-1 deb
napi-build-utils 1.0.2 npm
native-watchdog 1.4.2 npm
ncurses-base 6.3-2ubuntu0.1 deb
ncurses-bin 6.3-2ubuntu0.1 deb
negotiator 0.6.3 npm
net-tools 1.60+git20181103.0eebece-1ubuntu5 deb
netbase 6.3 deb
netcat 1.218-4ubuntu1 deb
netcat-openbsd 1.218-4ubuntu1 deb
netmask 2.0.2 npm
node 18.18.2 binary
node-abi 3.8.0 npm
node-addon-api 3.2.1 npm
node-addon-api 4.3.0 npm
node-addon-api 7.0.0 npm
node-addon-api 7.1.0 npm
node-fetch 2.7.0 npm
node-gyp-build 4.3.0 npm
node-pty 1.1.0-beta11 npm
nopt 5.0.0 npm
npm 1.0.1 npm
npmlog 5.0.1 npm
nw-pre-gyp-module-test 0.0.1 npm
object-assign 4.1.1 npm
object-inspect 1.12.3 npm
object-inspect 1.13.1 npm
objective-c 1.0.0 npm
on-finished 2.4.1 npm
on-headers 1.0.2 npm
once 1.4.0 npm (+1 duplicate)
openssh-client 1:8.9p1-3ubuntu0.7 deb
openssl 3.0.2-0ubuntu1.15 deb
os-tmpdir 1.0.2 npm
pac-proxy-agent 7.0.1 npm
pac-resolver 7.0.0 npm
parseurl 1.3.3 npm
passwd 1:4.8.1-2ubuntu2.2 deb
patch 2.7.6-7build2 deb
path-is-absolute 1.0.1 npm
path-to-regexp 3.2.0 npm
pem 1.14.8 npm
pend 1.2.0 npm
perl 1.0.0 npm
perl 5.34.0-3ubuntu1.3 deb
perl-base 5.34.0-3ubuntu1.3 deb
perl-modules-5.34 5.34.0-3ubuntu1.3 deb
php 1.0.0 npm
php-language-features 1.0.0 npm
picomatch 2.3.1 npm
pinentry-curses 1.1.1-1build2 deb
powershell 1.0.0 npm
prebuild-install 7.1.1 npm
procps 2:3.3.17-6ubuntu2.1 deb
proxy-addr 2.0.7 npm
proxy-agent 6.4.0 npm
proxy-from-env 1.1.0 npm (+1 duplicate)
publicsuffix 20211207.1025-1 deb
pug 1.0.0 npm
pump 3.0.0 npm
python 1.0.0 npm
qs 6.11.0 npm (+1 duplicate)
qs 6.12.1 npm
r 1.0.0 npm
range-parser 1.2.1 npm
raw-body 3.0.0-beta.1 npm
razor 1.0.0 npm
rc 1.2.8 npm
readable-stream 3.6.0 npm
readable-stream 3.6.2 npm
readline-common 8.1.2-1 deb
references-view 1.0.0 npm
regenerator-runtime 0.14.0 npm
requires-port 1.0.0 npm
restructuredtext 1.0.0 npm
rimraf 3.0.2 npm
rotating-file-stream 3.2.1 npm
router 2.0.0-beta.2 npm
ruby 1.0.0 npm
rust 1.0.0 npm
safe-buffer 5.1.2 npm
safe-buffer 5.2.1 npm (+1 duplicate)
safe-compare 1.1.4 npm
safer-buffer 2.1.2 npm
scss 1.0.0 npm
search-result 1.0.0 npm
sed 4.8-1ubuntu2 deb
semver 6.3.1 npm
semver 7.5.4 npm
semver 7.6.0 npm
send 1.0.0-beta.2 npm
sensible-utils 0.0.17 deb
serve-static 2.0.0-beta.2 npm
set-blocking 2.0.0 npm
set-function-length 1.2.2 npm
setprototypeof 1.2.0 npm
shaderlab 1.0.0 npm
shellscript 1.0.0 npm
side-channel 1.0.4 npm
side-channel 1.0.6 npm
signal-exit 3.0.7 npm
simple-browser 1.0.0 npm
simple-concat 1.0.1 npm
simple-get 4.0.1 npm
smart-buffer 4.2.0 npm (+1 duplicate)
socks 2.7.1 npm (+1 duplicate)
socks-proxy-agent 8.0.1 npm
socks-proxy-agent 8.0.2 npm
source-map 0.6.1 npm
sql 1.0.0 npm
statuses 2.0.1 npm
string-width 4.2.3 npm
string_decoder 1.3.0 npm (+1 duplicate)
strip-ansi 6.0.1 npm
strip-json-comments 2.0.1 npm
sudo 1.9.9-1ubuntu2.4 deb
swift 1.0.0 npm
sysvinit-utils 3.01-1ubuntu1 deb
tar 1.34+dfsg-1ubuntu0.1.22.04.2 deb
tar 6.2.1 npm
tar-fs 2.1.1 npm
tar-stream 2.2.0 npm
tas-client-umd 0.1.8 npm
theme-abyss 1.0.0 npm
theme-defaults 1.0.0 npm
theme-kimbie-dark 1.0.0 npm
theme-monokai 1.0.0 npm
theme-monokai-dimmed 1.0.0 npm
theme-quietlight 1.0.0 npm
theme-red 1.0.0 npm
theme-solarized-dark 1.0.0 npm
theme-solarized-light 1.0.0 npm
theme-tomorrow-night-blue 1.0.0 npm
to-regex-range 5.0.1 npm
toidentifier 1.0.1 npm
tr46 0.0.3 npm
tslib 2.6.2 npm
tunnel-agent 0.6.0 npm
tunnel-forwarding 1.0.0 npm
type-is 1.6.18 npm
typescript 1.0.0 npm
typescript 5.4.5 npm
typescript-language-features 1.0.0 npm
tzdata 2024a-0ubuntu0.22.04 deb
ubuntu-keyring 2021.03.26 deb
universalify 0.1.2 npm
unpipe 1.0.0 npm
usrmerge 25ubuntu2 deb
util-deprecate 1.0.2 npm (+1 duplicate)
util-linux 2.37.2-4ubuntu3.4 deb
utils-merge 1.0.1 npm
vary 1.1.2 npm
vb 1.0.0 npm
vscode-css-languageserver 1.0.0 npm
vscode-extensions 0.0.1 npm
vscode-html-languageserver 1.0.0 npm
vscode-js-profile-table 1.0.9 npm
vscode-json-languageserver 1.3.4 npm
vscode-markdown-languageserver 0.5.0-alpha.6 npm
vscode-oniguruma 1.7.0 npm
vscode-regexpp 3.1.0 npm
vscode-reh 1.89.1 npm
vscode-textmate 9.0.0 npm
vscode-theme-seti 1.0.0 npm
webidl-conversions 3.0.1 npm
whatwg-url 5.0.0 npm
which 2.0.2 npm
wide-align 1.1.5 npm
wrappy 1.0.2 npm (+1 duplicate)
ws 8.17.0 npm
xauth 1:1.1-1build2 deb
xdg-basedir 4.0.0 npm
xml 1.0.0 npm
yallist 4.0.0 npm (+1 duplicate)
yaml 1.0.0 npm
yauzl 2.10.0 npm
yauzl 3.1.1 npm
yazl 2.4.3 npm
zlib1g 1:1.2.11.dfsg-2ubuntu9.2 deb

View File

@ -0,0 +1,80 @@
---
# project information
project_name: code-server
project_url: "https://coder.com"
project_logo: "https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/code-server-banner.png"
project_blurb: "[{{ project_name|capitalize }}]({{ project_url }}) is VS Code running on a remote server, accessible through the browser.\n- Code on your Chromebook, tablet, and laptop with a consistent dev environment.\n- If you have a Windows or Mac workstation, more easily develop for Linux.\n- Take advantage of large cloud servers to speed up tests, compilations, downloads, and more.\n- Preserve battery life when you're on the go.\n- All intensive computation runs on your server.\n- You're no longer running excess instances of Chrome."
project_lsio_github_repo_url: "https://github.com/linuxserver/docker-{{ project_name }}"
# supported architectures
available_architectures:
- {arch: "{{ arch_x86_64 }}", tag: "amd64-latest"}
- {arch: "{{ arch_arm64 }}", tag: "arm64v8-latest"}
# development version
development_versions: false
development_versions_items:
- {tag: "latest", desc: "Stable releases"}
# container parameters
common_param_env_vars_enabled: true
param_container_name: "{{ project_name }}"
param_usage_include_vols: true
param_volumes:
- {vol_path: "/config", vol_host_path: "/path/to/appdata/config", desc: "Contains all relevant configuration files."}
param_usage_include_ports: true
param_ports:
- {external_port: "8443", internal_port: "8443", port_desc: "web gui"}
param_usage_include_env: true
param_env_vars:
- {env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use EG Europe/London"}
# optional container parameters
opt_param_usage_include_env: true
opt_param_env_vars:
- {env_var: "PASSWORD", env_value: "password", desc: "Optional web gui password, if `PASSWORD` or `HASHED_PASSWORD` is not provided, there will be no auth."}
- {env_var: "HASHED_PASSWORD", env_value: "", desc: "Optional web gui password, overrides `PASSWORD`, instructions on how to create it is below."}
- {env_var: "SUDO_PASSWORD", env_value: "password", desc: "If this optional variable is set, user will have sudo access in the code-server terminal with the specified password."}
- {env_var: "SUDO_PASSWORD_HASH", env_value: "", desc: "Optionally set sudo password via hash (takes priority over `SUDO_PASSWORD` var). Format is `$type$salt$hashed`."}
- {env_var: "PROXY_DOMAIN", env_value: "code-server.my.domain", desc: "If this optional variable is set, this domain will be proxied for subdomain proxying. See [Documentation](https://github.com/cdr/code-server/blob/master/docs/FAQ.md#sub-domains)"}
- {env_var: "DEFAULT_WORKSPACE", env_value: "/config/workspace", desc: "If this optional variable is set, code-server will open this directory by default"}
optional_block_1: false
optional_block_1_items: ""
# application setup block
app_setup_block_enabled: true
app_setup_block: |
Access the webui at `http://<your-ip>:8443`.
For github integration, drop your ssh key in to `/config/.ssh`.
Then open a terminal from the top menu and set your github username and email via the following commands
```bash
git config --global user.name "username"
git config --global user.email "email address"
```
### Hashed code-server password
How to create the [hashed password](https://github.com/cdr/code-server/blob/master/docs/FAQ.md#can-i-store-my-password-hashed).
# changelog
changelogs:
- {date: "01.07.23:", desc: "Deprecate armhf. As announced [here](https://www.linuxserver.io/blog/a-farewell-to-arm-hf)"}
- {date: "05.10.22:", desc: "Install recommended deps to maintain parity with the older images."}
- {date: "29.09.22:", desc: "Rebase to jammy, switch to s6v3. Fix chown logic to skip `/config/workspace` contents."}
- {date: "20.02.22:", desc: "Install using the official tarballs."}
- {date: "29.12.21:", desc: "Add `install-extension` as a helper for mods to install extensions."}
- {date: "06.12.21:", desc: "Add `DEFAULT_WORKSPACE` env var."}
- {date: "29.11.21:", desc: "Rebase to Ubuntu focal."}
- {date: "16.09.21:", desc: "Fix slow `chown` on large workspace (contents of workspace folder no longer chowned)."}
- {date: "11.07.21:", desc: "Bump node to 14 to fix builds"}
- {date: "08.05.21:", desc: "Fix doc link"}
- {date: "04.02.20:", desc: "Allow setting gui password via hash using env var `HASHED_PASSWORD`."}
- {date: "23.12.20:", desc: "Allow setting sudo password via hash using env var `SUDO_PASSWORD_HASH`."}
- {date: "29.05.20:", desc: "Add --domain-proxy support."}
- {date: "21.05.20:", desc: "Shrink images, install via yarn, fix arm32v7 build."}
- {date: "18.05.20:", desc: "Switch to multi-arch images, install via npm."}
- {date: "29.04.20:", desc: "Update start arguments."}
- {date: "01.04.20:", desc: "Structural changes required for v3."}
- {date: "17.01.20:", desc: "Fix artifact url retrieval from github."}
- {date: "24.10.19:", desc: "Upgrade to v2 builds."}
- {date: "28.09.19:", desc: "Update project logo."}
- {date: "21.09.19:", desc: "Add development builds/tag."}
- {date: "09.07.19:", desc: "Add optional sudo access."}
- {date: "01.07.19:", desc: "Add nano."}
- {date: "24.06.19:", desc: "Initial Release."}

Some files were not shown because too many files have changed in this diff Show More