Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
web
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
web
Commits
cf95e53f
提交
cf95e53f
authored
5月 30, 2023
作者:
18928357778
浏览文件
操作
浏览文件
下载
差异文件
合并代码
上级
4c051160
00daecb9
显示空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
193 行增加
和
105 行删除
+193
-105
index.tsx
components/NavHeader/index.tsx
+0
-4
index.tsx
components/filter/index.tsx
+56
-46
index.tsx
components/loginModal/index.tsx
+1
-1
userProvider.tsx
lib/userProvider.tsx
+8
-6
index.tsx
pages/forum/api/index.tsx
+15
-4
index.page.tsx
pages/forum/index.page.tsx
+97
-29
index.tsx
pages/projectInfo/components/bids/index.tsx
+4
-2
index.ts
pages/projectInfo/components/requirements/api/index.ts
+1
-1
index.module.scss
pages/projectInfo/components/requirements/index.module.scss
+1
-0
index.tsx
pages/projectInfo/components/requirements/index.tsx
+10
-12
没有找到文件。
components/NavHeader/index.tsx
浏览文件 @
cf95e53f
...
...
@@ -75,11 +75,7 @@ export default function NavHeader() {
if
(
!
userInfo
)
{
setOpenLoginModal
(
true
);
}
else
{
if
(
userInfo
.
companyAuthStatus
)
{
setOpenPublishModal
(
true
);
}
else
{
router
.
push
(
"/certification"
);
}
}
}
...
...
components/filter/index.tsx
浏览文件 @
cf95e53f
...
...
@@ -3,8 +3,8 @@ import { FilterOptionResp, RegionResp } from "./api";
import
ResultItem
from
"./compoents/resultItem"
;
import
RegionItem
from
"./compoents/regionItem"
;
import
styles
from
"./index.module.scss"
;
import
{
useEffect
,
useState
,
forwardRef
,
useImperativeHandle
}
from
"react"
;
import
{
useRouter
}
from
'next/router'
import
React
,
{
useEffect
,
useState
,
forwardRef
,
useImperativeHandle
,
Ref
}
from
"react"
;
import
{
useRouter
}
from
"next/router"
;
import
BrandItem
from
"./compoents/brandItem"
;
import
ModelItem
from
"./compoents/modelItem"
;
import
PartItem
from
"./compoents/partItem"
;
...
...
@@ -60,65 +60,74 @@ type Props = {
)
=>
void
;
//筛选条件更改事件
};
const
idArr
=
[
"brandId"
,
"categoryId"
,
"modelId"
,
"partsId"
,
"productCategoryId"
,
"qualityId"
,
"industryId"
,
"appTypeId"
]
const
nameArr
:
any
=
{
const
idArr
=
[
"brandId"
,
"categoryId"
,
"modelId"
,
"partsId"
,
"productCategoryId"
,
"qualityId"
,
"industryId"
,
"appTypeId"
,
];
const
nameArr
:
any
=
{
brandId
:
{
type
:
"brandId"
,
typeObj
:
"brand"
,
typeName
:
"品牌:"
,
type
:
"brandId"
,
typeObj
:
"brand"
,
typeName
:
"品牌:"
,
},
// districtId: {
// type:"districtId",
// typeObj:"region",
// typeName:"地域:",
// },
modelId
:
{
type
:
"modelId"
,
typeObj
:
"model"
,
typeName
:
"型号:"
,
modelId
:
{
type
:
"modelId"
,
typeObj
:
"model"
,
typeName
:
"型号:"
,
},
partsId
:
{
type
:
"partsId"
,
typeObj
:
"part"
,
typeName
:
"部件:"
,
type
:
"partsId"
,
typeObj
:
"part"
,
typeName
:
"部件:"
,
},
productCategoryId
:
{
type
:
"productCategoryId"
,
typeObj
:
"category"
,
typeName
:
"类目:"
,
type
:
"productCategoryId"
,
typeObj
:
"category"
,
typeName
:
"类目:"
,
},
qualityId
:
{
type
:
"qualityId"
,
typeObj
:
"quality"
,
typeName
:
"成色:"
,
type
:
"qualityId"
,
typeObj
:
"quality"
,
typeName
:
"成色:"
,
},
industryId
:
{
type
:
"industryId"
,
typeObj
:
"industryId"
,
typeName
:
"行业:"
,
type
:
"industryId"
,
typeObj
:
"industryId"
,
typeName
:
"行业:"
,
},
appTypeId
:
{
type
:
"appTypeId"
,
typeObj
:
"appTypeId"
,
typeName
:
"应用:"
,
type
:
"appTypeId"
,
typeObj
:
"appTypeId"
,
typeName
:
"应用:"
,
},
categoryId
:
{
type
:
"categoryId"
,
typeObj
:
"categoryId"
,
typeName
:
"类目:"
,
type
:
"categoryId"
,
typeObj
:
"categoryId"
,
typeName
:
"类目:"
,
},
}
}
;
const
Filter
=
forwardRef
((
props
:
Props
,
ref
)
=>
{
const
Filter
=
(
props
:
Props
,
ref
:
Ref
<
any
>
)
=>
{
const
router
=
useRouter
();
useImperativeHandle
(
ref
,
()
=>
({
idArr
:
idArr
,
clearRouter
:
clearRouter
}))
idArr
:
idArr
,
clearRouter
:
clearRouter
,
}))
;
const
[
result
,
setResult
]
=
useState
<
FilterResult
>
({});
const
onChange
=
(
item
:
FilterOptionResp
,
type
:
string
)
=>
{
clearRouter
()
clearRouter
()
;
let
data
:
{
[
key
:
string
]:
FilterOptionResp
}
=
{};
data
[
type
]
=
item
;
...
...
@@ -139,25 +148,28 @@ const nameArr:any = {
});
},
[
result
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
let
queryVal
=
JSON
.
parse
(
JSON
.
stringify
(
router
.
query
));
if
(
Object
.
keys
(
router
.
query
).
length
)
{
for
(
const
key
in
queryVal
)
{
if
(
idArr
.
includes
(
key
))
{
onChange
({
id
:
queryVal
[
key
],
name
:
nameArr
[
key
].
typeName
+
queryVal
.
name
},
nameArr
[
key
].
typeObj
)
onChange
(
{
id
:
queryVal
[
key
],
name
:
nameArr
[
key
].
typeName
+
queryVal
.
name
},
nameArr
[
key
].
typeObj
);
}
}
}
},
[
router
])
},
[
router
]);
const
clearRouter
=
()
=>
{
if
(
Object
.
keys
(
router
.
query
).
length
)
{
router
.
query
=
{}
router
.
replace
(
router
.
pathname
)
}
router
.
query
=
{};
router
.
replace
(
router
.
pathname
);
}
};
const
onDel
=
(
key
:
string
)
=>
{
clearRouter
()
clearRouter
()
;
//@ts-ignore
delete
result
[
key
];
setResult
({
...
...
@@ -236,7 +248,6 @@ const nameArr:any = {
</
div
>
</>
);
}
)
};
export
default
Filter
\ No newline at end of file
export
default
forwardRef
(
Filter
);
components/loginModal/index.tsx
浏览文件 @
cf95e53f
...
...
@@ -67,7 +67,7 @@ export default function LoginModal(props: Props) {
window
.
localStorage
.
setItem
(
"token"
,
res
.
result
.
token
);
api
.
userInfo
().
then
((
res
)
=>
{
setUserInfo
(
res
.
result
||
""
);
setUserInfo
(
res
.
result
);
window
.
messageApi
.
success
(
"登录成功"
);
props
.
onCancel
();
});
...
...
lib/userProvider.tsx
浏览文件 @
cf95e53f
...
...
@@ -10,8 +10,8 @@ import api, { UserInfoResp } from "~/api";
export
const
UserContext
=
createContext
<
{
testLogin
:
()
=>
void
;
logout
:
()
=>
void
;
userInfo
:
UserInfoResp
|
null
|
""
;
setUserInfo
:
Dispatch
<
SetStateAction
<
UserInfoResp
|
null
|
""
>>
;
userInfo
:
UserInfoResp
|
null
|
undefined
;
setUserInfo
:
Dispatch
<
SetStateAction
<
UserInfoResp
|
null
|
undefined
>>
;
needLogin
:
Boolean
;
setNeedLogin
:
Dispatch
<
SetStateAction
<
Boolean
>>
;
}
>
({
...
...
@@ -27,12 +27,14 @@ type Props = {
children
:
React
.
ReactNode
;
};
const
UserProvider
=
({
children
}:
Props
)
=>
{
const
[
userInfo
,
setUserInfo
]
=
useState
<
UserInfoResp
|
null
|
''
>
(
null
);
const
[
userInfo
,
setUserInfo
]
=
useState
<
UserInfoResp
|
null
|
undefined
>
(
null
);
const
[
needLogin
,
setNeedLogin
]
=
useState
<
Boolean
>
(
false
);
//用于通知登录modal需要打开
useEffect
(()
=>
{
try
{
setUserInfo
(
JSON
.
parse
(
window
.
localStorage
.
getItem
(
"userInfo"
)
||
""
));
setUserInfo
(
JSON
.
parse
(
window
.
localStorage
.
getItem
(
"userInfo"
)
||
""
)
||
undefined
);
}
catch
(
e
)
{}
},
[]);
...
...
@@ -48,7 +50,7 @@ const UserProvider = ({ children }: Props) => {
if
(
res
.
code
==
"200"
)
{
window
.
localStorage
.
setItem
(
"token"
,
res
.
result
?.
token
||
""
);
api
.
userInfo
().
then
((
res
)
=>
{
setUserInfo
(
res
.
result
||
''
);
setUserInfo
(
res
.
result
||
undefined
);
});
}
});
...
...
@@ -57,7 +59,7 @@ const UserProvider = ({ children }: Props) => {
//登出
function
logout
()
{
localStorage
.
setItem
(
"token"
,
""
);
setUserInfo
(
''
);
setUserInfo
(
undefined
);
}
return
(
...
...
pages/forum/api/index.tsx
浏览文件 @
cf95e53f
...
...
@@ -40,10 +40,9 @@ export interface CommentParams {
content
:
string
;
//评论内容
dynamicId
:
number
;
//动态id
parentId
?:
number
;
//父级评论
userId
:
number
;
//用户id
}
export
interface
ByDynamic
Params
{
export
interface
ByDynamic
Resp
{
id
:
number
;
dynamicId
:
number
;
parentId
:
number
;
...
...
@@ -51,7 +50,12 @@ export interface ByDynamicParams {
content
:
string
;
likesCount
:
number
;
createTime
:
string
;
children
:
ByDynamicParams
[];
children
:
ByDynamicResp
[];
userBaseInfoVO
:
{
id
:
number
,
nickName
:
string
,
userImg
:
string
}
}
export
default
{
...
...
@@ -70,7 +74,14 @@ export default {
},
//根据动态查看评论
byDynamic
(
params
:
{
dynamicId
:
number
}):
Promise
<
Response
<
Array
<
ByDynamicParams
>>>
{
byDynamic
(
params
:
{
dynamicId
:
number
;
}):
Promise
<
Response
<
Array
<
ByDynamicResp
>>>
{
return
request
(
"/release/dynamic/byDynamic"
,
"get"
,
params
);
},
//点赞或取消点赞
likeOrCancel
(
params
:
{
dynamicId
:
number
})
{
return
request
(
"/release/dynamic/likeOrCancel"
,
"get"
,
params
);
},
};
pages/forum/index.page.tsx
浏览文件 @
cf95e53f
...
...
@@ -15,14 +15,15 @@ import errImg from "~/assets/errImg";
import
{
RightOutlined
}
from
"@ant-design/icons"
;
import
{
useContext
,
useEffect
,
useState
}
from
"react"
;
import
PublishMessage
from
"./components/publishMessage"
;
import
api
,
{
ByDynamic
Params
,
Dynamic
}
from
"./api"
;
import
api
,
{
ByDynamic
Resp
,
Dynamic
}
from
"./api"
;
import
InfiniteScroll
from
"react-infinite-scroll-component"
;
import
{
UserContext
}
from
"~/lib/userProvider"
;
import
moment
from
"moment"
;
interface
Item
extends
Dynamic
{
openComment
?:
boolean
;
//是否开启评论
showCommentAll
?:
boolean
;
//是否展示全部评论
commentList
?:
Array
<
ByDynamic
Params
>
;
commentList
?:
Array
<
ByDynamic
Resp
>
;
//评论列表
}
export
default
function
Forum
()
{
...
...
@@ -34,6 +35,7 @@ export default function Forum() {
});
const
[
count
,
setCount
]
=
useState
(
0
);
//动态总数
const
{
userInfo
,
setNeedLogin
}
=
useContext
(
UserContext
);
const
[
form
]
=
Form
.
useForm
();
//评论区的form
useEffect
(()
=>
{
api
...
...
@@ -78,27 +80,74 @@ export default function Forum() {
item
.
openComment
=
!
item
.
openComment
;
const
temp
=
[...
list
];
setList
(
temp
);
getCommentList
(
item
);
};
//评论内容
const
onComment
=
(
values
:
any
,
id
:
number
,
i
:
number
)
=>
{
//获取评论列表
const
getCommentList
=
(
item
:
Item
)
=>
{
api
.
byDynamic
({
dynamicId
:
item
.
id
,
})
.
then
((
res
)
=>
{
if
(
res
?.
code
===
"200"
)
{
item
.
commentList
=
res
.
result
||
[];
}
const
temp
=
[...
list
];
setList
(
temp
);
});
};
//展示所有评论
const
showCommentAll
=
(
item
:
Item
)
=>
{
item
.
showCommentAll
=
true
;
const
temp
=
[...
list
];
setList
(
temp
);
};
//评论内容
const
onComment
=
(
values
:
any
,
item
:
Item
)
=>
{
if
(
userInfo
)
{
api
.
comment
({
content
:
values
.
content
,
dynamicId
:
id
,
userId
:
userInfo
.
id
,
dynamicId
:
item
.
id
,
})
.
then
((
res
)
=>
{
if
(
res
.
code
===
"200"
)
{
window
.
messageApi
.
success
(
"评论成功"
);
form
.
resetFields
([
"content"
]);
item
.
commentCount
+=
1
;
getCommentList
(
item
);
}
});
}
else
{
setNeedLogin
(
true
);
}
};
//点赞或取消
const
onLike
=
(
item
:
Item
)
=>
{
if
(
userInfo
)
{
api
.
likeOrCancel
({
dynamicId
:
item
.
id
,
})
.
then
((
res
)
=>
{
if
(
res
.
code
===
"200"
)
{
item
.
likes
=
!
item
.
likes
;
if
(
item
.
likes
)
{
item
.
likesCount
++
;
}
else
{
item
.
likesCount
--
;
}
const
temp
=
[...
list
];
setList
(
temp
);
}
});
}
};
return
(
<
Layout
>
<
div
className=
{
styles
.
forum
}
>
...
...
@@ -169,7 +218,10 @@ export default function Forum() {
></
div
>
{
item
.
commentCount
}
评论
</
div
>
<
div
className=
{
styles
.
ctrlsItem
}
>
<
div
className=
{
styles
.
ctrlsItem
}
onClick=
{
()
=>
onLike
(
item
)
}
>
<
div
className=
{
`${styles.ctrlsItemIcon} ${
styles.iconPraise
...
...
@@ -183,8 +235,9 @@ export default function Forum() {
{
item
.
openComment
&&
(
<
div
className=
{
styles
.
commentWrap
}
>
<
Form
form=
{
form
}
onFinish=
{
(
values
)
=>
{
onComment
(
values
,
item
.
id
,
i
);
onComment
(
values
,
item
);
}
}
>
<
Form
.
Item
...
...
@@ -213,38 +266,53 @@ export default function Forum() {
</
Form
>
<
div
className=
{
styles
.
comments
}
>
<
div
className=
{
styles
.
commentItem
}
>
<
div
className=
{
styles
.
commentHeadImg
}
></
div
>
<
div
className=
{
styles
.
info
}
>
<
div
className=
{
styles
.
nameWrap
}
>
<
div
className=
{
styles
.
commentName
}
>
无人机爱好者111:
<
div
className=
{
styles
.
date
}
>
05-16
</
div
>
</
div
>
<
div
className=
{
styles
.
commentContent
}
>
无人机记录生活
</
div
>
</
div
>
</
div
>
{
/* 判断是否展示所有评论 */
}
{
item
.
commentList
?.
filter
((
comment
,
i
)
=>
{
if
(
item
.
showCommentAll
)
{
return
true
;
}
else
{
if
(
i
<
2
)
{
return
true
;
}
}
})
.
map
((
comment
)
=>
{
return
(
<
div
key=
{
comment
.
id
}
className=
{
styles
.
commentItem
}
>
<
div
className=
{
styles
.
commentHeadImg
}
>
<
Image
src=
{
comment
.
userBaseInfoVO
?.
userImg
}
></
Image
>
</
div
>
<
div
className=
{
styles
.
commentItem
}
>
<
div
className=
{
styles
.
commentHeadImg
}
></
div
>
<
div
className=
{
styles
.
info
}
>
<
div
className=
{
styles
.
nameWrap
}
>
<
div
className=
{
styles
.
commentName
}
>
无人机爱好者111:
<
div
className=
{
styles
.
date
}
>
05-16
</
div
>
{
comment
.
userBaseInfoVO
?.
nickName
}
:
<
div
className=
{
styles
.
date
}
>
{
moment
(
comment
.
createTime
).
format
(
"YYYY-MM-DD"
)
}
</
div
>
</
div
>
<
div
className=
{
styles
.
commentContent
}
>
无人机记录生活
{
comment
.
content
}
</
div
>
</
div
>
</
div
>
</
div
>
);
})
}
</
div
>
{
!
item
.
showCommentAll
&&
(
<
div
className=
{
styles
.
showAll
}
>
查看全部15条评论
{
!
item
.
showCommentAll
&&
item
.
commentCount
>
2
&&
(
<
div
className=
{
styles
.
showAll
}
onClick=
{
()
=>
showCommentAll
(
item
)
}
>
查看全部
{
item
.
commentCount
}
条评论
<
RightOutlined
size=
{
14
}
/>
</
div
>
)
}
...
...
pages/projectInfo/components/bids/index.tsx
浏览文件 @
cf95e53f
...
...
@@ -22,13 +22,14 @@ export default function Bids(props: Props) {
const
[
count
,
setCount
]
=
useState
(
0
);
const
[
abort
,
setAbort
]
=
useState
<
AbortController
|
null
>
(
null
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
{
userInfo
,
setNeedLogin
}
=
useContext
(
UserContext
);
const
{
userInfo
,
setNeedLogin
}
=
useContext
(
UserContext
);
const
[
reload
,
setReload
]
=
useState
(
false
);
useEffect
(()
=>
{
//中断前一次请求
abort
?.
abort
();
setAbort
(
new
AbortController
());
},
[
pageParams
,
props
.
params
]);
},
[
pageParams
,
props
.
params
,
reload
]);
useEffect
(()
=>
{
if
(
!
abort
)
{
...
...
@@ -70,6 +71,7 @@ export default function Bids(props: Props) {
.
then
((
res
)
=>
{
if
(
res
.
code
===
"200"
)
{
window
.
messageApi
.
success
(
"申请成功"
);
setReload
(
!
reload
);
}
});
}
else
{
...
...
pages/projectInfo/components/requirements/api/index.ts
浏览文件 @
cf95e53f
...
...
@@ -24,6 +24,7 @@ export interface Item {
publishName
:
string
;
publishPhone
:
string
;
requireDescription
:
string
;
requirementTypeName
:
string
;
solved
?:
0
|
1
;
createTime
:
string
;
updateTime
?:
string
;
...
...
@@ -31,7 +32,6 @@ export interface Item {
export
interface
SolveRequireParams
{
requirementsInfoId
:
number
,
//需求id
userAccountId
:
number
//用户id
}
...
...
pages/projectInfo/components/requirements/index.module.scss
浏览文件 @
cf95e53f
...
...
@@ -32,6 +32,7 @@
}
.desc
{
width
:
fit-content
;
font-size
:
14px
;
font-family
:
MicrosoftYaHei
;
color
:
RGBA
(
135
,
135
,
135
,
0
.4
);
...
...
pages/projectInfo/components/requirements/index.tsx
浏览文件 @
cf95e53f
import
{
Button
,
Empty
,
Pagination
,
Popconfirm
,
Spin
}
from
"antd"
;
import
{
Button
,
Empty
,
Pagination
,
Popconfirm
,
Spin
,
Tooltip
}
from
"antd"
;
import
router
from
"next/router"
;
import
React
,
{
useState
,
useEffect
}
from
"react"
;
import
React
,
{
useState
,
useEffect
,
useContext
}
from
"react"
;
import
{
UserContext
}
from
"~/lib/userProvider"
;
import
api
,
{
Item
}
from
"./api"
;
import
styles
from
"./index.module.scss"
;
...
...
@@ -22,12 +23,8 @@ export default function Requirements(props: Props) {
});
const
[
count
,
setCount
]
=
useState
(
0
);
const
[
abort
,
setAbort
]
=
useState
<
AbortController
|
null
>
(
null
);
const
[
userId
,
setUserId
]
=
useState
(
-
1
);
const
[
reload
,
setReload
]
=
useState
(
false
);
useEffect
(()
=>
{
setUserId
(
Number
(
window
.
localStorage
.
getItem
(
"userId"
)
||
-
1
));
},
[]);
const
{
userInfo
}
=
useContext
(
UserContext
);
useEffect
(()
=>
{
//中断前一次请求
...
...
@@ -72,7 +69,6 @@ export default function Requirements(props: Props) {
api
.
solveRequire
({
requirementsInfoId
:
item
.
id
,
userAccountId
:
userId
,
})
.
then
((
res
)
=>
{
if
(
res
.
code
===
"200"
)
{
...
...
@@ -94,14 +90,16 @@ export default function Requirements(props: Props) {
<
div
className=
{
styles
.
logo
}
></
div
>
<
div
className=
{
styles
.
info
}
>
<
div
className=
{
styles
.
title
}
>
项目需求:
{
item
.
require
Description
}
项目需求:
{
item
.
require
mentTypeName
}
</
div
>
{
/*
<
Tooltip
placement=
"top"
title=
{
item
.
requireDescription
}
>
<
div
className=
{
styles
.
desc
}
>
具体需求:
{
item
.
requireDescription
}
</div> */
}
</
div
>
{
item
.
userAccountId
===
userId
?
(
</
Tooltip
>
</
div
>
{
userInfo
&&
item
.
userAccountId
===
userInfo
.
id
?
(
<
Popconfirm
title=
"提示"
description=
"确认该需求已经解决了吗?"
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论