Compare commits

...

6 Commits

Author SHA1 Message Date
e8dc76ef82 【新增】新增显示教程详情
Some checks failed
CI Build and Test / build (pull_request) Has been cancelled
2025-10-30 09:36:39 +08:00
8aa6fc0abf 【优化】拦截地址 2025-10-30 09:36:09 +08:00
7eda1a85eb 【优化】使用Thymeleaf渲染 2025-10-30 09:35:46 +08:00
6a124a5754 【删除】教程展示测试文件 2025-10-30 09:34:03 +08:00
564e617802 【改进】模块化 2025-10-30 09:32:55 +08:00
3f09aa1238 【新增】模板引擎支持包 2025-10-30 09:31:24 +08:00
14 changed files with 72 additions and 33 deletions

View File

@@ -41,6 +41,7 @@ dependencies {
runtimeOnly 'com.mysql:mysql-connector-j' // MySQL 驱动 runtimeOnly 'com.mysql:mysql-connector-j' // MySQL 驱动
annotationProcessor 'org.projectlombok:lombok' // Lombok 注解处理 annotationProcessor 'org.projectlombok:lombok' // Lombok 注解处理
testImplementation 'org.springframework.boot:spring-boot-starter-test' // 测试框架 testImplementation 'org.springframework.boot:spring-boot-starter-test' // 测试框架
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' // thymeleaf模版引擎
} }
tasks.named('test') { tasks.named('test') {

View File

@@ -32,7 +32,7 @@ public class SaTokenConfig implements WebMvcConfigurer {
// 排除固件查询接口(不需要登录) // 排除固件查询接口(不需要登录)
.excludePathPatterns("/firmware/**") .excludePathPatterns("/firmware/**")
// 排除静态资源 // 排除静态资源
.excludePathPatterns("/", "/index.html", "/admin/login.html", "/*.css", "/*.js", "/*.ico", "/static/**") .excludePathPatterns("/", "/loading.html", "/admin/login.html", "/*.css", "/*.js", "/*.ico", "/static/**")
// 排除后台管理静态资源 // 排除后台管理静态资源
.excludePathPatterns("/admin/**") .excludePathPatterns("/admin/**")
// 排除 Druid 监控 // 排除 Druid 监控

View File

@@ -0,0 +1,24 @@
package com.corewing.app.modules.admin;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class SysMainController {
@GetMapping({"/", "/index.html"})
public String loading() {
return "/admin/loading";
}
@GetMapping("/admin/login.html")
public String login() {
return "/admin/login";
}
@GetMapping("/admin/index.html")
public String adminIndex() {
return "/admin/index";
}
}

View File

@@ -1,4 +1,4 @@
package com.corewing.app.controller; package com.corewing.app.modules.admin;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import com.corewing.app.common.Result; import com.corewing.app.common.Result;

View File

@@ -1,4 +1,4 @@
package com.corewing.app.controller; package com.corewing.app.modules.app;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;

View File

@@ -1,4 +1,4 @@
package com.corewing.app.controller; package com.corewing.app.modules.app;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;

View File

@@ -1,4 +1,4 @@
package com.corewing.app.controller; package com.corewing.app.modules.app;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;

View File

@@ -1,4 +1,4 @@
package com.corewing.app.controller; package com.corewing.app.modules.app;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -10,10 +10,9 @@ import com.corewing.app.service.TutorialCategoryService;
import com.corewing.app.service.TutorialService; import com.corewing.app.service.TutorialService;
import com.corewing.app.util.I18nUtil; import com.corewing.app.util.I18nUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@@ -21,7 +20,7 @@ import java.util.List;
* 教程接口 * 教程接口
*/ */
@RequestMapping("/tutorial") @RequestMapping("/tutorial")
@RestController @Controller
@Slf4j @Slf4j
public class TutorialController { public class TutorialController {
@@ -33,12 +32,27 @@ public class TutorialController {
this.tutorialCategoryService = tutorialCategoryService; this.tutorialCategoryService = tutorialCategoryService;
} }
/**
* 跳转到界面查看教程详情
* @param tutorialId 教程id
* @param model 数据模型
* @return 详情页
*/
@GetMapping("/viewDetail/{tutorialId}")
public String viewDetail(@PathVariable Long tutorialId, ModelMap model) {
Tutorial tutorial = tutorialService.getById(tutorialId);
model.put("tutorial", tutorial);
return "/app/tutorial/viewDetail";
}
/** /**
* 添加查看次数 * 添加查看次数
* @param tutorialId 教程id * @param tutorialId 教程id
* @return * @return
*/ */
@GetMapping("/addViewCount") @GetMapping("/addViewCount")
@ResponseBody
public Result<String> addViewCount(@RequestParam Long tutorialId) { public Result<String> addViewCount(@RequestParam Long tutorialId) {
Tutorial tutorial = tutorialService.getById(tutorialId); Tutorial tutorial = tutorialService.getById(tutorialId);
if(tutorial == null) { if(tutorial == null) {
@@ -56,6 +70,7 @@ public class TutorialController {
* *
*/ */
@GetMapping("/category") @GetMapping("/category")
@ResponseBody
public Result<List<TutorialCategory>> category( public Result<List<TutorialCategory>> category(
@RequestParam(required = false, defaultValue = "0") Integer firstStatus @RequestParam(required = false, defaultValue = "0") Integer firstStatus
) { ) {
@@ -77,6 +92,7 @@ public class TutorialController {
* *
*/ */
@GetMapping("/page") @GetMapping("/page")
@ResponseBody
public Result<IPage<Tutorial>> getPageList( public Result<IPage<Tutorial>> getPageList(
@RequestParam(defaultValue = "1") Long current, @RequestParam(defaultValue = "1") Long current,
@RequestParam(defaultValue = "10") Long size, @RequestParam(defaultValue = "10") Long size,

View File

@@ -1,4 +1,4 @@
package com.corewing.app.controller; package com.corewing.app.modules.app;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import com.corewing.app.common.Result; import com.corewing.app.common.Result;

View File

@@ -1,12 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>教程展示</title>
</head>
<body>
打包测试推送全部分支
</body>
</html>

View File

@@ -80,14 +80,14 @@
</script> </script>
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<div class="logo">🚀</div> <div class="logo">🚀</div>
<h1>CoreWing</h1> <h1>CoreWing</h1>
<p>后台管理系统</p> <p>后台管理系统</p>
<div class="loading"> <div class="loading">
<div class="spinner"></div> <div class="spinner"></div>
<span>正在跳转...</span> <span>正在跳转...</span>
</div>
</div> </div>
</div>
</body> </body>
</html> </html>

View File

@@ -488,7 +488,7 @@
const token = localStorage.getItem('token'); const token = localStorage.getItem('token');
if (token) { if (token) {
// 如果已有 token尝试跳转到主页 // 如果已有 token尝试跳转到主页
// window.location.href = '/admin/index.html'; // window.location.href = '/admin/loading.html';
} }
} }
}).mount('#app'); }).mount('#app');

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title th:text="${tutorial?.tutorialTitle}"></title>
</head>
<body>
</body>
</html>