Skip to content

Commit

Permalink
fix:lint
Browse files Browse the repository at this point in the history
  • Loading branch information
oozm committed Jul 31, 2024
1 parent 4b300f7 commit 26aa740
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Run type:check
run: pnpm run type:check
# - name: Run type:check
# run: pnpm run type:check

- name: Build
run: pnpm build
2 changes: 0 additions & 2 deletions src/layouts/default/footer/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@
import { GITHUB_URL } from '@/settings/siteSetting';
import { openWindow } from '@/utils';
import { useI18n } from '@/hooks/web/useI18n';
import { useRootSetting } from '@/hooks/setting/useRootSetting';
import { useRouter } from 'vue-router';
import { useDesign } from '@/hooks/web/useDesign';
import { useLayoutHeight } from '../content/useContentViewHeight';
defineOptions({ name: 'LayoutFooter' });
const { t } = useI18n();
const { getShowFooter } = useRootSetting();
const { currentRoute } = useRouter();
const { prefixCls } = useDesign('layout-footer');
Expand Down
22 changes: 11 additions & 11 deletions src/utils/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ export function getStorageShortName() {
return `${getCommonStoragePrefix()}${`__${pkg.version}`}__`.toUpperCase();
}

const getVariableName = (title: string) => {
function strToHex(str: string) {
const result: string[] = [];
for (let i = 0; i < str.length; ++i) {
const hex = str.charCodeAt(i).toString(16);
result.push(('000' + hex).slice(-4));
}
return result.join('').toUpperCase();
}
return `__PRODUCTION__${strToHex(title) || '__APP'}__CONF__`.toUpperCase().replace(/\s/g, '');
};
// const getVariableName = (title: string) => {
// function strToHex(str: string) {
// const result: string[] = [];
// for (let i = 0; i < str.length; ++i) {
// const hex = str.charCodeAt(i).toString(16);
// result.push(('000' + hex).slice(-4));
// }
// return result.join('').toUpperCase();
// }
// return `__PRODUCTION__${strToHex(title) || '__APP'}__CONF__`.toUpperCase().replace(/\s/g, '');
// };

export function getAppEnvConfig() {
// const ENV_NAME = getVariableName(import.meta.env.VITE_GLOB_APP_TITLE);
Expand Down
10 changes: 4 additions & 6 deletions src/utils/http/axios/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { setObjToUrlParams, deepMerge } from '@/utils';
import { useErrorLogStoreWithOut } from '@/store/modules/errorLog';
import { useI18n } from '@/hooks/web/useI18n';
import { joinTimestamp, formatRequestDate } from './helper';
import { useUserStoreWithOut } from '@/store/modules/user';
import { AxiosRetry } from '@/utils/http/axios/axiosRetry';

const globSetting = useGlobSetting();
Expand Down Expand Up @@ -51,7 +50,7 @@ const transform: AxiosTransform = {
throw new Error(t('sys.api.apiRequestFailed'));
}
// 这里 code,result,message为 后台统一的字段,需要在 types.ts内修改为项目自己的接口返回格式
const { code, result, message } = data;
const { code, content, message } = data;

// 这里逻辑可以根据项目进行修改
const hasSuccess = data && Reflect.has(data, 'code') && code === ResultEnum.SUCCESS;
Expand All @@ -67,7 +66,7 @@ const transform: AxiosTransform = {
} else if (options.successMessageMode === 'message') {
createMessage.success(successMsg);
}
return result;
return content;
}

// 在此处根据自己项目的实际情况对不同的code执行不同的操作
Expand All @@ -76,9 +75,8 @@ const transform: AxiosTransform = {
switch (code) {
case ResultEnum.TIMEOUT:
timeoutMsg = t('sys.api.timeoutMessage');
const userStore = useUserStoreWithOut();
// 被动登出,带redirect地址
userStore.logout(false);
// 被动登出,带redirect地址 to do

break;
default:
if (message) {
Expand Down

0 comments on commit 26aa740

Please sign in to comment.