feat: 代码开发中...

This commit is contained in:
2023-03-16 07:04:56 +08:00
parent 1a377c911f
commit 63147e4c08
34 changed files with 482 additions and 218 deletions

View File

@@ -4,6 +4,8 @@ plugins {
id 'io.spring.dependency-management' version '1.1.0' id 'io.spring.dependency-management' version '1.1.0'
} }
evaluationDependsOn(":blog-frontend")
group = 'cn.hamster3.application.blog' group = 'cn.hamster3.application.blog'
version = '0.0.1-SNAPSHOT' version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17' sourceCompatibility = '17'
@@ -60,8 +62,13 @@ tasks.named('test') {
} }
processResources { processResources {
dependsOn(":blog-frontend:npmBuild") dependsOn(":blog-frontend:npmBuildOnly")
from(tasks.findByPath(":blog-frontend:npmBuild").outputs) { //noinspection ConfigurationAvoidance
from(tasks.findByPath(":blog-frontend:npmBuildOnly").outputs) {
into 'static' into 'static'
} }
} }
clean {
delete(files('bin'))
}

View File

@@ -1,7 +1,8 @@
package cn.hamster3.application.blog.controller; package cn.hamster3.application.blog.controller;
import org.springframework.web.bind.annotation.RequestMapping; import cn.hamster3.application.blog.vo.ResponseVO;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/** /**
* 附件相关接口 * 附件相关接口
@@ -9,4 +10,28 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/api/v1/attach") @RequestMapping("/api/v1/attach")
public class AttachController { public class AttachController {
@PostMapping("/")
public ResponseVO<Void> createAttach(@RequestBody MultipartFile file) {
return ResponseVO.success();
}
@PutMapping("/{attachID}/")
public ResponseVO<Void> modifyAttach(@PathVariable String attachID, @RequestBody MultipartFile file) {
return ResponseVO.success();
}
@GetMapping("/{attachID}/")
public ResponseVO<Void> getAttach() {
return ResponseVO.success();
}
@DeleteMapping("/{attachID}/")
public ResponseVO<Void> deleteAttach(@PathVariable String attachID) {
return ResponseVO.success();
}
@GetMapping("/")
public ResponseVO<Void> getAttachList() {
return ResponseVO.success();
}
} }

View File

@@ -1,22 +1,42 @@
package cn.hamster3.application.blog.controller; package cn.hamster3.application.blog.controller;
import cn.hamster3.application.blog.entity.BlogEntity; import cn.hamster3.application.blog.service.IBlogService;
import cn.hamster3.application.blog.vo.ResponseVO; import cn.hamster3.application.blog.vo.ResponseVO;
import cn.hamster3.application.blog.vo.blog.BlogCreateRequireVO;
import org.springframework.web.bind.annotation.GetMapping; import cn.hamster3.application.blog.vo.blog.BlogInfoResponseVO;
import org.springframework.web.bind.annotation.RequestMapping; import cn.hamster3.application.blog.vo.blog.BlogUpdateRequireVO;
import org.springframework.web.bind.annotation.RestController; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
/** @Tag(name = "博文接口", description = "博文相关接口")
* 博文相关接口
*/
@RestController @RestController
@RequestMapping("/api/v1/blog") @RequestMapping(value = "/api/v1/blog", produces = MediaType.APPLICATION_JSON_VALUE)
public class BlogController { public class BlogController {
@GetMapping("/") @Resource
public ResponseVO<List<BlogEntity>> getBlogList() { private IBlogService blogService;
@PostMapping("/")
public ResponseVO<Long> createBlog(@RequestBody @Valid BlogCreateRequireVO requireVO) {
return blogService.createBlog(requireVO);
}
@GetMapping("/{blogID}/")
public ResponseVO<BlogInfoResponseVO> getBlogInfo() {
return null; return null;
} }
@GetMapping("/")
public ResponseVO<List<BlogInfoResponseVO>> getBlogInfoList() {
return null;
}
@PutMapping("/{blogID}/")
public ResponseVO<Void> updateBlog(@PathVariable String blogID, @RequestBody @Valid BlogUpdateRequireVO requireVO) {
return ResponseVO.success();
}
} }

View File

@@ -2,38 +2,49 @@ package cn.hamster3.application.blog.controller;
import cn.hamster3.application.blog.service.IUserService; import cn.hamster3.application.blog.service.IUserService;
import cn.hamster3.application.blog.vo.ResponseVO; import cn.hamster3.application.blog.vo.ResponseVO;
import cn.hamster3.application.blog.vo.user.UserInfoResponseVO;
import cn.hamster3.application.blog.vo.user.UserRegisterRequireVO; import cn.hamster3.application.blog.vo.user.UserRegisterRequireVO;
import cn.hamster3.application.blog.vo.user.UserRegisterResponseVO; import cn.hamster3.application.blog.vo.user.UserRegisterResponseVO;
import cn.hamster3.application.blog.vo.user.UserUpdateRequireVO;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/** /**
* 用户相关接口 * 用户相关接口
*/ */
@RestController @RestController
@RequestMapping("/api/v1/user") @RequestMapping(value = "/api/v1/user", produces = MediaType.APPLICATION_JSON_VALUE)
public class UserController { public class UserController {
@Resource @Resource
private IUserService userService; private IUserService userService;
@PostMapping("/") @PostMapping("/")
public ResponseVO<UserRegisterResponseVO> registerUser(@RequestBody @Valid UserRegisterRequireVO requireVO) { public ResponseVO<UserRegisterResponseVO> createUser(@RequestBody @Valid UserRegisterRequireVO requireVO) {
return userService.registerUser(requireVO); return userService.registerUser(requireVO);
} }
@PutMapping("/") @PutMapping("/")
public Object modifyUserInfo() { public ResponseVO<Void> updateUser(@RequestBody @Valid UserUpdateRequireVO requireVO) {
return null;
}
@GetMapping("/")
public ResponseVO<Void> getAllUserInfo() {
return ResponseVO.success(); return ResponseVO.success();
} }
@GetMapping("/")
public ResponseVO<List<UserInfoResponseVO>> getAllUserInfo() {
return ResponseVO.success(new ArrayList<>());
}
@GetMapping("/{userID}/") @GetMapping("/{userID}/")
public Object getUserInfo(@PathVariable String userID) { public ResponseVO<UserInfoResponseVO> getUserInfo(@PathVariable String userID) {
return null; return ResponseVO.success(null);
}
@GetMapping("/{userID}/attaches")
public ResponseVO<Void> getUserAttaches(@PathVariable String userID) {
return ResponseVO.success(null);
} }
} }

View File

@@ -0,0 +1,16 @@
package cn.hamster3.application.blog.entity.mapper;
import cn.hamster3.application.blog.entity.BlogEntity;
import cn.hamster3.application.blog.vo.blog.BlogCreateRequireVO;
import cn.hamster3.application.blog.vo.blog.BlogInfoResponseVO;
import org.mapstruct.Mapper;
import org.mapstruct.MappingConstants;
import org.mapstruct.ReportingPolicy;
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE, componentModel = MappingConstants.ComponentModel.SPRING)
public interface BlogMapper {
BlogEntity voToEntity(BlogCreateRequireVO requireVO);
BlogInfoResponseVO entityToInfoVO(BlogEntity requireVO);
}

View File

@@ -0,0 +1,18 @@
package cn.hamster3.application.blog.entity.mapper;
import cn.hamster3.application.blog.entity.UserEntity;
import cn.hamster3.application.blog.vo.user.UserInfoResponseVO;
import cn.hamster3.application.blog.vo.user.UserRegisterRequireVO;
import cn.hamster3.application.blog.vo.user.UserRegisterResponseVO;
import org.mapstruct.Mapper;
import org.mapstruct.MappingConstants;
import org.mapstruct.ReportingPolicy;
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE, componentModel = MappingConstants.ComponentModel.SPRING)
public interface UserMapper {
UserEntity voToEntity(UserRegisterRequireVO requireVO);
UserInfoResponseVO entityToInfoVO(UserEntity requireVO);
UserRegisterResponseVO entityToRegisterVO(UserEntity requireVO);
}

View File

@@ -1,18 +0,0 @@
package cn.hamster3.application.blog.mapper;
import cn.hamster3.application.blog.entity.UserEntity;
import cn.hamster3.application.blog.vo.user.UserRegisterRequireVO;
import cn.hamster3.application.blog.vo.user.UserRegisterResponseVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
@Mapper(componentModel = "spring")
public interface UserMapper {
@Mapping(target = "permissions", ignore = true)
@Mapping(target = "attachEntities", ignore = true)
@Mapping(target = "blogEntities", ignore = true)
UserEntity voToEntity(UserRegisterRequireVO requireVO);
UserRegisterResponseVO entityToVO(UserEntity requireVO);
}

View File

@@ -0,0 +1,4 @@
package cn.hamster3.application.blog.service;
public interface IAttachService {
}

View File

@@ -1,4 +1,8 @@
package cn.hamster3.application.blog.service; package cn.hamster3.application.blog.service;
import cn.hamster3.application.blog.vo.ResponseVO;
import cn.hamster3.application.blog.vo.blog.BlogCreateRequireVO;
public interface IBlogService { public interface IBlogService {
ResponseVO<Long> createBlog(BlogCreateRequireVO requireVO);
} }

View File

@@ -0,0 +1,8 @@
package cn.hamster3.application.blog.service.impl;
import cn.hamster3.application.blog.service.IAttachService;
import org.springframework.stereotype.Service;
@Service
public class AttachService implements IAttachService {
}

View File

@@ -1,12 +1,25 @@
package cn.hamster3.application.blog.service.impl; package cn.hamster3.application.blog.service.impl;
import cn.hamster3.application.blog.dao.BlogRepository; import cn.hamster3.application.blog.dao.BlogRepository;
import cn.hamster3.application.blog.entity.BlogEntity;
import cn.hamster3.application.blog.entity.mapper.BlogMapper;
import cn.hamster3.application.blog.service.IBlogService; import cn.hamster3.application.blog.service.IBlogService;
import cn.hamster3.application.blog.vo.ResponseVO;
import cn.hamster3.application.blog.vo.blog.BlogCreateRequireVO;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class BlogService implements IBlogService { public class BlogService implements IBlogService {
@Resource
BlogMapper blogMapper;
@Resource @Resource
private BlogRepository blogRepo; private BlogRepository blogRepo;
@Override
public ResponseVO<Long> createBlog(BlogCreateRequireVO requireVO) {
BlogEntity entity = blogMapper.voToEntity(requireVO);
BlogEntity save = blogRepo.save(entity);
return ResponseVO.success(save.getId());
}
} }

View File

@@ -2,7 +2,7 @@ package cn.hamster3.application.blog.service.impl;
import cn.hamster3.application.blog.dao.UserRepository; import cn.hamster3.application.blog.dao.UserRepository;
import cn.hamster3.application.blog.entity.UserEntity; import cn.hamster3.application.blog.entity.UserEntity;
import cn.hamster3.application.blog.mapper.UserMapper; import cn.hamster3.application.blog.entity.mapper.UserMapper;
import cn.hamster3.application.blog.service.IUserService; import cn.hamster3.application.blog.service.IUserService;
import cn.hamster3.application.blog.vo.ResponseVO; import cn.hamster3.application.blog.vo.ResponseVO;
import cn.hamster3.application.blog.vo.user.UserRegisterRequireVO; import cn.hamster3.application.blog.vo.user.UserRegisterRequireVO;
@@ -37,6 +37,6 @@ public class UserService implements IUserService {
entity.setPassword(passwordEncoder.encode(entity.getPassword())); entity.setPassword(passwordEncoder.encode(entity.getPassword()));
UserEntity save = userRepo.save(entity); UserEntity save = userRepo.save(entity);
return ResponseVO.success("注册成功!", userMapper.entityToVO(save)); return ResponseVO.success("注册成功!", userMapper.entityToRegisterVO(save));
} }
} }

View File

@@ -19,10 +19,6 @@ public class ResponseVO<T> {
return new ResponseVO<>(200, "", null); return new ResponseVO<>(200, "", null);
} }
public static ResponseVO<Void> success(String msg) {
return new ResponseVO<>(200, msg, null);
}
public static <T> ResponseVO<T> success(T data) { public static <T> ResponseVO<T> success(T data) {
return new ResponseVO<>(200, "", data); return new ResponseVO<>(200, "", data);
} }

View File

@@ -0,0 +1,16 @@
package cn.hamster3.application.blog.vo.blog;
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Data
public class BlogCreateRequireVO {
@Nullable
@Max(value = 16, message = "密码最大长度不能超过 16 个字!")
private String password;
@NotNull(message = "博客文章内容不能为空!")
private String content;
}

View File

@@ -0,0 +1,4 @@
package cn.hamster3.application.blog.vo.blog;
public class BlogInfoResponseVO {
}

View File

@@ -0,0 +1,6 @@
package cn.hamster3.application.blog.vo.blog;
public class BlogUpdateRequireVO {
private String password;
private String content;
}

View File

@@ -0,0 +1,4 @@
package cn.hamster3.application.blog.vo.user;
public class UserInfoResponseVO {
}

View File

@@ -0,0 +1,4 @@
package cn.hamster3.application.blog.vo.user;
public class UserUpdateRequireVO {
}

View File

@@ -1,3 +1,11 @@
server:
port: 8080
servlet:
context-path: /
multipart:
enable: true
max-file-size: 16M
max-require-size: 32M
spring: spring:
# 要使用的环境预设 # 要使用的环境预设
# prod: 生产环境 # prod: 生产环境

View File

@@ -20,6 +20,20 @@ tasks.register("npmBuild", NpmTask) {
args = ['run', 'build'] args = ['run', 'build']
} }
tasks.register("npmBuildOnly", NpmTask) {
dependsOn("npmInstall")
inputs.files(
'public', 'src',
'env.d.ts', 'index.html',
'package.json', 'package-lock.json',
'tsconfig.config.json', 'tsconfig.json',
'vite.config.ts'
)
outputs.files(fileTree('dist'))
args = ['run', 'build-only']
}
//调用npm run dev //调用npm run dev
tasks.register("npmDev", NpmTask) { tasks.register("npmDev", NpmTask) {

View File

@@ -1,12 +1,12 @@
{ {
"name": "vue-project", "name": "blog-frontend",
"version": "0.0.0", "version": "0.0.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "vue-project", "name": "blog-frontend",
"version": "0.0.0", "version": "0.0.1",
"dependencies": { "dependencies": {
"axios": "^1.3.4", "axios": "^1.3.4",
"element-plus": "^2.2.32", "element-plus": "^2.2.32",

View File

@@ -1,9 +1,9 @@
{ {
"name": "vue-project", "name": "blog-frontend",
"version": "0.0.0", "version": "0.0.1",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "vite --port 3000", "dev": "vite --host 0.0.0.0 --port 3000",
"build": "run-p type-check build-only", "build": "run-p type-check build-only",
"preview": "vite preview", "preview": "vite preview",
"build-only": "vite build", "build-only": "vite build",

View File

@@ -1,45 +1,50 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue';
import { RouterLink, RouterView } from 'vue-router' import { RouterLink, RouterView } from 'vue-router'
import VueIndexVuew from '@/views/VueIndexVuew.vue'
import * as api from '@/api-base/index' import * as api from '@/api-base/index'
// let userAPI = api.UserControllerApiFp(); let title = ref("网站标题")
api.UserControllerApiFactory().getAllUserInfo()
.then(response => { onMounted(() => {
let data = response.data; api.SiteSettingControllerApiFactory().getSiteTitle()
console.log(data) .then(response => {
}) console.log(response.data)
.catch(err => { title.value = response.data.data || "网站标题"
console.error(err); })
}) .catch(err => {
console.error(err);
})
})
const activeIndex = ref('index')
const handleSelect = (key: string, keyPath: string[]) => {
console.log(key, keyPath)
}
</script> </script>
<template> <template>
<el-container> <el-container>
<el-header> <el-header>
<el-row :gutter="20"> <el-menu :default-active="activeIndex" mode="horizontal" :ellipsis="false" @select="handleSelect">
<el-col :span="4"> <el-menu-item index="index"> {{ title }} </el-menu-item>
<h1>网站标题</h1> <el-menu-item index="categorize"> 分类 </el-menu-item>
</el-col> <el-menu-item index="tags"> 标签 </el-menu-item>
<el-col :span="16">
<h1> <div class="flex-grow" />
<RouterLink to="/" class="router-link">首页</RouterLink>
<RouterLink to="/" class="router-link">项目</RouterLink> <el-menu-item index="login">登录 </el-menu-item>
<RouterLink to="/" class="router-link">分类</RouterLink> <el-menu-item index="register"> 注册 </el-menu-item>
<a href="/swagger-ui/index.html">Swagger</a> </el-menu>
&nbsp;
<a href="https://editor.swagger.io/">Editor</a>
</h1>
</el-col>
<el-col :span="4">
<h1>头像</h1>
</el-col>
</el-row>
</el-header> </el-header>
<el-main> <el-main>
<RouterView /> <RouterView />
</el-main> </el-main>
<el-footer></el-footer> <el-footer>
<p>
<a href="/swagger-ui/index.html">Swagger</a>
|
<a href="https://editor.swagger.io/">Editor</a>
</p>
</el-footer>
</el-container> </el-container>
</template> </template>
@@ -47,24 +52,9 @@ api.UserControllerApiFactory().getAllUserInfo()
.el-container { .el-container {
width: 100%; width: 100%;
height: 100%; height: 100%;
padding: 5px;
background-color: aqua;
} }
.el-header { .flex-grow {
height: 60px; flex-grow: 1;
background-color: aliceblue;
}
.el-row {
margin-bottom: 20px;
}
.el-col {
background-color: aquamarine;
}
.router-link {
margin-right: 5px;
} }
</style> </style>

View File

@@ -10,6 +10,8 @@
* NOTE: This class is auto generated by the swagger code generator program. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*/export * from './apis/blog-controller-api'; */export * from './apis/attach-controller-api';
export * from './apis/blog-controller-api';
export * from './apis/site-setting-controller-api';
export * from './apis/user-controller-api'; export * from './apis/user-controller-api';

View File

@@ -17,12 +17,46 @@ import { Configuration } from '../configuration';
// @ts-ignore // @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
import { ResponseVOListBlogEntity } from '../models'; import { ResponseVOListBlogEntity } from '../models';
import { ResponseVOVoid } from '../models';
/** /**
* BlogControllerApi - axios parameter creator * BlogControllerApi - axios parameter creator
* @export * @export
*/ */
export const BlogControllerApiAxiosParamCreator = function (configuration?: Configuration) { export const BlogControllerApiAxiosParamCreator = function (configuration?: Configuration) {
return { return {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createBlog: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/api/v1/blog/`;
// 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;
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};
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
},
/** /**
* *
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
@@ -51,6 +85,45 @@ export const BlogControllerApiAxiosParamCreator = function (configuration?: Conf
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
},
/**
*
* @param {string} blogID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
modifyBlog: async (blogID: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'blogID' is not null or undefined
if (blogID === null || blogID === undefined) {
throw new RequiredError('blogID','Required parameter blogID was null or undefined when calling modifyBlog.');
}
const localVarPath = `/api/v1/blog/{blogID}/`
.replace(`{${"blogID"}}`, encodeURIComponent(String(blogID)));
// 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: 'PUT', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
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};
return { return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions, options: localVarRequestOptions,
@@ -65,6 +138,18 @@ export const BlogControllerApiAxiosParamCreator = function (configuration?: Conf
*/ */
export const BlogControllerApiFp = function(configuration?: Configuration) { export const BlogControllerApiFp = function(configuration?: Configuration) {
return { return {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createBlog(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ResponseVOVoid>>> {
const localVarAxiosArgs = await BlogControllerApiAxiosParamCreator(configuration).createBlog(options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/** /**
* *
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
@@ -77,6 +162,19 @@ export const BlogControllerApiFp = function(configuration?: Configuration) {
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/**
*
* @param {string} blogID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async modifyBlog(blogID: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ResponseVOVoid>>> {
const localVarAxiosArgs = await BlogControllerApiAxiosParamCreator(configuration).modifyBlog(blogID, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
} }
}; };
@@ -86,6 +184,14 @@ export const BlogControllerApiFp = function(configuration?: Configuration) {
*/ */
export const BlogControllerApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { export const BlogControllerApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
return { return {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createBlog(options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOVoid>> {
return BlogControllerApiFp(configuration).createBlog(options).then((request) => request(axios, basePath));
},
/** /**
* *
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
@@ -94,6 +200,15 @@ export const BlogControllerApiFactory = function (configuration?: Configuration,
async getBlogList(options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOListBlogEntity>> { async getBlogList(options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOListBlogEntity>> {
return BlogControllerApiFp(configuration).getBlogList(options).then((request) => request(axios, basePath)); return BlogControllerApiFp(configuration).getBlogList(options).then((request) => request(axios, basePath));
}, },
/**
*
* @param {string} blogID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async modifyBlog(blogID: string, options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOVoid>> {
return BlogControllerApiFp(configuration).modifyBlog(blogID, options).then((request) => request(axios, basePath));
},
}; };
}; };
@@ -104,6 +219,15 @@ export const BlogControllerApiFactory = function (configuration?: Configuration,
* @extends {BaseAPI} * @extends {BaseAPI}
*/ */
export class BlogControllerApi extends BaseAPI { export class BlogControllerApi extends BaseAPI {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BlogControllerApi
*/
public async createBlog(options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOVoid>> {
return BlogControllerApiFp(this.configuration).createBlog(options).then((request) => request(this.axios, this.basePath));
}
/** /**
* *
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
@@ -113,4 +237,14 @@ export class BlogControllerApi extends BaseAPI {
public async getBlogList(options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOListBlogEntity>> { public async getBlogList(options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOListBlogEntity>> {
return BlogControllerApiFp(this.configuration).getBlogList(options).then((request) => request(this.axios, this.basePath)); return BlogControllerApiFp(this.configuration).getBlogList(options).then((request) => request(this.axios, this.basePath));
} }
/**
*
* @param {string} blogID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BlogControllerApi
*/
public async modifyBlog(blogID: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOVoid>> {
return BlogControllerApiFp(this.configuration).modifyBlog(blogID, options).then((request) => request(this.axios, this.basePath));
}
} }

View File

@@ -16,8 +16,11 @@ import { Configuration } from '../configuration';
// Some imports not used depending on template conditions // Some imports not used depending on template conditions
// @ts-ignore // @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
import { ResponseVOListUserInfoResponseVO } from '../models';
import { ResponseVOUserInfoResponseVO } from '../models';
import { ResponseVOUserRegisterResponseVO } from '../models'; import { ResponseVOUserRegisterResponseVO } from '../models';
import { ResponseVOVoid } from '../models'; import { ResponseVOVoid } from '../models';
import { UserModifyRequireVO } from '../models';
import { UserRegisterRequireVO } from '../models'; import { UserRegisterRequireVO } from '../models';
/** /**
* UserControllerApi - axios parameter creator * UserControllerApi - axios parameter creator
@@ -99,10 +102,15 @@ export const UserControllerApiAxiosParamCreator = function (configuration?: Conf
}, },
/** /**
* *
* @param {UserModifyRequireVO} body
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
modifyUserInfo: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => { modifyUserInfo: async (body: UserModifyRequireVO, 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 modifyUserInfo.');
}
const localVarPath = `/api/v1/user/`; const localVarPath = `/api/v1/user/`;
// use dummy base URL string because the URL constructor only accepts absolute URLs. // use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com'); const localVarUrlObj = new URL(localVarPath, 'https://example.com');
@@ -114,6 +122,8 @@ export const UserControllerApiAxiosParamCreator = function (configuration?: Conf
const localVarHeaderParameter = {} as any; const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any; const localVarQueryParameter = {} as any;
localVarHeaderParameter['Content-Type'] = 'application/json';
const query = new URLSearchParams(localVarUrlObj.search); const query = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) { for (const key in localVarQueryParameter) {
query.set(key, localVarQueryParameter[key]); query.set(key, localVarQueryParameter[key]);
@@ -124,6 +134,8 @@ export const UserControllerApiAxiosParamCreator = function (configuration?: Conf
localVarUrlObj.search = (new URLSearchParams(query)).toString(); localVarUrlObj.search = (new URLSearchParams(query)).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.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 { return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
@@ -186,7 +198,7 @@ export const UserControllerApiFp = function(configuration?: Configuration) {
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
async getAllUserInfo(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ResponseVOVoid>>> { async getAllUserInfo(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ResponseVOListUserInfoResponseVO>>> {
const localVarAxiosArgs = await UserControllerApiAxiosParamCreator(configuration).getAllUserInfo(options); const localVarAxiosArgs = await UserControllerApiAxiosParamCreator(configuration).getAllUserInfo(options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
@@ -199,7 +211,7 @@ export const UserControllerApiFp = function(configuration?: Configuration) {
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
async getUserInfo(userID: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<any>>> { async getUserInfo(userID: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ResponseVOUserInfoResponseVO>>> {
const localVarAxiosArgs = await UserControllerApiAxiosParamCreator(configuration).getUserInfo(userID, options); const localVarAxiosArgs = await UserControllerApiAxiosParamCreator(configuration).getUserInfo(userID, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
@@ -208,11 +220,12 @@ export const UserControllerApiFp = function(configuration?: Configuration) {
}, },
/** /**
* *
* @param {UserModifyRequireVO} body
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
async modifyUserInfo(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<any>>> { async modifyUserInfo(body: UserModifyRequireVO, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ResponseVOVoid>>> {
const localVarAxiosArgs = await UserControllerApiAxiosParamCreator(configuration).modifyUserInfo(options); const localVarAxiosArgs = await UserControllerApiAxiosParamCreator(configuration).modifyUserInfo(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
@@ -245,7 +258,7 @@ export const UserControllerApiFactory = function (configuration?: Configuration,
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
async getAllUserInfo(options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOVoid>> { async getAllUserInfo(options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOListUserInfoResponseVO>> {
return UserControllerApiFp(configuration).getAllUserInfo(options).then((request) => request(axios, basePath)); return UserControllerApiFp(configuration).getAllUserInfo(options).then((request) => request(axios, basePath));
}, },
/** /**
@@ -254,16 +267,17 @@ export const UserControllerApiFactory = function (configuration?: Configuration,
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
async getUserInfo(userID: string, options?: AxiosRequestConfig): Promise<AxiosResponse<any>> { async getUserInfo(userID: string, options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOUserInfoResponseVO>> {
return UserControllerApiFp(configuration).getUserInfo(userID, options).then((request) => request(axios, basePath)); return UserControllerApiFp(configuration).getUserInfo(userID, options).then((request) => request(axios, basePath));
}, },
/** /**
* *
* @param {UserModifyRequireVO} body
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
async modifyUserInfo(options?: AxiosRequestConfig): Promise<AxiosResponse<any>> { async modifyUserInfo(body: UserModifyRequireVO, options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOVoid>> {
return UserControllerApiFp(configuration).modifyUserInfo(options).then((request) => request(axios, basePath)); return UserControllerApiFp(configuration).modifyUserInfo(body, options).then((request) => request(axios, basePath));
}, },
/** /**
* *
@@ -290,7 +304,7 @@ export class UserControllerApi extends BaseAPI {
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserControllerApi * @memberof UserControllerApi
*/ */
public async getAllUserInfo(options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOVoid>> { public async getAllUserInfo(options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOListUserInfoResponseVO>> {
return UserControllerApiFp(this.configuration).getAllUserInfo(options).then((request) => request(this.axios, this.basePath)); return UserControllerApiFp(this.configuration).getAllUserInfo(options).then((request) => request(this.axios, this.basePath));
} }
/** /**
@@ -300,17 +314,18 @@ export class UserControllerApi extends BaseAPI {
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserControllerApi * @memberof UserControllerApi
*/ */
public async getUserInfo(userID: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<any>> { public async getUserInfo(userID: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOUserInfoResponseVO>> {
return UserControllerApiFp(this.configuration).getUserInfo(userID, options).then((request) => request(this.axios, this.basePath)); return UserControllerApiFp(this.configuration).getUserInfo(userID, options).then((request) => request(this.axios, this.basePath));
} }
/** /**
* *
* @param {UserModifyRequireVO} body
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserControllerApi * @memberof UserControllerApi
*/ */
public async modifyUserInfo(options?: AxiosRequestConfig) : Promise<AxiosResponse<any>> { public async modifyUserInfo(body: UserModifyRequireVO, options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOVoid>> {
return UserControllerApiFp(this.configuration).modifyUserInfo(options).then((request) => request(this.axios, this.basePath)); return UserControllerApiFp(this.configuration).modifyUserInfo(body, options).then((request) => request(this.axios, this.basePath));
} }
/** /**
* *

View File

@@ -16,7 +16,7 @@ import { Configuration } from "./configuration";
// @ts-ignore // @ts-ignore
import globalAxios, { AxiosRequestConfig, AxiosInstance } from 'axios'; import globalAxios, { AxiosRequestConfig, AxiosInstance } from 'axios';
export const BASE_PATH = "http://localhost:8080".replace(/\/+$/, ""); export const BASE_PATH = "http://192.168.1.100:8080".replace(/\/+$/, "");
/** /**
* *

View File

@@ -1,9 +1,16 @@
export * from './attach-attach-idbody';
export * from './attach-entity'; export * from './attach-entity';
export * from './blog-attach-entity'; export * from './blog-attach-entity';
export * from './blog-entity'; export * from './blog-entity';
export * from './response-volist-blog-entity'; export * from './response-volist-blog-entity';
export * from './response-volist-user-info-response-vo';
export * from './response-vostring';
export * from './response-vouser-info-response-vo';
export * from './response-vouser-register-response-vo'; export * from './response-vouser-register-response-vo';
export * from './response-vovoid'; export * from './response-vovoid';
export * from './user-entity'; export * from './user-entity';
export * from './user-info-response-vo';
export * from './user-modify-require-vo';
export * from './user-register-require-vo'; export * from './user-register-require-vo';
export * from './user-register-response-vo'; export * from './user-register-response-vo';
export * from './v1-attach-body';

View File

@@ -11,7 +11,7 @@
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*/ */
import { UserRegisterResponseVO } from './user-register-response-vo'; import type { UserRegisterResponseVO } from './user-register-response-vo';
/** /**
* *
* @export * @export

View File

@@ -11,8 +11,8 @@
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*/ */
import { AttachEntity } from './attach-entity'; import type { AttachEntity } from './attach-entity';
import { BlogEntity } from './blog-entity'; import type { BlogEntity } from './blog-entity';
/** /**
* *
* @export * @export

View File

@@ -1,14 +1,13 @@
@import './base.css'; @import './base.css';
html, html,
body { body,
height: 100%; #app {
width: 100%; width: 100%;
height: 100%;
} }
#app { #app {
height: 100%; margin: 0;
width: 100%; padding: 0;
margin: 0 auto;
padding: 2rem;
} }

View File

@@ -1,21 +1,22 @@
import { createRouter, createWebHistory } from 'vue-router' import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
const router = createRouter({ const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL), history: createWebHistory(import.meta.env.BASE_URL),
routes: [ routes: [
{ {
path: '/', path: '/',
name: 'home', name: 'index',
component: HomeView component: () => import('@/views/IndexView.vue')
}, },
{ {
path: '/about', path: '/register',
name: 'about', name: 'register',
// route level code-splitting component: () => import('@/views/RegisterView.vue')
// this generates a separate chunk (About.[hash].js) for this route },
// which is lazy-loaded when the route is visited. {
component: () => import('../views/AboutView.vue') path: '/login',
name: 'login',
component: () => import('@/views/LoginView.vue')
} }
] ]
}) })

View File

@@ -1,6 +1,44 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue';
import BlogComponent from '@/components/BlogComponent.vue';
const count = ref(3)
const load = () => {
count.value += 2
}
</script> </script>
<template> <template>
<el-scrollbar style="overflow: auto">
<ul class="infinite-list" v-infinite-scroll="load">
<li v-for=" i in count" :key="i" class="infinite-list-item">
<BlogComponent :i="i"></BlogComponent>
</li>
</ul>
</el-scrollbar>
</template> </template>
<style scoped>
.infinite-list {
height: 100%;
padding: 0;
margin: 0;
list-style: none;
margin-right: 10px;
}
.infinite-list .infinite-list-item {
display: flex;
align-items: center;
justify-content: center;
/* height: 50px; */
background: var(--el-color-primary-light-9);
margin: 10px;
color: var(--el-color-primary);
}
.infinite-list .infinite-list-item+.list-item {
margin-top: 10px;
}
</style>

View File

@@ -1,82 +0,0 @@
<script setup lang="ts">
import { RouterLink, RouterView } from 'vue-router'
</script>
<template>
<header>
<img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />
<div class="wrapper">
<HelloWorld msg="You did it!" />
<nav>
<RouterLink to="/">Home</RouterLink>
<RouterLink to="/about">About</RouterLink>
</nav>
</div>
</header>
</template>
<style scoped>
header {
line-height: 1.5;
max-height: 100vh;
}
.logo {
display: block;
margin: 0 auto 2rem;
}
nav {
width: 100%;
font-size: 12px;
text-align: center;
margin-top: 2rem;
}
nav a.router-link-exact-active {
color: var(--color-text);
}
nav a.router-link-exact-active:hover {
background-color: transparent;
}
nav a {
display: inline-block;
padding: 0 1rem;
border-left: 1px solid var(--color-border);
}
nav a:first-of-type {
border: 0;
}
@media (min-width: 1024px) {
header {
display: flex;
place-items: center;
padding-right: calc(var(--section-gap) / 2);
}
.logo {
margin: 0 2rem 0 0;
}
header .wrapper {
display: flex;
place-items: flex-start;
flex-wrap: wrap;
}
nav {
text-align: left;
margin-left: -1rem;
font-size: 1rem;
padding: 1rem 0;
margin-top: 1rem;
}
}
</style>