Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 7021942

Browse files
committed
fix(uploader): add uid to filename && avoid unneed mount
1 parent 18e3598 commit 7021942

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

containers/DocUploader/logic.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ export const getOSSFileName = filename => {
4444
const userName = store.accountInfo.nickname
4545
const userId = store.accountInfo.id
4646
const id = store.viewingData.id || 'new'
47+
const curDate = new Date()
48+
const curTime = curDate.getTime()
4749

48-
return `${community}-${thread}-${id}-${userName}-${userId}-${filename}`
50+
return `${community}-${thread}-${id}-${userName}-${userId}-${curTime}-${filename}`
4951
}
5052

5153
export const sendEvent = (state = 'start') => {

containers/Preview/index.js

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,31 @@ class PreviewContainer extends React.Component {
4343

4444
return (
4545
<React.Fragment>
46-
<ModalPreview visible={modalVisible}>
47-
<Viewer
48-
type={type}
49-
root={root}
50-
attachment={attachmentData}
51-
attUser={attUserData}
52-
/>
53-
</ModalPreview>
46+
{modalVisible && (
47+
<ModalPreview visible={modalVisible}>
48+
<Viewer
49+
type={type}
50+
root={root}
51+
attachment={attachmentData}
52+
attUser={attUserData}
53+
/>
54+
</ModalPreview>
55+
)}
5456

55-
<SliderPreview
56-
visible={slideVisible}
57-
type={type}
58-
imageUploading={imageUploading}
59-
>
60-
<Viewer
57+
{slideVisible && (
58+
<SliderPreview
59+
visible={slideVisible}
6160
type={type}
62-
root={root}
63-
attachment={attachmentData}
64-
attUser={attUserData}
65-
/>
66-
</SliderPreview>
61+
imageUploading={imageUploading}
62+
>
63+
<Viewer
64+
type={type}
65+
root={root}
66+
attachment={attachmentData}
67+
attUser={attUserData}
68+
/>
69+
</SliderPreview>
70+
)}
6771
</React.Fragment>
6872
)
6973
}

0 commit comments

Comments
 (0)