Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
admin
Commits
61beb134
提交
61beb134
authored
2月 26, 2024
作者:
ZhangLingKun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化:论坛贴子编辑
上级
cb100fb1
流水线
#8296
已通过 于阶段
in 1 分 15 秒
变更
5
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
163 行增加
和
19 行删除
+163
-19
forumManageType.ts
src/api/interface/forumManageType.ts
+9
-0
forumManageAPI.ts
src/api/modules/forumManageAPI.ts
+5
-0
index.tsx
...categoryManage/category/components/addCgyDailog/index.tsx
+24
-18
index.tsx
...mManage/dynamicList/components/dynamicEditModal/index.tsx
+96
-0
index.tsx
src/pages/forumManage/dynamicList/index.tsx
+29
-1
没有找到文件。
src/api/interface/forumManageType.ts
浏览文件 @
61beb134
...
@@ -152,3 +152,12 @@ export type countGambitType = InterFunction<
...
@@ -152,3 +152,12 @@ export type countGambitType = InterFunction<
unDynamicAuditSum
:
number
;
unDynamicAuditSum
:
number
;
}
}
>
;
>
;
// 动态修改
export
type
updateDynamicType
=
InterFunction
<
{
id
:
number
;
description
:
string
;
mediaVO
:
{
type
:
number
;
url
:
string
}[];
},
any
>
;
src/api/modules/forumManageAPI.ts
浏览文件 @
61beb134
...
@@ -9,6 +9,7 @@ import {
...
@@ -9,6 +9,7 @@ import {
hiddenForumType
,
hiddenForumType
,
likeUserInfoType
,
likeUserInfoType
,
listGambitType
,
listGambitType
,
updateDynamicType
,
updateGambitType
,
updateGambitType
,
}
from
'~/api/interface/forumManageType'
;
}
from
'~/api/interface/forumManageType'
;
import
axios
from
'~/api/request'
;
import
axios
from
'~/api/request'
;
...
@@ -45,4 +46,8 @@ export class ForumManageAPI {
...
@@ -45,4 +46,8 @@ export class ForumManageAPI {
// 话题-统计个数
// 话题-统计个数
static
getCountGambit
:
countGambitType
=
()
=>
static
getCountGambit
:
countGambitType
=
()
=>
axios
.
get
(
'/release/backstage/forum/getDynamicAuditSum'
);
axios
.
get
(
'/release/backstage/forum/getDynamicAuditSum'
);
// 动态修改
static
updateDynamic
:
updateDynamicType
=
(
data
)
=>
axios
.
post
(
'/release/dynamic/updateDynamic'
,
data
);
}
}
src/pages/categoryManage/category/components/addCgyDailog/index.tsx
浏览文件 @
61beb134
import
React
,
{
useEffect
,
useImperativeHandle
,
useState
}
from
'react'
;
import
{
useEffect
,
useImperativeHandle
,
useState
}
from
'react'
;
import
{
Modal
,
Form
,
Input
,
Row
,
Col
,
Upload
,
message
,
Button
}
from
'antd'
;
import
{
Modal
,
Form
,
Input
,
Upload
,
message
,
Button
}
from
'antd'
;
import
{
LoadingOutlined
,
PlusOutlined
,
UploadOutlined
}
from
'@ant-design/icons'
;
import
{
UploadOutlined
}
from
'@ant-design/icons'
;
import
Cookies
from
'js-cookie'
;
import
Cookies
from
'js-cookie'
;
import
{
uploadImgURL
}
from
'~/api/request'
;
import
{
uploadImgURL
}
from
'~/api/request'
;
import
events
from
'~/events'
;
import
events
from
'~/events'
;
...
@@ -32,11 +32,12 @@ function Index(props: any) {
...
@@ -32,11 +32,12 @@ function Index(props: any) {
}));
}));
function
onFinish
()
{}
function
onFinish
()
{}
function
onFinishFailed
()
{}
function
onFinishFailed
()
{}
function
getBase64
(
img
:
any
,
callback
:
Function
)
{
// eslint-disable-next-line @typescript-eslint/ban-types
const
reader
=
new
FileReader
();
// function getBase64(img: any, callback: Function) {
reader
.
addEventListener
(
'load'
,
()
=>
callback
(
reader
.
result
));
// const reader = new FileReader();
reader
.
readAsDataURL
(
img
);
// reader.addEventListener('load', () => callback(reader.result));
}
// reader.readAsDataURL(img);
// }
function
handleChange
(
val
:
any
)
{
function
handleChange
(
val
:
any
)
{
// console.log("上传图片-->", val);
// console.log("上传图片-->", val);
if
(
!
[
'image/jpg'
,
'image/jpeg'
,
'image/png'
].
includes
(
val
.
file
.
type
))
{
if
(
!
[
'image/jpg'
,
'image/jpeg'
,
'image/png'
].
includes
(
val
.
file
.
type
))
{
...
@@ -69,13 +70,13 @@ function Index(props: any) {
...
@@ -69,13 +70,13 @@ function Index(props: any) {
setFileList
(
val
.
fileList
);
setFileList
(
val
.
fileList
);
}
}
}
}
const
beforeUpload
=
(
file
:
any
)
=>
{
//
const beforeUpload = (file: any) => {
// const isPNG = file.type === 'image/png';
// const isPNG = file.type === 'image/png';
// if (!isPNG) {
// if (!isPNG) {
// message.error(`${file.name}`);
// message.error(`${file.name}`);
// }
// }
// return isPNG || Upload.LIST_IGNORE;
// return isPNG || Upload.LIST_IGNORE;
};
//
};
// 图片删除
// 图片删除
const
deleteImg
=
()
=>
{
const
deleteImg
=
()
=>
{
setImageUrl
(
''
);
setImageUrl
(
''
);
...
@@ -127,8 +128,13 @@ function Index(props: any) {
...
@@ -127,8 +128,13 @@ function Index(props: any) {
{
imageUrl
?
(
{
imageUrl
?
(
<
div
className=
'img-wrap'
>
<
div
className=
'img-wrap'
>
<
div
className=
'img-content'
>
<
div
className=
'img-content'
>
<
img
src=
{
imageUrl
}
className=
'img'
onClick=
{
()
=>
props
.
imgClick
(
imageUrl
)
}
/>
<
img
<
img
src=
{
deletePng
}
alt=
''
className=
'delete-img'
onClick=
{
deleteImg
}
/>
src=
{
imageUrl
}
alt=
'图片'
className=
'img'
onClick=
{
()
=>
props
.
imgClick
(
imageUrl
)
}
/>
<
img
src=
{
deletePng
}
alt=
'图片'
className=
'delete-img'
onClick=
{
deleteImg
}
/>
</
div
>
</
div
>
</
div
>
</
div
>
)
:
(
)
:
(
...
@@ -138,7 +144,7 @@ function Index(props: any) {
...
@@ -138,7 +144,7 @@ function Index(props: any) {
fileList=
{
fileList
}
fileList=
{
fileList
}
action=
{
uploadImgURL
}
action=
{
uploadImgURL
}
maxCount=
{
1
}
maxCount=
{
1
}
beforeUpload=
{
beforeUpload
}
//
beforeUpload=
{
beforeUpload
}
onChange=
{
handleChange
}
onChange=
{
handleChange
}
headers=
{
headers
}
headers=
{
headers
}
accept=
'image/*'
accept=
'image/*'
...
...
src/pages/forumManage/dynamicList/components/dynamicEditModal/index.tsx
0 → 100644
浏览文件 @
61beb134
import
React
,
{
useState
}
from
'react'
;
import
{
Form
,
Input
,
message
,
Modal
,
ModalProps
}
from
'antd'
;
import
{
InterDataType
}
from
'~/api/interface'
;
import
{
forumDetailType
}
from
'~/api/interface/forumManageType'
;
import
{
Uploader
}
from
'~/components/uploader'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
ForumManageAPI
}
from
'~/api'
;
//论坛详情返回类型
type
DetailType
=
InterDataType
<
forumDetailType
>
;
// 参数类型
type
PropsType
=
ModalProps
&
{
detail
?:
DetailType
;
onCancel
:
()
=>
void
};
const
DynamicEditModal
:
React
.
FC
<
PropsType
>
=
({
open
,
onCancel
,
detail
,
onOk
})
=>
{
// 表单钩子
const
[
form
]
=
Form
.
useForm
();
// 图片文件列表
const
[
imgFileList
,
setImgFileList
]
=
useState
<
any
>
([]);
// 关闭事件
const
handleCancel
=
()
=>
{
form
.
resetFields
();
onCancel
?.();
};
//确定事件
const
handleOk
=
()
=>
{
form
.
validateFields
().
then
(
async
(
values
)
=>
{
const
res
=
await
ForumManageAPI
.
updateDynamic
({
id
:
Number
(
detail
?.
id
),
description
:
values
.
description
,
mediaVO
:
values
.
mediaVO
,
});
if
(
res
&&
res
.
code
===
'200'
)
{
message
.
success
(
'编辑成功'
);
onOk
?.(
values
);
}
});
};
// 组件挂载
React
.
useEffect
(()
=>
{
if
(
!
detail
?.
id
)
return
;
form
.
setFieldsValue
({
description
:
detail
?.
description
,
mediaVO
:
detail
?.
mediaVO
,
});
setImgFileList
(
detail
?.
mediaVO
?.
filter
((
i
)
=>
i
.
type
===
0
).
map
((
i
,
j
)
=>
({
url
:
i
.
url
,
id
:
j
})),
);
},
[
detail
]);
return
(
<
Modal
open=
{
open
}
title=
'编辑贴子'
width=
{
520
}
onCancel=
{
handleCancel
}
onOk=
{
handleOk
}
>
<
Form
name=
'basic'
labelCol=
{
{
span
:
4
}
}
wrapperCol=
{
{
span
:
16
}
}
autoComplete=
'off'
form=
{
form
}
>
<
Form
.
Item
label=
'详情'
name=
'description'
rules=
{
[{
required
:
true
,
message
:
'请输入贴子详情'
}]
}
>
<
Input
.
TextArea
placeholder=
'请输入贴子详情'
showCount
rows=
{
3
}
maxLength=
{
140
}
allowClear
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'图片'
name=
'mediaVO'
rules=
{
[{
required
:
false
,
message
:
'请上传贴子图片'
}]
}
>
<
Uploader
listType=
{
'picture-card'
}
fileUpload
fileLength=
{
1
}
fileSize=
{
10
}
fileType=
{
[
'image/png'
,
'image/jpeg'
,
'image/jpg'
,
'image/gif'
,
'image/bmp'
]
}
onChange=
{
(
e
)
=>
{
setImgFileList
(
e
);
form
.
setFieldValue
(
'mediaVO'
,
e
?.
map
((
i
)
=>
({
type
:
0
,
url
:
i
.
url
})));
}
}
defaultFileList=
{
imgFileList
}
>
<
PlusOutlined
/>
</
Uploader
>
</
Form
.
Item
>
</
Form
>
</
Modal
>
);
};
export
default
DynamicEditModal
;
src/pages/forumManage/dynamicList/index.tsx
浏览文件 @
61beb134
...
@@ -7,6 +7,7 @@ import { ForumManageAPI } from '~/api';
...
@@ -7,6 +7,7 @@ import { ForumManageAPI } from '~/api';
import
{
InterDataType
,
InterListType
,
InterReqListType
,
PaginationProps
}
from
'~/api/interface'
;
import
{
InterDataType
,
InterListType
,
InterReqListType
,
PaginationProps
}
from
'~/api/interface'
;
import
{
countGambitType
,
forumDetailType
,
forumListType
}
from
'~/api/interface/forumManageType'
;
import
{
countGambitType
,
forumDetailType
,
forumListType
}
from
'~/api/interface/forumManageType'
;
import
'./index.scss'
;
import
'./index.scss'
;
import
DynamicEditModal
from
'~/pages/forumManage/dynamicList/components/dynamicEditModal'
;
// 动态审核状态
// 动态审核状态
const
checkStatusList
=
[
const
checkStatusList
=
[
...
@@ -101,7 +102,7 @@ const DynamicList = () => {
...
@@ -101,7 +102,7 @@ const DynamicList = () => {
title
:
'操作'
,
title
:
'操作'
,
align
:
'center'
,
align
:
'center'
,
fixed
:
'right'
,
fixed
:
'right'
,
width
:
18
0
,
width
:
22
0
,
render
:
(
_text
:
string
,
record
)
=>
(
render
:
(
_text
:
string
,
record
)
=>
(
<>
<>
<
Button
<
Button
...
@@ -114,6 +115,9 @@ const DynamicList = () => {
...
@@ -114,6 +115,9 @@ const DynamicList = () => {
<
Button
type=
'link'
onClick=
{
()
=>
lookDynamicDetail
(
record
)
}
>
<
Button
type=
'link'
onClick=
{
()
=>
lookDynamicDetail
(
record
)
}
>
详情
详情
</
Button
>
</
Button
>
<
Button
type=
'link'
onClick=
{
()
=>
editDynamicDetail
(
record
)
}
>
编辑
</
Button
>
<
Button
<
Button
type=
'link'
type=
'link'
onClick=
{
()
=>
deleteForumClick
(
record
)
}
onClick=
{
()
=>
deleteForumClick
(
record
)
}
...
@@ -270,6 +274,18 @@ const DynamicList = () => {
...
@@ -270,6 +274,18 @@ const DynamicList = () => {
),
),
});
});
};
};
// 编辑弹窗是否显示
const
[
editModalShow
,
setEditModalShow
]
=
useState
<
boolean
>
(
false
);
// 编辑贴子
const
editDynamicDetail
=
(
record
:
forumType
[
0
])
=>
{
ForumManageAPI
.
getForumDetail
({
dynamicId
:
record
?.
id
}).
then
(({
code
,
result
})
=>
{
if
(
code
===
'200'
)
{
setForumDetail
(
result
);
setEditModalShow
(
true
);
// console.log('运行到此处 --->', result);
}
});
};
// 组件挂载
// 组件挂载
useEffect
(()
=>
{
useEffect
(()
=>
{
getDynamicList
();
getDynamicList
();
...
@@ -318,6 +334,18 @@ const DynamicList = () => {
...
@@ -318,6 +334,18 @@ const DynamicList = () => {
onCancel=
{
dynamicDetailModalOnCancel
}
onCancel=
{
dynamicDetailModalOnCancel
}
forumDetail=
{
forumDetail
}
forumDetail=
{
forumDetail
}
/>
/>
<
DynamicEditModal
open=
{
editModalShow
}
detail=
{
forumDetail
}
onCancel=
{
()
=>
{
setEditModalShow
(
false
);
paginationChange
(
pagination
.
pageNo
,
pagination
.
pageSize
);
}
}
onOk=
{
()
=>
{
setEditModalShow
(
false
);
paginationChange
(
pagination
.
pageNo
,
pagination
.
pageSize
);
}
}
/>
</
div
>
</
div
>
);
);
};
};
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论