Ver Fonte

build: :bug: 加缺省页信息和分页调整

chaooo há 2 anos atrás
pai
commit
df249944de

+ 11 - 11
src/components/Breadcrumb/index.vue

@@ -27,22 +27,22 @@ const breadcrumbs = ref([] as Array<RouteLocationMatched>);
 
 function getBreadcrumb() {
   let matched = currentRoute.matched.filter((item) => item.meta && item.meta?.title);
-  const first = matched[0];
-  if (!isDashboard(first)) {
-    matched = [{path: "/"} as any].concat(matched);
-  }
+  // const first = matched[0];
+  // if (!isDashboard(first)) {
+  //   matched = [{path: "/dashboard"} as any].concat(matched);
+  // }
   breadcrumbs.value = matched.filter((item) => {
     return item.meta && item.meta.title && item.meta.breadcrumb !== false;
   });
 }
 
-function isDashboard(route: RouteLocationMatched) {
-  const name = route && route.name;
-  if (!name) {
-    return false;
-  }
-  return name.toString().trim().toLocaleLowerCase() === "Dashboard".toLocaleLowerCase();
-}
+// function isDashboard(route: RouteLocationMatched) {
+//   const name = route && route.name;
+//   if (!name) {
+//     return false;
+//   }
+//   return name.toString().trim().toLocaleLowerCase() === "Dashboard".toLocaleLowerCase();
+// }
 
 function handleLink(item: any) {
   const {redirect, path} = item;

+ 1 - 1
src/components/Pagination/index.vue

@@ -33,7 +33,7 @@ const props = defineProps({
   pageSizes: {
     type: Array as PropType<number[]>,
     default() {
-      return [10, 12, 20, 24, 30, 50];
+      return [10, 20, 50, 100];
     },
   },
   layout: {

+ 1 - 2
src/layout/components/Navbar/Admin/index.vue

@@ -1,6 +1,5 @@
 <script setup lang="ts">
 import {useAppStore} from "@/store/modules/app";
-import Fullscreen from "@/layout/components/Navbar/Fullscreen.vue";
 import UserInfo from "@/layout/components/Navbar/UserInfo.vue";
 
 const appStore = useAppStore();
@@ -23,7 +22,7 @@ function toggleSideBar() {
     <!-- 右侧导航设置 -->
     <div class="flex">
       <!-- 导航栏设置(窄屏隐藏),全屏等-->
-      <Fullscreen />
+      <!--      <Fullscreen />-->
       <!-- 用户信息 -->
       <UserInfo />
     </div>

+ 1 - 2
src/layout/components/Navbar/School/index.vue

@@ -1,6 +1,5 @@
 <script setup lang="ts">
 import {useAppStore} from "@/store/modules/app";
-import Fullscreen from "@/layout/components/Navbar/Fullscreen.vue";
 import SchoolSelect from "@/layout/components/Navbar/SchoolSelect.vue";
 import UserInfo from "@/layout/components/Navbar/UserInfo.vue";
 
@@ -24,7 +23,7 @@ function toggleSideBar() {
     <!-- 右侧导航设置 -->
     <div class="flex">
       <!-- 导航栏设置(窄屏隐藏),全屏等-->
-      <Fullscreen />
+      <!--      <Fullscreen />-->
       <!-- 学校选择 -->
       <SchoolSelect />
       <!-- 用户信息 -->

+ 31 - 8
src/layout/components/Navbar/SchoolSelect.vue

@@ -39,9 +39,14 @@ onMounted(() => {
 <template>
   <!-- 学校选择下拉框 -->
   <div class="nav-select">
-    <el-select v-model="schoolId" size="large" placeholder="请选择学校" @change="changeMySchool()">
-      <el-option v-for="item in schoolData" :key="item.school_id" :label="item.name" :value="item.school_id" />
-    </el-select>
+    <template v-if="(schoolData?.length || 0) > 1">
+      <el-select v-model="schoolId" size="large" placeholder="请选择学校" @change="changeMySchool()">
+        <el-option v-for="item in schoolData" :key="item.school_id" :label="item.name" :value="item.school_id" />
+      </el-select>
+    </template>
+    <template v-else>
+      <span class="single">{{ schoolData?.[0].name }}</span>
+    </template>
     <span class="school">学校编码:{{ userStore.schoolNum }}</span>
   </div>
 </template>
@@ -51,6 +56,22 @@ onMounted(() => {
   align-items: center;
   justify-items: center;
 
+  .el-select {
+    width: 280px;
+    padding: 15px 0;
+    margin-left: 12px;
+  }
+
+  .single {
+    display: inline-block;
+    width: 280px;
+    height: 40px;
+    line-height: 40px;
+    text-align: center;
+    background: #efefef;
+    border-radius: 12px;
+  }
+
   .school {
     padding-left: 15px;
   }
@@ -60,11 +81,6 @@ onMounted(() => {
   margin-bottom: -2px;
 }
 
-.el-select {
-  width: 280px;
-  padding: 15px 0;
-  margin-left: 12px;
-}
 //移动端兼容
 .mobile {
   .navbar {
@@ -83,6 +99,13 @@ onMounted(() => {
         margin: 0;
       }
 
+      .single {
+        display: inline-block;
+        width: 50%;
+        padding: 0;
+        margin: 0;
+      }
+
       :deep(.el-input__wrapper) {
         background: #fff;
       }

+ 1 - 4
src/styles/reset.scss

@@ -87,10 +87,7 @@ div:focus {
   padding: 30px 0;
   line-height: 1.5rem;
   text-align: center;
-  //background-image: url("../assets/empty.png");
-  //background-repeat: no-repeat;
-  //background-position: center center;
-  //position: relative;
+
   p {
     margin: 0;
     font-size: 14px;

+ 4 - 1
src/views/equipment/index.vue

@@ -69,7 +69,10 @@ async function getEquipmentData(schoolId: number) {
         dataStatus.UF ||
         dataStatus.JM;
       if (!equipmentStatus.value) {
-        dataMessage.value = "没有符合条件的搜索记录或该学校未绑定任何设备!";
+        dataMessage.value = "没有符合搜索条件的记录!";
+        if (pageParams.teacher_id == 0 && pageParams.sn == "") {
+          dataMessage.value = "您的学校还未绑定任何设备,请在水母智脑app手机端或平板端绑定设备!";
+        }
       }
     })
     .catch((error) => {

+ 5 - 0
src/views/grade/index.vue

@@ -216,6 +216,11 @@ watch(
   }
 }
 
+:deep(.el-table .el-table__header .el-table__cell .cell) {
+  overflow: visible;
+  white-space: nowrap;
+}
+
 :deep(.el-table th.el-table__cell) {
   background: #e9ebee;
 }

+ 14 - 4
src/views/login/index.vue

@@ -214,11 +214,21 @@ function handleLogin() {
   }
 }
 
-@media only screen and (width <= 600px) {
+@media only screen and (width <= 768px) {
   .login-container {
-    .login-form .title {
-      height: 80px;
-      line-height: 80px;
+    box-sizing: border-box;
+    width: 750px;
+    height: 1080px;
+    padding-top: 420px;
+    background-size: cover;
+
+    .login-form {
+      margin: 0 auto;
+
+      .title {
+        height: 80px;
+        line-height: 80px;
+      }
     }
 
     .el-form-item {

+ 12 - 8
src/views/student/index.vue

@@ -38,10 +38,9 @@ const studentSearch: StudentParams = reactive({
   grade_id: 0,
   search: "",
   page_no: 1,
-  page_size: 12,
+  page_size: 10,
 });
-// 0加载中,1数据正常,2数据为空
-const dataStatus = ref(0);
+const dataMessage = ref("加载中...");
 const studentCount = ref(0);
 const studentData = ref<StudentItem[]>();
 async function getStudentData(schoolId: number) {
@@ -51,10 +50,15 @@ async function getStudentData(schoolId: number) {
       const {count, lists} = data;
       studentCount.value = count;
       studentData.value = lists;
-      dataStatus.value = 1;
+      if (!(count && count > 0)) {
+        dataMessage.value = "没有符合搜索条件的记录!";
+        if (studentSearch.grade_id == 0 && studentSearch.search == "") {
+          dataMessage.value = "暂时还没有任何学生绑定学校!";
+        }
+      }
     })
     .catch((error) => {
-      dataStatus.value = 2;
+      dataMessage.value = error.message;
       console.log(error);
     });
 }
@@ -121,8 +125,7 @@ watch(
         <template #empty>
           <div class="empty">
             <img src="../../assets/empty.png" alt="数据为空" />
-            <p v-if="dataStatus == 0">加载中...</p>
-            <p v-if="dataStatus == 2">暂时还没有任何学生绑定学校!</p>
+            <p>{{ dataMessage }}</p>
           </div>
         </template>
       </el-table>
@@ -195,6 +198,7 @@ watch(
 }
 
 :deep(.el-table .el-table__header .el-table__cell .cell) {
+  overflow: visible;
   white-space: nowrap;
 }
 
@@ -224,6 +228,6 @@ watch(
 }
 
 .empty {
-  padding: 100px 0;
+  padding: 200px 0;
 }
 </style>

+ 23 - 11
src/views/teacher/index.vue

@@ -12,11 +12,11 @@ defineOptions({
   inheritAttrs: false,
 });
 /**
- * 班级数据
+ * 教师数据
  */
 const teacherData = ref<TeacherItem[]>();
-// 0加载中,1数据正常,2数据为空
-const dataStatus = ref(0);
+const dataMessage = ref("加载中...");
+const dataStatus = ref(false);
 // 教师数量
 let teacherCount = ref(0);
 // 用于搜索的教师名称或手机号
@@ -25,13 +25,21 @@ let searchKeyword = ref("");
 async function getTeacherData(schoolId: number, keyword: string) {
   getTeacherManage(schoolId, keyword)
     .then(({data}) => {
-      const temp: TeacherManage = data;
-      teacherData.value = temp.lists;
-      teacherCount.value = temp.count;
-      dataStatus.value = 1;
+      const {count, lists} = data;
+      teacherData.value = lists;
+      teacherCount.value = count;
+      dataStatus.value = true;
+      if (!(count && count > 0)) {
+        dataStatus.value = false;
+        dataMessage.value = "没有符合搜索条件的记录!";
+        if (searchKeyword.value == "") {
+          dataMessage.value = "暂时还没有任何教师注册绑定学校!";
+        }
+      }
     })
     .catch((error) => {
-      dataStatus.value = 2;
+      dataStatus.value = false;
+      dataMessage.value = error.message;
       console.log(error);
     });
 }
@@ -94,7 +102,7 @@ watch(
         >人</span
       >
     </div>
-    <template v-if="dataStatus == 1">
+    <template v-if="dataStatus">
       <!-- 折叠面板-->
       <div v-for="teacher in teacherData" :key="teacher.id" class="list-collapse">
         <el-collapse v-model="teacher.active" @change="collapseTeacher(teacher)">
@@ -169,8 +177,7 @@ watch(
     <template v-else>
       <div class="empty page-empty">
         <img src="../../assets/empty.png" alt="数据为空" />
-        <p v-if="dataStatus == 0">加载中...</p>
-        <p v-if="dataStatus == 2">暂时还没有任何教师注册绑定学校!</p>
+        <p>{{ dataMessage }}</p>
       </div>
     </template>
   </div>
@@ -261,6 +268,7 @@ watch(
 }
 
 :deep(.el-table .el-table__header .el-table__cell .cell) {
+  overflow: visible;
   white-space: nowrap;
 }
 
@@ -286,4 +294,8 @@ watch(
 :deep(.grade .el-table th.el-table__cell) {
   background: #ddd;
 }
+
+.empty {
+  padding: 200px 0;
+}
 </style>

+ 17 - 1
src/views/training/index.vue

@@ -18,7 +18,7 @@ const pageParams: TrainingParams = reactive({
   is_formal: 0, // 1正式,2非正式
   grade_id: 0,
   page_no: 1,
-  page_size: 12,
+  page_size: 10,
   // 学生名称/手机号
   search: "",
 });
@@ -38,6 +38,7 @@ async function getGradeData(schoolId: number) {
       console.log(error);
     });
 }
+const dataMessage = ref("加载中...");
 const trainingData = ref<TrainingItem[]>();
 const trainingCount = ref(0);
 async function getTrainingData(schoolId: number) {
@@ -47,8 +48,15 @@ async function getTrainingData(schoolId: number) {
       const {count, lists} = data;
       trainingData.value = lists;
       trainingCount.value = count;
+      if (!(count && count > 0)) {
+        dataMessage.value = "没有符合搜索条件的记录!";
+        if (pageParams.grade_id == 0 && pageParams.is_formal == 0 && pageParams.search == "") {
+          dataMessage.value = "还没有任何学生训练记录!";
+        }
+      }
     })
     .catch((error) => {
+      dataMessage.value = error.message;
       console.log(error);
     });
 }
@@ -107,6 +115,13 @@ watch(
             >
           </template>
         </el-table-column>
+        <!-- 无数据插槽 -->
+        <template #empty>
+          <div class="empty">
+            <img src="../../assets/empty.png" alt="数据为空" />
+            <p>{{ dataMessage }}</p>
+          </div>
+        </template>
       </el-table>
     </div>
     <pagination
@@ -170,6 +185,7 @@ watch(
 }
 
 :deep(.el-table .el-table__header .el-table__cell .cell) {
+  overflow: visible;
   white-space: nowrap;
 }