feat: 更新API生成配置,升级依赖版本,添加TanStack Query插件支持,优化请求模型参数传递方式
This commit is contained in:
@@ -2,6 +2,6 @@
|
||||
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
|
||||
"spaces": 2,
|
||||
"generator-cli": {
|
||||
"version": "7.10.0"
|
||||
"version": "7.12.0"
|
||||
}
|
||||
}
|
||||
|
||||
11
package.json
11
package.json
@@ -22,7 +22,8 @@
|
||||
"clean:cache": "rimraf .eslintcache && rimraf node_modules && pnpm install",
|
||||
"prepare": "husky && husky install",
|
||||
"release": "bumpp",
|
||||
"gen:api": "openapi-generator-cli generate -i http://127.0.0.1:12401/api.json -g typescript-axios -o ./src/api/generated -p withSeparateModelsAndApi=true,modelPackage=models,apiPackage=apis,useTagAsApiPackage=true,sortParamsByRequiredFlag=true,useSquareBracketsInArrayNames=true,withInterfaces=true,useSingleRequestParameter=true,stringEnums=true"
|
||||
"generate:api": "openapi-generator-cli generate -i http://127.0.0.1:12401/api.json -g typescript-axios -o ./src/api/generated -p withSeparateModelsAndApi=true,modelPackage=models,apiPackage=apis,useTagAsApiPackage=true,sortParamsByRequiredFlag=true,useSquareBracketsInArrayNames=true,withInterfaces=false,useSingleRequestParameter=true,stringEnums=true",
|
||||
"generate:hooks": "tsx scripts/generate-hooks.ts"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,ts,jsx,tsx}": [
|
||||
@@ -55,6 +56,7 @@
|
||||
"@milkdown/theme-nord": "^7.7.0",
|
||||
"@milkdown/vue": "^7.7.0",
|
||||
"@openapitools/openapi-generator-cli": "^2.20.0",
|
||||
"@tanstack/vue-query": "^5.74.7",
|
||||
"@vueuse/core": "^10.11.1",
|
||||
"axios": "^1.8.4",
|
||||
"codemirror": "^6.0.1",
|
||||
@@ -70,7 +72,8 @@
|
||||
"sortablejs": "^1.15.6",
|
||||
"vue": "^3.5.13",
|
||||
"vue-echarts": "^6.7.3",
|
||||
"vue-router": "^4.5.0"
|
||||
"vue-router": "^4.5.0",
|
||||
"yaml": "^2.7.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@arco-plugins/vite-vue": "^1.4.5",
|
||||
@@ -78,6 +81,8 @@
|
||||
"@commitlint/config-conventional": "^19.8.0",
|
||||
"@commitlint/types": "^19.8.0",
|
||||
"@eslint/js": "^9.25.1",
|
||||
"@openapi-codegen/cli": "^3.1.0",
|
||||
"@openapi-codegen/typescript": "^11.0.1",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@types/lodash": "^4.17.16",
|
||||
"@types/mockjs": "^1.0.10",
|
||||
@@ -113,6 +118,8 @@
|
||||
"stylelint-less": "^3.0.1",
|
||||
"stylelint-order": "^6.0.4",
|
||||
"stylelint-prettier": "^5.0.3",
|
||||
"ts-node": "^10.9.2",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3",
|
||||
"unplugin-vue-components": "^0.27.5",
|
||||
"vite": "^5.4.15",
|
||||
|
||||
1125
pnpm-lock.yaml
generated
1125
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
||||
ignoredBuiltDependencies:
|
||||
- '@openapitools/openapi-generator-cli'
|
||||
- '@swc/core'
|
||||
onlyBuiltDependencies:
|
||||
- '@nestjs/core'
|
||||
- cwebp-bin
|
||||
|
||||
@@ -1 +1 @@
|
||||
7.10.0
|
||||
7.12.0
|
||||
|
||||
@@ -6077,7 +6077,7 @@ export const DefaultApiAxiosParamCreator = function (
|
||||
}
|
||||
|
||||
if (dateRange) {
|
||||
localVarQueryParameter['dateRange'] = dateRange;
|
||||
localVarQueryParameter['dateRange[]'] = dateRange;
|
||||
}
|
||||
|
||||
if (userId !== undefined) {
|
||||
@@ -6225,7 +6225,7 @@ export const DefaultApiAxiosParamCreator = function (
|
||||
}
|
||||
|
||||
if (dateRange) {
|
||||
localVarQueryParameter['dateRange'] = dateRange;
|
||||
localVarQueryParameter['dateRange[]'] = dateRange;
|
||||
}
|
||||
|
||||
if (userId !== undefined) {
|
||||
|
||||
@@ -104,7 +104,12 @@ export class Configuration {
|
||||
this.accessToken = param.accessToken;
|
||||
this.basePath = param.basePath;
|
||||
this.serverIndex = param.serverIndex;
|
||||
this.baseOptions = param.baseOptions;
|
||||
this.baseOptions = {
|
||||
...param.baseOptions,
|
||||
headers: {
|
||||
...param.baseOptions?.headers
|
||||
}
|
||||
};
|
||||
this.formDataCtor = param.formDataCtor;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,61 +23,61 @@ export interface KamiApiCardInfoWalmartV1ListReq {
|
||||
* @type {number}
|
||||
* @memberof KamiApiCardInfoWalmartV1ListReq
|
||||
*/
|
||||
current: number;
|
||||
'current': number;
|
||||
/**
|
||||
* 页码
|
||||
* @type {number}
|
||||
* @memberof KamiApiCardInfoWalmartV1ListReq
|
||||
*/
|
||||
pageSize: KamiApiCardInfoWalmartV1ListReqPageSizeEnum;
|
||||
'pageSize': KamiApiCardInfoWalmartV1ListReqPageSizeEnum;
|
||||
/**
|
||||
* 礼品卡密码
|
||||
* @type {string}
|
||||
* @memberof KamiApiCardInfoWalmartV1ListReq
|
||||
*/
|
||||
giftCardPwd?: string;
|
||||
'giftCardPwd'?: string;
|
||||
/**
|
||||
* 商户ID
|
||||
* @type {string}
|
||||
* @memberof KamiApiCardInfoWalmartV1ListReq
|
||||
*/
|
||||
merchantId?: string;
|
||||
'merchantId'?: string;
|
||||
/**
|
||||
* 附加信息
|
||||
* @type {string}
|
||||
* @memberof KamiApiCardInfoWalmartV1ListReq
|
||||
*/
|
||||
attach?: string;
|
||||
'attach'?: string;
|
||||
/**
|
||||
* 账户昵称
|
||||
* @type {string}
|
||||
* @memberof KamiApiCardInfoWalmartV1ListReq
|
||||
*/
|
||||
accountNickName?: string;
|
||||
'accountNickName'?: string;
|
||||
/**
|
||||
* 组ID
|
||||
* @type {number}
|
||||
* @memberof KamiApiCardInfoWalmartV1ListReq
|
||||
*/
|
||||
groupId?: number;
|
||||
'groupId'?: number;
|
||||
/**
|
||||
* 账户cookie
|
||||
* @type {string}
|
||||
* @memberof KamiApiCardInfoWalmartV1ListReq
|
||||
*/
|
||||
accountCk?: string;
|
||||
'accountCk'?: string;
|
||||
/**
|
||||
* 时间范围
|
||||
* @type {Array<string>}
|
||||
* @memberof KamiApiCardInfoWalmartV1ListReq
|
||||
*/
|
||||
dateRange?: Array<string>;
|
||||
'dateRange[]'?: Array<string>;
|
||||
/**
|
||||
* 用户ID
|
||||
* @type {string}
|
||||
* @memberof KamiApiCardInfoWalmartV1ListReq
|
||||
*/
|
||||
userId?: string;
|
||||
'userId'?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,61 +23,61 @@ export interface KamiApiCardInfoWalmartV1OrderExportReq {
|
||||
* @type {number}
|
||||
* @memberof KamiApiCardInfoWalmartV1OrderExportReq
|
||||
*/
|
||||
current: number;
|
||||
'current': number;
|
||||
/**
|
||||
* 页码
|
||||
* @type {number}
|
||||
* @memberof KamiApiCardInfoWalmartV1OrderExportReq
|
||||
*/
|
||||
pageSize: KamiApiCardInfoWalmartV1OrderExportReqPageSizeEnum;
|
||||
'pageSize': KamiApiCardInfoWalmartV1OrderExportReqPageSizeEnum;
|
||||
/**
|
||||
* 礼品卡密码
|
||||
* @type {string}
|
||||
* @memberof KamiApiCardInfoWalmartV1OrderExportReq
|
||||
*/
|
||||
giftCardPwd?: string;
|
||||
'giftCardPwd'?: string;
|
||||
/**
|
||||
* 商户ID
|
||||
* @type {string}
|
||||
* @memberof KamiApiCardInfoWalmartV1OrderExportReq
|
||||
*/
|
||||
merchantId?: string;
|
||||
'merchantId'?: string;
|
||||
/**
|
||||
* 附加信息
|
||||
* @type {string}
|
||||
* @memberof KamiApiCardInfoWalmartV1OrderExportReq
|
||||
*/
|
||||
attach?: string;
|
||||
'attach'?: string;
|
||||
/**
|
||||
* 账户昵称
|
||||
* @type {string}
|
||||
* @memberof KamiApiCardInfoWalmartV1OrderExportReq
|
||||
*/
|
||||
accountNickName?: string;
|
||||
'accountNickName'?: string;
|
||||
/**
|
||||
* 组ID
|
||||
* @type {number}
|
||||
* @memberof KamiApiCardInfoWalmartV1OrderExportReq
|
||||
*/
|
||||
groupId?: number;
|
||||
'groupId'?: number;
|
||||
/**
|
||||
* 账户cookie
|
||||
* @type {string}
|
||||
* @memberof KamiApiCardInfoWalmartV1OrderExportReq
|
||||
*/
|
||||
accountCk?: string;
|
||||
'accountCk'?: string;
|
||||
/**
|
||||
* 时间范围
|
||||
* @type {Array<string>}
|
||||
* @memberof KamiApiCardInfoWalmartV1OrderExportReq
|
||||
*/
|
||||
dateRange?: Array<string>;
|
||||
'dateRange[]'?: Array<string>;
|
||||
/**
|
||||
* 用户ID
|
||||
* @type {string}
|
||||
* @memberof KamiApiCardInfoWalmartV1OrderExportReq
|
||||
*/
|
||||
userId?: string;
|
||||
'userId'?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,9 +5,9 @@ import globalComponents from '@/components';
|
||||
import router from './router';
|
||||
import store from './store';
|
||||
import directive from './directive';
|
||||
import { setupTanstackQuery } from './plugins/tanstack-query';
|
||||
import './mock';
|
||||
import App from './App.vue';
|
||||
// https://arco.design/docs/designlab/use-theme-package
|
||||
import '@/assets/style/global.less';
|
||||
import '@/api/interceptor';
|
||||
|
||||
@@ -16,6 +16,8 @@ const app = createApp(App);
|
||||
app.use(ArcoVue, {});
|
||||
app.use(ArcoVueIcon);
|
||||
|
||||
setupTanstackQuery(app);
|
||||
|
||||
app.use(router);
|
||||
app.use(store);
|
||||
app.use(globalComponents);
|
||||
|
||||
27
src/plugins/tanstack-query.ts
Normal file
27
src/plugins/tanstack-query.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import {
|
||||
VueQueryPlugin,
|
||||
QueryClient,
|
||||
type VueQueryPluginOptions
|
||||
} from '@tanstack/vue-query';
|
||||
import type { App } from 'vue';
|
||||
|
||||
// 创建一个 QueryClient 实例
|
||||
export const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
refetchOnWindowFocus: false,
|
||||
retry: false,
|
||||
staleTime: 1000 * 60 * 5 // 5 分钟
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 插件配置
|
||||
export const vueQueryPluginOptions: VueQueryPluginOptions = {
|
||||
queryClient
|
||||
};
|
||||
|
||||
// 导出插件安装函数
|
||||
export function setupTanstackQuery(app: App) {
|
||||
app.use(VueQueryPlugin, vueQueryPluginOptions);
|
||||
}
|
||||
Reference in New Issue
Block a user