瀏覽代碼

登录+验证码

刘冰洁 1 年之前
父節點
當前提交
b379e1f29b

+ 2 - 2
src/config/regexp.ts

@@ -6,8 +6,8 @@ export const REGEXP_PHONE =
 export const REGEXP_EMAIL = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
 
 /** 密码正则(密码为6-18位数字/字符/符号的组合) */
-export const REGEXP_PWD =
-  /^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)]|[()])+$)(?!^.*[\u4E00-\u9FA5].*$)([^(0-9a-zA-Z)]|[()]|[a-z]|[A-Z]|[0-9]){6,18}$/;
+export const REGEXP_PWD = /^([0-9]{6,18}|[a-zA-Z]{6,18}|[^0-9a-zA-Z]{6,18})$/;
+  // /^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)]|[()])+$)(?!^.*[\u4E00-\u9FA5].*$)([^(0-9a-zA-Z)]|[()]|[a-z]|[A-Z]|[0-9]){6,18}$/;
 
 /** 6位数字验证码正则 */
 export const REGEXP_CODE_SIX = /^\d{6}$/;

+ 1 - 1
src/config/service.ts

@@ -43,4 +43,4 @@ export const ERROR_STATUS = {
 export const NO_ERROR_MSG_CODE: (string | number)[] = [];
 
 /** token失效需要刷新token的code(这里的66666只是个例子,需要将后端表示token过期的code填进来) */
-export const REFRESH_TOKEN_CODE: (string | number)[] = [66666];
+export const REFRESH_TOKEN_CODE: (string | number)[] = ['token'];

+ 28 - 5
src/service/api/auth.ts

@@ -1,4 +1,4 @@
-import { mockRequest } from '../request';
+import { request,mockRequest } from '../request';
 
 /**
  * 获取验证码
@@ -6,16 +6,39 @@ import { mockRequest } from '../request';
  * @returns - 返回boolean值表示是否发送成功
  */
 export function fetchSmsCode(phone: string) {
-  return mockRequest.post<boolean>('/getSmsCode', { phone });
+  return request.post<boolean>('/getSmsCode', { phone });
 }
 
+// 参数接口
+export interface AdminLoginParams {
+  username?: string;
+  passwd?: string;
+	captchaVerification?: string
+}
+
+// 响应接口
+export interface AdminLoginRes {
+  status: boolean;
+  msg: string;
+  data: Record<string, unknown>;
+}
+/**
+ * 管理员登录
+ * @param {object} params AdminPojo
+ * @param {string} params.username
+ * @param {string} params.passwd
+ * @returns
+ */
+// export function adminLogin(params: AdminLoginParams) {
+//   return request.post(`/adminLogin`, params);
+// }
 /**
  * 登录
  * @param userName - 用户名
  * @param password - 密码
  */
-export function fetchLogin(userName: string, password: string) {
-  return mockRequest.post<ApiAuth.Token>('/login', { userName, password });
+export function fetchLogin(params: AdminLoginParams) {
+  return request.post<ApiAuth.Token>('/adminLogin',params);
 }
 
 /** 获取用户信息 */
@@ -37,5 +60,5 @@ export function fetchUserRoutes(userId: string) {
  * @param refreshToken
  */
 export function fetchUpdateToken(refreshToken: string) {
-  return mockRequest.post<ApiAuth.Token>('/updateToken', { refreshToken });
+  return request.post<ApiAuth.Token>('/refreshToken',  refreshToken );
 }

+ 6 - 1
src/service/request/index.ts

@@ -5,6 +5,11 @@ const { url, proxyPattern } = getServiceEnvConfig(import.meta.env);
 
 const isHttpProxy = import.meta.env.VITE_HTTP_PROXY === 'Y';
 
-export const request = createRequest({ baseURL: isHttpProxy ? proxyPattern : url });
+export const request = createRequest({ baseURL: isHttpProxy ? proxyPattern : url,
+	headers: {
+		'X-Requested-With': 'XMLHttpRequest',
+    'Content-Type': 'application/json; charset=UTF-8'
+	}
+});
 
 export const mockRequest = createRequest({ baseURL: '/mock' });

+ 5 - 3
src/service/request/instance.ts

@@ -43,14 +43,18 @@ export default class CustomAxiosInstance {
   setInterceptor() {
     this.instance.interceptors.request.use(
       async config => {
+				console.log("--------------------", config);
         const handleConfig = { ...config };
         if (handleConfig.headers) {
           // 数据转换
+					console.log(handleConfig.headers);
           const contentType = handleConfig.headers['Content-Type'] as UnionKey.ContentType;
+					// console.log(contentType);
           handleConfig.data = await transformRequestData(handleConfig.data, contentType);
           // 设置token
-          handleConfig.headers.Authorization = localStg.get('token') || '';
+          handleConfig.headers.Authorization = localStg.get('token') ||'';
         }
+				console.log(handleConfig);
         return handleConfig;
       },
       (axiosError: AxiosError) => {
@@ -66,10 +70,8 @@ export default class CustomAxiosInstance {
           const { codeKey, dataKey, successCode } = this.backendConfig;
           // 请求成功
           if (backend[codeKey] === successCode ) {
-            // console.log('fanhui');
             return handleServiceResult(null, backend[dataKey]);
           }
-
           // token失效, 刷新token
           if (REFRESH_TOKEN_CODE.includes(backend[codeKey])) {
             const config = await handleRefreshToken(response.config);

+ 1 - 0
src/service/request/request.ts

@@ -19,6 +19,7 @@ interface RequestParam {
  * @param backendConfig - 后端接口字段配置
  */
 export function createRequest(axiosConfig: AxiosRequestConfig, backendConfig?: Service.BackendResultConfig) {
+	console.log( "axiosConfig",  axiosConfig )
   const customInstance = new CustomAxiosInstance(axiosConfig, backendConfig);
 
   /**

+ 30 - 28
src/store/modules/auth/index.ts

@@ -1,7 +1,7 @@
 import { unref, nextTick } from 'vue';
 import { defineStore } from 'pinia';
 import { router } from '@/router';
-import { fetchLogin, fetchUserInfo } from '@/service';
+import { fetchLogin, fetchUserInfo,AdminLoginParams } from '@/service';
 import { useRouterPush } from '@/composables';
 import { localStg } from '@/utils';
 import { useTabStore } from '../tab';
@@ -107,14 +107,16 @@ export const useAuthStore = defineStore('auth-store', {
 
       return successFlag;
     },
+		
     /**
      * 登录
      * @param userName - 用户名
      * @param password - 密码
      */
-    async login(userName: string, password: string) {
+
+    async login(params:AdminLoginParams) {
       this.loginLoading = true;
-      const { data } = await fetchLogin(userName, password);
+      const { data } = await fetchLogin(params);
       if (data) {
         await this.handleActionAfterLogin(data);
       }
@@ -124,30 +126,30 @@ export const useAuthStore = defineStore('auth-store', {
      * 更换用户权限(切换账号)
      * @param userRole
      */
-    async updateUserRole(userRole: Auth.RoleType) {
-      const { resetRouteStore, initAuthRoute } = useRouteStore();
-
-      const accounts: Record<Auth.RoleType, { userName: string; password: string }> = {
-        super: {
-          userName: 'Super',
-          password: 'super123'
-        },
-        admin: {
-          userName: 'Admin',
-          password: 'admin123'
-        },
-        user: {
-          userName: 'User01',
-          password: 'user01123'
-        }
-      };
-      const { userName, password } = accounts[userRole];
-      const { data } = await fetchLogin(userName, password);
-      if (data) {
-        await this.loginByToken(data);
-        resetRouteStore();
-        initAuthRoute();
-      }
-    }
+    // async updateUserRole(userRole: Auth.RoleType) {
+    //   const { resetRouteStore, initAuthRoute } = useRouteStore();
+
+    //   const accounts: Record<Auth.RoleType, { userName: string; password: string }> = {
+    //     super: {
+    //       userName: 'Super',
+    //       password: 'super123'
+    //     },
+    //     admin: {
+    //       userName: 'Admin',
+    //       password: 'admin123'
+    //     },
+    //     user: {
+    //       userName: 'User01',
+    //       password: 'user01123'
+    //     }
+    //   };
+    //   const { userName, password } = accounts[userRole];
+    //   const { data } = await fetchLogin(userName, password);
+    //   if (data) {
+    //     await this.loginByToken(data);
+    //     resetRouteStore();
+    //     initAuthRoute();
+    //   }
+    // }
   }
 });

+ 19 - 8
src/utils/crypto/index.ts

@@ -1,14 +1,23 @@
 import CryptoJS from 'crypto-js';
 
-const CryptoSecret = '__CryptoJS_Secret__';
+const keyword = 'eas-key-password';
 
 /**
  * 加密数据
  * @param data - 数据
  */
 export function encrypto(data: any) {
-  const newData = JSON.stringify(data);
-  return CryptoJS.AES.encrypt(newData, CryptoSecret).toString();
+	const time = Date.now();
+	 //转码
+	 const wordStr = CryptoJS.enc.Utf8.parse(time + "" + data);
+	 const key = CryptoJS.enc.Utf8.parse(keyword);
+  // const newData = JSON.stringify(data);
+	//加密
+  const cryptoStr = CryptoJS.AES.encrypt(wordStr, key, {
+    mode: CryptoJS.mode.ECB, //模式
+    padding: CryptoJS.pad.Pkcs7, //补零
+  });
+ return cryptoStr.toString();
 }
 
 /**
@@ -16,10 +25,12 @@ export function encrypto(data: any) {
  * @param cipherText - 密文
  */
 export function decrypto(cipherText: string) {
-  const bytes = CryptoJS.AES.decrypt(cipherText, CryptoSecret);
-  const originalText = bytes.toString(CryptoJS.enc.Utf8);
-  if (originalText) {
-    return JSON.parse(originalText);
-  }
+	const key = CryptoJS.enc.Utf8.parse(keyword);
+	//解密
+  const cryptoStr = CryptoJS.AES.decrypt(cipherText, key, {
+    mode: CryptoJS.mode.ECB, //模式
+    padding: CryptoJS.pad.Pkcs7, //补零
+  });
+  return CryptoJS.enc.Utf8.stringify(cryptoStr).toString();
   return null;
 }

+ 1 - 7
src/utils/form/rule.ts

@@ -1,6 +1,6 @@
 import type { Ref } from 'vue';
 import type { FormItemRule } from 'naive-ui';
-import { REGEXP_CODE_SIX, REGEXP_PHONE,REGEXP_PWD } from '@/config';
+import { REGEXP_PWD } from '@/config';
 
 /** 创建自定义错误信息的必填表单规则 */
 export const createRequiredFormRule = (message = '不能为空'): FormItemRule => ({ required: true, message });
@@ -11,21 +11,15 @@ export const requiredFormRule = createRequiredFormRule();
 interface CustomFormRules {
   /** 手机号码 */
   createTime: FormItemRule[];
-	description:[];
-
 	pwd:FormItemRule[];
 }
 
 /** 表单规则 */
 export const formRules: CustomFormRules = {
-	description:[
-
-	],
   createTime: [
     createRequiredFormRule('请输入创建时间'),
     { pattern: '', message: '不能为空', trigger: 'input' }
   ],
-
 	pwd: [{ pattern: REGEXP_PWD, message: '密码格式错误', trigger: 'blur' }]
 };
 

+ 8 - 8
src/views/_builtin/login/components/pwd-login/components/verifition/Verify.vue

@@ -33,7 +33,7 @@
      * */
     import VerifySlide from './Verify/VerifySlide'
     import VerifyPoints from './Verify/VerifyPoints'
-import { computed, ref,watch,toRefs,watchEffect } from 'vue';
+		import { computed, ref,watch,toRefs,watchEffect } from 'vue';
 
     export default {
         name: 'Vue2Verify',
@@ -83,7 +83,7 @@ import { computed, ref,watch,toRefs,watchEffect } from 'vue';
             const clickShow = ref(false)
             const verifyType = ref(undefined)
             const componentType = ref(undefined)
-            
+
             const instance = ref({})
 
             const showBox = computed(()=>{
@@ -112,7 +112,7 @@ import { computed, ref,watch,toRefs,watchEffect } from 'vue';
                     clickShow.value = true;
                 }
             }
-            watchEffect(()=>{   
+            watchEffect(()=>{
                 switch (captchaType.value) {
                     case 'blockPuzzle':
                         verifyType.value = '2'
@@ -134,7 +134,7 @@ import { computed, ref,watch,toRefs,watchEffect } from 'vue';
                 closeBox,
                 show
             }
-        },  
+        },
     }
 </script>
 <style>
@@ -193,11 +193,11 @@ import { computed, ref,watch,toRefs,watchEffect } from 'vue';
         color: #fff;
     }
     .suc-bg{
-       background-color:rgba(92, 184, 92,.5);  
+       background-color:rgba(92, 184, 92,.5);
        filter: progid:DXImageTransform.Microsoft.gradient(startcolorstr=#7f5CB85C, endcolorstr=#7f5CB85C);
     }
     .err-bg{
-       background-color:rgba(217, 83, 79,.5);  
+       background-color:rgba(217, 83, 79,.5);
        filter: progid:DXImageTransform.Microsoft.gradient(startcolorstr=#7fD9534F, endcolorstr=#7fD9534F);
     }
     .tips-enter,.tips-leave-to{
@@ -256,8 +256,8 @@ import { computed, ref,watch,toRefs,watchEffect } from 'vue';
         border: none;
         margin-top: 10px;
     }
-    
-    
+
+
     /*滑动验证码*/
     .verify-bar-area {
         position: relative;

File diff suppressed because it is too large
+ 546 - 362
src/views/_builtin/login/components/pwd-login/components/verifition/Verify/VerifySlide.vue


+ 2 - 2
src/views/_builtin/login/components/pwd-login/components/verifition/api/index.js

@@ -9,7 +9,7 @@ import request from "./../utils/axios"  //组件内部封装的axios
 //获取验证图片  以及token
 export function reqGet(data) {
 	return  request({
-        url: '/captcha/get',
+        url: '/proxy-pattern/verify.get',
         method: 'post',
         data
     })
@@ -18,7 +18,7 @@ export function reqGet(data) {
 //滑动或者点选验证
 export function reqCheck(data) {
 	return  request({
-        url: '/captcha/check',
+        url: '/proxy-pattern/verify.check',
         method: 'post',
         data
     })

+ 1 - 1
src/views/_builtin/login/components/pwd-login/components/verifition/utils/axios.js

@@ -1,6 +1,6 @@
 import axios from 'axios';
 
-axios.defaults.baseURL = 'https://captcha.anji-plus.com/captcha-api';
+axios.defaults.baseURL = '/';
 
 const service = axios.create({
   timeout: 40000,

File diff suppressed because it is too large
+ 140 - 54
src/views/_builtin/login/components/pwd-login/index.vue


File diff suppressed because it is too large
+ 224 - 0
src/views/_builtin/login/components/pwd-login/indexppp.vue


+ 48 - 30
src/views/management/sort/components/column-search.vue

@@ -1,13 +1,31 @@
 <template>
-  <n-space  >
-    <n-input-group>
-			<span class="w-40px mr-5px line-height-33.99px">页码</span>  <n-input-number :style="{ width: '48%',marginRight:'2%'}" placeholder="请输入页码..." clearable 	v-model="pagination.page"	  @change="searchCondition" />
-			<span class="w-40px mr-5px line-height-33.99px">条数</span> <n-input-number :style="{ width: '48%' }" placeholder="请输入数据条数..." clearable v-model="pagination.pageSize"  @change="searchCondition"/>
-			<n-button type="primary" ghost  @click="searchCondition()">
-    		 	搜索
-    </n-button>
-    </n-input-group>
-  </n-space>
+	<n-space>
+		<n-input-group>
+			<n-input-group>
+				 <span class="w-80px mr-5px line-height-33.99px">学科名称</span> <n-input :style="{ width: '31%', marginRight: '2%' }"
+					clearable />
+				<span class="w-80px mr-5px line-height-33.99px">学科描述</span> <n-input :style="{ width: '31%' ,marginRight:'2%'}" clearable/>
+    		<span class="w-100px line-height-33.99px">创建用户ID</span> <n-input-number :style="{ width: '22%',marginRight:'10%' }" clearable />
+			</n-input-group>
+			<n-input-group>
+			  <span class="line-height-33.99px mr-5px w-70px">创建时间</span>
+				<n-date-picker :style="{ width: '13%' }" />
+				<n-time-picker :style="{ width: '14.2%', marginRight: '2%' }" />
+				<span class="line-height-33.99px mr-5px w-70px">修改时间</span>
+				<n-date-picker :style="{ width: '13%' }" />
+				<n-time-picker :style="{ width: '14.2%', marginRight: '2%' }" />
+				<span class="w-50px  line-height-33.99px">状态</span>
+				<n-select :options="selectOptions" :style="{ width: '21%', marginRight: '2%' }" clearable />
+			</n-input-group>
+			<span class="w-40px mr-5px line-height-33.99px">页码</span> <n-input-number :style="{ width: '48%', marginRight: '2%' }"
+				placeholder="请输入页码..." clearable v-model="pagination.page" @change="searchCondition" />
+			<span class="w-40px mr-5px line-height-33.99px">条数</span> <n-input-number :style="{ width: '48%' }"
+				placeholder="请输入数据条数..." clearable v-model="pagination.pageSize" @change="searchCondition" />
+			 <n-button type="primary" ghost @click="searchCondition()">
+				搜索
+			</n-button>
+		</n-input-group>
+	</n-space>
 </template>
 
 <script lang="ts">
@@ -15,7 +33,7 @@ import { defineComponent, ref } from 'vue'
 import { NButton, NSpace } from 'naive-ui';
 import type { PaginationProps } from 'naive-ui';
 
-import { selectByCondition_1} from '~/src/service/api/sort';
+import { selectByCondition_1 } from '~/src/service/api/sort';
 import type { SelectByCondition_1Params } from '~/src/service/api/sort';
 
 const searchData = ref<any[]>([]);
@@ -35,36 +53,36 @@ const pagination: PaginationProps = ref({
 	}
 }).value;
 
-function searchCondition(){
+function searchCondition() {
 	const pageNum = pagination.page as number;
-  const pageSize = pagination.pageSize as number;
-  const params: SelectByCondition_1Params = {};
-	console.log(pageNum,pageSize);
+	const pageSize = pagination.pageSize as number;
+	const params: SelectByCondition_1Params = {};
+	console.log(pageNum, pageSize);
 
-  selectByCondition_1(pageNum, pageSize, params).then(res => {
-    // console.log(res);
-    searchData.value = res.data as [];
+	selectByCondition_1(pageNum, pageSize, params).then(res => {
+		// console.log(res);
+		searchData.value = res.data as [];
 		console.log(searchData.value);
-  });
+	});
 }
 
 export default defineComponent({
-  setup () {
-    return {
+	setup() {
+		return {
 			searchCondition,
 			searchData,
-      pagination,
-      selectOptions: ref([
-        {
-          label: 'Y',
-          value: 'Y'
-        },
+			pagination,
+			selectOptions: ref([
+				{
+					label: 'Y',
+					value: 'Y'
+				},
 				{
 					label: 'N',
-          value: 'N'
+					value: 'N'
 				}
-      ]),
-    }
-  }
+			]),
+		}
+	}
 })
 </script>

+ 29 - 101
src/views/management/sort/index.vue

@@ -5,7 +5,7 @@
 				<n-space class="pb-14px" justify="space-between">
 					<!-- 加入查询组件 -->
 					<n-space>
-						<n-button type="primary" :data="addData" @click="addTableData">
+						<n-button type="primary"  @click="addTableData">
 							<icon-ic-round-plus class="mr-4px text-20px" />
 							新增
 						</n-button>
@@ -19,7 +19,7 @@
 							查询
 						</n-button>
 						<n-input-group>
-							<n-input :style="{ width: '100%', }" placeholder="请输入id查询..." @clear="searchClear"  @keydown="handleKeyDown" @change="handleChange"
+							<n-input :style="{ width: '100%', }" placeholder="请输入id查询..." @clear="searchClear"  @change="handleChange"
 								@keyup.enter="handleSearch" v-model="searchId" clearable />
 							<n-button type="primary" ghost @click="handleSearch">
 								搜索
@@ -46,9 +46,9 @@
 						</n-button>
 					</n-space>
 				</n-space>
-				<n-data-table v-if="searchForm.length > 0" :columns="columns" :data="searchForm" :loading="loading"
+				<n-data-table v-if="searchForm.length > 0" :columns="createColumns" :data="searchForm" :loading="loading"
 					:pagination="pagination" :row-key="rowKey" @update:checked-row-keys="handleCheck" />
-				<n-data-table v-if="searchForm.length <= 0" :columns="columns" :data="tableData" :loading="loading"
+				<n-data-table v-if="searchForm.length <= 0" :columns="createColumns" :data="tableData" :loading="loading"
 					:pagination="pagination" :row-key="rowKey" @update:checked-row-keys="handleCheck" />
 				<table-action-add v-model:visible="visible" :type="modalType" :edit-data="editData" />
 			</n-card>
@@ -56,19 +56,16 @@
 	</div>
 </template>
 
-<script lang="tsx" >
-import { defineComponent, ref } from 'vue'
+<script setup lang="tsx" >
+import { ref } from 'vue'
 import { NButton, NSpace, NTag, NPopconfirm } from 'naive-ui';
 import type { DataTableColumns, PaginationProps } from 'naive-ui';
 import { useBoolean, useLoading } from '@/hooks';
 import type { DataTableRowKey } from 'naive-ui'
 import TableActionAdd from './components/table-action-add.vue'
 import type { ModalType } from './components/table-action-add.vue';
-// import {  userStatusLabels } from '@/constants';
 import { userStatusLabels } from '@/constants';
 import { selectAll_1, deleteById, selectById_1 } from '~/src/service/api/sort';
-import type { AddEasEduCategoryParams } from '~/src/service/api/sort';
-// import ColumnSearch from './components/column-search.vue';
 import { selectByCondition_1 } from '~/src/service/api/sort';
 import type { SelectByCondition_1Params } from '~/src/service/api/sort';
 type RowData = {
@@ -81,19 +78,17 @@ type RowData = {
 	createUid: number
 	disabled: string
 }
-
 const { loading, startLoading, endLoading } = useLoading(false);
 const { bool: visible, setTrue: openModal } = useBoolean();
-
 const tableData = ref<any[]>([]);
 const searchInput = ref([]) as any;
 const searchForm = ref([]) as any;
 const searchId = ref<number>(0); // 定义为数字类型,默认值为0
-const searchData = ref<any[]>([]);
+// const searchData = ref<any[]>([]);
 const searchConData = ref<any[]>([]);
 const searchpagedata = ref<number>(0)
 const searchpagesize = ref<number>(0)
-// const search = ref([]) as any;
+
 function searchPage(v: number | null) {
 	searchpagedata.value = Number(v)
 }
@@ -108,13 +103,11 @@ const pagination: PaginationProps = ref({
 	onChange: (page: number) => {
 		// 处理页码变化
 		pagination.page = page;
-		console.log(pagination.page);
 	},
 	onUpdatePageSize: (pageSize: number) => {
 		// 处理每页显示数量变化
 		pagination.pageSize = pageSize;
 		pagination.page = 1;
-		console.log(pagination.pageSize);
 	}
 }).value;
 
@@ -123,11 +116,8 @@ function searchCondition() {
 	const pageSize = searchpagesize.value as number;
 	const params: SelectByCondition_1Params = {};
 	if(pageNum  &&  pageSize){
-		console.log(pageNum,pageSize);
 		selectByCondition_1(pageNum, pageSize, params).then(res => {
-		console.log(pageNum,pageSize);
 		searchConData.value = res.data as [];
-		console.log(searchConData.value);
 		pagination.page =searchpagedata.value
 		pagination.pageSize=searchpagesize.value
 		window.$message?.success('查询成功');
@@ -147,6 +137,7 @@ export async function getTableData() {
 			endLoading();
 		}, 1000);
 	});
+	checkedRowKeysRef.value=[]
 }
 function init() {
 	getTableData();
@@ -163,14 +154,12 @@ function searchConClear(){
 
 const showSearch = ref(false)
 function handleOpenSearch() {
-	// 点击查询时显示搜索框
+// 点击查询时显示搜索框
 	showSearch.value = !showSearch.value;
 }
 // 输入数据
 function handleChange(v: string) {
-	// console.log(v);
 	searchId.value = Number(v)
-	console.log(searchId.value);
 }
 // 根据id查询数据
 async function handleSearch() {
@@ -180,15 +169,9 @@ async function handleSearch() {
 				// 更新数据
 				searchInput.value = res.data as [];
 				const filteredItems = tableData.value.filter(item => item.id === searchInput.value.id)
-				// console.log(filteredItems);
 				searchForm.value = filteredItems;
-				console.log(searchForm.value);
 				window.$message?.success('查询成功');
 			})
-			.catch(err => {
-				window.$message?.warning('请输入有效的ID进行查询');
-				console.error('查询失败', err);
-			});
 	}
 	else {
 		searchForm.value.length = 0
@@ -196,37 +179,26 @@ async function handleSearch() {
 	}
 }
 
-
 function searchClear() {
 	searchForm.value.length = 0
 	getTableData();
 }
 
-
 const checkedRowKeysRef = ref<DataTableRowKey[]>([])
-
+	const s = ref<DataTableRowKey[]>([])
 // 根据id进行删除
 async function deleteTableData() {
-	const ids = checkedRowKeysRef.value;
-	// console.log(ids);
+	const ids = checkedRowKeysRef.value.filter((item)=>!s.value?.includes(item));
+	s.value=checkedRowKeysRef.value
 	if (ids.length !== 0) {
 		console.log(ids);
 		for (const id of ids) {
 			// 调用删除接口
-			console.log(id);
-			checkedRowKeysRef.value= []
 			await deleteById(id as number)
 				.then((res) => {
-					// const deleteRes = res.data;
-						console.log(`成功删除课程,ID: ${id}`);
 						window.$message?.success('删除成功!');
 				})
-				.catch((error) => {
-					// 错误处理
-					console.error(`删除课程发生错误,ID: ${id}`, error);
-					window.$message?.error('删除失败!');
-				});
-		}	checkedRowKeysRef.value= []
+		}
 		getTableData(); // 删除完成后刷新表格数据
 	} else {
 		// 没有选择任何行时的操作
@@ -238,18 +210,11 @@ const modalType = ref<ModalType>('add' || 'edit');
 
 function setModalType(type: ModalType) {
 	modalType.value = type;
-	// console.log(modalType.value);
 }
 // 添加
-const addData = ref<AddEasEduCategoryParams[]>([]);
 function addTableData() {
 	openModal();
 	setModalType('add');
-	// const params: AddEasEduCategoryParams = {};
-	// addEasEduCategory(params).then(res => {
-	// 	console.log(res);
-	// 	addData.value = res.data as [];
-	// });
 }
 
 const editData = ref<UserManagement.User | null>(null);
@@ -264,7 +229,6 @@ function handleEditTable(rowId: number | null) {
 	if (findItem) {
 		setEditData(findItem);
 	}
-	// console.log(findItem);
 	getTableData(); // 编辑完成后刷新表格数据
 }
 
@@ -272,7 +236,6 @@ function handleDeleteTable(rowId: number | null) {
 	const findItem = tableData.value.find(item => item.id === rowId);
 	if (findItem) {
 		deleteById(findItem.id).then((r) => {
-			console.log(r);
 			getTableData(); // 编辑完成后刷新表格数据
 		})
 	}
@@ -353,54 +316,19 @@ const createColumns = (): DataTableColumns<UserManagement.User> => [
 	},
 ]
 
-export default defineComponent({
-	components: {
-		TableActionAdd,
-		// ColumnSearch
-	},
-	setup() {
-		return {
-			showSearch,
-			searchPage,
-			searchSize,
-			tableData,
-			addData,
-			searchConClear,
-			searchCondition,
-			loading,
-			modalType,
-			searchData,
-			setEditData,
-			handleSearch,
-			searchId,
-			searchForm,
-			editData,
-			handleChange,
-			getTableData,
-			addTableData,
-			setModalType,
-			deleteTableData,
-			handleEditTable,
-			searchClear,
-			handleOpenSearch,
-			visible,
-			columns: createColumns(),
-			checkedRowKeys: checkedRowKeysRef,
-			pagination,
-			rowKey: (row: RowData) => row.id,
-			handleCheck(rowKeys: DataTableRowKey[]) {
-				checkedRowKeysRef.value = rowKeys
-				console.log(checkedRowKeysRef.value);
-			},
-		handleKeyDown(event:KeyboardEvent) {
-      if (event.key === 'Backspace' && searchId.value===0) {
-        // 处理删除键按下且输入框为空的情况
-        // 执行刷新操作,例如调用 API 获取原来的列表数据
-				getTableData()
-      }
-			console.log(1);
-    },
-		}
-	}
-})
+const	rowKey= (row: RowData) => row.id
+function handleCheck(rowKeys: DataTableRowKey[]) {
+	checkedRowKeysRef.value = rowKeys
+}
+		// handleKeyDown(event:KeyboardEvent) {
+    //   if (event.key === 'Backspace' && searchId.value===0) {
+    //     // 处理删除键按下且输入框为空的情况
+    //     // 执行刷新操作,例如调用 API 获取原来的列表数据
+		// 		getTableData()
+    //   }
+		// 	console.log(1);
+    // },
+
+
+
 </script>

Some files were not shown because too many files changed in this diff