Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
a79c3360
提交
a79c3360
authored
3月 11, 2022
作者:
钟是志
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
查看代码
上级
f859edb2
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
65 行增加
和
26 行删除
+65
-26
PictureSignature.js
one_stop_public/libs/PictureSignature/PictureSignature.js
+59
-15
ShowItem.js
one_stop_public/libs/PictureSignature/ShowItem.js
+6
-1
styles.less
one_stop_public/libs/PictureSignature/styles.less
+0
-10
没有找到文件。
one_stop_public/libs/PictureSignature/PictureSignature.js
浏览文件 @
a79c3360
...
@@ -5,12 +5,43 @@ import ShowItem, { dragEventList, zipImage } from './ShowItem';
...
@@ -5,12 +5,43 @@ import ShowItem, { dragEventList, zipImage } from './ShowItem';
import
{
apiRequest
}
from
'../../utils/request'
;
import
{
apiRequest
}
from
'../../utils/request'
;
import
{
deepCopy
}
from
'@/webPublic/one_stop_public/utils/myutils'
;
import
{
deepCopy
}
from
'@/webPublic/one_stop_public/utils/myutils'
;
import
{
getModal
}
from
'@/webPublic/one_stop_public/utils/utils'
;
import
{
getModal
}
from
'@/webPublic/one_stop_public/utils/utils'
;
const
Modal
=
getModal
();
let
fakeFileInfo
=
{
const
Modal
=
getModal
();
path
:
'/u/202112/25143111x0ki.jpg'
,
// 超大的图片
const
styleList
=
{
name
:
'摇摇后摇.jpg'
,
modalParentDiv
:
{
display
:
'grid'
,
placeItems
:
'center'
,
width
:
'100%'
,
height
:
'100%'
,
},
modalDiv
:
{
display
:
'grid'
,
position
:
'relative'
,
overflow
:
'auto'
,
backgroundRepeat
:
'no-repeat'
,
backgroundPosition
:
'center'
,
backgroundSize
:
'cover'
,
},
oneSetItem
:
{
position
:
'absolute'
,
border
:
'1px solid red'
,
},
oneSetItemP
:
{
marginBottom
:
0
,
userSelect
:
'none'
,
},
draggableIcon
:{
position
:
'absolute'
,
left
:
'10'
,
top
:
'10'
,
color
:
'red'
,
zIndex
:
'10000'
,
},
readOnlyImage
:
{
width
:
'100%'
,
display
:
'grid'
,
placeItems
:
'center'
,
},
};
};
const
getContent
=
(
signConfig
=
[],
ratioX
)
=>
{
const
getContent
=
(
signConfig
=
[],
ratioX
)
=>
{
...
@@ -46,7 +77,7 @@ export default function PictureSignature({
...
@@ -46,7 +77,7 @@ export default function PictureSignature({
form
,
form
,
// fileInfo,
// fileInfo,
...
others
...
others
})
{
})
{
let
imageRef
=
useRef
();
let
imageRef
=
useRef
();
const
[
fileInfo
,
setFileInfo
]
=
useState
({
...
others
?.
fileInfo
});
const
[
fileInfo
,
setFileInfo
]
=
useState
({
...
others
?.
fileInfo
});
// const [fileInfo, setFileInfo] = useState(fakeFileInfo);
// const [fileInfo, setFileInfo] = useState(fakeFileInfo);
...
@@ -57,7 +88,8 @@ export default function PictureSignature({
...
@@ -57,7 +88,8 @@ export default function PictureSignature({
const
changeShowModal
=
()
=>
{
const
changeShowModal
=
()
=>
{
if
(
!
showModal
)
{
if
(
!
showModal
)
{
if
(
!
imageInfo
&&
!
disabled
)
{
if
(
!
imageInfo
&&
!
disabled
)
{
zipImage
(
fileInfo
.
path
,
fileInfo
.
name
,
otherProps
?.
backgroundImageWidth
).
then
(
res
=>
{
zipImage
(
fileInfo
.
path
,
fileInfo
.
name
,
otherProps
?.
backgroundImageWidth
)
.
then
(
res
=>
{
let
image
=
new
Image
();
//新建一个img标签(还没嵌入DOM节点)
let
image
=
new
Image
();
//新建一个img标签(还没嵌入DOM节点)
image
.
src
=
basicUrl
+
res
;
image
.
src
=
basicUrl
+
res
;
image
.
onload
=
()
=>
{
image
.
onload
=
()
=>
{
...
@@ -128,7 +160,8 @@ export default function PictureSignature({
...
@@ -128,7 +160,8 @@ export default function PictureSignature({
apiRequest
(
'/ImageLibApi/merge'
,
{
apiRequest
(
'/ImageLibApi/merge'
,
{
background
:
fileInfo
?.
path
,
background
:
fileInfo
?.
path
,
content
,
content
,
}).
then
(
res
=>
{
})
.
then
(
res
=>
{
if
(
form
&&
saveSignConfigValue
)
{
if
(
form
&&
saveSignConfigValue
)
{
form
.
setFieldsValue
({
form
.
setFieldsValue
({
[
saveSignConfigValue
]:
content
,
[
saveSignConfigValue
]:
content
,
...
@@ -223,11 +256,11 @@ export default function PictureSignature({
...
@@ -223,11 +256,11 @@ export default function PictureSignature({
}}
}}
{...
ModalProps
}
{...
ModalProps
}
>
>
<
div
className
=
{
styles
.
modalParentDiv
}
>
<
div
style
=
{
styleList
.
modalParentDiv
}
>
{
openEdit
&&
(
// 开启签章功能
{
openEdit
&&
(
// 开启签章功能
<
div
<
div
className
=
{
styles
.
modalDiv
}
style
=
{{
style
=
{{
...
styleList
.
modalDiv
,
backgroundImage
:
`url(
${
basicUrl
+
fileInfo
?.
path
})
`,
backgroundImage
:
`url(
${
basicUrl
+
fileInfo
?.
path
})
`,
width: showImageWidth,
width: showImageWidth,
height: imageInfo.height / (imageInfo.width / showImageWidth),
height: imageInfo.height / (imageInfo.width / showImageWidth),
...
@@ -243,14 +276,17 @@ export default function PictureSignature({
...
@@ -243,14 +276,17 @@ export default function PictureSignature({
key={g.key}
key={g.key}
data-mes={g.key}
data-mes={g.key}
draggable={false}
draggable={false}
className={styles.oneSetItem}
style={{
style={{
...styleList.oneSetItem,
top: g.y,
top: g.y,
left: g.x,
left: g.x,
}}
}}
>
>
<div className={styles.draggableIcon} data-mes={g.key} draggable={true}>
<div style={styleList.draggableIcon}
<Icon type="scissor" />
data-mes={g.key}
draggable={true}
>
<Icon type='scissor' />
</div>
</div>
<ShowItem {...g} basicUrl={basicUrl} />
<ShowItem {...g} basicUrl={basicUrl} />
</div>
</div>
...
@@ -259,12 +295,14 @@ export default function PictureSignature({
...
@@ -259,12 +295,14 @@ export default function PictureSignature({
</div>
</div>
)}
)}
{!openEdit && ( // 不开启签章功能 只是预览图片
{!openEdit && ( // 不开启签章功能 只是预览图片
<div className={styles.readOnlyImage}>
<div style={styleList.readOnlyImage}
>
<img
<img
src={basicUrl + fileInfo?.path + `
?
v
=
$
{
Math
.
random
()}
`}
src={basicUrl + fileInfo?.path + `
?
v
=
$
{
Math
.
random
()}
`}
alt={fileInfo.name}
alt={fileInfo.name}
style={{
style={{
width: `
$
{
showImageWidth
}
px
`,
width: `
$
{
showImageWidth
}
px
`,
height: 'auto',
}}
}}
/>
/>
</div>
</div>
...
@@ -277,7 +315,13 @@ export default function PictureSignature({
...
@@ -277,7 +315,13 @@ export default function PictureSignature({
}
}
export function SignArray(props) {
export function SignArray(props) {
const { value, onChange, basicUrl, json, form } = props;
const {
value,
onChange,
basicUrl,
json,
form,
} = props;
let files = value?.files || [];
let files = value?.files || [];
const onChangeFile = (newFielInfo, imageIndex) => {
const onChangeFile = (newFielInfo, imageIndex) => {
if (newFielInfo && newFielInfo.path) {
if (newFielInfo && newFielInfo.path) {
...
...
one_stop_public/libs/PictureSignature/ShowItem.js
浏览文件 @
a79c3360
import
React
from
"react"
;
import
React
from
"react"
;
import
{
queryApiActionPath
}
from
"@/webPublic/one_stop_public/utils/queryConfig"
;
import
{
queryApiActionPath
}
from
"@/webPublic/one_stop_public/utils/queryConfig"
;
import
{
apiRequest
}
from
"@/webPublic/one_stop_public/utils/request"
;
import
{
getToken
}
from
"@/webPublic/one_stop_public/utils/token"
;
import
{
getToken
}
from
"@/webPublic/one_stop_public/utils/token"
;
const
oneSetItemP
=
{
marginBottom
:
0
,
userSelect
:
'none'
,
};
const
ShowItem
=
({
basicUrl
,
type
,
x
,
y
,
...
otherInfo
})
=>
{
const
ShowItem
=
({
basicUrl
,
type
,
x
,
y
,
...
otherInfo
})
=>
{
switch
(
type
)
{
switch
(
type
)
{
case
'image'
:
case
'image'
:
...
@@ -27,6 +31,7 @@ const ShowItem = ({ basicUrl, type, x, y, ...otherInfo }) => {
...
@@ -27,6 +31,7 @@ const ShowItem = ({ basicUrl, type, x, y, ...otherInfo }) => {
key
=
{
otherInfo
.
key
}
key
=
{
otherInfo
.
key
}
style
=
{{
style
=
{{
// border: '1px solid red',
// border: '1px solid red',
...
oneSetItemP
,
cursor
:
'pointer'
,
cursor
:
'pointer'
,
fontSize
:
otherInfo
?.
fontSize
?
otherInfo
.
fontSize
+
'px'
:
undefined
,
fontSize
:
otherInfo
?.
fontSize
?
otherInfo
.
fontSize
+
'px'
:
undefined
,
fontFamily
:
otherInfo
?.
fontFamily
?
otherInfo
.
fontFamily
:
undefined
,
fontFamily
:
otherInfo
?.
fontFamily
?
otherInfo
.
fontFamily
:
undefined
,
...
...
one_stop_public/libs/PictureSignature/styles.less
浏览文件 @
a79c3360
...
@@ -10,32 +10,23 @@
...
@@ -10,32 +10,23 @@
.modalDiv{
.modalDiv{
display: grid;
display: grid;
//width: 1200px;
//grid-template-columns: 100px 1fr;
//grid-template-rows;
position: relative;
position: relative;
overflow: auto;
overflow: auto;
background-repeat: no-repeat;
background-repeat: no-repeat;
background-position: center;
background-position: center;
background-size: cover;
background-size: cover;
.rightSide{
overflow: auto;
}
}
}
.readOnlyImage{
.readOnlyImage{
width: 100%;
width: 100%;
display: grid;
display: grid;
place-items: center;
place-items: center;
//min-height: 800px;
img{
img{
//width: 1200px;
height: auto;
height: auto;
}
}
}
}
.oneSetItem{
.oneSetItem{
position: absolute;
position: absolute;
//margin-top: 20px;
border: 1px solid red;
border: 1px solid red;
p{
p{
margin-bottom: 0;
margin-bottom: 0;
...
@@ -60,7 +51,6 @@
...
@@ -60,7 +51,6 @@
position: absolute;
position: absolute;
left: 10;
left: 10;
top: 10;
top: 10;
//border: 1px solid #f2f2f2;
color: red;
color: red;
z-index: 10000;
z-index: 10000;
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论