刘洋 2 년 전
부모
커밋
4db8352ecc
5개의 변경된 파일463개의 추가작업 그리고 462개의 파일을 삭제
  1. 2 2
      src/pages/exam-manage/index.vue
  2. 143 143
      src/pages/login/index.vue
  3. 301 301
      src/pages/school-manage/index.vue
  4. 2 2
      src/pages/subjects-manage/index.vue
  5. 15 14
      src/pages/user-manage/index.vue

+ 2 - 2
src/pages/exam-manage/index.vue

@@ -22,7 +22,7 @@
           <a-input
             v-model:value="query.name"
             placeholder="考试批次"
-            maxlength="50"
+            :maxlength="50"
           ></a-input>
         </a-form-item>
         <a-form-item>
@@ -116,7 +116,7 @@
         <a-form-item label="考试批次" v-bind="validateInfos.name">
           <a-input
             v-model:value="examInfo.name"
-            maxlength="50"
+            :maxlength="50"
             placeholder="请输入考试批次"
           ></a-input>
         </a-form-item>

+ 143 - 143
src/pages/login/index.vue

@@ -1,143 +1,143 @@
-<template>
-  <div class="login-view tw-grid tw-place-content-center">
-    <div class="login-content tw-flex tw-items-center">
-      <img
-        class="login-banner"
-        draggable="false"
-        src="@imgs/login/login-banner.png"
-        alt=""
-      />
-      <a-form class="login-form" @submit="onLogin">
-        <div class="login-title">试卷结构管理</div>
-        <a-form-item v-bind="validateInfos.loginName">
-          <a-input
-            class="login-input login-input-name"
-            maxlength="50"
-            v-model:value="loginModel.loginName"
-            placeholder="请输入用户名"
-          >
-            <template #prefix>
-              <SvgIcon class="input-icon" name="user-icon" />
-            </template>
-          </a-input>
-        </a-form-item>
-        <a-form-item v-bind="validateInfos.password">
-          <a-input-password
-            class="login-input login-input-pwd"
-            v-model:value="loginModel.password"
-            placeholder="请输入密码"
-          >
-            <template #prefix>
-              <SvgIcon class="input-icon" name="pwd-icon" />
-            </template>
-          </a-input-password>
-        </a-form-item>
-        <a-button
-          class="login-button"
-          :loading="loading"
-          type="primary"
-          html-type="submit"
-          >{{ loading ? "登录中..." : "立即登录" }}</a-button
-        >
-      </a-form>
-    </div>
-    <div class="record-info">鄂ICP备12000033号-16</div>
-  </div>
-</template>
-
-<script setup lang="ts" name="PageLogin">
-import { reactive, ref } from "vue";
-import { useRouter } from "vue-router";
-import { Form, message } from "ant-design-vue";
-import { loginHttp } from "@api/common";
-// import SvgIcon from "@/components/svg-icon/index.vue";
-
-const router = useRouter();
-
-const loading = ref(false);
-
-const loginModel: LoginModel = reactive({
-  loginName: "",
-  password: "",
-});
-
-const loginRules = {
-  loginName: [{ required: true, message: "请输入用户名" }],
-  password: [{ required: true, message: "请输入密码" }],
-};
-
-const { validate, validateInfos } = Form.useForm(loginModel, loginRules);
-
-const onLogin = () => {
-  validate().then(() => {
-    loading.value = true;
-    doLogin()
-      .then(() => {
-        message.success({ content: "登录成功", key: "success" });
-        setTimeout(() => {
-          message.destroy("success");
-          router.replace({ name: "school" });
-        }, 500);
-      })
-      .finally(() => {
-        loading.value = false;
-      });
-  });
-};
-
-const doLogin = () => {
-  return loginHttp(loginModel);
-};
-</script>
-
-<style scoped lang="less">
-.login-view {
-  width: 100%;
-  height: 100vh;
-  background-color: @white;
-  .login-content {
-    .login-banner {
-      width: 480px;
-    }
-    .login-form {
-      background-color: @bg-color;
-      width: 428px;
-      height: 420px;
-      border-radius: 8px;
-      margin-left: 64px;
-      padding: 64px;
-      .login-title {
-        margin-bottom: 40px;
-        color: @black;
-        font-size: 20px;
-        font-weight: bold;
-      }
-      .login-input {
-        height: 56px;
-        background-color: @white;
-
-        :deep(.ant-input) {
-          background-color: @white;
-        }
-
-        .input-icon {
-          width: 16px;
-          height: 16px;
-        }
-      }
-      .login-button {
-        width: 160px;
-        height: 56px;
-        font-weight: bold;
-        margin-top: 32px;
-      }
-    }
-  }
-  .record-info {
-    width: 428px;
-    margin-left: auto;
-    text-align: center;
-    font-size: 16px;
-  }
-}
-</style>
+<template>
+  <div class="login-view tw-grid tw-place-content-center">
+    <div class="login-content tw-flex tw-items-center">
+      <img
+        class="login-banner"
+        draggable="false"
+        src="@imgs/login/login-banner.png"
+        alt=""
+      />
+      <a-form class="login-form" @submit="onLogin">
+        <div class="login-title">试卷结构管理</div>
+        <a-form-item v-bind="validateInfos.loginName">
+          <a-input
+            class="login-input login-input-name"
+            :maxlength="50"
+            v-model:value="loginModel.loginName"
+            placeholder="请输入用户名"
+          >
+            <template #prefix>
+              <SvgIcon class="input-icon" name="user-icon" />
+            </template>
+          </a-input>
+        </a-form-item>
+        <a-form-item v-bind="validateInfos.password">
+          <a-input-password
+            class="login-input login-input-pwd"
+            v-model:value="loginModel.password"
+            placeholder="请输入密码"
+          >
+            <template #prefix>
+              <SvgIcon class="input-icon" name="pwd-icon" />
+            </template>
+          </a-input-password>
+        </a-form-item>
+        <a-button
+          class="login-button"
+          :loading="loading"
+          type="primary"
+          html-type="submit"
+          >{{ loading ? "登录中..." : "立即登录" }}</a-button
+        >
+      </a-form>
+    </div>
+    <div class="record-info">鄂ICP备12000033号-16</div>
+  </div>
+</template>
+
+<script setup lang="ts" name="PageLogin">
+import { reactive, ref } from "vue";
+import { useRouter } from "vue-router";
+import { Form, message } from "ant-design-vue";
+import { loginHttp } from "@api/common";
+// import SvgIcon from "@/components/svg-icon/index.vue";
+
+const router = useRouter();
+
+const loading = ref(false);
+
+const loginModel: LoginModel = reactive({
+  loginName: "",
+  password: "",
+});
+
+const loginRules = {
+  loginName: [{ required: true, message: "请输入用户名" }],
+  password: [{ required: true, message: "请输入密码" }],
+};
+
+const { validate, validateInfos } = Form.useForm(loginModel, loginRules);
+
+const onLogin = () => {
+  validate().then(() => {
+    loading.value = true;
+    doLogin()
+      .then(() => {
+        message.success({ content: "登录成功", key: "success" });
+        setTimeout(() => {
+          message.destroy("success");
+          router.replace({ name: "school" });
+        }, 500);
+      })
+      .finally(() => {
+        loading.value = false;
+      });
+  });
+};
+
+const doLogin = () => {
+  return loginHttp(loginModel);
+};
+</script>
+
+<style scoped lang="less">
+.login-view {
+  width: 100%;
+  height: 100vh;
+  background-color: @white;
+  .login-content {
+    .login-banner {
+      width: 480px;
+    }
+    .login-form {
+      background-color: @bg-color;
+      width: 428px;
+      height: 420px;
+      border-radius: 8px;
+      margin-left: 64px;
+      padding: 64px;
+      .login-title {
+        margin-bottom: 40px;
+        color: @black;
+        font-size: 20px;
+        font-weight: bold;
+      }
+      .login-input {
+        height: 56px;
+        background-color: @white;
+
+        :deep(.ant-input) {
+          background-color: @white;
+        }
+
+        .input-icon {
+          width: 16px;
+          height: 16px;
+        }
+      }
+      .login-button {
+        width: 160px;
+        height: 56px;
+        font-weight: bold;
+        margin-top: 32px;
+      }
+    }
+  }
+  .record-info {
+    width: 428px;
+    margin-left: auto;
+    text-align: center;
+    font-size: 16px;
+  }
+}
+</style>

+ 301 - 301
src/pages/school-manage/index.vue

@@ -1,301 +1,301 @@
-<template>
-  <div class="school-manage">
-    <Block class="header-block tw-flex tw-items-center tw-justify-between">
-      <a-form layout="inline">
-        <a-form-item label="学校名称">
-          <a-input v-model:value="query.name" placeholder="学校名称" maxlength="50"></a-input>
-        </a-form-item>
-        <a-form-item>
-          <a-button
-            class="search-button"
-            type="primary"
-            @click="querySchoolList"
-            >查询</a-button
-          >
-        </a-form-item>
-      </a-form>
-      <a-button
-        v-if="mainStore.systemUserInfo?.role === 'SUPER_ADMIN'"
-        type="primary"
-        class="tw-flex tw-items-center operation-button"
-        @click="toggleAddSchoolModal"
-      >
-        <template #icon>
-          <PlusCircleOutlined />
-        </template>
-        新增
-      </a-button>
-    </Block>
-    <Block class="school-table">
-      <a-table
-        :columns="columns"
-        :data-source="schoolTableData.result"
-        emptyText="暂无学校信息"
-        @change="currentPageChange"
-        :pagination="{
-          total: schoolTableData.totalCount,
-          pageSize: query.pageSize,
-        }"
-        :row-class-name="
-          (_:any, index:number) => (index % 2 === 1 ? 'table-striped' : null)
-        "
-      >
-        <template #bodyCell="{ column, record, index, text }">
-          <template v-if="column.dataIndex === 'index'">
-            {{ index + 1 }}
-          </template>
-          <template v-else-if="column.dataIndex === 'enable'">
-            <template v-if="record.enable">
-              <CheckCircleFilled style="color: #30bf78" />
-            </template>
-            <template v-else>
-              <CloseCircleFilled style="color: #f4664a" />
-            </template>
-          </template>
-          <template v-else-if="column.dataIndex === 'updateTime'">
-            {{ text || record["createTime"] }}
-          </template>
-          <template v-else-if="column.dataIndex === 'operation'">
-            <div class="tw-flex tw-items-center">
-              <span
-                v-if="mainStore.systemUserInfo?.role === 'SUPER_ADMIN'"
-                class="tw-cursor-pointer tw-p-2"
-                @click="updateSchoolStatus(record)"
-                >{{ record.enable ? "禁用" : "启用" }}</span
-              >
-              <span
-                class="tw-cursor-pointer tw-p-2 tw-ml-1"
-                @click="onEdit(record)"
-                >编辑</span
-              >
-              <a-popover trigger="click">
-                <template #content>
-                  <VueQrCode
-                    type="image/png"
-                    :margin="0"
-                    :color="{}"
-                    :quality="0.9"
-                    :value="record.qrCode"
-                  />
-                </template>
-                <span class="tw-cursor-pointer tw-p-2 tw-ml-1">二维码</span>
-              </a-popover>
-            </div>
-          </template>
-        </template>
-      </a-table>
-    </Block>
-    <a-modal
-      v-model:visible="showModal"
-      :title="`${!schoolInfo.id ? '新增' : '编辑'}学校`"
-      okText="确定"
-      cancelText="取消"
-      :maskClosable="false"
-      @ok="onAddNewSchool"
-      :afterClose="resetFields"
-    >
-      <a-form :labelCol="{ span: 6 }">
-        <a-form-item label="学校编码" v-bind="validateInfos.code">
-          <a-input
-            :disabled="schoolInfo.id"
-            placeholder="学校编码"
-            v-model:value="schoolInfo.code"
-            maxlength="50"
-          ></a-input>
-        </a-form-item>
-        <a-form-item label="学校名称" v-bind="validateInfos.name">
-          <a-input
-            v-model:value="schoolInfo.name"
-            placeholder="学校名称"
-            maxlength="50"
-          ></a-input>
-        </a-form-item>
-        <a-form-item label="负责人" v-bind="validateInfos.contacts">
-          <a-input
-            v-model:value="schoolInfo.contacts"
-            placeholder="学校负责人"
-            maxlength="50"
-          ></a-input>
-        </a-form-item>
-        <a-form-item label="联系方式" v-bind="validateInfos.telephone">
-          <a-input
-            v-model:value="schoolInfo.telephone"
-            placeholder="学校联系方式"
-            maxlength="11"
-          ></a-input>
-        </a-form-item>
-        <a-form-item label="地区" v-bind="validateInfos.region">
-          <a-input
-            v-model:value="schoolInfo.region"
-            placeholder="学校所在地区"
-            maxlength="50"
-          ></a-input>
-        </a-form-item>
-        <a-form-item v-if="!schoolInfo.id" label="状态">
-          <a-radio-group v-model:value="schoolInfo.enable">
-            <a-radio :value="true">启用</a-radio>
-            <a-radio :value="false">禁用</a-radio>
-          </a-radio-group>
-        </a-form-item>
-      </a-form>
-    </a-modal>
-  </div>
-</template>
-
-<script setup lang="ts" name="PageSchool">
-import { reactive, ref, watch } from "vue";
-import {
-  PlusCircleOutlined,
-  CheckCircleFilled,
-  CloseCircleFilled,
-} from "@ant-design/icons-vue";
-import {
-  getSchoolListHttp,
-  updateSchoolStatusHttp,
-  editSchoolInfoHttp,
-} from "@/apis/school";
-import Block from "@/components/block/index.vue";
-import { message, TableColumnType } from "ant-design-vue";
-import { Form } from "ant-design-vue";
-import VueQrCode from "vue-qrcode";
-import { useMainStore } from "@/store/main";
-
-const mainStore = useMainStore();
-
-const showModal = ref(false);
-
-const schoolInfo = reactive<BaseSchoolInfo>({
-  code: "",
-  contacts: "",
-  name: "",
-  region: "",
-  telephone: "",
-  enable: true,
-  id: void 0,
-});
-
-const schoolRules = {
-  code: [{ required: true, message: "请填写学校编码" }],
-  name: [{ required: true, message: "请填写学校名称" }],
-  // contacts: [{ required: true, message: "请填写负责人" }],
-  // region: [{ required: true, message: "请填写学校地区" }],
-  telephone: [
-    // { required: true, message: "请填写联系方式" },
-    { pattern: /\d{11}/, message: "请填写正确联系方式" },
-  ],
-};
-
-const { validate, validateInfos, resetFields } = Form.useForm(
-  schoolInfo,
-  schoolRules
-);
-
-/** 请求参数 */
-const query = reactive<FetchSchoolListQuery>({
-  name: "",
-  pageNumber: 1,
-  pageSize: 10,
-});
-
-/** table配置 */
-const columns: TableColumnType[] = [
-  { title: "序号", dataIndex: "index", align: "center", width: 60 },
-  { title: "学校ID", dataIndex: "id", width: 80, ellipsis: true },
-  { title: "学校名称", dataIndex: "name", ellipsis: true },
-  { title: "地区", dataIndex: "region", ellipsis: true },
-  { title: "状态", dataIndex: "enable", align: "center", width: 60 },
-  { title: "负责人", dataIndex: "contacts", width: 120, ellipsis: true },
-  { title: "联系方式", dataIndex: "telephone", width: 140, ellipsis: true },
-  { title: "更新时间", dataIndex: "updateTime", width: 200, ellipsis: true },
-  { title: "操作", dataIndex: "operation", width: 220 },
-];
-
-/** 学校列表信息 */
-const schoolTableData = reactive<MultiplePageData<SchoolListInfo>>({
-  totalCount: 0,
-  result: [],
-});
-
-/** 显示新增学校弹窗 */
-const toggleAddSchoolModal = (show: boolean = true) => {
-  showModal.value = show;
-};
-
-const currentPageChange = ({ current }: { current: number }) => {
-  query.pageNumber = current;
-};
-
-/** 查询学校列表 */
-const querySchoolList = async () => {
-  try {
-    const { result = [], totalCount } = await getSchoolListHttp(query);
-    Object.assign(schoolTableData, { result, totalCount });
-  } catch (error) {
-    console.error(error);
-  }
-};
-
-watch(() => query.pageNumber, querySchoolList);
-
-/* 启用/禁用 */
-const updateSchoolStatus = (record: SchoolListInfo) => {
-  updateSchoolStatusHttp({ enable: !record.enable, ids: [record.id] }).then(
-    querySchoolList
-  );
-};
-
-/** 编辑学校 */
-const onEdit = (record: SchoolListInfo) => {
-  Object.assign(schoolInfo, {
-    code: record.code,
-    contacts: record.contacts,
-    name: record.name,
-    region: record.region,
-    telephone: record.telephone,
-    enable: !!record.enable,
-    id: record.id,
-  });
-  toggleAddSchoolModal(true);
-};
-
-/** 新增学校 */
-const onAddNewSchool = () => {
-  validate().then((valid) => {
-    if (valid) {
-      editSchoolInfoHttp(schoolInfo).then(() => {
-        message.success(`${schoolInfo.code ? "修改" : "添加"}成功`);
-        toggleAddSchoolModal(false);
-        querySchoolList();
-      });
-    }
-  });
-};
-
-/** effect */
-querySchoolList();
-</script>
-
-<style scoped lang="less">
-.school-manage {
-  .header-block {
-    .search-button {
-      background-color: @font-color;
-      color: @white;
-      border: none;
-      width: 56px;
-      padding: 0;
-      &:after {
-        display: none;
-        opacity: 0;
-      }
-    }
-
-    .operation-button {
-      width: 72px;
-      padding: 0;
-    }
-  }
-  .school-table {
-  }
-}
-</style>
+<template>
+  <div class="school-manage">
+    <Block class="header-block tw-flex tw-items-center tw-justify-between">
+      <a-form layout="inline">
+        <a-form-item label="学校名称">
+          <a-input v-model:value="query.name" placeholder="学校名称" :maxlength="50"></a-input>
+        </a-form-item>
+        <a-form-item>
+          <a-button
+            class="search-button"
+            type="primary"
+            @click="querySchoolList"
+            >查询</a-button
+          >
+        </a-form-item>
+      </a-form>
+      <a-button
+        v-if="mainStore.systemUserInfo?.role === 'SUPER_ADMIN'"
+        type="primary"
+        class="tw-flex tw-items-center operation-button"
+        @click="toggleAddSchoolModal"
+      >
+        <template #icon>
+          <PlusCircleOutlined />
+        </template>
+        新增
+      </a-button>
+    </Block>
+    <Block class="school-table">
+      <a-table
+        :columns="columns"
+        :data-source="schoolTableData.result"
+        emptyText="暂无学校信息"
+        @change="currentPageChange"
+        :pagination="{
+          total: schoolTableData.totalCount,
+          pageSize: query.pageSize,
+        }"
+        :row-class-name="
+          (_:any, index:number) => (index % 2 === 1 ? 'table-striped' : null)
+        "
+      >
+        <template #bodyCell="{ column, record, index, text }">
+          <template v-if="column.dataIndex === 'index'">
+            {{ index + 1 }}
+          </template>
+          <template v-else-if="column.dataIndex === 'enable'">
+            <template v-if="record.enable">
+              <CheckCircleFilled style="color: #30bf78" />
+            </template>
+            <template v-else>
+              <CloseCircleFilled style="color: #f4664a" />
+            </template>
+          </template>
+          <template v-else-if="column.dataIndex === 'updateTime'">
+            {{ text || record["createTime"] }}
+          </template>
+          <template v-else-if="column.dataIndex === 'operation'">
+            <div class="tw-flex tw-items-center">
+              <span
+                v-if="mainStore.systemUserInfo?.role === 'SUPER_ADMIN'"
+                class="tw-cursor-pointer tw-p-2"
+                @click="updateSchoolStatus(record)"
+                >{{ record.enable ? "禁用" : "启用" }}</span
+              >
+              <span
+                class="tw-cursor-pointer tw-p-2 tw-ml-1"
+                @click="onEdit(record)"
+                >编辑</span
+              >
+              <a-popover trigger="click">
+                <template #content>
+                  <VueQrCode
+                    type="image/png"
+                    :margin="0"
+                    :color="{}"
+                    :quality="0.9"
+                    :value="record.qrCode"
+                  />
+                </template>
+                <span class="tw-cursor-pointer tw-p-2 tw-ml-1">二维码</span>
+              </a-popover>
+            </div>
+          </template>
+        </template>
+      </a-table>
+    </Block>
+    <a-modal
+      v-model:visible="showModal"
+      :title="`${!schoolInfo.id ? '新增' : '编辑'}学校`"
+      okText="确定"
+      cancelText="取消"
+      :maskClosable="false"
+      @ok="onAddNewSchool"
+      :afterClose="resetFields"
+    >
+      <a-form :labelCol="{ span: 6 }">
+        <a-form-item label="学校编码" v-bind="validateInfos.code">
+          <a-input
+            :disabled="schoolInfo.id"
+            placeholder="学校编码"
+            v-model:value="schoolInfo.code"
+            :maxlength="50"
+          ></a-input>
+        </a-form-item>
+        <a-form-item label="学校名称" v-bind="validateInfos.name">
+          <a-input
+            v-model:value="schoolInfo.name"
+            placeholder="学校名称"
+            :maxlength="50"
+          ></a-input>
+        </a-form-item>
+        <a-form-item label="负责人" v-bind="validateInfos.contacts">
+          <a-input
+            v-model:value="schoolInfo.contacts"
+            placeholder="学校负责人"
+            :maxlength="50"
+          ></a-input>
+        </a-form-item>
+        <a-form-item label="联系方式" v-bind="validateInfos.telephone">
+          <a-input
+            v-model:value="schoolInfo.telephone"
+            placeholder="学校联系方式"
+            :maxlength="11"
+          ></a-input>
+        </a-form-item>
+        <a-form-item label="地区" v-bind="validateInfos.region">
+          <a-input
+            v-model:value="schoolInfo.region"
+            placeholder="学校所在地区"
+            :maxlength="50"
+          ></a-input>
+        </a-form-item>
+        <a-form-item v-if="!schoolInfo.id" label="状态">
+          <a-radio-group v-model:value="schoolInfo.enable">
+            <a-radio :value="true">启用</a-radio>
+            <a-radio :value="false">禁用</a-radio>
+          </a-radio-group>
+        </a-form-item>
+      </a-form>
+    </a-modal>
+  </div>
+</template>
+
+<script setup lang="ts" name="PageSchool">
+import { reactive, ref, watch } from "vue";
+import {
+  PlusCircleOutlined,
+  CheckCircleFilled,
+  CloseCircleFilled,
+} from "@ant-design/icons-vue";
+import {
+  getSchoolListHttp,
+  updateSchoolStatusHttp,
+  editSchoolInfoHttp,
+} from "@/apis/school";
+import Block from "@/components/block/index.vue";
+import { message, TableColumnType } from "ant-design-vue";
+import { Form } from "ant-design-vue";
+import VueQrCode from "vue-qrcode";
+import { useMainStore } from "@/store/main";
+
+const mainStore = useMainStore();
+
+const showModal = ref(false);
+
+const schoolInfo = reactive<BaseSchoolInfo>({
+  code: "",
+  contacts: "",
+  name: "",
+  region: "",
+  telephone: "",
+  enable: true,
+  id: void 0,
+});
+
+const schoolRules = {
+  code: [{ required: true, message: "请填写学校编码" }],
+  name: [{ required: true, message: "请填写学校名称" }],
+  // contacts: [{ required: true, message: "请填写负责人" }],
+  // region: [{ required: true, message: "请填写学校地区" }],
+  telephone: [
+    // { required: true, message: "请填写联系方式" },
+    { pattern: /\d{11}/, message: "请填写正确联系方式" },
+  ],
+};
+
+const { validate, validateInfos, resetFields } = Form.useForm(
+  schoolInfo,
+  schoolRules
+);
+
+/** 请求参数 */
+const query = reactive<FetchSchoolListQuery>({
+  name: "",
+  pageNumber: 1,
+  pageSize: 10,
+});
+
+/** table配置 */
+const columns: TableColumnType[] = [
+  { title: "序号", dataIndex: "index", align: "center", width: 60 },
+  { title: "学校ID", dataIndex: "id", width: 80, ellipsis: true },
+  { title: "学校名称", dataIndex: "name", ellipsis: true },
+  { title: "地区", dataIndex: "region", ellipsis: true },
+  { title: "状态", dataIndex: "enable", align: "center", width: 60 },
+  { title: "负责人", dataIndex: "contacts", width: 120, ellipsis: true },
+  { title: "联系方式", dataIndex: "telephone", width: 140, ellipsis: true },
+  { title: "更新时间", dataIndex: "updateTime", width: 200, ellipsis: true },
+  { title: "操作", dataIndex: "operation", width: 220 },
+];
+
+/** 学校列表信息 */
+const schoolTableData = reactive<MultiplePageData<SchoolListInfo>>({
+  totalCount: 0,
+  result: [],
+});
+
+/** 显示新增学校弹窗 */
+const toggleAddSchoolModal = (show: boolean = true) => {
+  showModal.value = show;
+};
+
+const currentPageChange = ({ current }: { current: number }) => {
+  query.pageNumber = current;
+};
+
+/** 查询学校列表 */
+const querySchoolList = async () => {
+  try {
+    const { result = [], totalCount } = await getSchoolListHttp(query);
+    Object.assign(schoolTableData, { result, totalCount });
+  } catch (error) {
+    console.error(error);
+  }
+};
+
+watch(() => query.pageNumber, querySchoolList);
+
+/* 启用/禁用 */
+const updateSchoolStatus = (record: SchoolListInfo) => {
+  updateSchoolStatusHttp({ enable: !record.enable, ids: [record.id] }).then(
+    querySchoolList
+  );
+};
+
+/** 编辑学校 */
+const onEdit = (record: SchoolListInfo) => {
+  Object.assign(schoolInfo, {
+    code: record.code,
+    contacts: record.contacts,
+    name: record.name,
+    region: record.region,
+    telephone: record.telephone,
+    enable: !!record.enable,
+    id: record.id,
+  });
+  toggleAddSchoolModal(true);
+};
+
+/** 新增学校 */
+const onAddNewSchool = () => {
+  validate().then((valid) => {
+    if (valid) {
+      editSchoolInfoHttp(schoolInfo).then(() => {
+        message.success(`${schoolInfo.code ? "修改" : "添加"}成功`);
+        toggleAddSchoolModal(false);
+        querySchoolList();
+      });
+    }
+  });
+};
+
+/** effect */
+querySchoolList();
+</script>
+
+<style scoped lang="less">
+.school-manage {
+  .header-block {
+    .search-button {
+      background-color: @font-color;
+      color: @white;
+      border: none;
+      width: 56px;
+      padding: 0;
+      &:after {
+        display: none;
+        opacity: 0;
+      }
+    }
+
+    .operation-button {
+      width: 72px;
+      padding: 0;
+    }
+  }
+  .school-table {
+  }
+}
+</style>

+ 2 - 2
src/pages/subjects-manage/index.vue

@@ -46,14 +46,14 @@
           <a-input
             v-model:value="query.courseCode"
             placeholder="科目代码"
-            maxlength="50"
+            :maxlength="50"
           ></a-input>
         </a-form-item>
         <a-form-item label="科目名称">
           <a-input
             v-model:value="query.courseName"
             placeholder="科目名称"
-            maxlength="50"
+            :maxlength="50"
           ></a-input>
         </a-form-item>
         <a-form-item label="试卷总分" class="range-item">

+ 15 - 14
src/pages/user-manage/index.vue

@@ -21,7 +21,7 @@
         <a-form-item label="登录名">
           <a-input
             v-model:value="query.loginName"
-            maxlength="50"
+            :maxlength="50"
             placeholder="登录名"
           ></a-input>
         </a-form-item>
@@ -89,7 +89,7 @@
             </template>
           </template>
           <template v-else-if="column.dataIndex === 'courseCodes'">
-            {{record.courseCodes.join('、')}}
+            {{record.courseCodes?.join('、')}}
           </template>
           <template v-else-if="column.dataIndex === 'operation'">
             <div
@@ -143,17 +143,27 @@
             >
           </a-select>
         </a-form-item>
+        <a-form-item label="角色" v-bind="validateInfos.role">
+          <a-select v-model:value="userInfo.role" placeholder="请选择角色">
+            <a-select-option value="SCHOOL_ADMIN">{{
+                ROLE.SCHOOL_ADMIN
+              }}</a-select-option>
+            <a-select-option value="SECTION_LEADER">{{
+                ROLE.SECTION_LEADER
+              }}</a-select-option>
+          </a-select>
+        </a-form-item>
         <a-form-item label="姓名" v-bind="validateInfos.name">
           <a-input
             v-model:value="userInfo.name"
-            maxlength="50"
+            :maxlength="50"
             placeholder="请输入姓名"
           ></a-input>
         </a-form-item>
         <a-form-item label="登录名" v-bind="validateInfos.loginName">
           <a-input
             v-model:value="userInfo.loginName"
-            maxlength="11"
+            :maxlength="11"
             :placeholder="
               userInfo.role === 'SECTION_LEADER'
                 ? '请输入登录手机号'
@@ -171,16 +181,7 @@
             placeholder="请输入密码"
           ></a-input-password>
         </a-form-item>
-        <a-form-item label="角色" v-bind="validateInfos.role">
-          <a-select v-model:value="userInfo.role" placeholder="请选择角色">
-            <a-select-option value="SCHOOL_ADMIN">{{
-              ROLE.SCHOOL_ADMIN
-            }}</a-select-option>
-            <a-select-option value="SECTION_LEADER">{{
-              ROLE.SECTION_LEADER
-            }}</a-select-option>
-          </a-select>
-        </a-form-item>
+
         <a-form-item
           v-if="userInfo.role === 'SECTION_LEADER'"
           label="所属科目"