├── README.assets ├── image-20200414221542608.png ├── image-20200414221629119.png ├── image-20200414221836238.png ├── image-20200414221924446.png ├── image-20200414222006949.png ├── image-20200414222057643.png ├── image-20200414222133529.png └── image-20200414222159379.png ├── README.md ├── back └── blog │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── blog │ │ │ └── application │ │ │ ├── MyApplication.java │ │ │ ├── config │ │ │ ├── CORSConfig.java │ │ │ └── WebMvcConfig.java │ │ │ ├── controller │ │ │ ├── AdminController.java │ │ │ ├── ArticleController.java │ │ │ ├── LabelController.java │ │ │ └── UploadController.java │ │ │ ├── dao │ │ │ ├── Article2LabelDao.java │ │ │ ├── ArticleDao.java │ │ │ ├── CommentDao.java │ │ │ ├── LabelDao.java │ │ │ ├── UserDao.java │ │ │ └── impl │ │ │ │ ├── Article2LabelDaoImpl.java │ │ │ │ ├── ArticleDaoImpl.java │ │ │ │ ├── CommentDaoImpl.java │ │ │ │ ├── LabelDaoImpl.java │ │ │ │ └── UserDaoImpl.java │ │ │ ├── mapper │ │ │ ├── Article2LabelMapper.java │ │ │ ├── Article2LabelMapper.xml │ │ │ ├── ArticleMapper.java │ │ │ ├── ArticleMapper.xml │ │ │ ├── CommentMapper.java │ │ │ ├── CommentMapper.xml │ │ │ ├── LabelMapper.java │ │ │ ├── LabelMapper.xml │ │ │ ├── UserMapper.java │ │ │ └── UserMapper.xml │ │ │ ├── model │ │ │ ├── Article.java │ │ │ ├── Article2Label.java │ │ │ ├── Comment.java │ │ │ ├── Label.java │ │ │ └── User.java │ │ │ ├── service │ │ │ ├── ArticleService.java │ │ │ ├── LabelService.java │ │ │ ├── UserService.java │ │ │ └── impl │ │ │ │ ├── ArticleServiceImpl.java │ │ │ │ ├── LabelServiceImpl.java │ │ │ │ └── UserServiceImpl.java │ │ │ ├── sql │ │ │ └── createTable.sql │ │ │ └── util │ │ │ └── TimeStampUtil.java │ └── resources │ │ ├── application.properties │ │ ├── banner.txt │ │ ├── mybatis-config.xml │ │ ├── static │ │ └── index.html │ │ └── www.starss.me.jks │ └── test │ └── java │ └── TestJDBC.java └── front └── blog ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── babel.config.js ├── debug.log ├── package-lock.json ├── package.json ├── postcss.config.js ├── public ├── favicon.ico └── index.html ├── src ├── App.vue ├── assets │ ├── ViewUI │ │ └── index.js │ ├── css │ │ ├── app.css │ │ ├── bootstrap.min.css │ │ ├── page.css │ │ └── style.css │ ├── images │ │ ├── bg.jpg │ │ ├── favicon.ico │ │ └── head.png │ ├── test.md │ └── test.puml ├── components │ ├── Articles.vue │ ├── Comment.vue │ ├── Footer.vue │ ├── GoTop.vue │ ├── Header.vue │ ├── Nav.vue │ ├── SideBar.vue │ └── TimeLine.vue ├── main.js ├── network │ ├── admin │ │ ├── api │ │ │ ├── admin.js │ │ │ └── base.js │ │ └── request.js │ └── common │ │ ├── api │ │ ├── article.js │ │ ├── base.js │ │ ├── index.js │ │ ├── label.js │ │ └── user.js │ │ └── request.js ├── router │ └── Router.js ├── store │ ├── index.js │ └── modules │ │ ├── article.js │ │ ├── label.js │ │ └── user.js ├── utils │ └── timeStampUtil.js └── views │ ├── admin │ ├── Admin.vue │ ├── Login.vue │ └── Write.vue │ └── common │ ├── 404.vue │ ├── About.vue │ ├── Archives.vue │ ├── Article.vue │ ├── Home.vue │ ├── Link.vue │ ├── Search.vue │ ├── Tag.vue │ └── Tags.vue └── vue.config.js /README.assets/image-20200414221542608.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Civitasv/vue-blog/0b8b44b534acba5b8b6b0e73a11bfc1130527d0e/README.assets/image-20200414221542608.png -------------------------------------------------------------------------------- /README.assets/image-20200414221629119.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Civitasv/vue-blog/0b8b44b534acba5b8b6b0e73a11bfc1130527d0e/README.assets/image-20200414221629119.png -------------------------------------------------------------------------------- /README.assets/image-20200414221836238.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Civitasv/vue-blog/0b8b44b534acba5b8b6b0e73a11bfc1130527d0e/README.assets/image-20200414221836238.png -------------------------------------------------------------------------------- /README.assets/image-20200414221924446.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Civitasv/vue-blog/0b8b44b534acba5b8b6b0e73a11bfc1130527d0e/README.assets/image-20200414221924446.png -------------------------------------------------------------------------------- /README.assets/image-20200414222006949.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Civitasv/vue-blog/0b8b44b534acba5b8b6b0e73a11bfc1130527d0e/README.assets/image-20200414222006949.png -------------------------------------------------------------------------------- /README.assets/image-20200414222057643.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Civitasv/vue-blog/0b8b44b534acba5b8b6b0e73a11bfc1130527d0e/README.assets/image-20200414222057643.png -------------------------------------------------------------------------------- /README.assets/image-20200414222133529.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Civitasv/vue-blog/0b8b44b534acba5b8b6b0e73a11bfc1130527d0e/README.assets/image-20200414222133529.png -------------------------------------------------------------------------------- /README.assets/image-20200414222159379.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Civitasv/vue-blog/0b8b44b534acba5b8b6b0e73a11bfc1130527d0e/README.assets/image-20200414222159379.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 个人博客框架 2 | 3 | ### 一 简介 4 | 5 | **主页**:http://starss.me/ 6 | 7 | **技术选型**:SpringBoot + Vue(Vue cli + Vuex ...) + MySQL 8 | 9 | **时间周期**:十天 10 | 11 | 前后端分离,其中前端部署在GitHub pages,后端部署在阿里云。 12 | 13 | ### 二 博客页面 14 | 15 | 博客分为`Home` | `Archives` | `Tags` | `Search` | `About` | `Link` 五个部分。 16 | 17 | #### 2.1 Home 18 | 19 | **PC**:![image-20200414221542608](README.assets/image-20200414221542608.png) 20 | 21 | **Mobile**: 22 | 23 | image-20200414221629119 24 | 25 | #### 2.2 Archives 26 | 27 | ![image-20200414221924446](README.assets/image-20200414221924446.png) 28 | 29 | #### 2.3 Tags 30 | 31 | ![image-20200414222006949](README.assets/image-20200414222006949.png) 32 | 33 | #### 2.4 Search 34 | 35 | 支持关键字查询。 36 | 37 | ![image-20200414222057643](README.assets/image-20200414222057643.png) 38 | 39 | #### 2.5 About 40 | 41 | ![image-20200414222133529](README.assets/image-20200414222133529.png) 42 | 43 | #### 2.6 Link 44 | 45 | ![image-20200414222159379](README.assets/image-20200414222159379.png) 46 | 47 | ### 三 后台管理 48 | 49 | 由于时间原因,目前在后台管理部分仅实现了登陆验证,markdown格式发布,博文管理(增删改查)功能,其余部分将陆续上线。在此不进行展示。 50 | 51 | ### 四 参考 52 | 53 | A. http://codingxiaxw.cn/ 54 | 55 | B. https://www.myong.top/ 56 | -------------------------------------------------------------------------------- /back/blog/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.hs.blog 8 | war 9 | blog 10 | 1.0-SNAPSHOT 11 | 12 | 13 | org.springframework.boot 14 | spring-boot-starter-parent 15 | 2.2.3.RELEASE 16 | 17 | 18 | 19 | UTF-8 20 | UTF-8 21 | 1.8 22 | 23 | com.blog.application.MyApplication 24 | 25 | 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-web 30 | 31 | 32 | 33 | org.springframework.boot 34 | spring-boot-starter-test 35 | test 36 | 37 | 38 | 39 | org.mybatis.spring.boot 40 | mybatis-spring-boot-starter 41 | 2.1.1 42 | 43 | 44 | 45 | org.mybatis.spring.boot 46 | mybatis-spring-boot-starter-test 47 | 48 | 49 | com.vaadin.external.google 50 | android-json 51 | 52 | 53 | 2.1.1 54 | test 55 | 56 | 57 | 58 | org.projectlombok 59 | lombok 60 | 1.18.10 61 | provided 62 | 63 | 64 | 65 | 66 | org.json 67 | json 68 | 20190722 69 | 70 | 71 | 72 | mysql 73 | mysql-connector-java 74 | 8.0.18 75 | 76 | 77 | 78 | 79 | com.alibaba 80 | druid 81 | 1.1.10 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | org.springframework.boot 90 | spring-boot-maven-plugin 91 | 92 | 93 | 94 | 95 | 96 | src/main/java 97 | 98 | **/*.xml 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /back/blog/src/main/java/com/blog/application/MyApplication.java: -------------------------------------------------------------------------------- 1 | package com.blog.application; 2 | 3 | import com.blog.application.dao.ArticleDao; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.boot.*; 6 | import org.springframework.boot.autoconfigure.*; 7 | import org.springframework.boot.builder.SpringApplicationBuilder; 8 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 9 | 10 | @SpringBootApplication 11 | public class MyApplication extends SpringBootServletInitializer { 12 | 13 | @Override 14 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 15 | return application.sources(MyApplication.class); 16 | } 17 | 18 | public static void main(String[] args) { 19 | // Spring应用启动 20 | SpringApplication s = new SpringApplication(); 21 | // 懒初始化 22 | s.setLazyInitialization(true); 23 | s.run(MyApplication.class, args); 24 | } 25 | 26 | 27 | } -------------------------------------------------------------------------------- /back/blog/src/main/java/com/blog/application/config/CORSConfig.java: -------------------------------------------------------------------------------- 1 | package com.blog.application.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | 7 | import static org.springframework.web.cors.CorsConfiguration.ALL; 8 | 9 | /** 10 | * CORS configuration 11 | */ 12 | @Configuration 13 | public class CORSConfig implements WebMvcConfigurer { 14 | 15 | @Override 16 | public void addCorsMappings(CorsRegistry corsRegistry) { 17 | corsRegistry.addMapping("/**") 18 | .allowedOrigins(ALL) 19 | .allowedMethods(ALL) 20 | .allowedHeaders(ALL) 21 | .allowCredentials(true); 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /back/blog/src/main/java/com/blog/application/config/WebMvcConfig.java: -------------------------------------------------------------------------------- 1 | package com.blog.application.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; 7 | 8 | @Configuration 9 | public class WebMvcConfig implements WebMvcConfigurer { 10 | @Override 11 | public void addResourceHandlers(ResourceHandlerRegistry registry) { 12 | registry.addResourceHandler("/files/**").addResourceLocations("file:/files/"); 13 | registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/"); 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /back/blog/src/main/java/com/blog/application/controller/AdminController.java: -------------------------------------------------------------------------------- 1 | package com.blog.application.controller; 2 | 3 | 4 | import com.blog.application.model.Article; 5 | import com.blog.application.model.User; 6 | import com.blog.application.service.UserService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.PostMapping; 9 | import org.springframework.web.bind.annotation.RequestBody; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RestController; 12 | import org.springframework.web.util.HtmlUtils; 13 | 14 | @RestController 15 | @RequestMapping("/admin") 16 | public class AdminController { 17 | 18 | @Autowired 19 | UserService userService; 20 | 21 | @PostMapping("/") 22 | public int login(@RequestBody User requestUser) { 23 | String username = requestUser.getUsername(); 24 | User user = userService.get(username, requestUser.getPassword()); 25 | 26 | if (null == user) { 27 | return 400; 28 | } else { 29 | return 200; 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /back/blog/src/main/java/com/blog/application/controller/ArticleController.java: -------------------------------------------------------------------------------- 1 | package com.blog.application.controller; 2 | 3 | import com.blog.application.model.Article; 4 | import com.blog.application.service.ArticleService; 5 | import org.json.JSONArray; 6 | import org.json.JSONObject; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.http.ResponseEntity; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Rest服务 15 | */ 16 | @RestController 17 | @RequestMapping("/articles") 18 | public class ArticleController { 19 | 20 | @Autowired 21 | ArticleService articleService; 22 | 23 | @GetMapping("/") 24 | public List
getAllArticles() { 25 | List
articleList = articleService.getAllArticles(); 26 | return articleList; 27 | } 28 | 29 | @GetMapping("/{articleID}") 30 | public Article getArticleByID(@PathVariable int articleID) { 31 | Article article = articleService.getArticleByID(articleID); 32 | return article; 33 | } 34 | 35 | @GetMapping("/info/{articleID}") 36 | public String getArticleInfoByID(@PathVariable int articleID) { 37 | Article article = articleService.getArticleByID(articleID); 38 | return article.getTitle(); 39 | } 40 | 41 | @PostMapping("/") 42 | public int saveArticle(@RequestBody String data) { 43 | JSONObject jsonObject = new JSONObject(data); 44 | JSONObject jsonObject1 = jsonObject.getJSONObject("article"); 45 | Article article = new Article(); 46 | article.setTitle(jsonObject1.getString("title")); 47 | article.setContent(jsonObject1.getString("content")); 48 | article.setDigest(jsonObject1.getString("digest")); 49 | try { 50 | article.setPublicTime(jsonObject1.getLong("publicTime")); 51 | } catch (Exception e) { 52 | article.setPublicTime(0); 53 | } 54 | JSONArray labels = jsonObject.getJSONArray("labels"); 55 | String[] labelLis = new String[labels.length()]; 56 | for (int i = 0; i < labels.length(); i++) { 57 | labelLis[i] = labels.getString(i); 58 | } 59 | return articleService.insertArticle(article, labelLis); 60 | } 61 | 62 | @DeleteMapping("/{articleID}") 63 | public int deleteArticle(@PathVariable int articleID){ 64 | return articleService.deleteArticleByTD(articleID); 65 | } 66 | 67 | @PutMapping("/") 68 | public int updateArticle(@RequestBody Article article){ 69 | return articleService.updateArticleByID(article); 70 | } 71 | 72 | @PutMapping("/read/{articleID}") 73 | public int addReadNum(@PathVariable int articleID){ 74 | return articleService.addReadNum(articleID); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /back/blog/src/main/java/com/blog/application/controller/LabelController.java: -------------------------------------------------------------------------------- 1 | package com.blog.application.controller; 2 | 3 | import com.blog.application.model.Article; 4 | import com.blog.application.model.Label; 5 | import com.blog.application.service.LabelService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.http.ResponseEntity; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * Rest服务 14 | */ 15 | @RestController 16 | @RequestMapping("/labels") 17 | public class LabelController { 18 | 19 | @Autowired 20 | LabelService labelService; 21 | 22 | @GetMapping("/") 23 | public List