Quellcode durchsuchen

feat(auth): 添加模拟登录接口用于测试

refactor(views): 移除未使用的导入和错误处理
style(views): 调整按钮图标和请求参数格式
zhanghaijun vor 10 Monaten
Ursprung
Commit
0aebb6e55f

+ 17 - 0
src/api/auth.api.ts

@@ -20,6 +20,23 @@ export interface UserItem {
 export class AuthService {
   // 登录
   static login = (params: LoginParams) => request.post<LoginResponse>('/auth/login', params)
+  // 模拟登录
+  static login2 = (params: LoginParams) => {
+    return Promise.resolve({
+      code: 200,
+      msg: '登录成功',
+      data: {
+        token: 'mock-token',
+        RYID: 'mock-RYID',
+        SF: '2',
+        userId: 1,
+        username: params.userName,
+        userType: 2,
+        roleCodes: ['ROLE_USER'],
+        buttons: ['btn:read']
+      }
+    })
+  }
   // 退出登录
   static logout = () => request.post('/auth/logout')
 }

+ 1 - 11
src/views/auth/login/index.vue

@@ -76,13 +76,12 @@
 
 <script setup lang="ts">
   import AppConfig from '@/config'
-  import { ElNotification, ElMessage } from 'element-plus'
+  import { ElNotification } from 'element-plus'
   import { useUserStore } from '@/store/modules/user'
   import { getCssVar } from '@/utils/ui'
   import { languageOptions } from '@/locales'
   import { LanguageEnum, SystemThemeEnum } from '@/enums/appEnum'
   import { useI18n } from 'vue-i18n'
-  import { HttpError } from '@/utils/http/server.error'
   defineOptions({ name: 'Login' })
   // 切换主题
   import { useTheme } from '@/composables/useTheme'
@@ -159,15 +158,6 @@
       } else {
         router.push('/')
       }
-    } catch (error) {
-      // 处理 HttpError
-      if (error instanceof HttpError) {
-        // console.log(error.code)
-      } else {
-        // 处理非 HttpError
-        ElMessage.error('登录失败,请稍后重试')
-        console.error('[Login] Unexpected error:', error)
-      }
     } finally {
       loading.value = false
       resetDragVerify()

+ 2 - 3
src/views/train/course/detail/index.vue

@@ -7,7 +7,7 @@
       <el-space wrap>
         <el-button v-if="!courseQuery" v-ripple type="primary" @click="handleCancel"> 取消 </el-button>
         <el-button v-if="!courseQuery" v-ripple type="primary" @click="addCourse"> 保存课程 </el-button>
-        <el-button v-if="courseEdit" v-ripple :icon="Plus" type="primary" @click="uploadCourse"> 上传信息化 </el-button>
+        <el-button v-if="courseEdit" v-ripple type="primary" @click="uploadCourse"> 上传信息化 </el-button>
       </el-space>
     </div>
     <div v-loading="loading" class="mt-4">
@@ -30,7 +30,6 @@
   import { useForm } from '@/components/form'
   import { router } from '@/router'
   import { ElMessageBox, ElMessage } from 'element-plus'
-  import { Plus } from '@element-plus/icons-vue'
   import request from '@/api'
 
   // 路由参数
@@ -94,7 +93,7 @@
       ElMessage.error('没有获取到课程ID,无法上传信息化')
       return
     }
-    await request.post('/course/uploadtms', { courseID: courseId.value })
+    await request.post('/course/uploadtms', [{ courseId: Number(courseId.value) }])
     ElMessage.success('课程信息化上传成功')
   }
 

+ 31 - 2
src/views/train/course/list/search.vue

@@ -47,6 +47,27 @@
   }
 
   // // 培训计划
+// const trainPlanOptions = ref<TrainPlanItem[]>([
+  //   {
+  //     PXSSID: '1',
+  //     PXSSMC: '培训计划1',
+  //     PlanInfo: [
+  //       {
+  //         JXJHID: '1',
+  //         KMMC: '计划1',
+  //         SDKCGUIDs: ['1', '2'],
+  //         TESTKCGUIDs: ['3', '4']
+  //       },
+  //       {
+  //         JXJHID: '2',
+  //         KMMC: '计划2',
+  //         SDKCGUIDs: ['5', '6'],
+  //         TESTKCGUIDs: ['7', '8']
+  //       }
+  //     ]
+  //   }
+  // ])
+  // const trainSelectValue = ref('')
   // export interface TrainPlanItem {
   //   PXSSID?: string /** 培训实施ID */
   //   PXSSMC?: string /** 培训实施名称 */
@@ -57,19 +78,27 @@
   //     TESTKCGUIDs?: string[] /** 课程课程GUID列表 */
   //   }[] /** 计划信息 */
   // }
-  // const trainPlanOptions = async () => {
+  // const getTrainPlanOptions = async () => {
   //   const { data } = await request.post<TrainPlanItem[]>('/course/tmsplan', {})
+//   trainPlanOptions.value = data || []
   // }
 
   // // 学员列表
+// const studentOptions = ref<StudentItem[]>([])
   // export interface StudentItem {
   //   XYEMPID: string /** 学员GUID */
   //   XYXM: string /** 学员姓名 */
   // }
-  // const studentOptions = async () => {
+  // const getStudentOptions = async () => {
   //   const { data } = await request.post<StudentItem[]>('/course/tmsplanstudent', { PXSSID: '' })
+//   studentOptions.value = data || []
   // }
 
+  // onMounted(() => {
+  //   getTrainPlanOptions()
+  //   getStudentOptions()
+  // })
+
   defineExpose({
     reset: () => {
       courseSearchRef.value?.reset()

+ 2 - 2
src/views/train/evaluation/list.vue

@@ -4,7 +4,7 @@
       <el-button v-if="activeTab === 'operation'" :icon="Download" type="primary" @click="exportOperationLog">导出操作记录</el-button>
       <el-button v-if="activeTab === 'referee'" :icon="Plus" type="primary" @click="addReferee">新增条目</el-button>
       <el-button v-if="activeTab === 'referee'" :icon="Download" type="primary" @click="exportReferee">导出电子考评</el-button>
-      <el-button v-if="activeTab === 'referee'" :icon="Plus" type="primary" @click="uploadReferee">上传点子考评</el-button>
+      <el-button v-if="activeTab === 'referee'" :icon="Upload" type="primary" @click="uploadReferee">上传点子考评</el-button>
     </div>
     <el-tabs v-model="activeTab" type="card" class="w-full">
       <el-tab-pane label="操作记录" name="operation">
@@ -18,7 +18,7 @@
 </template>
 <script setup lang="ts">
   import { ref } from 'vue'
-  import { Download, Plus } from '@element-plus/icons-vue'
+  import { Download, Plus, Upload } from '@element-plus/icons-vue'
   import ListLog from './list-log.vue'
   import ListReferee from './list-referee.vue'
   import { RefereeServer } from './referee.api'