Compare commits
9 Commits
efbe2a3def
...
dev_202510
| Author | SHA1 | Date | |
|---|---|---|---|
| e8dc76ef82 | |||
| 8aa6fc0abf | |||
| 7eda1a85eb | |||
| 6a124a5754 | |||
| 564e617802 | |||
| 3f09aa1238 | |||
| d28f358127 | |||
| 1cc52a113d | |||
| c895e7364a |
@@ -41,6 +41,7 @@ dependencies {
|
||||
runtimeOnly 'com.mysql:mysql-connector-j' // MySQL 驱动
|
||||
annotationProcessor 'org.projectlombok:lombok' // Lombok 注解处理
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test' // 测试框架
|
||||
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' // thymeleaf模版引擎
|
||||
}
|
||||
|
||||
tasks.named('test') {
|
||||
|
||||
@@ -32,7 +32,7 @@ public class SaTokenConfig implements WebMvcConfigurer {
|
||||
// 排除固件查询接口(不需要登录)
|
||||
.excludePathPatterns("/firmware/**")
|
||||
// 排除静态资源
|
||||
.excludePathPatterns("/", "/index.html", "/admin/login.html", "/*.css", "/*.js", "/*.ico", "/static/**")
|
||||
.excludePathPatterns("/", "/loading.html", "/admin/login.html", "/*.css", "/*.js", "/*.ico", "/static/**")
|
||||
// 排除后台管理静态资源
|
||||
.excludePathPatterns("/admin/**")
|
||||
// 排除 Druid 监控
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.corewing.app.controller;
|
||||
package com.corewing.app.modules.admin;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.corewing.app.common.Result;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.corewing.app.controller;
|
||||
package com.corewing.app.modules.app;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -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.metadata.IPage;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.corewing.app.controller;
|
||||
package com.corewing.app.modules.app;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -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.metadata.IPage;
|
||||
@@ -10,10 +10,9 @@ import com.corewing.app.service.TutorialCategoryService;
|
||||
import com.corewing.app.service.TutorialService;
|
||||
import com.corewing.app.util.I18nUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -21,7 +20,7 @@ import java.util.List;
|
||||
* 教程接口
|
||||
*/
|
||||
@RequestMapping("/tutorial")
|
||||
@RestController
|
||||
@Controller
|
||||
@Slf4j
|
||||
public class TutorialController {
|
||||
|
||||
@@ -33,12 +32,27 @@ public class TutorialController {
|
||||
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
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/addViewCount")
|
||||
@ResponseBody
|
||||
public Result<String> addViewCount(@RequestParam Long tutorialId) {
|
||||
Tutorial tutorial = tutorialService.getById(tutorialId);
|
||||
if(tutorial == null) {
|
||||
@@ -56,6 +70,7 @@ public class TutorialController {
|
||||
*
|
||||
*/
|
||||
@GetMapping("/category")
|
||||
@ResponseBody
|
||||
public Result<List<TutorialCategory>> category(
|
||||
@RequestParam(required = false, defaultValue = "0") Integer firstStatus
|
||||
) {
|
||||
@@ -77,6 +92,7 @@ public class TutorialController {
|
||||
*
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@ResponseBody
|
||||
public Result<IPage<Tutorial>> getPageList(
|
||||
@RequestParam(defaultValue = "1") Long current,
|
||||
@RequestParam(defaultValue = "10") Long size,
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.corewing.app.controller;
|
||||
package com.corewing.app.modules.app;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.corewing.app.common.Result;
|
||||
@@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>教程展示</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -80,14 +80,14 @@
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="logo">🚀</div>
|
||||
<h1>CoreWing</h1>
|
||||
<p>后台管理系统</p>
|
||||
<div class="loading">
|
||||
<div class="spinner"></div>
|
||||
<span>正在跳转...</span>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="logo">🚀</div>
|
||||
<h1>CoreWing</h1>
|
||||
<p>后台管理系统</p>
|
||||
<div class="loading">
|
||||
<div class="spinner"></div>
|
||||
<span>正在跳转...</span>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -488,7 +488,7 @@
|
||||
const token = localStorage.getItem('token');
|
||||
if (token) {
|
||||
// 如果已有 token,尝试跳转到主页
|
||||
// window.location.href = '/admin/index.html';
|
||||
// window.location.href = '/admin/loading.html';
|
||||
}
|
||||
}
|
||||
}).mount('#app');
|
||||
10
src/main/resources/templates/app/tutorial/viewDetail.html
Normal file
10
src/main/resources/templates/app/tutorial/viewDetail.html
Normal 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>
|
||||
Reference in New Issue
Block a user