diff --git a/api/openapitools.json b/api/openapitools.json new file mode 100644 index 0000000..15fef60 --- /dev/null +++ b/api/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.1.0" + } +} diff --git a/api/swagger.json b/api/swagger.json index 834aeb9..2f14472 100644 --- a/api/swagger.json +++ b/api/swagger.json @@ -306,6 +306,20 @@ "name": "DocumentId", "in": "path", "required": true + }, + { + "type": "string", + "description": "标题", + "name": "Title", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "内容", + "name": "Content", + "in": "query", + "required": true } ], "responses": { diff --git a/src/layouts/default/View.vue b/src/layouts/default/View.vue index 144e073..9097424 100644 --- a/src/layouts/default/View.vue +++ b/src/layouts/default/View.vue @@ -1,9 +1,7 @@ diff --git a/src/openapi/api.ts b/src/openapi/api.ts index b5177bd..40c6c9b 100644 --- a/src/openapi/api.ts +++ b/src/openapi/api.ts @@ -296,14 +296,20 @@ export const DocumentsApiAxiosParamCreator = function (configuration?: Configura * @summary 更新文档 * @param {string} libraryId 资料库 ID * @param {string} documentId 文档 ID + * @param {string} title 标题 + * @param {string} content 内容 * @param {*} [options] Override http request option. * @throws {RequiredError} */ - libraryLibraryIdDocumentDocumentIdPut: async (libraryId: string, documentId: string, options: AxiosRequestConfig = {}): Promise => { + libraryLibraryIdDocumentDocumentIdPut: async (libraryId: string, documentId: string, title: string, content: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'libraryId' is not null or undefined assertParamExists('libraryLibraryIdDocumentDocumentIdPut', 'libraryId', libraryId) // verify required parameter 'documentId' is not null or undefined assertParamExists('libraryLibraryIdDocumentDocumentIdPut', 'documentId', documentId) + // verify required parameter 'title' is not null or undefined + assertParamExists('libraryLibraryIdDocumentDocumentIdPut', 'title', title) + // verify required parameter 'content' is not null or undefined + assertParamExists('libraryLibraryIdDocumentDocumentIdPut', 'content', content) const localVarPath = `/library/{LibraryId}/document/{DocumentId}` .replace(`{${"LibraryId"}}`, encodeURIComponent(String(libraryId))) .replace(`{${"DocumentId"}}`, encodeURIComponent(String(documentId))); @@ -321,6 +327,14 @@ export const DocumentsApiAxiosParamCreator = function (configuration?: Configura // authentication BearerToken required await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) + if (title !== undefined) { + localVarQueryParameter['Title'] = title; + } + + if (content !== undefined) { + localVarQueryParameter['Content'] = content; + } + setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -517,11 +531,13 @@ export const DocumentsApiFp = function(configuration?: Configuration) { * @summary 更新文档 * @param {string} libraryId 资料库 ID * @param {string} documentId 文档 ID + * @param {string} title 标题 + * @param {string} content 内容 * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async libraryLibraryIdDocumentDocumentIdPut(libraryId: string, documentId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.libraryLibraryIdDocumentDocumentIdPut(libraryId, documentId, options); + async libraryLibraryIdDocumentDocumentIdPut(libraryId: string, documentId: string, title: string, content: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.libraryLibraryIdDocumentDocumentIdPut(libraryId, documentId, title, content, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['DocumentsApi.libraryLibraryIdDocumentDocumentIdPut']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); @@ -607,11 +623,13 @@ export const DocumentsApiFactory = function (configuration?: Configuration, base * @summary 更新文档 * @param {string} libraryId 资料库 ID * @param {string} documentId 文档 ID + * @param {string} title 标题 + * @param {string} content 内容 * @param {*} [options] Override http request option. * @throws {RequiredError} */ - libraryLibraryIdDocumentDocumentIdPut(libraryId: string, documentId: string, options?: any): AxiosPromise { - return localVarFp.libraryLibraryIdDocumentDocumentIdPut(libraryId, documentId, options).then((request) => request(axios, basePath)); + libraryLibraryIdDocumentDocumentIdPut(libraryId: string, documentId: string, title: string, content: string, options?: any): AxiosPromise { + return localVarFp.libraryLibraryIdDocumentDocumentIdPut(libraryId, documentId, title, content, options).then((request) => request(axios, basePath)); }, /** * 获取当前账号的文档列表 @@ -689,12 +707,14 @@ export class DocumentsApi extends BaseAPI { * @summary 更新文档 * @param {string} libraryId 资料库 ID * @param {string} documentId 文档 ID + * @param {string} title 标题 + * @param {string} content 内容 * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DocumentsApi */ - public libraryLibraryIdDocumentDocumentIdPut(libraryId: string, documentId: string, options?: AxiosRequestConfig) { - return DocumentsApiFp(this.configuration).libraryLibraryIdDocumentDocumentIdPut(libraryId, documentId, options).then((request) => request(this.axios, this.basePath)); + public libraryLibraryIdDocumentDocumentIdPut(libraryId: string, documentId: string, title: string, content: string, options?: AxiosRequestConfig) { + return DocumentsApiFp(this.configuration).libraryLibraryIdDocumentDocumentIdPut(libraryId, documentId, title, content, options).then((request) => request(this.axios, this.basePath)); } /** diff --git a/src/views/documents/Edit.vue b/src/views/documents/Edit.vue index e9b934c..6123a64 100644 --- a/src/views/documents/Edit.vue +++ b/src/views/documents/Edit.vue @@ -57,7 +57,7 @@ import { document } from "@/plugins/api"; import getTheme from "@/plugins/getTheme"; import LoadingComponent from "@/components/Loading.vue"; -const loading = ref(true) +const loading = ref(true); const libraryIdInt = parseInt(router.currentRoute.value.params.LibraryId); const documentIdInt = parseInt(router.currentRoute.value.params.DocumentId); @@ -80,6 +80,15 @@ document const show_created_failed = ref(false); const show_title_is_not_filled = ref(false); +function goto_document() { + router.push({ + name: "library.documents.view", + params: { + DocumentId: documentIdInt, + }, + }); +} + function updateDocument() { if (docu.value.Title == "") { show_title_is_not_filled.value = true; @@ -90,13 +99,11 @@ function updateDocument() { .libraryLibraryIdDocumentDocumentIdPut( libraryIdInt, documentIdInt, - { - Title: "a", - Content: "a", - } + docu.value.Title, + docu.value.Content ) .then((r) => { - console.log(r); + goto_document() }) .catch(() => { show_created_failed.value = true;