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