课堂代码提交-Vue3

This commit is contained in:
Levi 2024-11-09 13:58:00 +08:00
commit 03d9de7910
20 changed files with 1965 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/node_modules

13
index.html Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

1708
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

20
package.json Normal file
View File

@ -0,0 +1,20 @@
{
"name": "vue3_cli_default",
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vite build",
"serve": "vite preview"
},
"dependencies": {
"axios": "^1.7.7",
"element-plus": "^2.8.6",
"vue": "^3.2.8",
"vue-router": "^4.4.5"
},
"devDependencies": {
"@vitejs/plugin-vue": "^1.6.0",
"@vue/compiler-sfc": "^3.2.6",
"vite": "^2.5.2"
}
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

28
src/App.vue Normal file
View File

@ -0,0 +1,28 @@
<script setup>
import {
ref,
onMounted,
reactive
} from 'vue'
import Left from './components/Left.vue'
import Right from './components/Right.vue'
import Top from './components/Top.vue'
import Bottom from './components/Bottom.vue'
</script>
<template>
<Top style="height:120px; background-color: antiquewhite; margin:0px"></Top>
<el-row>
<el-col :span="8">
<Left style="height:400px; background-color: aqua; margin:0px"></Left>
</el-col>
<el-col :span="16">
<router-view style="height:400px; background-color: aquamarine; margin:0px"></router-view>
</el-col>
</el-row>
<Bottom style="height:120px; background-color: aliceblue; margin:0px"></Bottom>
</template>
<style>
</style>

BIN
src/assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -0,0 +1,9 @@
<template>
<h1>Bottom</h1>
</template>
<script>
</script>
<style>
</style>

View File

@ -0,0 +1,9 @@
<template>
<h1>课堂管理</h1>
</template>
<script>
</script>
<style>
</style>

9
src/components/Exam.vue Normal file
View File

@ -0,0 +1,9 @@
<template>
<h1>考试</h1>
</template>
<script>
</script>
<style>
</style>

View File

@ -0,0 +1,38 @@
<script setup>
import { ref } from 'vue'
defineProps({
msg: String
})
const count = ref(0)
</script>
<template>
<h1>{{ msg }}</h1>
<p>
Welcome:
<a href="https://hx.dcloud.net.cn/" target="_blank">HBuilderX</a>
</p>
<p>
<a href="https://vitejs.dev/guide/features.html" target="_blank">
Vite Documentation
</a>
|
<a href="https://v3.vuejs.org/" target="_blank">Vue 3 Documentation</a>
</p>
<button type="button" @click="count++">count is: {{ count }}</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test hot module replacement.
</p>
</template>
<style scoped>
a {
color: #42b983;
}
</style>

20
src/components/Left.vue Normal file
View File

@ -0,0 +1,20 @@
<template>
<h1>Left</h1>
<div>
<router-link to="/course">课程管理</router-link><br>
<router-link to="/task">作业管理</router-link><br>
<router-link to="/user">学生管理</router-link><br>
<el-button @click="myClick()">代码跳转</el-button>
</div>
</template>
<script setup>
import {useRouter} from 'vue-router'
const router = useRouter()
function myClick() {
router.replace('/user')
}
</script>
<style>
</style>

View File

@ -0,0 +1,9 @@
<template>
<h1>作业测验</h1>
</template>
<script>
</script>
<style>
</style>

9
src/components/Right.vue Normal file
View File

@ -0,0 +1,9 @@
<template>
<h1>Right</h1>
</template>
<script>
</script>
<style>
</style>

14
src/components/Task.vue Normal file
View File

@ -0,0 +1,14 @@
<template>
<h1>作业管理</h1>
<div>
<router-link to="/task/mytask">作业测验</router-link><br>
<router-link to="/task/exam">考试管理</router-link><br>
<router-view></router-view>
</div>
</template>
<script>
</script>
<style>
</style>

9
src/components/Top.vue Normal file
View File

@ -0,0 +1,9 @@
<template>
<h1>Top</h1>
</template>
<script>
</script>
<style>
</style>

9
src/components/User.vue Normal file
View File

@ -0,0 +1,9 @@
<template>
<h1>学生管理</h1>
</template>
<script>
</script>
<style>
</style>

14
src/main.js Normal file
View File

@ -0,0 +1,14 @@
// main.ts
import {
createApp
} from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'
import router from './router/router.js'
const app = createApp(App)
app.use(ElementPlus)
app.use(router)
app.mount('#app')

39
src/router/router.js Normal file
View File

@ -0,0 +1,39 @@
import {
createRouter,
createWebHashHistory
} from 'vue-router';
import Course from '../components/Course.vue'
import Task from '../components/Task.vue'
import User from '../components/User.vue'
import MyTask from '../components/MyTask.vue';
import Exam from '../components/Exam.vue';
const routes = [
{
path: '/course',
component: Course
}, {
path: '/task',
component: Task,
children: [{
path: 'mytask',
component: MyTask
}, {
path: 'exam',
component: Exam
}]
}, {
path: '/user',
component: User
}, {
path: '/',
redirect: '/course'
}
];
const router = createRouter({
history: createWebHashHistory(),
routes
});
export default router;

7
vite.config.js Normal file
View File

@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()]
})