Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
micro_app
gk
Commits
58590fea
Commit
58590fea
authored
Jul 15, 2025
by
daniel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(markNoRule): 新增富文本
parent
eacff52b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
235 additions
and
11 deletions
+235
-11
CommonController.java
...va/com/dlbridge/jadp/plugins/common/CommonController.java
+12
-0
markNoRule.jsp
src/main/webapp/WEB-INF/views/cmpt/markNoRule.jsp
+223
-11
No files found.
src/main/java/com/dlbridge/jadp/plugins/common/CommonController.java
View file @
58590fea
...
@@ -2,6 +2,7 @@ package com.dlbridge.jadp.plugins.common;
...
@@ -2,6 +2,7 @@ package com.dlbridge.jadp.plugins.common;
import
cn.hutool.http.HttpUtil
;
import
com.dlbridge.jadp.plugins.cmpt.utils.AliOssUtil
;
import
com.dlbridge.jadp.plugins.cmpt.utils.AliOssUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -122,4 +123,15 @@ public class CommonController {
...
@@ -122,4 +123,15 @@ public class CommonController {
return
Result
.
fail
().
setMsg
(
"文件删除失败"
);
return
Result
.
fail
().
setMsg
(
"文件删除失败"
);
}
}
// 伪代码,需要根据您的后端框架实现
@PostMapping
(
"/download-wechat-image"
)
public
Result
<?>
downloadWechatImage
(
@RequestBody
Map
<
String
,
String
>
request
)
{
String
url
=
request
.
get
(
"url"
);
try
{
byte
[]
imageData
=
HttpUtil
.
downloadBytes
(
url
);
return
Result
.
success
().
setContent
(
imageData
);
}
catch
(
Exception
e
)
{
return
Result
.
fail
().
setMsg
(
"文件下载失败"
);
}
}
}
}
src/main/webapp/WEB-INF/views/cmpt/markNoRule.jsp
View file @
58590fea
...
@@ -46,8 +46,18 @@
...
@@ -46,8 +46,18 @@
<link
rel=
"shortcut icon"
href=
"https://img.geexek.com/files/home/favicon.ico"
>
<link
rel=
"shortcut icon"
href=
"https://img.geexek.com/files/home/favicon.ico"
>
<link
rel=
"stylesheet"
<link
rel=
"stylesheet"
href=
"${ctxStatic}/cmpt/setting.css?v=
<%=
System
.
currentTimeMillis
()
%>
"
>
href=
"${ctxStatic}/cmpt/setting.css?v=
<%=
System
.
currentTimeMillis
()
%>
"
>
<!-- Include Quill stylesheet -->
<link
href=
"https://cdn.jsdelivr.net/npm/quill@2/dist/quill.snow.css"
rel=
"stylesheet"
/>
<link
href=
"https://cdn.jsdelivr.net/npm/quill@2/dist/quill.bubble.css"
rel=
"stylesheet"
/>
<!-- Include the Quill library -->
<script
src=
"https://cdn.jsdelivr.net/npm/quill@2/dist/quill.min.js"
></script>
<script
src=
"https://cdn.jsdelivr.net/npm/quill@2/dist/quill.core.js"
></script>
<script
src=
"https://cdn.jsdelivr.net/npm/quill@2/dist/quill.js"
></script>
<script
src=
" ${ctxStatic}/newdermon/vendor/jquery/jquery.min.js"
></script>
<script
src=
"${ctxStatic}/newdermon/vendor/jquery/jquery.min.js"
></script>
<style>
<style>
#app
{
#app
{
padding
:
0
20px
20px
20px
;
padding
:
0
20px
20px
20px
;
...
@@ -92,6 +102,21 @@
...
@@ -92,6 +102,21 @@
height
:
108px
;
height
:
108px
;
background-color
:
rgba
(
0
,
128
,
0
,
0.24
);
background-color
:
rgba
(
0
,
128
,
0
,
0.24
);
}
}
/* Quill编辑器样式 */
#editor
{
height
:
200px
;
background
:
#fff
;
}
.ql-toolbar
{
border-radius
:
4px
4px
0
0
;
background
:
#f5f5f5
;
}
.ql-container
{
border-radius
:
0
0
4px
4px
;
}
</style>
</style>
</head>
</head>
...
@@ -116,15 +141,15 @@
...
@@ -116,15 +141,15 @@
<!--
搜索框
-->
<!--
搜索框
-->
<
div
class
=
"w-full flex flex-row items-start gap-x-3"
>
<
div
class
=
"w-full flex flex-row items-start gap-x-3"
>
<
div
class
=
"bg-white flex flex-col gap-y-2 p-3"
style
=
"min-width:250px;"
>
<
div
class
=
"bg-white flex flex-col gap-y-2 p-3"
style
=
"min-width:250px;
max-width:300px;
"
>
<
h4
class
=
"flex flex-row items-center justify-between w-full gap-x-2"
>
<
div
class
=
"flex flex-row items-center justify-between w-full gap-x-2"
>
规则列表
<
h4
>
规则列表
<
/h4
>
<
n
-
button
type
=
"primary"
size
=
"small"
@
click
=
"onAddMarkNoRule"
>
<
n
-
button
type
=
"primary"
size
=
"small"
@
click
=
"onAddMarkNoRule"
>
新增
新增
<
/n-button
>
<
/n-button
>
<
/
h4
>
<
/
div
>
<
div
v
-
for
=
"(item,index) in markNoRules"
:
key
=
"item.value"
class
=
"flex rounded-sm cursor-pointer flex-row items-center gap-x-1"
>
<
div
v
-
for
=
"(item,index) in markNoRules"
:
key
=
"item.value"
class
=
"flex rounded-sm cursor-pointer flex-row items-center gap-x-1"
>
<
span
class
=
"py-1 px-4 rounded-sm
animate-fade-in"
:
class
=
"[ruleIndex===index?'bg-primary text-white':'']"
class
=
"flex-1"
@
click
=
"changeMarkNoRule(index)"
>
{{
item
.
description
}}
<
span
class
=
"py-1 px-4 rounded-sm
line-clamp-1 animate-fade-in"
:
class
=
"[ruleIndex===index?'bg-primary text-white':'']"
class
=
"flex-1"
@
click
=
"changeMarkNoRule(index)"
>
{{
item
.
ruleName
||
"未设置"
}}
<
/span
>
<
/span
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
@@ -158,8 +183,14 @@
...
@@ -158,8 +183,14 @@
label
-
width
=
"auto"
label
-
width
=
"auto"
size
=
"small"
size
=
"small"
>
>
<
n
-
form
-
item
label
=
"规则名称"
path
=
"ruleName"
>
<
n
-
input
v
-
model
:
value
=
"markNoRuleValue.ruleName"
placeholder
=
"请输入规则名称"
/>
<
/n-form-item
>
<
n
-
form
-
item
label
=
"规则描述"
path
=
"description"
>
<
n
-
form
-
item
label
=
"规则描述"
path
=
"description"
>
<
n
-
input
v
-
model
:
value
=
"markNoRuleValue.description"
placeholder
=
"请输入规则描述"
/>
<!--
<
n
-
input
v
-
model
:
value
=
"markNoRuleValue.description"
placeholder
=
"请输入规则描述"
/>
-->
<
div
class
=
"flex flex-col w-full"
>
<
div
id
=
"editor"
><
/div
>
<
/div
>
<
/n-form-item
>
<
/n-form-item
>
<
n
-
form
-
item
label
=
"排除字符"
>
<
n
-
form
-
item
label
=
"排除字符"
>
<
n
-
input
v
-
model
:
value
=
"markNoRuleValue.excludedChars"
placeholder
=
"请输入全局排查的字符集"
/>
<
n
-
input
v
-
model
:
value
=
"markNoRuleValue.excludedChars"
placeholder
=
"请输入全局排查的字符集"
/>
...
@@ -364,13 +395,17 @@
...
@@ -364,13 +395,17 @@
</script>
</script>
<script>
<script>
const
{
createApp
,
defineComponent
,
reactive
,
ref
,
onMounted
,
h
}
=
Vue
;
const
{
createApp
,
defineComponent
,
onBeforeUnmount
,
reactive
,
ref
,
onMounted
,
h
}
=
Vue
;
const
{
useMessage
,
useNotification
,
dateZhCN
,
NButton
,
NTag
,
zhCN
,
NSpace
,
NImageGroup
,
NImage
,
NText
,
NInputNumber
,
NSelect
,
NInput
,
NTimePicker
}
=
naive
const
{
useMessage
,
useNotification
,
dateZhCN
,
NButton
,
NTag
,
zhCN
,
NSpace
,
NImageGroup
,
NImage
,
NText
,
NInputNumber
,
NSelect
,
NInput
,
NTimePicker
}
=
naive
const
uploadUrl
=
window
.
location
.
origin
+
'/api-common/v1/upload?folder=gk/markNoRule'
+
'&cmptId='
+
getCId
()
const
downloadWeChatImgUrl
=
window
.
location
.
origin
+
'/api-common/v1/download-wechat-image'
// 添加全局 loading 指令
// 添加全局 loading 指令
const
ECC_BASE_URL
=
"https://ecc.geexek.com"
const
ECC_BASE_URL
=
"https://ecc.geexek.com"
const
SAVE_OR_UPDATE
=
ECC_BASE_URL
+
"/api-pick/v1/save-or-update"
const
SAVE_OR_UPDATE
=
ECC_BASE_URL
+
"/api-pick/v1/save-or-update"
const
RULE_LIST
=
ECC_BASE_URL
+
"/api-pick/v1/rule-list?"
const
RULE_LIST
=
ECC_BASE_URL
+
"/api-pick/v1/rule-list?"
const
DELETE_RULE
=
ECC_BASE_URL
+
"/api-pick/v1/delete-rule?"
const
DELETE_RULE
=
ECC_BASE_URL
+
"/api-pick/v1/delete-rule?"
// 在Quill初始化代码前添加
const
ImageResize
=
window
.
ImageResize
;
const
MyApp
=
defineComponent
({
const
MyApp
=
defineComponent
({
name
:
'MyApp'
,
name
:
'MyApp'
,
template
:
'#my-app'
,
template
:
'#my-app'
,
...
@@ -378,12 +413,14 @@
...
@@ -378,12 +413,14 @@
const
message
=
useMessage
()
const
message
=
useMessage
()
const
notification
=
useNotification
()
const
notification
=
useNotification
()
const
loading
=
ref
(
false
)
const
loading
=
ref
(
false
)
const
quillEditor
=
ref
(
null
)
/***---------------- 号码簿规则 start -----------------*/
/***---------------- 号码簿规则 start -----------------*/
const
markNoRuleRef
=
ref
(
null
)
const
markNoRuleRef
=
ref
(
null
)
const
markNoRules
=
ref
([])
const
markNoRules
=
ref
([])
// 规则初始化
// 规则初始化
const
initialValue
=
{
const
initialValue
=
{
id
:
undefined
,
id
:
undefined
,
ruleName
:
''
,
totalLength
:
3
,
// 参赛号长度
totalLength
:
3
,
// 参赛号长度
gender
:
GenderEnum
.
ALL
.
value
,
// 参赛号长度
gender
:
GenderEnum
.
ALL
.
value
,
// 参赛号长度
description
:
''
,
// 描述
description
:
''
,
// 描述
...
@@ -419,11 +456,16 @@
...
@@ -419,11 +456,16 @@
const
showDeleteModal
=
ref
(
false
)
const
showDeleteModal
=
ref
(
false
)
// 号码簿规则校验
// 号码簿规则校验
const
markNoRuleRules
=
{
const
markNoRuleRules
=
{
description
:
{
ruleName
:
{
required
:
true
,
required
:
true
,
message
:
'请输入规则名称'
,
message
:
'请输入规则名称'
,
trigger
:
'blur'
trigger
:
'blur'
},
},
description
:
{
required
:
true
,
message
:
'请输入规则描述'
,
trigger
:
'blur'
},
totalLength
:
{
totalLength
:
{
required
:
true
,
required
:
true
,
message
:
'请输入选号长度'
,
message
:
'请输入选号长度'
,
...
@@ -458,6 +500,9 @@
...
@@ -458,6 +500,9 @@
markNoRules
.
value
=
res
.
data
markNoRules
.
value
=
res
.
data
if
(
res
.
data
.
length
)
{
if
(
res
.
data
.
length
)
{
changeMarkNoRule
(
ruleIndex
.
value
===
-
1
?
0
:
ruleIndex
.
value
)
changeMarkNoRule
(
ruleIndex
.
value
===
-
1
?
0
:
ruleIndex
.
value
)
if
(
quillEditor
.
value
&&
markNoRuleValue
.
value
.
description
)
{
quillEditor
.
value
.
root
.
innerHTML
=
markNoRuleValue
.
value
.
description
;
}
}
else
{
}
else
{
markNoRuleValue
.
value
=
initialValue
markNoRuleValue
.
value
=
initialValue
}
}
...
@@ -674,10 +719,177 @@
...
@@ -674,10 +719,177 @@
})
})
}
}
/***---------------- 枪次表 end-----------------*/
/***---------------- 枪次表 end-----------------*/
// 图片上传
function
uploadImage
(
file
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
// 这里替换为你的图片上传API
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
file
);
fetch
(
uploadUrl
,
{
method
:
'POST'
,
body
:
formData
})
.
then
(
response
=>
response
.
json
())
.
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
resolve
(
res
.
content
);
}
else
{
reject
(
'上传失败'
);
}
})
.
catch
(
error
=>
reject
(
error
));
});
}
// 新增:下载并上传微信公众号图片
async
function
uploadWechatImage
(
url
)
{
try
{
// 1. 下载微信公众号图片
const
response
=
await
fetch
(
downloadWeChatImgUrl
,
{
method
:
'POST'
,
headers
:
{
'Content-Type'
:
'application/json'
},
body
:
JSON
.
stringify
({
url
})
});
const
result
=
await
response
.
json
();
if
(
result
.
code
===
200
)
{
// 2. 将二进制数据转换为Blob
// const blob = new Blob([result.content], { type: 'image/jpeg' });
// // 3. 上传到自己的服务器
// const formData = new FormData();
// formData.append('file', blob, 'wechat-image.jpg');
const
base64
=
result
.
content
;
// 后端返回的 Base64 编码内容(不含 data: 开头)
const
blob
=
base64ToBlob
(
base64
,
'image/jpeg'
);
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
blob
,
'wechat-image.jpg'
);
const
uploadResponse
=
await
fetch
(
uploadUrl
,
{
method
:
'POST'
,
body
:
formData
});
const
uploadResult
=
await
uploadResponse
.
json
();
// console.log({ uploadResult, result })
return
uploadResult
.
content
;
}
else
{
throw
new
Error
(
result
.
message
);
}
}
catch
(
error
)
{
console
.
error
(
'上传微信公众号图片失败:'
,
error
);
throw
error
;
}
}
// 初始化编辑器
const
initEditor
=
()
=>
{
quillEditor
.
value
=
new
Quill
(
'#editor'
,
{
theme
:
'snow'
,
modules
:
{
toolbar
:
{
container
:
[
[{
'font'
:
[]
},
{
'size'
:
[]
}],
[
'bold'
,
'italic'
,
'underline'
,
'strike'
],
[{
'color'
:
[]
},
{
'background'
:
[]
}],
[{
'header'
:
'1'
},
{
'header'
:
'2'
},
'blockquote'
,
'code-block'
],
[{
'list'
:
'ordered'
},
{
'list'
:
'bullet'
},
{
'indent'
:
'-1'
},
{
'indent'
:
'+1'
}],
[{
'direction'
:
'rtl'
}],
[
'link'
,
'image'
,
'video'
],
[
'clean'
]
],
handlers
:
{
'image'
:
function
()
{
const
input
=
document
.
createElement
(
'input'
);
input
.
setAttribute
(
'type'
,
'file'
);
input
.
setAttribute
(
'accept'
,
'image/*'
);
input
.
click
();
input
.
onchange
=
async
()
=>
{
const
file
=
input
.
files
[
0
];
if
(
/^image
\/
/
.
test
(
file
.
type
))
{
const
range
=
this
.
quill
.
getSelection
();
try
{
const
url
=
await
uploadImage
(
file
);
this
.
quill
.
insertEmbed
(
range
.
index
,
'image'
,
url
);
}
catch
(
error
)
{
notification
.
error
(
'上传失败'
);
}
}
else
{
console
.
warn
(
'只能上传图片'
);
}
};
}
}
}
}
});
// 注册图片调整模块
quillEditor
.
value
.
clipboard
.
addMatcher
(
Node
.
ELEMENT_NODE
,
(
node
,
delta
)
=>
{
const
isWechatImage
=
node
.
tagName
===
'IMG'
&&
(
node
.
src
.
includes
(
'mmbiz.qpic.cn'
)
||
node
.
src
.
includes
(
'mmbiz.qlogo.cn'
));
if
(
isWechatImage
)
{
const
originalSrc
=
node
.
src
;
// 插入占位图
setTimeout
(
async
()
=>
{
const
newUrl
=
await
uploadWechatImage
(
originalSrc
);
replaceImageSrc
(
originalSrc
,
newUrl
);
// 后面定义这个函数替换
},
0
);
return
delta
;
}
return
delta
;
});
// .
quillEditor
.
value
.
on
(
'text-change'
,
()
=>
{
console
.
log
(
quillEditor
.
value
.
root
.
innerHTML
)
markNoRuleValue
.
value
.
description
=
quillEditor
.
value
.
root
.
innerHTML
})
}
// 替换图片
function
replaceImageSrc
(
oldSrc
,
newSrc
)
{
const
quill
=
quillEditor
.
value
;
const
imgs
=
quill
.
root
.
querySelectorAll
(
'img'
);
imgs
.
forEach
(
img
=>
{
if
(
img
.
src
===
oldSrc
)
{
img
.
setAttribute
(
'src'
,
newSrc
);
}
});
}
// base64转blob
function
base64ToBlob
(
base64
,
mime
=
'image/jpeg'
)
{
const
byteString
=
atob
(
base64
);
// 解码 Base64 → 二进制字符串
const
byteArray
=
new
Uint8Array
(
byteString
.
length
);
for
(
let
i
=
0
;
i
<
byteString
.
length
;
i
++
)
{
byteArray
[
i
]
=
byteString
.
charCodeAt
(
i
);
}
return
new
Blob
([
byteArray
],
{
type
:
mime
});
}
// 页面加载
onMounted
(()
=>
{
onMounted
(()
=>
{
initEditor
()
getMarkNoRules
()
getMarkNoRules
()
})
})
// 添加销毁逻辑
onBeforeUnmount
(()
=>
{
if
(
quillEditor
.
value
)
{
quillEditor
.
value
.
off
(
'text-change'
);
// 移除事件监听
const
editorElement
=
document
.
querySelector
(
'#editor'
);
if
(
editorElement
)
{
editorElement
.
innerHTML
=
''
;
// 清空编辑器内容
}
quillEditor
.
value
=
null
;
// 释放引用
}
});
return
{
return
{
// 枪次表相关
// 枪次表相关
waveColumns
,
waveColumns
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment