delete user upload md img
This commit is contained in:
parent
f1485b638c
commit
3e8b5d36d3
|
@ -41,6 +41,7 @@ public class MarkDownFileController {
|
|||
@RequestMapping(value = "/upload-md-img", method = RequestMethod.POST)
|
||||
@RequiresAuthentication
|
||||
@ResponseBody
|
||||
@RequiresRoles(value = {"root", "admin", "problem_admin"}, logical = Logical.OR)
|
||||
public CommonResult uploadMDImg(@RequestParam("image") MultipartFile image, HttpServletRequest request) {
|
||||
if (image == null) {
|
||||
return CommonResult.errorResponse("上传的图片不能为空!");
|
||||
|
@ -90,6 +91,7 @@ public class MarkDownFileController {
|
|||
@RequestMapping(value = "/delete-md-img", method = RequestMethod.GET)
|
||||
@RequiresAuthentication
|
||||
@ResponseBody
|
||||
@RequiresRoles(value = {"root", "admin", "problem_admin"}, logical = Logical.OR)
|
||||
public CommonResult deleteMDImg(@RequestParam("fileId") Long fileId, HttpServletRequest request) {
|
||||
|
||||
// 获取当前登录用户
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.hoj.dao.UserRecordMapper">
|
||||
<select id="getACMRankList" resultType="top.hcode.hoj.pojo.vo.ACMRankVo" useCache="true">
|
||||
SELECT u.uuid as uid,u.nickname,u.username,u.signature,u.avatar,
|
||||
SELECT u.uuid as uid,u.nickname,u.username,left(u.signature,100) as signature,u.avatar,
|
||||
(SELECT COUNT( DISTINCT pid ) FROM user_acproblem WHERE uid = u.uuid) AS ac,
|
||||
(SELECT COUNT(uid) FROM judge WHERE uid=u.uuid AND cid=0) AS total
|
||||
FROM user_info u WHERE u.status = 0
|
||||
|
@ -10,7 +10,7 @@
|
|||
</select>
|
||||
|
||||
<select id="getRecent7ACRank" resultType="top.hcode.hoj.pojo.vo.ACMRankVo">
|
||||
SELECT u.uuid as uid,u.nickname,u.username,u.signature,u.avatar,
|
||||
SELECT u.uuid as uid,u.nickname,u.username,u.avatar,
|
||||
(SELECT COUNT( DISTINCT pid ) FROM user_acproblem WHERE uid =u.uuid
|
||||
and DATE(gmt_create) >= DATE_SUB(CURDATE(),INTERVAL 7 DAY)) AS ac,
|
||||
(SELECT COUNT(uid) FROM judge WHERE uid=u.uuid AND cid=0
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
|
||||
<select id="getOIRankList" resultType="top.hcode.hoj.pojo.vo.OIRankVo" useCache="true">
|
||||
SELECT ui.uuid AS uid, ui.nickname, ui.username, ui.signature, ui.avatar
|
||||
SELECT ui.uuid AS uid, ui.nickname, ui.username, left(ui.signature,100) as signature, ui.avatar
|
||||
, (
|
||||
SELECT COUNT(DISTINCT pid)
|
||||
FROM user_acproblem
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
@imgDel="$imgDel"
|
||||
:ishljs="true"
|
||||
:autofocus="false"
|
||||
:toolbars="toolbars"
|
||||
v-model="currentValue"
|
||||
codeStyle="arduino-light"
|
||||
>
|
||||
|
@ -46,11 +47,54 @@ export default {
|
|||
return {
|
||||
currentValue: this.value,
|
||||
img_file: {},
|
||||
toolbars: {
|
||||
bold: true, // 粗体
|
||||
italic: true, // 斜体
|
||||
header: true, // 标题
|
||||
underline: true, // 下划线
|
||||
strikethrough: true, // 中划线
|
||||
mark: true, // 标记
|
||||
superscript: true, // 上角标
|
||||
subscript: true, // 下角标
|
||||
quote: true, // 引用
|
||||
ol: true, // 有序列表
|
||||
ul: true, // 无序列表
|
||||
link: true, // 链接
|
||||
imagelink: false, // 图片链接
|
||||
code: true, // code
|
||||
table: true, // 表格
|
||||
fullscreen: true, // 全屏编辑
|
||||
readmodel: true, // 沉浸式阅读
|
||||
htmlcode: true, // 展示html源码
|
||||
help: true, // 帮助
|
||||
/* 1.3.5 */
|
||||
undo: true, // 上一步
|
||||
redo: true, // 下一步
|
||||
trash: true, // 清空
|
||||
save: true, // 保存(触发events中的save事件)
|
||||
/* 1.4.2 */
|
||||
navigation: true, // 导航目录
|
||||
/* 2.1.8 */
|
||||
alignleft: true, // 左对齐
|
||||
aligncenter: true, // 居中
|
||||
alignright: true, // 右对齐
|
||||
/* 2.2.1 */
|
||||
subfield: true, // 单双栏模式
|
||||
preview: true, // 预览
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
if (this.isAdminRole) {
|
||||
this.toolbars.imagelink = true;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 将图片上传到服务器,返回地址替换到md中
|
||||
$imgAdd(pos, $file) {
|
||||
if (!this.isAdminRole) {
|
||||
return;
|
||||
}
|
||||
var formdata = new FormData();
|
||||
formdata.append('image', $file);
|
||||
//将下面上传接口替换为你自己的服务器接口
|
||||
|
@ -103,6 +147,9 @@ export default {
|
|||
});
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['isAdminRole']),
|
||||
},
|
||||
watch: {
|
||||
value(val) {
|
||||
if (this.currentValue !== val) {
|
||||
|
@ -117,9 +164,13 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['isAdminRole']),
|
||||
isAdminRole(val) {
|
||||
if (!val) {
|
||||
this.toolbars.imagelink = false;
|
||||
} else {
|
||||
this.toolbars.imagelink = true;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue