[fix] 缓解errorMsg导致的错误
This commit is contained in:
parent
7ad6f1f093
commit
e0585e28bb
|
|
@ -1,5 +1,6 @@
|
|||
# backend service base url, prod environment
|
||||
VITE_SERVICE_BASE_URL=http://154.219.110.17:8080/api
|
||||
# VITE_SERVICE_BASE_URL=http://154.219.110.17:8080/api
|
||||
VITE_SERVICE_BASE_URL=https://test.tju.edu.kg/api
|
||||
|
||||
# other backend service base url, prod environment
|
||||
# VITE_OTHER_SERVICE_BASE_URL= `{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# backend service base url, test environment
|
||||
VITE_SERVICE_BASE_URL=http://localhost:8080/api
|
||||
#VITE_SERVICE_BASE_URL=http://154.219.110.17:8080/api
|
||||
#VITE_SERVICE_BASE_URL=http://localhost:8080/api
|
||||
VITE_SERVICE_BASE_URL=http://154.219.110.17:8080/api
|
||||
|
||||
# # other backend service base url, test environment
|
||||
# VITE_OTHER_SERVICE_BASE_URL= `{
|
||||
|
|
|
|||
|
|
@ -52,7 +52,9 @@ function createCommonRequest<ResponseData = any>(
|
|||
async response => {
|
||||
const responseType: ResponseType = (response.config?.responseType as ResponseType) || 'json';
|
||||
|
||||
response.data.errorMsg = "success";
|
||||
if (responseType !== 'json' || opts.isBackendSuccess(response)) {
|
||||
console.log("true")
|
||||
return Promise.resolve(response);
|
||||
}
|
||||
|
||||
|
|
@ -60,9 +62,14 @@ function createCommonRequest<ResponseData = any>(
|
|||
if (fail) {
|
||||
return fail;
|
||||
}
|
||||
|
||||
// console.log('...Response Data:', response.data);
|
||||
// const isSuccess = opts.isBackendSuccess(response);
|
||||
// console.log('...Is Backend Success:', isSuccess);
|
||||
|
||||
const backendErrorMessage = response.data?.message || 'the backend request error.';
|
||||
const backendError = new AxiosError<ResponseData>(
|
||||
'the backend request error',
|
||||
backendErrorMessage,
|
||||
BACKEND_ERROR_CODE,
|
||||
response.config,
|
||||
response.request,
|
||||
|
|
@ -72,10 +79,11 @@ function createCommonRequest<ResponseData = any>(
|
|||
await opts.onError(backendError);
|
||||
|
||||
return Promise.reject(backendError);
|
||||
|
||||
},
|
||||
async (error: AxiosError<ResponseData>) => {
|
||||
await opts.onError(error);
|
||||
|
||||
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -107,12 +107,8 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
|||
async function getUserInfo() {
|
||||
const { response, error } = await fetchGetUserInfo();
|
||||
let data:any = response.data.data
|
||||
|
||||
//console.log(data.name)
|
||||
//console.log(error?.status == 200)
|
||||
|
||||
if (error?.status == 200) {
|
||||
console.log("200")
|
||||
let info: Api.Auth.UserInfo = {
|
||||
userId: data.employeeId.toString(),
|
||||
userName: data.name,
|
||||
|
|
@ -121,10 +117,11 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
|||
};
|
||||
Object.assign(userInfo, info);
|
||||
|
||||
console.log("getUserInfo")
|
||||
console.log("getUserInfo true")
|
||||
return true;
|
||||
}
|
||||
|
||||
console.log("getUserInfo false")
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,15 +57,18 @@ async function handleSubmit() {
|
|||
/>
|
||||
</AFormItem>
|
||||
<ASpace direction="vertical" size="large" class="w-full">
|
||||
<!--
|
||||
<div class="flex-y-center justify-between">
|
||||
<ACheckbox>{{ $t('page.login.pwdLogin.rememberMe') }}</ACheckbox>
|
||||
<AButton type="text" @click="toggleLoginModule('reset-pwd')">
|
||||
{{ $t('page.login.pwdLogin.forgetPassword') }}
|
||||
</AButton>
|
||||
</div>
|
||||
-->
|
||||
<AButton type="primary" block size="large" shape="round" :loading="authStore.loginLoading" @click="handleSubmit">
|
||||
{{ $t('common.confirm') }}
|
||||
</AButton>
|
||||
<!--
|
||||
<div class="flex-y-center justify-between">
|
||||
<AButton class="h-34px flex-1" block @click="toggleLoginModule('code-login')">
|
||||
{{ $t(loginModuleRecord['code-login']) }}
|
||||
|
|
@ -74,7 +77,8 @@ async function handleSubmit() {
|
|||
<AButton class="h-34px flex-1" block @click="toggleLoginModule('register')">
|
||||
{{ $t(loginModuleRecord.register) }}
|
||||
</AButton>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
</ASpace>
|
||||
</AForm>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="plan-container">
|
||||
<h2>计划管理</h2>
|
||||
<a-card title="计划管理" :bordered="false">
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="planData"
|
||||
|
|
@ -28,20 +28,18 @@
|
|||
@showSizeChange="handlePageSizeChange"
|
||||
/>
|
||||
</div>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import axios from 'axios';
|
||||
import dayjs from 'dayjs';
|
||||
import { Tag } from 'ant-design-vue';
|
||||
import { apiRequestGet } from '@/utils/api';
|
||||
|
||||
export default {
|
||||
name: 'PlanManagement',
|
||||
setup() {
|
||||
// 表格列定义
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '计划ID',
|
||||
|
|
@ -146,25 +144,13 @@ export default {
|
|||
fetchPlanData();
|
||||
});
|
||||
|
||||
return {
|
||||
columns,
|
||||
planData,
|
||||
loading,
|
||||
pagination,
|
||||
statusMap,
|
||||
getStatusColor,
|
||||
formatDate,
|
||||
handlePageChange,
|
||||
handlePageSizeChange,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.plan-container {
|
||||
padding: 20px;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue