修复资源用mvc

This commit is contained in:
2025-05-19 11:24:10 +08:00
parent f4f4bc600b
commit a7b82e1e26
21 changed files with 1871 additions and 444 deletions
+5 -5
View File
@@ -322,7 +322,7 @@
// 初始化分类列表
that.initCategoryList = function () {
$.ajax({
url: '/admin/article/articlecate',
url: '/admin/articles/articlecate',
type: 'POST',
success: function (res) {
if (res.code === 0) {
@@ -387,7 +387,7 @@
// 加载分类信息
that.loadCategoryInfo = function (id) {
$.get('/admin/article/cateedit?id=' + id, function (res) {
$.get('/admin/articles/cateedit?id=' + id, function (res) {
if (res.code === 0) {
that.showCategoryForm(0, res.data);
}
@@ -413,7 +413,7 @@
$select.empty().append('<option value="0">顶级分类</option>');
// 获取所有分类作为父级选项
$.ajax({
url: '/admin/article/articlecate',
url: '/admin/articles/articlecate',
type: 'POST',
async: false,
success: function (res) {
@@ -472,7 +472,7 @@
// 监听表单提交
form.on('submit(saveCategory)', function (data) {
var url = data.field.id ? '/admin/article/cateedit' : '/admin/article/cateadd';
var url = data.field.id ? '/admin/articles/cateedit' : '/admin/articles/cateadd';
$.post(url, data.field, function (res) {
if (res.code === 0) {
layer.msg(res.msg, { icon: 1 });
@@ -490,7 +490,7 @@
if (!id) return;
layer.confirm('确定要删除该分类吗?', function (index) {
$.post('/admin/article/catedel', { id: id }, function (res) {
$.post('/admin/articles/catedel', { id: id }, function (res) {
if (res.code === 0) {
layer.msg(res.msg, { icon: 1 });
that.initCategoryList();
+4 -4
View File
@@ -87,7 +87,7 @@
// 初始化表格
table.render({
elem: '#articleTable',
url: '/admin/article/articlelist',
url: '/admin/articles/articlelist',
method: 'post',
cols: [[
{ field: 'id', title: 'ID', align: 'center', width: 80 },
@@ -174,18 +174,18 @@
}
function add() {
window.location.href = '/admin/article/add';
window.location.href = '/admin/articles/add';
}
function edit(id) {
window.location.href = '/admin/article/edit?id=' + id;
window.location.href = '/admin/articles/edit?id=' + id;
}
function del(id) {
layer.confirm('确定要删除该文章吗?', {
btn: ['确定', '取消']
}, function () {
$.post('/admin/article/delete', { id: id }, function (res) {
$.post('/admin/articles/delete', { id: id }, function (res) {
if (res.code == 0) {
layer.msg(res.msg, { icon: 1 });
setTimeout(function () {
+11 -5
View File
@@ -57,13 +57,13 @@
</script>
<script type="text/html" id="statusTemplate">
{{# if(d.status === 0){ }}
{{# if(d.status == '0'){ }}
<span style="color:red;">未审核</span>
{{# } else if(d.status === 1){ }}
{{# } else if(d.status == '1'){ }}
<span style="color:orange;">待审核</span>
{{# } else if(d.status === 2){ }}
{{# } else if(d.status == '2'){ }}
<span style="color:green;">已发布</span>
{{# } else if(d.status === 3){ }}
{{# } else if(d.status == '3'){ }}
<span style="color:gray;">已下架</span>
{{# } }}
</script>
@@ -157,7 +157,13 @@
function reloadTable() {
var categoryId = $('#categoryFilter').val();
var categoryName = categoryId ? $('#categoryFilter option[value="' + categoryId + '"]').text() : '';
var categoryName = '';
if (categoryId) {
var selectedOption = $('#categoryFilter option[value="' + categoryId + '"]');
if (selectedOption.length > 0) {
categoryName = selectedOption.text().trim();
}
}
var nameKeyword = $('#nameSearch').val().trim();
var uploaderKeyword = $('#uploaderSearch').val().trim();