更新
This commit is contained in:
@@ -39,7 +39,11 @@ public class SensitiveWordInitializer implements CommandLineRunner{
|
||||
denySet.add(item.getWord());
|
||||
}
|
||||
});
|
||||
redisService.sAdd(SensitiveRedisContants.SENSITIVE_WORD_ALLOW, allowSet);
|
||||
redisService.sAdd(SensitiveRedisContants.SENSITIVE_WORD_DENY, denySet);
|
||||
if (!allowSet.isEmpty()) {
|
||||
redisService.sAdd(SensitiveRedisContants.SENSITIVE_WORD_ALLOW, allowSet.toArray());
|
||||
}
|
||||
if (!denySet.isEmpty()) {
|
||||
redisService.sAdd(SensitiveRedisContants.SENSITIVE_WORD_DENY, denySet.toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class CourseController {
|
||||
/**
|
||||
* 删除课程
|
||||
*/
|
||||
@DeleteMapping("/course")
|
||||
@DeleteMapping("/{courseID}")
|
||||
public ResultDomain<Boolean> deleteCourse(@PathVariable("courseID") String courseID) {
|
||||
return courseService.deleteCourse(courseID);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
{{ getActionButtonText(row.status) }}
|
||||
</el-button>
|
||||
<el-button size="small" @click="editArticle(row)">编辑</el-button>
|
||||
<el-button size="small" type="danger" @click="deleteArticle()">删除</el-button>
|
||||
<el-button size="small" type="danger" @click="deleteArticle(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -77,7 +77,7 @@ defineOptions({
|
||||
name: 'ArticleManagementView'
|
||||
});
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { ElButton, ElInput, ElTable, ElTableColumn, ElTag, ElPagination, ElMessage } from 'element-plus';
|
||||
import { ElButton, ElInput, ElTable, ElTableColumn, ElTag, ElPagination, ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { resourceApi, resourceTagApi } from '@/apis/resource'
|
||||
import type { PageParam, ResourceSearchParams, Resource, Tag } from '@/types';
|
||||
@@ -200,9 +200,30 @@ function handleEditFromView() {
|
||||
}
|
||||
}
|
||||
|
||||
function deleteArticle() {
|
||||
// TODO: 删除文章
|
||||
ElMessage.info('删除功能开发中');
|
||||
async function deleteArticle(row: Resource) {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要删除文章「${row.title}」吗?`,
|
||||
'删除确认',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}
|
||||
);
|
||||
const res = await resourceApi.deleteResource(row.resourceID!);
|
||||
if (res.success) {
|
||||
ElMessage.success('删除成功');
|
||||
loadArticles();
|
||||
} else {
|
||||
ElMessage.error(res.message || '删除失败');
|
||||
}
|
||||
} catch (error) {
|
||||
if (error !== 'cancel') {
|
||||
console.error('删除失败:', error);
|
||||
ElMessage.error('删除失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getStatusType(status: number) {
|
||||
|
||||
Reference in New Issue
Block a user