提交 d2532294 authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 9c0ae726
......@@ -40,14 +40,14 @@
"zustand": "^4.5.5"
},
"devDependencies": {
"@types/react": "^18.3.5",
"@types/react": "^18.3.7",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react-swc": "^3.7.0",
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.35.2",
"eslint-plugin-react-hooks": "^4.6.2",
"less": "^4.2.0",
"vite": "^5.4.4",
"vite": "^5.4.6",
"vite-plugin-mkcert": "^1.17.6"
},
"optionalDependencies": {
......@@ -1422,9 +1422,9 @@
"integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q=="
},
"node_modules/@types/react": {
"version": "18.3.5",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.5.tgz",
"integrity": "sha512-WeqMfGJLGuLCqHGYRGHxnKrXcTitc6L/nBUWfWPcTarG3t9PsquqUMuVeXZeca+mglY4Vo5GZjCi0A3Or2lnxA==",
"version": "18.3.7",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.7.tgz",
"integrity": "sha512-KUnDCJF5+AiZd8owLIeVHqmW9yM4sqmDVf2JRJiBMFkGvkoZ4/WyV2lL4zVsoinmRS/W3FeEdZLEWFRofnT2FQ==",
"license": "MIT",
"dependencies": {
"@types/prop-types": "*",
......@@ -9493,9 +9493,9 @@
}
},
"node_modules/vite": {
"version": "5.4.4",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.4.4.tgz",
"integrity": "sha512-RHFCkULitycHVTtelJ6jQLd+KSAAzOgEYorV32R2q++M6COBjKJR6BxqClwp5sf0XaBDjVMuJ9wnNfyAJwjMkA==",
"version": "5.4.6",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.4.6.tgz",
"integrity": "sha512-IeL5f8OO5nylsgzd9tq4qD2QqI0k2CQLGrWD0rCN0EQJZpBK5vJAx0I+GDkMOXxQX/OfFHMuLIx6ddAxGX/k+Q==",
"dev": true,
"license": "MIT",
"dependencies": {
......
......@@ -43,14 +43,14 @@
"zustand": "^4.5.5"
},
"devDependencies": {
"@types/react": "^18.3.5",
"@types/react": "^18.3.7",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react-swc": "^3.7.0",
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.35.2",
"eslint-plugin-react-hooks": "^4.6.2",
"less": "^4.2.0",
"vite": "^5.4.4",
"vite": "^5.4.6",
"vite-plugin-mkcert": "^1.17.6"
},
"browserslist": [
......
......@@ -428,7 +428,6 @@ const WangEditorCustomer = (props, ref) => {
}, 50)
}
editorConfig.onFocus = () => {
clearTimeout(saveRef.current)
}
......@@ -646,13 +645,13 @@ const WangEditorCustomer = (props, ref) => {
</div>
<span className="time">{autosaveTime > 0 ? `上次保存发生在 ${dayjs(autosaveTime).format('YYYY-MM-DD HH:mm:ss')}` : ''}</span>
</div>
<Button type="primary" icon={<SaveOutlined />} className="view" onClick={saveContent} style={{ color: '#fff' }} disabled={disabled}>
<Button type="primary" icon={<SaveOutlined />} className="view" onClick={saveContent} style={{ color: '#fff' }} disabled={disabled || !contentId}>
保存
</Button>
<Button icon={<EyeOutlined />} className="history" onClick={previewIt}>
<Button icon={<EyeOutlined />} className="history" onClick={previewIt} disabled={!contentId}>
预览
</Button>
<Button icon={<HistoryOutlined />} className="history" onClick={historyIt} disabled={disabled}>
<Button icon={<HistoryOutlined />} className="history" onClick={historyIt} disabled={disabled || !contentId}>
历史
</Button>
</Space>
......
......@@ -229,10 +229,10 @@ const Audit = () => {
// 审核中
if (audit_status === 2) return
// 创建者或者管理员
const hasButton = userInfo.id === user_id || userInfo.type === 1
const isAdminOrCreator = userInfo.id === user_id || userInfo.type === 1
return (
<Space>
{hasButton && operationPermissionsList.includes('/books/management/getAllList') && (
{isAdminOrCreator && operationPermissionsList.includes('/books/management/getAllList') && (
<Button
onClick={() => {
navigate('/books/management/add-edit', { state: { id: id } })
......@@ -246,13 +246,13 @@ const Audit = () => {
{operationPermissionsList.includes('/books/management/getInfoById') && (
<Button
onClick={() => {
navigate('/books/management/chapter', { state: { id } })
navigate('/books/management/chapter', { state: { id, isAdminOrCreator: isAdminOrCreator } })
}}>
编辑
</Button>
)}
{hasButton && operationPermissionsList.includes('/books/management/export') && (
{isAdminOrCreator && operationPermissionsList.includes('/books/management/export') && (
<Button
onClick={() => {
setId(id)
......@@ -262,7 +262,7 @@ const Audit = () => {
</Button>
)}
{hasButton && operationPermissionsList.includes('/books/management/del') && (
{isAdminOrCreator && operationPermissionsList.includes('/books/management/del') && (
<Button
onClick={() => {
setId(id)
......@@ -272,7 +272,7 @@ const Audit = () => {
</Button>
)}
{hasButton && operationPermissionsList.includes('/books/management/release') && audit_status === 1 && (
{isAdminOrCreator && operationPermissionsList.includes('/books/management/release') && audit_status === 1 && (
<Button
onClick={() => {
setId(id)
......
......@@ -20,6 +20,7 @@ const Examine = () => {
const location = useLocation()
const id = get(location, 'state.id', '')
const isAdminOrCreator = get(location, 'state.isAdminOrCreator', false)
const { treeChapter, userInfo } = useSelector(state => state.user)
const navigate = useNavigate()
......@@ -125,7 +126,7 @@ const Examine = () => {
const getChapterVal = async () => {
setLoading(true)
const data = await getInfoByChapterId({ chapter_id: chapterId })
setDisabled(!data.selected_editor_ids.includes(userInfo.id))
setDisabled(!data.selected_editor_ids.includes(userInfo.id) && !isAdminOrCreator)
dispatch(setTreeChapter({ saveBookId: id, saveChapterId: chapterId }))
const { content, id: cId } = data
......@@ -287,13 +288,16 @@ const Examine = () => {
}
}, [gData, treeChapter])
const chapterMenuItems = [
let chapterMenuItems = [
{ key: '1', label: '展开全部' },
{ key: '2', label: '添加子节' },
{ key: '5', label: '设置编者' },
{ key: '3', label: '编辑' },
{ key: '4', label: '删除' }
]
if (!isAdminOrCreator) {
chapterMenuItems = [{ key: '1', label: '展开全部' }]
}
const handleMenuClick = async (e, node) => {
e.domEvent.stopPropagation()
......@@ -409,7 +413,7 @@ const Examine = () => {
<Row gutter={5} justify={'space-between'} style={{ alignItems: 'center' }}>
<Col>章节目录</Col>
<Col>
<Button type="text" icon={<DiffOutlined />} onClick={addChapterParent}></Button>
{isAdminOrCreator && <Button type="text" icon={<DiffOutlined />} onClick={addChapterParent}></Button>}
<Button type="text" icon={<MenuFoldOutlined />} onClick={() => setisCollapse(true)}></Button>
</Col>
</Row>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论