修改分类列表 2021年11月10日16:13:31
parent
dd31a658bd
commit
1ea24fdccb
|
|
@ -263,4 +263,29 @@ public class UrlRequestController extends BaseController {
|
||||||
}
|
}
|
||||||
return this.jumpPage("admin/article/edit");
|
return this.jumpPage("admin/article/edit");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/category/index")
|
||||||
|
public ModelAndView category_index(){
|
||||||
|
return this.jumpPage("admin/category/list");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/category/add")
|
||||||
|
public ModelAndView category_add(Model model){
|
||||||
|
Category.Type[] values = Category.Type.values();
|
||||||
|
model.addAttribute("categoryTypeList",values);
|
||||||
|
return this.jumpPage("admin/category/add");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/category/edit")
|
||||||
|
public ModelAndView category_edit(Model model,String categoryId){
|
||||||
|
Category.Type[] values = Category.Type.values();
|
||||||
|
model.addAttribute("categoryTypeList",values);
|
||||||
|
Category category = null;
|
||||||
|
if (categoryId != null && !categoryId.equals("")){
|
||||||
|
category = this.categoryFeign.findById(Long.parseLong(categoryId));
|
||||||
|
}
|
||||||
|
model.addAttribute("category",category);
|
||||||
|
return this.jumpPage("admin/category/edit");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.zhangmeng.model.entity.Article;
|
||||||
import com.zhangmeng.model.entity.Category;
|
import com.zhangmeng.model.entity.Category;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -15,5 +16,5 @@ public interface CategoryFeign {
|
||||||
public List<Category> findAll();
|
public List<Category> findAll();
|
||||||
|
|
||||||
@GetMapping("/category/findById")
|
@GetMapping("/category/findById")
|
||||||
public Category findById(long categoryId);
|
public Category findById(@RequestParam("categoryId") Long categoryId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,19 @@ var article_batchRemove_url = gate_way_url + "/" + blog_url + "/article/batchRem
|
||||||
//-----------------------------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------------------------
|
||||||
//文件上传
|
//文件上传
|
||||||
var file_upload_url = gate_way_url + "/" + file_url + "/upload/file";
|
var file_upload_url = gate_way_url + "/" + file_url + "/upload/file";
|
||||||
|
//----------------------------------------------------------------------------------------------------------------
|
||||||
|
//分类列表
|
||||||
|
var category_list_url = gate_way_url + "/" + blog_url + "/category/list";
|
||||||
|
//添加分类
|
||||||
|
var category_add_url = gate_way_url + "/" + admin_manager_url + "/category/add" + access_token_url;
|
||||||
|
//修改分类
|
||||||
|
var category_edit_url = gate_way_url + "/" + admin_manager_url + "/category/edit" + access_token_url;
|
||||||
|
//分类删除
|
||||||
|
var category_delete_url = gate_way_url + "/" + blog_url + "/category/delete";
|
||||||
|
//批量删除
|
||||||
|
var category_batchRemove_url = gate_way_url + "/" + blog_url + "/category/batchRemove";
|
||||||
|
//分类保存
|
||||||
|
var category_save_url = gate_way_url + "/" + blog_url + "/category/save";
|
||||||
|
|
||||||
|
|
||||||
//页面跳转
|
//页面跳转
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>分类添加</title>
|
<title>分类添加</title>
|
||||||
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/system/component/pear/css/pear.css" />
|
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/css/pear.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form class="layui-form" action="">
|
<form class="layui-form" action="">
|
||||||
|
|
@ -53,8 +53,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<script src="${springMacroRequestContext.contextPath}/system/component/layui/layui.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/layui/layui.js"></script>
|
||||||
<script src="${springMacroRequestContext.contextPath}/system/component/pear/pear.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/pear.js"></script>
|
||||||
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/admin/js/mystyle-admin.js"></script>
|
||||||
<script>
|
<script>
|
||||||
layui.use(['form','jquery'],function(){
|
layui.use(['form','jquery'],function(){
|
||||||
let form = layui.form;
|
let form = layui.form;
|
||||||
|
|
@ -62,14 +63,11 @@
|
||||||
|
|
||||||
form.on('submit(category-save)', function(data){
|
form.on('submit(category-save)', function(data){
|
||||||
var obj = data.field;
|
var obj = data.field;
|
||||||
obj['token'] = localStorage.getItem("token");
|
obj['access_token'] = access_token;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url:'/category/save',
|
url:category_save_url,
|
||||||
data:obj,
|
data:obj,
|
||||||
type:'post',
|
type:'post',
|
||||||
beforeSend: function(xhr) {
|
|
||||||
xhr.setRequestHeader("token:"+ localStorage.getItem("token"));
|
|
||||||
},
|
|
||||||
success:function(result){
|
success:function(result){
|
||||||
if(result.flag){
|
if(result.flag){
|
||||||
layer.msg(result.message,{icon:1,time:1000},function(){
|
layer.msg(result.message,{icon:1,time:1000},function(){
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>分类编辑</title>
|
<title>分类编辑</title>
|
||||||
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/system/component/pear/css/pear.css"/>
|
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/css/pear.css"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form class="layui-form" action="">
|
<form class="layui-form" action="">
|
||||||
|
|
@ -62,8 +62,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<script src="${springMacroRequestContext.contextPath}/system/component/layui/layui.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/layui/layui.js"></script>
|
||||||
<script src="${springMacroRequestContext.contextPath}/system/component/pear/pear.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/pear.js"></script>
|
||||||
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/admin/js/mystyle-admin.js"></script>
|
||||||
<script>
|
<script>
|
||||||
layui.use(['form', 'jquery'], function () {
|
layui.use(['form', 'jquery'], function () {
|
||||||
let form = layui.form;
|
let form = layui.form;
|
||||||
|
|
@ -71,9 +72,9 @@
|
||||||
|
|
||||||
form.on('submit(category-edit)', function (data) {
|
form.on('submit(category-edit)', function (data) {
|
||||||
var obj = data.field;
|
var obj = data.field;
|
||||||
obj['token'] = localStorage.getItem("token");
|
obj['access_token'] = access_token;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/category/save',
|
url: category_save_url,
|
||||||
data: obj,
|
data: obj,
|
||||||
type: 'post',
|
type: 'post',
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>分类管理</title>
|
<title>分类管理</title>
|
||||||
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/system/component/pear/css/pear.css" />
|
<link rel="stylesheet"
|
||||||
|
href="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/css/pear.css"/>
|
||||||
</head>
|
</head>
|
||||||
<body class="pear-container">
|
<body class="pear-container">
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
|
|
@ -49,27 +50,30 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" id="category-bar">
|
<script type="text/html" id="category-bar">
|
||||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="layui-icon layui-icon-edit"></i></button>
|
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>
|
||||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i></button>
|
</button>
|
||||||
|
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i>
|
||||||
|
</button>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" id="category-enable">
|
<script type="text/html" id="category-enable">
|
||||||
<input type="checkbox" name="enable" value="{{d.id}}" lay-skin="switch" lay-text="启用|禁用" lay-filter="category-enable" checked = "{{ d.enable == 0 ? 'true' : 'false' }}">
|
<input type="checkbox" name="enable" value="{{d.id}}" lay-skin="switch" lay-text="启用|禁用"
|
||||||
|
lay-filter="category-enable" checked="{{ d.enable == 0 ? 'true' : 'false' }}">
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" id="category-addTime">
|
<script type="text/html" id="category-addTime">
|
||||||
{{layui.util.toDateString(d.addTime, 'yyyy-MM-dd HH:mm:ss')}}
|
{{layui.util.toDateString(d.addTime, 'yyyy-MM-dd HH:mm:ss')}}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="${springMacroRequestContext.contextPath}/system/component/layui/layui.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/layui/layui.js"></script>
|
||||||
<script src="${springMacroRequestContext.contextPath}/system/component/pear/pear.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/pear.js"></script>
|
||||||
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/admin/js/mystyle-admin.js"></script>
|
||||||
<script>
|
<script>
|
||||||
layui.use(['table', 'form', 'jquery', 'common'], function () {
|
layui.use(['table', 'form', 'jquery', 'common'], function () {
|
||||||
let table = layui.table;
|
let table = layui.table;
|
||||||
let form = layui.form;
|
let form = layui.form;
|
||||||
let $ = layui.jquery;
|
let $ = layui.jquery;
|
||||||
let common = layui.common;
|
let common = layui.common;
|
||||||
let token = localStorage.getItem("token");
|
|
||||||
let cols = [
|
let cols = [
|
||||||
[{
|
[{
|
||||||
type: 'checkbox'
|
type: 'checkbox'
|
||||||
|
|
@ -110,8 +114,10 @@
|
||||||
|
|
||||||
table.render({
|
table.render({
|
||||||
elem: '#category-table',
|
elem: '#category-table',
|
||||||
url: '/category/list',
|
url: category_list_url,
|
||||||
headers: {token: localStorage.getItem("token")},
|
headers: {
|
||||||
|
access_token: access_token
|
||||||
|
},
|
||||||
page: true,
|
page: true,
|
||||||
cols: cols,
|
cols: cols,
|
||||||
skin: 'line',
|
skin: 'line',
|
||||||
|
|
@ -177,7 +183,7 @@
|
||||||
title: '新增',
|
title: '新增',
|
||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: [common.isModile() ? '100%' : '900px', common.isModile() ? '100%' : '600px'],
|
area: [common.isModile() ? '100%' : '900px', common.isModile() ? '100%' : '600px'],
|
||||||
content: '/category/add?token=' + token
|
content: category_add_url
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -188,7 +194,7 @@
|
||||||
title: '修改',
|
title: '修改',
|
||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: ['900px', '600px'],
|
area: ['900px', '600px'],
|
||||||
content: '/category/edit?token=' + token + '&categoryId=' + obj.data.id
|
content: category_edit_url + '&categoryId=' + obj.data.id
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -201,10 +207,10 @@
|
||||||
layer.close(index);
|
layer.close(index);
|
||||||
let loading = layer.load();
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/category/delete",
|
url: category_delete_url,
|
||||||
data: {
|
data: {
|
||||||
categoryId: obj.data['id'],
|
categoryId: obj.data['id'],
|
||||||
token:token
|
access_token: access_token
|
||||||
},
|
},
|
||||||
type: 'post',
|
type: 'post',
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
|
|
@ -246,10 +252,10 @@
|
||||||
layer.close(index);
|
layer.close(index);
|
||||||
let loading = layer.load();
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/category/batchRemove",
|
url: category_batchRemove_url,
|
||||||
data: {
|
data: {
|
||||||
ids: checkIds,
|
ids: checkIds,
|
||||||
token:token
|
access_token: access_token
|
||||||
},
|
},
|
||||||
type: 'post',
|
type: 'post',
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
|
|
|
||||||
|
|
@ -32,5 +32,5 @@ public interface CategoryControllerApi {
|
||||||
public List<Category> findAll();
|
public List<Category> findAll();
|
||||||
|
|
||||||
@ApiOperation("根据id查询")
|
@ApiOperation("根据id查询")
|
||||||
public Category findById(@RequestParam long categoryId);
|
public Category findById(@RequestParam("categoryId") Long categoryId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,9 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void configure(HttpSecurity http) throws Exception {
|
public void configure(HttpSecurity http) throws Exception {
|
||||||
|
|
||||||
|
http.headers().frameOptions().disable();
|
||||||
|
|
||||||
// 所有请求必须认证通过
|
// 所有请求必须认证通过
|
||||||
http.authorizeRequests()
|
http.authorizeRequests()
|
||||||
// 跨域预检请求
|
// 跨域预检请求
|
||||||
|
|
|
||||||
|
|
@ -112,8 +112,8 @@ public class CategoryController extends BaseController implements CategoryContro
|
||||||
return this.categoryService.findAll();
|
return this.categoryService.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/category/findById")
|
@GetMapping("findById")
|
||||||
public Category findById(@RequestParam long categoryId){
|
public Category findById(@RequestParam("categoryId") Long categoryId){
|
||||||
return this.categoryService.findById(categoryId);
|
return this.categoryService.findById(categoryId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue