feat: 开发中...
This commit is contained in:
@@ -1,32 +1,37 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { RouterLink, RouterView } from 'vue-router'
|
||||
import { SettingControllerApiFactory, UserControllerApiFactory, UserInfoResponseVORoleEnum, type UserInfoResponseVO } from '@/api-base';
|
||||
import { UserInfoResponseVORoleEnum } from "@/swagger";
|
||||
import { api, globalStore, siteSetting } from "@/api"
|
||||
import { updateCurrentUserInfo } from '@/utils';
|
||||
|
||||
let title = ref<string>("网站标题")
|
||||
let navigationMenu = ref([{
|
||||
url: "/about",
|
||||
text: "关于我"
|
||||
}])
|
||||
let currentUserInfo = ref<UserInfoResponseVO | null>(null)
|
||||
let currentUserInfo = globalStore.currentUserInfo
|
||||
let navigationMenu = siteSetting.customNavigationMenu
|
||||
|
||||
onMounted(() => {
|
||||
SettingControllerApiFactory().getSettingContent("site.title")
|
||||
.then(response => {
|
||||
let vo = response.data;
|
||||
let siteTitle: string = vo.data ?? "网站标题"
|
||||
title.value = siteTitle
|
||||
document.title = siteTitle
|
||||
})
|
||||
|
||||
SettingControllerApiFactory().getSettingContent("site.navigation.menus")
|
||||
// 获取站点标题
|
||||
api.SettingController.getSettingContent("site.title")
|
||||
.then(response => {
|
||||
let vo = response.data;
|
||||
if (vo.code === 200) {
|
||||
let navigationMenuObject = JSON.parse(vo.data || "{}")
|
||||
let title = vo.data ?? "网站标题"
|
||||
siteSetting.title.value = title
|
||||
document.title = title
|
||||
}
|
||||
})
|
||||
|
||||
// 获取站点自定义导航栏
|
||||
api.SettingController.getSettingContent("site.navigation.menus")
|
||||
.then(response => {
|
||||
let vo = response.data;
|
||||
if (vo.code === 200) {
|
||||
let navigationMenuObject = JSON.parse(vo.data || "[]")
|
||||
navigationMenu.value = navigationMenuObject
|
||||
}
|
||||
})
|
||||
|
||||
// 获取当前登录的用户信息
|
||||
updateCurrentUserInfo();
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -36,7 +41,7 @@ onMounted(() => {
|
||||
<el-header>
|
||||
<el-menu default-active="index" mode="horizontal" :ellipsis="false">
|
||||
<el-menu-item index="index">
|
||||
<router-link to="/">{{ title }}</router-link>
|
||||
<router-link to="/">{{ siteSetting.title.value }}</router-link>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="tags">
|
||||
<router-link to="/tags">标签</router-link>
|
||||
@@ -47,14 +52,14 @@ onMounted(() => {
|
||||
|
||||
<div class="flex-grow" />
|
||||
|
||||
<el-menu-item index="login" v-if="!currentUserInfo">
|
||||
<el-menu-item index="login" v-if="!currentUserInfo.id">
|
||||
<router-link to="/login">登录</router-link>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="register" v-if="!currentUserInfo">
|
||||
<el-menu-item index="register" v-if="!currentUserInfo.id">
|
||||
<router-link to="/register">注册</router-link>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="register" v-if="currentUserInfo?.role === UserInfoResponseVORoleEnum.ADMIN">
|
||||
<router-link to="/register">设置</router-link>
|
||||
<el-menu-item index="settings" v-if="currentUserInfo?.role === UserInfoResponseVORoleEnum.ADMIN">
|
||||
<router-link to="/settings">设置</router-link>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</el-header>
|
||||
@@ -63,6 +68,10 @@ onMounted(() => {
|
||||
</el-main>
|
||||
<el-footer>
|
||||
<p>
|
||||
<a href="https://cn.vuejs.org/">Vue3</a>
|
||||
|
|
||||
<a href="https://element-plus.gitee.io/zh-CN/">Element UI Plus</a>
|
||||
|
|
||||
<a href="/swagger-ui/index.html">Swagger</a>
|
||||
|
|
||||
<a href="https://editor.swagger.io/">Editor</a>
|
||||
|
@@ -1,26 +0,0 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* OpenAPI definition
|
||||
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
||||
*
|
||||
* OpenAPI spec version: v0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface SettingUpdateRequireVO
|
||||
*/
|
||||
export interface SettingUpdateRequireVO {
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof SettingUpdateRequireVO
|
||||
*/
|
||||
content: string;
|
||||
}
|
8
blog-frontend/src/api/api.ts
Normal file
8
blog-frontend/src/api/api.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { UserControllerApiFactory, BlogControllerApiFactory, SettingControllerApiFactory, AttachControllerApiFactory } from "@/swagger"
|
||||
|
||||
export const api = {
|
||||
AttachController: AttachControllerApiFactory(),
|
||||
UserController: UserControllerApiFactory(),
|
||||
BlogController: BlogControllerApiFactory(),
|
||||
SettingController: SettingControllerApiFactory()
|
||||
}
|
12
blog-frontend/src/api/global-store.ts
Normal file
12
blog-frontend/src/api/global-store.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { reactive, ref } from "vue"
|
||||
import type { NavigationMenu } from "@/api"
|
||||
import type { UserInfoResponseVO } from "@/swagger"
|
||||
|
||||
export const globalStore = {
|
||||
currentUserInfo: ref<UserInfoResponseVO>({})
|
||||
}
|
||||
|
||||
export const siteSetting = {
|
||||
title: ref<string>("网站标题"),
|
||||
customNavigationMenu: ref<Array<NavigationMenu>>([])
|
||||
}
|
4
blog-frontend/src/api/index.ts
Normal file
4
blog-frontend/src/api/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from "./api"
|
||||
export * from "./global-store"
|
||||
export * from "./types"
|
||||
export * from "@/swagger"
|
1
blog-frontend/src/api/types/index.ts
Normal file
1
blog-frontend/src/api/types/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./navigation-menu"
|
6
blog-frontend/src/api/types/navigation-menu.ts
Normal file
6
blog-frontend/src/api/types/navigation-menu.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
interface NavigationMenu {
|
||||
url: string,
|
||||
text: string
|
||||
}
|
||||
|
||||
export type { NavigationMenu }
|
4
blog-frontend/src/swagger/.gitignore
vendored
Normal file
4
blog-frontend/src/swagger/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
wwwroot/*.js
|
||||
node_modules
|
||||
typings
|
||||
dist
|
1
blog-frontend/src/swagger/.npmignore
Normal file
1
blog-frontend/src/swagger/.npmignore
Normal file
@@ -0,0 +1 @@
|
||||
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
|
23
blog-frontend/src/swagger/.swagger-codegen-ignore
Normal file
23
blog-frontend/src/swagger/.swagger-codegen-ignore
Normal file
@@ -0,0 +1,23 @@
|
||||
# Swagger Codegen Ignore
|
||||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
1
blog-frontend/src/swagger/.swagger-codegen/VERSION
Normal file
1
blog-frontend/src/swagger/.swagger-codegen/VERSION
Normal file
@@ -0,0 +1 @@
|
||||
3.0.41
|
45
blog-frontend/src/swagger/README.md
Normal file
45
blog-frontend/src/swagger/README.md
Normal file
@@ -0,0 +1,45 @@
|
||||
## @
|
||||
|
||||
This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
|
||||
|
||||
Environment
|
||||
* Node.js
|
||||
* Webpack
|
||||
* Browserify
|
||||
|
||||
Language level
|
||||
* ES5 - you must have a Promises/A+ library installed
|
||||
* ES6
|
||||
|
||||
Module system
|
||||
* CommonJS
|
||||
* ES6 module system
|
||||
|
||||
It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html))
|
||||
|
||||
### Building
|
||||
|
||||
To build and compile the typescript sources to javascript use:
|
||||
```
|
||||
npm install
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Publishing
|
||||
|
||||
First build the package then run ```npm publish```
|
||||
|
||||
### Consuming
|
||||
|
||||
navigate to the folder of your consuming project and run one of the following commands.
|
||||
|
||||
_published:_
|
||||
|
||||
```
|
||||
npm install @ --save
|
||||
```
|
||||
|
||||
_unPublished (not recommended):_
|
||||
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE --save
|
@@ -20,7 +20,6 @@ import { ResponseVOPageableVOSettingInfoResponseVO } from '../models';
|
||||
import { ResponseVOSettingInfoResponseVO } from '../models';
|
||||
import { ResponseVOString } from '../models';
|
||||
import { ResponseVOVoid } from '../models';
|
||||
import { SettingUpdateRequireVO } from '../models';
|
||||
/**
|
||||
* SettingControllerApi - axios parameter creator
|
||||
* @export
|
||||
@@ -202,12 +201,12 @@ export const SettingControllerApiAxiosParamCreator = function (configuration?: C
|
||||
/**
|
||||
*
|
||||
* @summary 更改网站设置
|
||||
* @param {SettingUpdateRequireVO} body
|
||||
* @param {string} body
|
||||
* @param {string} id 设置ID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
updateSetting: async (body: SettingUpdateRequireVO, id: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
updateSetting: async (body: string, id: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'body' is not null or undefined
|
||||
if (body === null || body === undefined) {
|
||||
throw new RequiredError('body','Required parameter body was null or undefined when calling updateSetting.');
|
||||
@@ -228,7 +227,7 @@ export const SettingControllerApiAxiosParamCreator = function (configuration?: C
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||
localVarHeaderParameter['Content-Type'] = 'text/plain';
|
||||
|
||||
const query = new URLSearchParams(localVarUrlObj.search);
|
||||
for (const key in localVarQueryParameter) {
|
||||
@@ -317,12 +316,12 @@ export const SettingControllerApiFp = function(configuration?: Configuration) {
|
||||
/**
|
||||
*
|
||||
* @summary 更改网站设置
|
||||
* @param {SettingUpdateRequireVO} body
|
||||
* @param {string} body
|
||||
* @param {string} id 设置ID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async updateSetting(body: SettingUpdateRequireVO, id: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ResponseVOVoid>>> {
|
||||
async updateSetting(body: string, id: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ResponseVOVoid>>> {
|
||||
const localVarAxiosArgs = await SettingControllerApiAxiosParamCreator(configuration).updateSetting(body, id, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||
@@ -382,12 +381,12 @@ export const SettingControllerApiFactory = function (configuration?: Configurati
|
||||
/**
|
||||
*
|
||||
* @summary 更改网站设置
|
||||
* @param {SettingUpdateRequireVO} body
|
||||
* @param {string} body
|
||||
* @param {string} id 设置ID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async updateSetting(body: SettingUpdateRequireVO, id: string, options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOVoid>> {
|
||||
async updateSetting(body: string, id: string, options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOVoid>> {
|
||||
return SettingControllerApiFp(configuration).updateSetting(body, id, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
};
|
||||
@@ -448,13 +447,13 @@ export class SettingControllerApi extends BaseAPI {
|
||||
/**
|
||||
*
|
||||
* @summary 更改网站设置
|
||||
* @param {SettingUpdateRequireVO} body
|
||||
* @param {string} body
|
||||
* @param {string} id 设置ID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof SettingControllerApi
|
||||
*/
|
||||
public async updateSetting(body: SettingUpdateRequireVO, id: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOVoid>> {
|
||||
public async updateSetting(body: string, id: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOVoid>> {
|
||||
return SettingControllerApiFp(this.configuration).updateSetting(body, id, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
}
|
@@ -30,49 +30,6 @@ import { UserUpdateRequireVO } from '../models';
|
||||
*/
|
||||
export const UserControllerApiAxiosParamCreator = function (configuration?: Configuration) {
|
||||
return {
|
||||
/**
|
||||
*
|
||||
* @summary 注册用户
|
||||
* @param {UserCreateRequireVO} body
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
createUser: async (body: UserCreateRequireVO, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'body' is not null or undefined
|
||||
if (body === null || body === undefined) {
|
||||
throw new RequiredError('body','Required parameter body was null or undefined when calling createUser.');
|
||||
}
|
||||
const localVarPath = `/api/v1/user/`;
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
||||
let baseOptions;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
}
|
||||
const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options};
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||
|
||||
const query = new URLSearchParams(localVarUrlObj.search);
|
||||
for (const key in localVarQueryParameter) {
|
||||
query.set(key, localVarQueryParameter[key]);
|
||||
}
|
||||
for (const key in options.params) {
|
||||
query.set(key, options.params[key]);
|
||||
}
|
||||
localVarUrlObj.search = (new URLSearchParams(query)).toString();
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
|
||||
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 查询用户列表
|
||||
@@ -358,6 +315,49 @@ export const UserControllerApiAxiosParamCreator = function (configuration?: Conf
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 注册用户
|
||||
* @param {UserCreateRequireVO} body
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
register: async (body: UserCreateRequireVO, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'body' is not null or undefined
|
||||
if (body === null || body === undefined) {
|
||||
throw new RequiredError('body','Required parameter body was null or undefined when calling register.');
|
||||
}
|
||||
const localVarPath = `/api/v1/user/`;
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
||||
let baseOptions;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
}
|
||||
const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options};
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||
|
||||
const query = new URLSearchParams(localVarUrlObj.search);
|
||||
for (const key in localVarQueryParameter) {
|
||||
query.set(key, localVarQueryParameter[key]);
|
||||
}
|
||||
for (const key in options.params) {
|
||||
query.set(key, options.params[key]);
|
||||
}
|
||||
localVarUrlObj.search = (new URLSearchParams(query)).toString();
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
|
||||
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 更新用户信息
|
||||
@@ -416,20 +416,6 @@ export const UserControllerApiAxiosParamCreator = function (configuration?: Conf
|
||||
*/
|
||||
export const UserControllerApiFp = function(configuration?: Configuration) {
|
||||
return {
|
||||
/**
|
||||
*
|
||||
* @summary 注册用户
|
||||
* @param {UserCreateRequireVO} body
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async createUser(body: UserCreateRequireVO, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ResponseVOUserInfoResponseVO>>> {
|
||||
const localVarAxiosArgs = await UserControllerApiAxiosParamCreator(configuration).createUser(body, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 查询用户列表
|
||||
@@ -518,6 +504,20 @@ export const UserControllerApiFp = function(configuration?: Configuration) {
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 注册用户
|
||||
* @param {UserCreateRequireVO} body
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async register(body: UserCreateRequireVO, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ResponseVOUserInfoResponseVO>>> {
|
||||
const localVarAxiosArgs = await UserControllerApiAxiosParamCreator(configuration).register(body, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 更新用户信息
|
||||
@@ -542,16 +542,6 @@ export const UserControllerApiFp = function(configuration?: Configuration) {
|
||||
*/
|
||||
export const UserControllerApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
||||
return {
|
||||
/**
|
||||
*
|
||||
* @summary 注册用户
|
||||
* @param {UserCreateRequireVO} body
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async createUser(body: UserCreateRequireVO, options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOUserInfoResponseVO>> {
|
||||
return UserControllerApiFp(configuration).createUser(body, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 查询用户列表
|
||||
@@ -616,6 +606,16 @@ export const UserControllerApiFactory = function (configuration?: Configuration,
|
||||
async loginUser(body: UserLoginRequireVO, options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOVoid>> {
|
||||
return UserControllerApiFp(configuration).loginUser(body, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 注册用户
|
||||
* @param {UserCreateRequireVO} body
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async register(body: UserCreateRequireVO, options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOUserInfoResponseVO>> {
|
||||
return UserControllerApiFp(configuration).register(body, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 更新用户信息
|
||||
@@ -637,17 +637,6 @@ export const UserControllerApiFactory = function (configuration?: Configuration,
|
||||
* @extends {BaseAPI}
|
||||
*/
|
||||
export class UserControllerApi extends BaseAPI {
|
||||
/**
|
||||
*
|
||||
* @summary 注册用户
|
||||
* @param {UserCreateRequireVO} body
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserControllerApi
|
||||
*/
|
||||
public async createUser(body: UserCreateRequireVO, options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOUserInfoResponseVO>> {
|
||||
return UserControllerApiFp(this.configuration).createUser(body, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @summary 查询用户列表
|
||||
@@ -718,6 +707,17 @@ export class UserControllerApi extends BaseAPI {
|
||||
public async loginUser(body: UserLoginRequireVO, options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOVoid>> {
|
||||
return UserControllerApiFp(this.configuration).loginUser(body, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @summary 注册用户
|
||||
* @param {UserCreateRequireVO} body
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserControllerApi
|
||||
*/
|
||||
public async register(body: UserCreateRequireVO, options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOUserInfoResponseVO>> {
|
||||
return UserControllerApiFp(this.configuration).register(body, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @summary 更新用户信息
|
52
blog-frontend/src/swagger/git_push.sh
Normal file
52
blog-frontend/src/swagger/git_push.sh
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh hugomario swagger-petstore-perl "minor update"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
release_note=$3
|
||||
|
||||
if [ "$git_user_id" = "" ]; then
|
||||
git_user_id="GIT_USER_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||
fi
|
||||
|
||||
if [ "$git_repo_id" = "" ]; then
|
||||
git_repo_id="GIT_REPO_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||
fi
|
||||
|
||||
if [ "$release_note" = "" ]; then
|
||||
release_note="Minor update"
|
||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||
fi
|
||||
|
||||
# Initialize the local directory as a Git repository
|
||||
git init
|
||||
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
git_remote=`git remote`
|
||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||
|
||||
if [ "$GIT_TOKEN" = "" ]; then
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git pull origin master
|
||||
|
||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
||||
|
@@ -21,7 +21,6 @@ export * from './response-vostring';
|
||||
export * from './response-vouser-info-response-vo';
|
||||
export * from './response-vovoid';
|
||||
export * from './setting-info-response-vo';
|
||||
export * from './setting-update-require-vo';
|
||||
export * from './user-create-require-vo';
|
||||
export * from './user-entity';
|
||||
export * from './user-info-response-vo';
|
15
blog-frontend/src/utils/index.ts
Normal file
15
blog-frontend/src/utils/index.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { api, globalStore } from "@/api";
|
||||
|
||||
|
||||
export function updateCurrentUserInfo() {
|
||||
api.UserController.getCurrentUserInfo({ withCredentials: true })
|
||||
.then(resp => {
|
||||
let vo = resp.data
|
||||
if (vo.code === 200) {
|
||||
globalStore.currentUserInfo.value = vo.data || {}
|
||||
console.log("current user info: ", vo.data)
|
||||
} else {
|
||||
console.error("ckeck current user info failed!")
|
||||
}
|
||||
})
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { UserControllerApiFactory } from '@/api-base';
|
||||
import type UserLoginRequireVO from '@/api-base';
|
||||
import { reactive } from 'vue';
|
||||
import { api } from '@/api';
|
||||
import { updateCurrentUserInfo } from '@/utils';
|
||||
|
||||
const form = reactive({
|
||||
email: '',
|
||||
@@ -9,14 +9,16 @@ const form = reactive({
|
||||
})
|
||||
|
||||
const onSubmit = () => {
|
||||
UserControllerApiFactory().loginUser(form)
|
||||
api.UserController.loginUser(form, { withCredentials: true })
|
||||
.then(resp => {
|
||||
let vo = resp.data;
|
||||
if (vo.data === 200) {
|
||||
if (vo.code === 200) {
|
||||
console.log('login success!')
|
||||
} else {
|
||||
console.log(vo.msg)
|
||||
console.log('login failed!')
|
||||
}
|
||||
updateCurrentUserInfo();
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
@@ -1,13 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { api, siteSetting } from '@/api';
|
||||
|
||||
const changeTitle = () => {
|
||||
api.SettingController.updateSetting(siteSetting.title.value, "site.title", { withCredentials: true })
|
||||
}
|
||||
|
||||
function changeSettings() {
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
|
||||
abc
|
||||
<el-input v-model="siteSetting.title.value" placeholder="Please input" @change="changeTitle" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
<style scoped></style>
|
Reference in New Issue
Block a user