Эх сурвалжийг харах

拉取远程仓库之前提交

Linhanmic 1 сар өмнө
parent
commit
7abd65af75

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 779 - 0
package-lock.json


+ 1 - 0
package.json

@@ -22,6 +22,7 @@
     "@vitejs/plugin-vue": "^3.0.1",
     "eslint": "^8.20.0",
     "eslint-plugin-vue": "^9.2.0",
+    "tailwindcss": "^3.4.13",
     "vite": "^3.0.1"
   }
 }

BIN
src/assets/admin-avatar.png


BIN
src/assets/teacher.png


+ 1 - 1
src/components/AdminMenu.vue

@@ -1,7 +1,7 @@
 <template>
     <div class="relative" @mouseleave="isOpen = false">
       <div @mouseenter="isOpen = true" class="flex items-center cursor-pointer">
-        <img src="/admin-avatar.png" alt="Admin" class="w-8 h-8 rounded-full mr-2" />
+        <img src="@/assets/admin-avatar.png" alt="Admin" class="w-8 h-8 rounded-full mr-2" />
         <span class="text-gray-800">管理员</span>
       </div>
       <div v-if="isOpen" class="absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg z-10">

+ 7 - 2
src/components/Pagination.vue

@@ -30,7 +30,8 @@ const props = defineProps({
   },
   totalItems: {
     type: Number,
-    required: true
+    required: true,
+    default: 1
   },
   itemsPerPage: {
     type: Number,
@@ -40,7 +41,11 @@ const props = defineProps({
 
 const emit = defineEmits(['page-change']);
 
-const totalPages = computed(() => Math.ceil(props.totalItems / props.itemsPerPage));
+const totalPages = computed(() => {
+  const totalItems = props.totalItems || 0;
+  const itemsPerPage = props.itemsPerPage || 1; // 避免除以零
+  return Math.ceil(totalItems / itemsPerPage);
+});
 
 const onPageChange = (page) => {
   if (page >= 1 && page <= totalPages.value) {

+ 1 - 1
src/components/TeacherCard.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="bg-white shadow-lg rounded-lg overflow-hidden transition-all duration-300 hover:shadow-xl transform hover:-translate-y-2">
     <div class="relative pb-2/3">
-      <img :src="teacher.profileImage" :alt="teacher.name" class="absolute h-full w-full object-cover" />
+      <img :src="teacher.image" :alt="teacher.name" class="absolute h-full w-full object-cover" />
       <div class="absolute inset-0 bg-gradient-to-t from-black to-transparent opacity-60"></div>
       <div class="absolute bottom-0 left-0 p-4 text-white">
         <h3 class="text-xl font-semibold mb-1">{{ teacher.name }}</h3>

+ 1 - 1
src/store/modules/teachers.js

@@ -21,7 +21,7 @@ export const useTeachersStore = defineStore('teachers', {
       try {
         const response = await OpenApi.default.getHomepageData(page, pageSize = 12, name)
         this.teachers = response.data.records
-        this.totalPages = response.data.pages
+        this.totalPages = response.data.tatal
         this.currentPage = page
       } catch (error) {
         console.error('获取教师列表失败:', error)

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 2478 - 2
src/styles/main.css


+ 7 - 7
src/views/Login.vue

@@ -51,14 +51,14 @@ export default {
       try {
         const response = await userLoginPost({ username: username.value, password: password.value });
         localStorage.setItem('token', response.token);
-        authStore.setUser(response.user);
-        authStore.login();
+        //authStore.setUser(response.user);
+        //authStore.login();
         
-        if (response.user.role === 'admin') {
-          router.push('/admin');
-        } else {
-          router.push('/');
-        }
+//        if (response.user.role === 'admin') {
+//          router.push('/admin');
+//        } else {
+//          router.push('/');
+        router.push('/');
       } catch (error) {
         console.error('Login failed:', error);
         alert('登录失败:' + (error.response?.data?.message || error.message));

+ 3 - 3
src/views/Profile.vue

@@ -115,9 +115,9 @@ export default {
     const thesisPage = ref(1);
     const workPage = ref(1);
 
-    const awardTotal = ref(0);
-    const thesisTotal = ref(0);
-    const workTotal = ref(0);
+    const awardTotal = ref(1);
+    const thesisTotal = ref(1);
+    const workTotal = ref(1);
 
     const teacherId = authStore.user.id;
     const token = authStore.token;

+ 3 - 1
src/views/TeacherDetail.vue

@@ -121,7 +121,9 @@ export default {
 
     const fetchTeacherData = async () => {
       try {
-        teacher.value = await getTeacherById(teacherId.value);
+        const response = await getTeacherById(teacherId.value);
+        teacher.value = response.data;
+        console.log(teacher.value)
         patentTotal.value = teacher.value.patent ? teacher.value.patent.length : 0;
       } catch (error) {
         console.error('获取教师信息失败:', error);

+ 9 - 0
tailwind.config.js

@@ -0,0 +1,9 @@
+/** @type {import('tailwindcss').Config} */
+module.exports = {
+  content: ["./src/**/*.{html,js,vue}"],
+  theme: {
+    extend: {},
+  },
+  plugins: [],
+}
+

+ 3 - 1
vite.config.js

@@ -12,12 +12,14 @@ export default defineConfig({
   resolve: {
     alias: {
       '@': path.resolve(__dirname, './src'),
+      '@assets': path.resolve(__dirname, './src/assets'),
     },
   },
   server: {
     proxy: {
       '/api': {
-        target: 'http://10.113.233.180:8080',
+        //target: 'http://10.113.233.180:8080',
+        target: 'http://localhost:8080',
         changeOrigin: true,
         rewrite: (path) => path.replace(/^\/api/, '')
       }

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно