Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
admin
Commits
b0c8853c
提交
b0c8853c
authored
9月 23, 2023
作者:
龚洪江
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop'
# Conflicts: # src/router/router.tsx
上级
ebb11a20
b1cb3a4c
显示空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
632 行增加
和
73 行删除
+632
-73
kustomization.yaml
kustomization/overlays/dev/kustomization.yaml
+1
-1
dataDashboardsType.ts
src/api/interface/dataDashboardsType.ts
+34
-0
forumManageType.ts
src/api/interface/forumManageType.ts
+89
-0
dataDashboardsAPI.ts
src/api/modules/dataDashboardsAPI.ts
+4
-0
forumManageAPI.ts
src/api/modules/forumManageAPI.ts
+14
-0
index.scss
src/pages/dataDashboards/components/joinInfo/index.scss
+23
-10
index.tsx
src/pages/dataDashboards/components/joinInfo/index.tsx
+38
-3
index.tsx
src/pages/dataDashboards/components/tradeInfo/index.tsx
+59
-37
index.tsx
src/pages/dataDashboards/components/userInfo/index.tsx
+12
-2
index.scss
src/pages/dataDashboards/index.scss
+2
-2
index.tsx
src/pages/forumManage/dynamicList/index.tsx
+7
-1
index.tsx
.../forumManage/topicList/components/addTopicModal/index.tsx
+136
-0
index.tsx
src/pages/forumManage/topicList/index.tsx
+176
-0
index.tsx
...resourceManage/materielManage/comp/addEditModal/index.tsx
+12
-5
router.tsx
src/router/router.tsx
+10
-12
dictionary.ts
src/utils/dictionary.ts
+15
-0
没有找到文件。
kustomization/overlays/dev/kustomization.yaml
浏览文件 @
b0c8853c
...
...
@@ -14,4 +14,4 @@ patches:
images
:
-
name
:
REGISTRY/NAMESPACE/IMAGE:TAG
newName
:
mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/admin
newTag
:
72aefa215ad35ffd5c849a04f6c037c7089e9d20
newTag
:
5ee7e014e51f387d5eaaf208b66cf1d55d47b605
src/api/interface/dataDashboardsType.ts
浏览文件 @
b0c8853c
...
...
@@ -94,3 +94,37 @@ export type userJoinReportDataType = InterFunction<
trainingInstitution
:
number
;
}
>
;
// 数据看板-订单数据
export
type
orderReportDataType
=
InterFunction
<
any
,
{
/**
* 商品租赁交易总额
*/
leaseGMV
:
number
;
/**
* 商品租赁订单总数
*/
leaseOrderCount
:
number
;
/**
* 商城售卖交易总额
*/
saleGMV
:
number
;
/**
* 商城售卖订单总数
*/
saleOrderCount
:
number
;
/**
* 服务订单交易总额
*/
serviceGMV
:
number
;
/**
* 服务订单订单总数
*/
serviceOrderCount
:
number
;
/**
* 交易总额
*/
totalGMV
:
number
;
}
>
;
src/api/interface/forumManageType.ts
浏览文件 @
b0c8853c
...
...
@@ -8,6 +8,7 @@ export type forumListType = InterListFunction<
description
:
string
;
mediaVO
:
null
;
show
:
number
;
gambitName
:
string
[];
userBaseInfo
:
{
nickName
:
string
;
userImg
:
string
;
...
...
@@ -53,3 +54,91 @@ export type checkDynamicType = InterFunction<
{
dynamicId
:
number
;
status
:
boolean
},
NonNullable
<
unknown
>
>
;
// 话题-列表
export
type
listGambitType
=
InterListFunction
<
{
/**
* 话题名称
*/
gambitName
?:
string
;
/**
* 话题属性 1普通 2热门 3推荐
*/
gambitProperty
?:
number
;
},
{
/**
* 话题参与讨论数量
*/
discussionCount
?:
number
;
/**
* 话题封面
*/
gambitCover
?:
string
;
/**
* 话题图标
*/
gambitIcon
?:
string
;
/**
* 话题名称
*/
gambitName
?:
string
;
/**
* 话题属性
*/
gambitProperty
?:
number
;
id
:
number
;
/**
* 贴子数
*/
postCount
?:
number
;
}
>
;
// 话题-新增
export
type
addGambitType
=
InterFunction
<
{
/**
* 话题封面
*/
gambitCover
:
string
;
/**
* 话题图标
*/
gambitIcon
:
string
;
/**
* 话题名称
*/
gambitName
:
string
;
/**
* 话题属性 话题属性 1普通 2热门 3推荐
*/
gambitProperty
:
number
;
},
any
>
;
// 话题-删除
export
type
deleteGambitType
=
InterFunction
<
{
id
:
number
},
any
>
;
// 话题-编辑
export
type
updateGambitType
=
InterFunction
<
{
/**
* 话题封面
*/
gambitCover
:
string
;
/**
* 话题图标
*/
gambitIcon
:
string
;
/**
* 话题名称
*/
gambitName
:
string
;
/**
* 话题属性 话题属性 1普通 2热门 3推荐
*/
gambitProperty
:
number
;
id
?:
number
;
},
any
>
;
src/api/modules/dataDashboardsAPI.ts
浏览文件 @
b0c8853c
import
{
orderReportDataType
,
releaseReportDataType
,
userJoinReportDataType
,
userReportDataType
,
...
...
@@ -15,4 +16,7 @@ export class DataDashboardsAPI {
// 数据看板-加盟信息
static
getUserJoinReportData
:
userJoinReportDataType
=
()
=>
axios
.
get
(
'/pms/product/report/getProductReportData'
);
// 数据看板-订单信息
static
getOrderReportData
:
orderReportDataType
=
()
=>
axios
.
get
(
'/oms/product/report/getOrderReportData'
);
}
src/api/modules/forumManageAPI.ts
浏览文件 @
b0c8853c
import
{
addGambitType
,
checkDynamicType
,
deleteForumType
,
deleteGambitType
,
forumDetailType
,
forumListType
,
hiddenForumType
,
likeUserInfoType
,
listGambitType
,
updateGambitType
,
}
from
'~/api/interface/forumManageType'
;
import
axios
from
'~/api/request'
;
...
...
@@ -27,4 +31,14 @@ export class ForumManageAPI {
// 动态审核
static
checkDynamic
:
checkDynamicType
=
(
params
)
=>
axios
.
get
(
'/release/backstage/forum/checkDynamic'
,
{
params
});
// 话题-列表
static
getTopicList
:
listGambitType
=
(
data
)
=>
axios
.
post
(
'/release/gambit/listGambit'
,
data
);
// 话题-新增
static
addGambit
:
addGambitType
=
(
data
)
=>
axios
.
post
(
'/release/gambit/insertGambit'
,
data
);
// 话题-删除
static
deleteGambit
:
deleteGambitType
=
(
params
)
=>
axios
.
get
(
'/release/gambit/deleteGambit'
,
{
params
});
// 话题-编辑
static
updateGambit
:
updateGambitType
=
(
data
)
=>
axios
.
post
(
'/release/gambit/updateGambit'
,
data
);
}
src/pages/dataDashboards/components/joinInfo/index.scss
浏览文件 @
b0c8853c
...
...
@@ -53,16 +53,15 @@ $design_height:856;
}
&
-card-3
{
height
:
toVh
(
346
,
1080
);
display
:
flex
;
.card-info-left
{
flex
:
1
;
.card-header
{
.sku-count
{
font-size
:
2
.33rem
;
font-weight
:
bold
;
color
:
#010101
;
line-height
:
3
.33rem
;
}
padding-right
:
0
!
important
;
}
.card-progress
{
padding
:
0
53px
0
39px
;
padding-left
:
39px
;
margin-bottom
:
19px
;
.progress-item
{
display
:
flex
;
...
...
@@ -74,13 +73,27 @@ $design_height:856;
}
&
-info
{
flex
:
1
;
margin
:
0
36px
0
24px
;
margin
:
0
10px
0
24px
;
}
}
&
-value
{
}
}
.card-info-right
{
padding
:
20px
40px
0
0
;
.sku-count
{
font-size
:
2
.33rem
;
font-weight
:
bold
;
color
:
#010101
;
line-height
:
3
.33rem
;
margin-bottom
:
26px
;
}
.progress-item-value
{
font-size
:
1
.67rem
;
font-weight
:
bold
;
color
:
#000000
;
}
line-height
:
24px
;
text-align
:
center
;
}
}
}
...
...
src/pages/dataDashboards/components/joinInfo/index.tsx
浏览文件 @
b0c8853c
...
...
@@ -7,6 +7,8 @@ import { InterDataType } from '~/api/interface';
import
{
userJoinReportDataType
}
from
'~/api/interface/dataDashboardsType'
;
// 数据看板-加盟返回类型
type
joinReportDataType
=
InterDataType
<
userJoinReportDataType
>
;
let
timer
:
any
;
const
JoinInfo
=
()
=>
{
const
[
joinReportDataType
,
setJoinReportDataType
]
=
useState
<
joinReportDataType
>
();
const
[
listingProducts
,
setListingProducts
]
=
useState
<
{
label
:
string
;
value
:
number
}[]
>
([]);
...
...
@@ -59,7 +61,7 @@ const JoinInfo = () => {
series
:
[
{
type
:
'pie'
,
radius
:
[
'40%'
,
'
7
0%'
],
radius
:
[
'40%'
,
'
6
0%'
],
avoidLabelOverlap
:
false
,
itemStyle
:
{
normal
:
{
...
...
@@ -69,6 +71,21 @@ const JoinInfo = () => {
},
},
},
label
:
{
formatter
:
'{value|{c}}
\
n{name|{b}}'
,
rich
:
{
name
:
{
fontSize
:
'0.8rem'
,
color
:
'#999'
,
},
value
:
{
fontSize
:
'1.2rem'
,
color
:
'#000'
,
fontWeight
:
'bold'
,
align
:
'center'
,
},
},
},
data
,
},
],
...
...
@@ -78,8 +95,16 @@ const JoinInfo = () => {
});
};
// 定时刷新数据
const
refreshData
=
()
=>
{
if
(
timer
)
clearInterval
(
timer
);
timer
=
setInterval
(()
=>
{
getUserJoinReportData
();
},
600000
);
};
useEffect
(()
=>
{
getUserJoinReportData
();
refreshData
();
},
[]);
return
(
<
div
className=
'join-info'
>
...
...
@@ -95,10 +120,11 @@ const JoinInfo = () => {
<
div
className=
'card-echarts'
id=
'pie'
></
div
>
</
div
>
<
div
className=
'join-info-card-3'
>
<
div
className=
'card-info-left'
>
<
div
className=
'card-header'
>
<
div
className=
'card-header-icon'
></
div
>
<
div
className=
'card-header-title'
>
上架商品 (SKU)
</
div
>
<
div
className=
'sku-count'
>
{
totalCount
}
</
div
>
{
/*<div className='sku-count'>{totalCount}</div>*/
}
</
div
>
<
div
className=
'card-progress'
>
{
listingProducts
.
map
((
v
,
i
)
=>
(
...
...
@@ -111,7 +137,16 @@ const JoinInfo = () => {
showInfo=
{
false
}
/>
</
div
>
<
div
className=
'progress-item-value'
>
{
v
.
value
}
</
div
>
{
/*<div className='progress-item-value'>{v.value}</div>*/
}
</
div
>
))
}
</
div
>
</
div
>
<
div
className=
'card-info-right'
>
<
div
className=
'sku-count'
>
{
totalCount
}
</
div
>
{
listingProducts
.
map
((
v
,
i
)
=>
(
<
div
className=
'progress-item-value'
key=
{
i
}
>
{
v
.
value
}
</
div
>
))
}
</
div
>
...
...
src/pages/dataDashboards/components/tradeInfo/index.tsx
浏览文件 @
b0c8853c
import
'./index.scss'
;
import
*
as
echarts
from
'echarts'
;
import
{
useEffect
}
from
'react'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
{
DataDashboardsAPI
}
from
'~/api'
;
import
{
InterDataType
}
from
'~/api/interface'
;
import
{
orderReportDataType
}
from
'~/api/interface/dataDashboardsType'
;
import
dayjs
from
'dayjs'
;
// 数据看板-订单数据返回类型
type
orderDataType
=
InterDataType
<
orderReportDataType
>
;
let
timer
:
any
;
const
TradeInfo
=
()
=>
{
const
[
orderData
,
setOrderData
]
=
useState
<
orderDataType
>
();
// 表格数据
const
[
tableData
,
setTableData
]
=
useState
<
{
label
:
string
;
orderCount
:
number
;
GMV
:
number
}[]
>
(
[],
);
// 初始化柱状图
const
initEchartsBar
=
()
=>
{
const
initEchartsBar
=
(
totalPriceCount
:
number
[]
)
=>
{
const
myChart
=
echarts
.
init
(
document
.
getElementById
(
'histogram'
));
myChart
.
setOption
({
legend
:
{
...
...
@@ -12,10 +25,6 @@ const TradeInfo = () => {
top
:
0
,
data
:
[
{
name
:
'总订单数'
,
icon
:
'pin'
,
},
{
name
:
'总交易额'
,
icon
:
'pin'
,
},
...
...
@@ -31,22 +40,9 @@ const TradeInfo = () => {
yAxis
:
{},
series
:
[
{
name
:
'总订单数'
,
type
:
'bar'
,
data
:
[
50
,
20
,
36
],
barWidth
:
'13'
,
itemStyle
:
{
barBorderRadius
:
[
7
,
7
,
0
,
0
],
color
:
new
echarts
.
graphic
.
LinearGradient
(
0
,
0
,
0
,
1
,
[
{
offset
:
0
,
color
:
'#0B7CFE'
},
{
offset
:
1
,
color
:
'#FFFFFF'
},
]),
},
},
{
name
:
'总交易额'
,
type
:
'bar'
,
data
:
[
50
,
20
,
36
]
,
data
:
totalPriceCount
,
barWidth
:
'13'
,
itemStyle
:
{
barBorderRadius
:
[
7
,
7
,
0
,
0
],
...
...
@@ -62,17 +58,51 @@ const TradeInfo = () => {
myChart
.
resize
();
});
};
// 数据看板-订单数据
const
getOrderReportData
=
()
=>
{
DataDashboardsAPI
.
getOrderReportData
().
then
(({
result
})
=>
{
if
(
result
)
{
setOrderData
(
result
);
initEchartsBar
([
result
.
saleGMV
,
result
.
leaseGMV
,
result
.
serviceGMV
]);
setTableData
([
{
label
:
'商城售卖'
,
orderCount
:
result
.
saleOrderCount
,
GMV
:
result
.
saleGMV
,
},
{
label
:
'商品租赁'
,
orderCount
:
result
.
leaseOrderCount
,
GMV
:
result
.
leaseGMV
,
},
{
label
:
'服务订单'
,
orderCount
:
result
.
serviceOrderCount
,
GMV
:
result
.
serviceGMV
,
},
]);
}
});
};
// 定时刷新数据
const
refreshData
=
()
=>
{
if
(
timer
)
clearInterval
(
timer
);
timer
=
setInterval
(()
=>
{
getOrderReportData
();
},
600000
);
};
useEffect
(()
=>
{
initEchartsBar
();
getOrderReportData
();
refreshData
();
},
[]);
return
(
<
div
className=
'trade-info'
>
<
div
className=
'trade-info-card-1'
>
<
div
className=
'total-price'
>
12987.00
</
div
>
<
div
className=
'total-price'
>
{
orderData
?.
totalGMV
.
toLocaleString
()
}
</
div
>
<
div
className=
'total-price-meta'
>
实时交易总额 (GMV)
</
div
>
<
div
className=
'time'
>
09.05
更新
</
div
>
<
div
className=
'time'
>
{
dayjs
().
format
(
'MM-DD'
)
}
更新
</
div
>
</
div
>
<
div
className=
'trade-info-card-2'
>
<
div
className=
'card-header'
>
...
...
@@ -86,21 +116,13 @@ const TradeInfo = () => {
<
div
className=
'header-td'
>
订单总数(个)
</
div
>
<
div
className=
'header-td'
>
交易总额(元)
</
div
>
</
div
>
<
div
className=
'card-table-tr'
>
<
div
className=
'td'
>
商城售卖
</
div
>
<
div
className=
'td'
>
123
</
div
>
<
div
className=
'td'
>
¥187.00
</
div
>
</
div
>
<
div
className=
'card-table-tr'
>
<
div
className=
'td'
>
商品租赁
</
div
>
<
div
className=
'td'
>
123
</
div
>
<
div
className=
'td'
>
¥187.00
</
div
>
</
div
>
{
' '
}
<
div
className=
'card-table-tr'
>
<
div
className=
'td'
>
服务订单
</
div
>
<
div
className=
'td'
>
123
</
div
>
<
div
className=
'td'
>
¥187.00
</
div
>
{
tableData
.
map
((
v
,
index
)
=>
(
<
div
className=
'card-table-tr'
key=
{
index
}
>
<
div
className=
'td'
>
{
v
.
label
}
</
div
>
<
div
className=
'td'
>
{
v
.
orderCount
}
</
div
>
<
div
className=
'td'
>
¥
{
v
.
GMV
.
toLocaleString
()
}
</
div
>
</
div
>
))
}
</
div
>
</
div
>
</
div
>
...
...
src/pages/dataDashboards/components/userInfo/index.tsx
浏览文件 @
b0c8853c
...
...
@@ -9,6 +9,7 @@ type userInfoDataType = InterDataType<userReportDataType>;
// 数据报表-信息发布返回类型
type
releaseReportData
=
InterDataType
<
releaseReportDataType
>
;
let
timer
:
any
;
const
UserInfo
=
()
=>
{
const
[
userReportData
,
setUserReportData
]
=
useState
<
userInfoDataType
>
();
const
[
releaseReportData
,
setReleaseReportData
]
=
useState
<
releaseReportData
>
();
...
...
@@ -28,10 +29,19 @@ const UserInfo = () => {
}
});
};
// 定时刷新数据
const
refreshData
=
()
=>
{
if
(
timer
)
clearInterval
(
timer
);
timer
=
setInterval
(()
=>
{
getUserReportData
();
getReleaseReportData
();
},
600000
);
};
useEffect
(()
=>
{
getUserReportData
();
getReleaseReportData
();
refreshData
();
},
[]);
return
(
<
div
className=
'user-info'
>
...
...
@@ -56,11 +66,11 @@ const UserInfo = () => {
</
div
>
<
div
className=
'card-info-2'
>
<
div
className=
'user-auth'
>
<
div
className=
'value'
>
{
userReportData
?.
dronePilot
Count
}
</
div
>
<
div
className=
'value'
>
{
userReportData
?.
realName
Count
}
</
div
>
<
div
className=
'label'
>
实名认证
</
div
>
</
div
>
<
div
className=
'flyer-auth'
>
<
div
className=
'value'
>
{
userReportData
?.
realName
Count
}
</
div
>
<
div
className=
'value'
>
{
userReportData
?.
dronePilot
Count
}
</
div
>
<
div
className=
'label'
>
飞手认证
</
div
>
</
div
>
</
div
>
...
...
src/pages/dataDashboards/index.scss
浏览文件 @
b0c8853c
...
...
@@ -20,8 +20,8 @@
border-radius
:
5px
;
border
:
1px
solid
#4E4E4E
;
position
:
absolute
;
top
:
36
px
;
lef
t
:
25px
;
top
:
20
px
;
righ
t
:
25px
;
font-size
:
12px
;
font-weight
:
bold
;
color
:
#FFFFFF
;
...
...
src/pages/forumManage/dynamicList/index.tsx
浏览文件 @
b0c8853c
import
SearchBox
,
{
searchColumns
}
from
'~/components/search-box'
;
import
{
Button
,
message
,
Modal
,
Table
,
Tooltip
}
from
'antd'
;
import
{
Button
,
message
,
Modal
,
Table
,
T
ag
,
T
ooltip
}
from
'antd'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
DynamicDetailModal
from
'./components/dynamicDetailModal'
;
...
...
@@ -44,6 +44,12 @@ const DynamicList = () => {
),
},
{
title
:
'话题'
,
align
:
'center'
,
dataIndex
:
'gambitName'
,
render
:
(
text
:
string
[])
=>
text
?.
map
((
v
,
index
)
=>
<
Tag
key=
{
index
}
>
{
v
}
</
Tag
>),
},
{
title
:
'作者(用户名称)'
,
align
:
'center'
,
render
:
(
_text
:
string
,
record
)
=>
(
...
...
src/pages/forumManage/topicList/components/addTopicModal/index.tsx
0 → 100644
浏览文件 @
b0c8853c
import
{
Form
,
Input
,
message
,
Modal
,
ModalProps
,
Select
}
from
'antd'
;
import
{
FC
,
useEffect
,
useState
}
from
'react'
;
import
{
Uploader
}
from
'~/components/uploader'
;
import
{
UploadOutlined
}
from
'@ant-design/icons'
;
import
{
InterListType
,
InterReqType
}
from
'~/api/interface'
;
import
{
addGambitType
,
listGambitType
}
from
'~/api/interface/forumManageType'
;
import
{
gambitPropertyList
}
from
'~/utils/dictionary'
;
import
{
ForumManageAPI
}
from
'~/api'
;
// 新增话题参数类型
type
addTopicParams
=
Exclude
<
InterReqType
<
addGambitType
>
,
undefined
>
;
// 话题列表返回类型
type
topicListType
=
InterListType
<
listGambitType
>
;
interface
selfProps
{
onOk
:
()
=>
void
;
onCancel
:
()
=>
void
;
currentTopicItem
:
topicListType
[
0
]
|
undefined
;
}
const
AddTopicModal
:
FC
<
ModalProps
&
selfProps
>
=
({
open
,
onCancel
,
onOk
,
currentTopicItem
})
=>
{
const
[
form
]
=
Form
.
useForm
<
addTopicParams
>
();
const
[
gambitIconFileList
,
setGambitIconFileList
]
=
useState
<
any
>
([]);
const
[
gambitCoverFileList
,
setGambitCoverFileList
]
=
useState
<
any
>
([]);
const
handleOk
=
()
=>
{
form
.
validateFields
().
then
((
values
)
=>
{
ForumManageAPI
[
currentTopicItem
?
'updateGambit'
:
'addGambit'
]({
...
values
,
gambitName
:
values
.
gambitName
,
id
:
currentTopicItem
?
currentTopicItem
.
id
:
undefined
,
}).
then
(({
code
})
=>
{
if
(
code
===
'200'
)
{
message
.
success
(
currentTopicItem
?
'编辑成功'
:
'新增成功'
);
form
.
resetFields
();
setGambitIconFileList
([]);
setGambitCoverFileList
([]);
onOk
();
}
});
});
};
const
handleCancel
=
()
=>
{
form
.
resetFields
();
setGambitIconFileList
([]);
setGambitCoverFileList
([]);
onCancel
();
};
// 图标上传成功
const
gambitIconUploadSuccess
=
(
value
:
any
)
=>
{
setGambitIconFileList
(
value
);
form
.
setFieldValue
(
'gambitIcon'
,
value
.
length
?
value
[
0
].
url
:
undefined
);
};
// 封面上传成功
const
gambitCoverUploadSuccess
=
(
value
:
any
)
=>
{
setGambitCoverFileList
(
value
);
form
.
setFieldValue
(
'gambitCover'
,
value
.
length
?
value
[
0
].
url
:
undefined
);
};
useEffect
(()
=>
{
if
(
currentTopicItem
)
{
form
.
setFieldsValue
({
gambitCover
:
currentTopicItem
.
gambitCover
||
undefined
,
gambitIcon
:
currentTopicItem
.
gambitIcon
||
undefined
,
gambitName
:
currentTopicItem
.
gambitName
,
gambitProperty
:
currentTopicItem
.
gambitProperty
,
});
setGambitIconFileList
(
currentTopicItem
.
gambitIcon
?
[
{
id
:
Math
.
random
(),
uid
:
Math
.
random
(),
name
:
'icon'
,
url
:
currentTopicItem
.
gambitIcon
,
},
]
:
[],
);
setGambitCoverFileList
(
currentTopicItem
.
gambitCover
?
[
{
id
:
Math
.
random
(),
uid
:
Math
.
random
(),
name
:
'icon'
,
url
:
currentTopicItem
.
gambitCover
,
},
]
:
[],
);
}
},
[
currentTopicItem
]);
return
(
<
Modal
title=
'新增话题'
open=
{
open
}
onOk=
{
handleOk
}
onCancel=
{
handleCancel
}
>
<
Form
labelCol=
{
{
span
:
4
}
}
wrapperCol=
{
{
span
:
15
}
}
form=
{
form
}
>
<
Form
.
Item
label=
'名称'
name=
'gambitName'
rules=
{
[{
required
:
true
,
message
:
'请输入名称'
}]
}
>
<
Input
placeholder=
'请输入名称'
maxLength=
{
30
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'图标'
name=
'gambitIcon'
>
<
Uploader
fileUpload
listType=
'picture-card'
fileLength=
{
1
}
onChange=
{
gambitIconUploadSuccess
}
defaultFileList=
{
gambitIconFileList
}
>
<
UploadOutlined
/>
</
Uploader
>
</
Form
.
Item
>
<
Form
.
Item
label=
'封面'
name=
'gambitCover'
>
<
Uploader
fileUpload
listType=
'picture-card'
fileLength=
{
1
}
onChange=
{
gambitCoverUploadSuccess
}
defaultFileList=
{
gambitCoverFileList
}
>
<
UploadOutlined
/>
</
Uploader
>
</
Form
.
Item
>
<
Form
.
Item
label=
'属性'
name=
'gambitProperty'
rules=
{
[{
required
:
true
,
message
:
'请选择属性'
}]
}
>
<
Select
placeholder=
'请选择属性'
options=
{
gambitPropertyList
}
></
Select
>
</
Form
.
Item
>
</
Form
>
</
Modal
>
);
};
export
default
AddTopicModal
;
src/pages/forumManage/topicList/index.tsx
0 → 100644
浏览文件 @
b0c8853c
import
{
Button
,
Table
,
Image
,
Tag
,
Modal
,
message
}
from
'antd'
;
import
SearchBox
from
'~/components/search-box'
;
import
AddTopicModal
from
'./components/addTopicModal'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
{
ForumManageAPI
}
from
'~/api'
;
import
{
InterListType
,
InterReqListType
,
PaginationProps
}
from
'~/api/interface'
;
import
{
listGambitType
}
from
'~/api/interface/forumManageType'
;
import
{
ColumnsType
}
from
'antd/es/table/InternalTable'
;
import
{
gambitPropertyList
}
from
'~/utils/dictionary'
;
// 话题列表返回类型
type
topicListType
=
InterListType
<
listGambitType
>
;
// 话题列表参数类型
type
topicParameters
=
InterReqListType
<
listGambitType
>
;
const
TopicList
=
()
=>
{
const
tableColumns
:
ColumnsType
<
topicListType
[
0
]
>
=
[
{
title
:
'名称'
,
align
:
'center'
,
dataIndex
:
'gambitName'
,
},
{
title
:
'属性'
,
align
:
'center'
,
dataIndex
:
'gambitProperty'
,
render
:
(
text
:
number
)
=>
(
<
Tag
>
{
gambitPropertyList
.
find
((
v
)
=>
v
.
value
===
text
)?.
label
}
</
Tag
>
),
},
{
title
:
'图标'
,
align
:
'center'
,
dataIndex
:
'gambitIcon'
,
render
:
(
text
:
string
)
=>
<
Image
src=
{
text
}
width=
{
50
}
height=
{
50
}
/>,
},
{
title
:
'封面'
,
align
:
'center'
,
dataIndex
:
'gambitCover'
,
render
:
(
text
:
string
)
=>
<
Image
src=
{
text
}
width=
{
50
}
height=
{
50
}
/>,
},
{
title
:
'操作'
,
align
:
'center'
,
width
:
'20%'
,
render
:
(
_text
:
any
,
record
)
=>
(
<>
<
Button
type=
'link'
onClick=
{
()
=>
addTopicModalShowClick
(
record
)
}
>
编辑
</
Button
>
<
Button
type=
'link'
onClick=
{
()
=>
deleteTopic
(
record
)
}
>
删除
</
Button
>
</>
),
},
];
const
[
addTopicModalShow
,
setAddTopicModalShow
]
=
useState
<
boolean
>
(
false
);
const
[
pagination
,
setPagination
]
=
useState
<
PaginationProps
&
{
totalCount
:
number
}
>
({
pageNo
:
1
,
pageSize
:
10
,
totalCount
:
0
,
});
const
[
query
,
setQuery
]
=
useState
<
topicParameters
>
();
const
[
tableData
,
setTableData
]
=
useState
<
topicListType
>
([]);
const
[
currentTopicItem
,
setCurrentTopicItem
]
=
useState
<
topicListType
[
0
]
>
();
// 筛选
const
searchSuccess
=
(
value
:
topicParameters
)
=>
{
pagination
.
pageSize
=
10
;
pagination
.
pageNo
=
1
;
setQuery
(
value
);
getTopicList
(
value
);
};
// 获取话题列表
const
getTopicList
=
(
query
?:
topicParameters
)
=>
{
ForumManageAPI
.
getTopicList
({
pageNo
:
pagination
.
pageNo
,
pageSize
:
pagination
.
pageSize
,
...
query
,
}).
then
(({
result
})
=>
{
setTableData
(
result
.
list
||
[]);
pagination
.
totalCount
=
result
.
totalCount
;
setPagination
({
...
pagination
});
});
};
// 分页
const
paginationChange
=
(
pageNo
:
number
,
pageSize
:
number
)
=>
{
pagination
.
pageNo
=
pageNo
;
pagination
.
pageSize
=
pageSize
;
getTopicList
(
query
);
};
// 新建话题弹窗
const
addTopicModalShowClick
=
(
record
?:
topicListType
[
0
])
=>
{
setCurrentTopicItem
(
record
?
{
...
record
}
:
undefined
);
setAddTopicModalShow
(
true
);
};
const
addTopicModalCancel
=
()
=>
{
setAddTopicModalShow
(
false
);
};
const
addTopicModalShowOk
=
()
=>
{
getTopicList
();
setAddTopicModalShow
(
false
);
};
// 删除话题
const
deleteTopic
=
(
record
:
topicListType
[
0
])
=>
{
Modal
.
confirm
({
title
:
'删除话题'
,
content
:
'确认删除该话题?'
,
onOk
:
()
=>
{
ForumManageAPI
.
deleteGambit
({
id
:
record
.
id
}).
then
(({
code
})
=>
{
if
(
code
===
'200'
)
{
message
.
success
(
'删除成功'
);
getTopicList
();
}
});
},
});
};
useEffect
(()
=>
{
getTopicList
();
},
[]);
return
(
<
div
className=
'topic-list'
>
<
SearchBox
search=
{
[
{
label
:
'名称'
,
type
:
'input'
,
name
:
'gambitName'
,
placeholder
:
'请输入名称'
,
},
{
label
:
'属性'
,
type
:
'Select'
,
name
:
'gambitProperty'
,
options
:
gambitPropertyList
,
placeholder
:
'请选择属性'
,
},
]
}
child=
{
<
Button
type=
'primary'
onClick=
{
()
=>
addTopicModalShowClick
()
}
>
新建
</
Button
>
}
searchData=
{
searchSuccess
}
/>
<
Table
bordered
dataSource=
{
tableData
}
rowKey=
'id'
columns=
{
tableColumns
}
pagination=
{
{
total
:
pagination
.
totalCount
,
pageSize
:
pagination
.
pageSize
,
current
:
pagination
.
pageNo
,
showSizeChanger
:
true
,
showQuickJumper
:
true
,
onChange
:
(
page
:
number
,
pageSize
:
number
)
=>
paginationChange
(
page
,
pageSize
),
showTotal
:
(
total
,
range
)
=>
`当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`
,
}
}
/>
<
AddTopicModal
open=
{
addTopicModalShow
}
onCancel=
{
addTopicModalCancel
}
onOk=
{
addTopicModalShowOk
}
currentTopicItem=
{
currentTopicItem
}
/>
</
div
>
);
};
export
default
TopicList
;
src/pages/resourceManage/materielManage/comp/addEditModal/index.tsx
浏览文件 @
b0c8853c
...
...
@@ -47,11 +47,14 @@ const AddEditModal: React.FC<propType> = (props) => {
const
[
form
]
=
Form
.
useForm
<
ReqType
>
();
// 上传图片
const
[
bannerTypeValue
,
setBannerTypeValue
]
=
useState
(
0
);
// 封面图文件
const
[
bannerImgFileList
,
setBannerImgFileList
]
=
useState
<
any
>
([]);
// 是否有效
const
[
validTime
,
setValidTime
]
=
useState
<
number
>
(
0
);
// 关闭弹窗
const
handleCancel
=
()
=>
{
setBannerTypeValue
(
0
);
setBannerImgFileList
([]);
form
.
resetFields
();
closed
();
};
...
...
@@ -93,6 +96,9 @@ const AddEditModal: React.FC<propType> = (props) => {
if
(
!
open
)
return
;
if
(
!
data
)
return
;
form
.
setFieldsValue
(
data
);
setBannerImgFileList
([
{
id
:
Math
.
random
(),
uid
:
Math
.
random
(),
name
:
'bannerImg'
,
url
:
data
?.
bannerImg
},
]);
setBannerTypeValue
(
data
?.
bannerType
);
if
(
data
?.
endTime
&&
data
?.
startTime
)
{
setValidTime
(
1
);
...
...
@@ -180,8 +186,11 @@ const AddEditModal: React.FC<propType> = (props) => {
fileLength=
{
1
}
fileSize=
{
10
}
fileType=
{
[
'image/png'
,
'image/jpeg'
,
'image/jpg'
,
'image/gif'
,
'image/bmp'
]
}
onChange=
{
(
e
)
=>
form
.
setFieldValue
(
'bannerImg'
,
e
[
0
].
url
)
}
defaultFileList=
{
data
?.
bannerImg
?
[{
url
:
data
?.
bannerImg
}]
:
[]
}
onChange=
{
(
e
)
=>
{
setBannerImgFileList
(
e
);
form
.
setFieldValue
(
'bannerImg'
,
e
[
0
].
url
);
}
}
defaultFileList=
{
bannerImgFileList
}
>
<
PlusOutlined
/>
</
Uploader
>
...
...
@@ -235,9 +244,7 @@ const AddEditModal: React.FC<propType> = (props) => {
wrapperCol=
{
{
span
:
20
}
}
>
<
RichText
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
value=
{
form
.
getFieldValue
(
'textContent'
)
}
richTextContent=
{
form
.
getFieldValue
(
'textContent'
)
}
onChange=
{
(
e
)
=>
form
.
setFieldValue
(
'textContent'
,
e
)
}
height=
{
250
}
/>
...
...
src/router/router.tsx
浏览文件 @
b0c8853c
...
...
@@ -229,18 +229,16 @@ export const whiteRouterList: Array<RouteObject & RouteObjectType> = [
// 路由数组
export
const
routerList
:
Array
<
RouteObjectType
>
=
[
// {
// path: '/dataDashboards',
// element: withLoadingComponent(<DataBoardView />),
// errorElement: <ErrorPage />,
// meta: {
// icon: <BarChartOutlined />,
// title: '数据看板',
// id: 300,
// hidden: true,
// develop: true,
// },
// },
{
path
:
'/dataDashboards'
,
element
:
withLoadingComponent
(<
DataBoardView
/>),
errorElement
:
<
ErrorPage
/>,
meta
:
{
icon
:
<
BarChartOutlined
/>,
title
:
'数据看板'
,
id
:
2
,
},
},
{
path
:
'/customManage'
,
element
:
<
LayoutView
/>,
...
...
src/utils/dictionary.ts
浏览文件 @
b0c8853c
...
...
@@ -187,3 +187,18 @@ export const fileTypeList = [
value
:
'application/vnd.openxmlformats-officedocument.presentationml.presentation'
,
},
];
// 话题-属性字典
export
const
gambitPropertyList
=
[
{
label
:
'普通'
,
value
:
1
,
},
{
label
:
'热门'
,
value
:
2
,
},
{
label
:
'推荐'
,
value
:
3
,
},
];
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论