delete user upload md img

This commit is contained in:
Himit_ZH 2021-12-27 20:46:32 +08:00
parent f1485b638c
commit 3e8b5d36d3
3 changed files with 59 additions and 6 deletions

View File

@ -41,6 +41,7 @@ public class MarkDownFileController {
@RequestMapping(value = "/upload-md-img", method = RequestMethod.POST) @RequestMapping(value = "/upload-md-img", method = RequestMethod.POST)
@RequiresAuthentication @RequiresAuthentication
@ResponseBody @ResponseBody
@RequiresRoles(value = {"root", "admin", "problem_admin"}, logical = Logical.OR)
public CommonResult uploadMDImg(@RequestParam("image") MultipartFile image, HttpServletRequest request) { public CommonResult uploadMDImg(@RequestParam("image") MultipartFile image, HttpServletRequest request) {
if (image == null) { if (image == null) {
return CommonResult.errorResponse("上传的图片不能为空!"); return CommonResult.errorResponse("上传的图片不能为空!");
@ -90,6 +91,7 @@ public class MarkDownFileController {
@RequestMapping(value = "/delete-md-img", method = RequestMethod.GET) @RequestMapping(value = "/delete-md-img", method = RequestMethod.GET)
@RequiresAuthentication @RequiresAuthentication
@ResponseBody @ResponseBody
@RequiresRoles(value = {"root", "admin", "problem_admin"}, logical = Logical.OR)
public CommonResult deleteMDImg(@RequestParam("fileId") Long fileId, HttpServletRequest request) { public CommonResult deleteMDImg(@RequestParam("fileId") Long fileId, HttpServletRequest request) {
// 获取当前登录用户 // 获取当前登录用户

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!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"> <mapper namespace="top.hcode.hoj.dao.UserRecordMapper">
<select id="getACMRankList" resultType="top.hcode.hoj.pojo.vo.ACMRankVo" useCache="true"> <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( 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 (SELECT COUNT(uid) FROM judge WHERE uid=u.uuid AND cid=0) AS total
FROM user_info u WHERE u.status = 0 FROM user_info u WHERE u.status = 0
@ -10,7 +10,7 @@
</select> </select>
<select id="getRecent7ACRank" resultType="top.hcode.hoj.pojo.vo.ACMRankVo"> <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 (SELECT COUNT( DISTINCT pid ) FROM user_acproblem WHERE uid =u.uuid
and DATE(gmt_create) >= DATE_SUB(CURDATE(),INTERVAL 7 DAY)) AS ac, and DATE(gmt_create) >= DATE_SUB(CURDATE(),INTERVAL 7 DAY)) AS ac,
(SELECT COUNT(uid) FROM judge WHERE uid=u.uuid AND cid=0 (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 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) SELECT COUNT(DISTINCT pid)
FROM user_acproblem FROM user_acproblem

View File

@ -6,6 +6,7 @@
@imgDel="$imgDel" @imgDel="$imgDel"
:ishljs="true" :ishljs="true"
:autofocus="false" :autofocus="false"
:toolbars="toolbars"
v-model="currentValue" v-model="currentValue"
codeStyle="arduino-light" codeStyle="arduino-light"
> >
@ -46,11 +47,54 @@ export default {
return { return {
currentValue: this.value, currentValue: this.value,
img_file: {}, 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, // eventssave
/* 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: { methods: {
// md // md
$imgAdd(pos, $file) { $imgAdd(pos, $file) {
if (!this.isAdminRole) {
return;
}
var formdata = new FormData(); var formdata = new FormData();
formdata.append('image', $file); formdata.append('image', $file);
// //
@ -103,6 +147,9 @@ export default {
}); });
}, },
}, },
computed: {
...mapGetters(['isAdminRole']),
},
watch: { watch: {
value(val) { value(val) {
if (this.currentValue !== val) { if (this.currentValue !== val) {
@ -117,9 +164,13 @@ export default {
}); });
} }
}, },
}, isAdminRole(val) {
computed: { if (!val) {
...mapGetters(['isAdminRole']), this.toolbars.imagelink = false;
} else {
this.toolbars.imagelink = true;
}
},
}, },
}; };
</script> </script>