baiseventeen před 2 roky
rodič
revize
afbe26b6ee
6 změnil soubory, kde provedl 146 přidání a 0 odebrání
  1. 39 0
      README.md
  2. 11 0
      src/apis/test.ts
  3. 17 0
      src/types/query.ts
  4. 5 0
      src/types/scss.d.ts
  5. 68 0
      src/views/Home/Role.vue
  6. 6 0
      src/views/Home/role.scss

+ 39 - 0
README.md

@@ -0,0 +1,39 @@
+# EAI-FrontEnd-Vue
+
+This template should help get you started developing with Vue 3 in Vite.
+
+## Recommended IDE Setup
+
+[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
+
+## Type Support for `.vue` Imports in TS
+
+TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.
+
+## Customize configuration
+
+See [Vite Configuration Reference](https://vitejs.dev/config/).
+
+## Project Setup
+
+```sh
+npm install
+```
+
+### Compile and Hot-Reload for Development
+
+```sh
+npm run dev
+```
+
+### Type-Check, Compile and Minify for Production
+
+```sh
+npm run build
+```
+
+### Lint with [ESLint](https://eslint.org/)
+
+```sh
+npm run lint
+```

+ 11 - 0
src/apis/test.ts

@@ -0,0 +1,11 @@
+import axiosInstance from "@/apis/axios.config";
+
+const TEST_PREFIX = "/test"
+
+const testApis = {
+    test() {
+        return axiosInstance.get(`${TEST_PREFIX}`)
+    }
+}
+
+export default testApis

+ 17 - 0
src/types/query.ts

@@ -0,0 +1,17 @@
+export interface CourseQuery {
+    courseId:number;
+    teacherId:number;
+    studentId:number;
+    courseName:string;
+    semester:string;
+}
+
+export interface AssignmentQuery {
+    assignmentId:number;
+    teacherId:number;
+    courseId:number;
+    assignmentName:string;
+    status:string;
+}
+
+

+ 5 - 0
src/types/scss.d.ts

@@ -0,0 +1,5 @@
+// scss.d.ts
+declare module '*.module.scss' {
+    const classes: { [key: string]: string };
+    export default classes;
+}

+ 68 - 0
src/views/Home/Role.vue

@@ -0,0 +1,68 @@
+<!--
+  Description: 权限控制
+  Author: BaiQi
+  Created Date: 2024-6-30
+-->
+<template>
+  <div class="home-container">
+    <router-view></router-view>
+  </div>
+</template>
+
+<script lang="ts" setup>
+  import './role.scss'
+  import {useStore} from "@/store";
+  import emitter from "@/utils/emitter";
+  import {onUnmounted, ref} from "vue";
+  import router from "@/router";
+
+  const store = useStore()
+  const role:'teachers' | 'student' = store.user.role === 'STUDENT' ?   'student':'teachers';
+
+  const changePage = (value: string) => {
+    console.log(role)
+    if(role == 'student'){
+      console.log("学生")
+      switch (value){
+        case 'CourseSquare':
+          router.push("/home/courseSquare");
+          break;
+        case 'MyCourse':
+          router.push("/home/myCourse");
+          break;
+        case 'MyWork':
+          router.push("/home/myHomework");
+          // router.push("/home/assignment/1/edit");
+          break;
+      }
+      // changePage.value = value
+    } else if(role == 'teachers'){
+      switch (value){
+        case 'CourseSquare':
+          router.push("/home/courseSquare");
+          break;
+        case 'MyCourse':
+          router.push("/home/myCourse");
+          break;
+        case 'MyWork':
+          router.push("/home/myHomework");
+          // router.push("/home/assignment/1/edit");
+          break;
+      }
+    }
+  }
+  //绑定路由变更事件
+  emitter.on("change-page", (value:string)=> {
+    changePage(value)
+  })
+  //解绑事件
+  onUnmounted(()=>{
+    emitter.off('change-page')
+  })
+</script>
+
+<script lang="ts">
+export default {
+  name: "Role"
+}
+</script>

+ 6 - 0
src/views/Home/role.scss

@@ -0,0 +1,6 @@
+.home-container {
+  min-height: calc(100vh - 40px);
+  flex: 1;
+  overflow: hidden;
+  background-color: #F5F5F5;
+}