Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-components
Project
Project
Details
Activity
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
ReactWeb5
wisdom-components
Commits
5daa86ca
Commit
5daa86ca
authored
Jun 27, 2022
by
周宏民
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 富文本组件服务修改
parent
48f48f4d
Pipeline
#53993
failed with stages
in 4 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
25 deletions
+29
-25
package.json
packages/base-components/RichText/package.json
+1
-1
index.js
packages/base-components/RichText/src/index.js
+28
-24
No files found.
packages/base-components/RichText/package.json
View file @
5daa86ca
...
...
@@ -9,7 +9,7 @@
"*.less"
],
"module"
:
"es/index.js"
,
"main"
:
"
lib
/index.js"
,
"main"
:
"
es
/index.js"
,
"files"
:
[
"lib"
,
"es"
,
...
...
packages/base-components/RichText/src/index.js
View file @
5daa86ca
import
{
Image
,
message
,
Spin
}
from
'antd'
;
import
classNames
from
'classnames'
;
import
{
forwardRef
,
useEffect
,
useImperativeHandle
,
useRef
,
useState
}
from
'react'
;
// import { request } from '@wisdom-utils/utils';
import
request
from
'umi-request'
;
import
WangEditor
from
'./wangEditor.js'
;
// import { API } from '@/api/service/workflow';
const
API
=
{};
// import { appWork, projectManageService } from '@/api';
import
FileListItem
from
'./fileListItem'
;
import
styles
from
'./index.less'
;
import
WangEditor
from
'./wangEditor.js'
;
const
baseUrl
=
''
;
const
API
=
{
POST_UPLOADERFILES
:
`
${
baseUrl
}
/PandaWorkFlow/WorkFlow/AccountManage/UploaderFiles`
,
GET_DOWNLOADFILES
:
`
${
baseUrl
}
/PandaWorkFlow/WorkFlow/AccountManage/DownloadFiles`
,
GET_GETALLPERSONNELS
:
`
${
baseUrl
}
/PandaInformatization/PandaWork/MeetingTask/GetAllPersonnels`
,
// 获取人员
GET_WORKHOURUSERLIST
:
`
${
baseUrl
}
/PandaInformatization/PandaWork/ProjectManage/GetWorkHourUserList`
,
//根据项目id获取项目参与人员
};
let
editor
=
null
;
let
range
;
const
selection
=
window
.
getSelection
();
...
...
@@ -20,7 +24,6 @@ let selectPerson = [];
const
RichText
=
forwardRef
((
props
,
ref
)
=>
{
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
zIndex
,
setZIndex
]
=
useState
(
500
);
// const [inputValue, setInputValue] = useState('');
const
[
selectIndex
,
setSelectIndex
]
=
useState
(
null
);
const
[
selectList
,
setSelectList
]
=
useState
([]);
const
[
selectSearchList
,
setSelectSearchList
]
=
useState
([]);
...
...
@@ -30,27 +33,37 @@ const RichText = forwardRef((props, ref) => {
const
richTextRef
=
useRef
();
const
selectBoxRef
=
useRef
();
const
fileInputRef
=
useRef
();
const
getData
=
async
()
=>
{
// const { data } = await projectManageService.GetWorkHourUserList({ projectId: props.projectId });
// setSelectList(data);
const
getData
=
()
=>
{
request
(
API
.
GET_WORKHOURUSERLIST
,
{
method
:
'get'
,
params
:
{
projectId
:
props
.
projectId
},
}).
then
((
res
)
=>
{
setSelectList
(
res
.
data
||
[]);
});
};
// 获取全部人员信息
const
getAllPeople
=
async
()
=>
{
// const res = await appWork.GetAllPersonnels();
// allPeople = res?.data?.data || [];
request
(
API
.
GET_GETALLPERSONNELS
,
{
method
:
'get'
,
params
:
{},
}).
then
((
res
)
=>
{
setSelectList
(
res
?.
data
?.
data
||
[]);
});
};
// 图片上传
const
uploadImg
=
(
file
)
=>
{
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
file
);
setLoading
(
true
);
request
({
url
:
API
.
POST_UPLOADERFILES
,
request
(
API
.
POST_UPLOADERFILES
,
{
method
:
'POST'
,
data
:
formData
,
})
.
then
((
res
)
=>
{
if
(
!
res
.
data
)
return
;
if
(
!
res
.
data
)
{
setLoading
(
false
);
return
;
}
const
img
=
res
.
data
.
replace
(
/
[\\
\/
=
]
/g
,
'/'
);
const
imgHtml
=
`
<img contenteditable="false" style="display: block;" width="50%" src="
${
API
.
GET_DOWNLOADFILES
}
?filePath=
${
img
}
" >
...
...
@@ -243,7 +256,6 @@ const RichText = forwardRef((props, ref) => {
getAllPeople
();
return
()
=>
{
richTextRef
.
current
&&
richTextRef
.
current
.
removeEventListener
(
'input'
,
(
e
)
=>
{});
editor
&&
editor
.
destroy
();
editor
=
null
;
};
...
...
@@ -281,11 +293,7 @@ const RichText = forwardRef((props, ref) => {
tempList
=
arr
;
setSelectSearchList
(
arr
);
},
[
selectList
,
props
.
personList
]);
// useEffect(() => {
// if (!props.projectId) {
// setSelectList(props.personList || []);
// }
// }, [props.personList]);
useEffect
(()
=>
{
setFileList
(
props
.
fileList
);
},
[
props
.
fileList
]);
...
...
@@ -322,10 +330,6 @@ const RichText = forwardRef((props, ref) => {
selection
.
collapseToEnd
();
}
};
// const onChange = val => {
// setInputValue(val.currentTarget.value);
// handleChange(val.currentTarget.value);
// };
let
timer
=
null
;
const
filterList
=
(
val
,
list
)
=>
{
if
(
!
val
)
{
...
...
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