Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
web-ci-test
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
test-ci
web-ci-test
Commits
4372450a
提交
4372450a
authored
5月 30, 2023
作者:
翁进城
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into feature/chuck
上级
dd94b9e5
7b100249
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
42 行增加
和
69 行删除
+42
-69
index.ts
components/NavHeader/publishModal/api/index.ts
+1
-0
index.tsx
components/NavHeader/publishModal/index.tsx
+6
-2
hooks.ts
lib/hooks.ts
+0
-47
index.page.tsx
pages/JoinPolicy/index.page.tsx
+1
-1
index.tsx
pages/forum/api/index.tsx
+5
-0
index.module.scss
pages/forum/index.module.scss
+1
-0
index.page.tsx
pages/forum/index.page.tsx
+10
-9
index.tsx
pages/projectInfo/components/bids/index.tsx
+18
-10
没有找到文件。
components/NavHeader/publishModal/api/index.ts
浏览文件 @
4372450a
...
...
@@ -10,6 +10,7 @@ export interface PublishParams {
publishName
:
string
;
//发布名称
requirementTypeId
:
number
;
//需求类型
requireDescription
:
string
;
//需求描述
provinceCode
?:
string
;
//省编码
}
export
default
{
...
...
components/NavHeader/publishModal/index.tsx
浏览文件 @
4372450a
import
{
Button
,
Form
,
Input
,
Modal
,
Select
}
from
"antd"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useGeolocation
}
from
"~/lib/hooks"
;
import
api
,
{
PublishParams
,
TypeResp
}
from
"./api"
;
import
styles
from
"./index.module.scss"
;
...
...
@@ -17,7 +18,8 @@ export default function PublishModal(props: Props) {
requirementTypeId
:
-
1
,
});
const
[
form
]
=
Form
.
useForm
();
console
.
log
(
"form"
,
form
);
const
position
=
useGeolocation
();
console
.
log
(
"position"
,
position
);
useEffect
(()
=>
{
api
.
listType
().
then
((
res
)
=>
{
...
...
@@ -32,10 +34,12 @@ export default function PublishModal(props: Props) {
.
publish
({
...
params
,
...
values
,
provinceCode
:
position
?.
address
?.
addressComponent
?.
adcode
})
.
then
((
res
)
=>
{
if
(
res
.
code
!==
"-1
"
)
{
if
(
res
.
code
===
"200
"
)
{
props
.
onCancel
&&
props
.
onCancel
();
window
.
messageApi
.
success
(
"发布成功"
);
setTimeout
(()
=>
{
form
.
resetFields
();
},
500
);
...
...
lib/hooks.ts
浏览文件 @
4372450a
import
{
useEffect
,
useState
}
from
"react"
;
import
api
,
{
UserInfoResp
}
from
"~/api"
;
/*
const fetcher = (url) =>
fetch(url)
.then((r) => r.json())
.then((data) => {
return { user: data?.user || null };
}); */
export
function
useUser
()
{
const
[
user
,
setUser
]
=
useState
<
UserInfoResp
|
null
>
(
null
);
const
[
userAccountId
,
setUserAccountId
]
=
useState
<
number
|
""
>
(
''
);
useEffect
(()
=>
{
setUserAccountId
(
Number
(
window
.
localStorage
.
getItem
(
'userId'
)));
try
{
let
userInfo
=
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'userInfo'
)
||
''
)
||
null
;
setUser
(
userInfo
);
}
catch
(
e
)
{
}
},
[])
useEffect
(()
=>
{
if
(
!
user
)
{
api
.
userInfo
()
.
then
((
res
)
=>
{
if
(
res
.
code
==
'200'
){
setUser
(
res
.
result
||
null
);
}
else
{
setUserAccountId
(
''
);
}
window
.
localStorage
.
setItem
(
'userInfo'
,
JSON
.
stringify
(
res
.
result
||
''
));
});
}
//退出登录
if
(
userAccountId
===
''
){
setUser
(
null
);
window
.
localStorage
.
setItem
(
'userInfo'
,
''
);
}
},
[
userAccountId
]);
return
user
;
}
export
function
useGeolocation
()
{
const
[
position
,
setPosition
]
=
useState
<
{
...
...
pages/JoinPolicy/index.page.tsx
浏览文件 @
4372450a
...
...
@@ -32,7 +32,7 @@ export default function JoinPolicy() {
.
then
((
res
)
=>
{
console
.
log
(
"提交结果"
,
res
);
if
(
res
.
code
===
"200"
)
{
window
.
messageApi
.
success
(
res
.
result
);
window
.
messageApi
.
success
(
'提交成功'
);
setTimeout
(()
=>
{
router
.
push
(
"/"
);
},
1500
);
...
...
pages/forum/api/index.tsx
浏览文件 @
4372450a
...
...
@@ -21,6 +21,11 @@ export interface Dynamic {
likesCount
:
number
;
commentCount
:
number
;
likes
:
boolean
;
userBaseInfo
:
{
id
:
number
,
nickName
:
string
,
userImg
:
string
}
}
export
interface
DynamicListResp
{
...
...
pages/forum/index.module.scss
浏览文件 @
4372450a
...
...
@@ -58,6 +58,7 @@
font-family
:
MicrosoftYaHei
;
color
:
#000000
;
margin-bottom
:
16px
;
padding-right
:
10px
;
}
}
...
...
pages/forum/index.page.tsx
浏览文件 @
4372450a
...
...
@@ -82,6 +82,7 @@ export default function Forum() {
//评论内容
const
onComment
=
(
values
:
any
,
id
:
number
,
i
:
number
)
=>
{
if
(
userInfo
)
{
api
.
comment
({
...
...
@@ -91,14 +92,9 @@ export default function Forum() {
})
.
then
((
res
)
=>
{
if
(
res
.
code
===
"200"
)
{
window
.
messageApi
.
success
(
"评论成功"
);
}
});
}
};
//评论内容
const
onCommentContent
=
()
=>
{
if
(
userInfo
)
{
}
else
{
setNeedLogin
(
true
);
}
...
...
@@ -127,9 +123,15 @@ export default function Forum() {
return
(
<
div
key=
{
item
.
id
}
className=
{
styles
.
item
}
>
<
Space
size=
{
10
}
align=
"start"
>
<
Image
alt=
""
className=
{
styles
.
headImg
}
></
Image
>
<
Image
alt=
""
className=
{
styles
.
headImg
}
src=
{
item
.
userBaseInfo
.
userImg
}
></
Image
>
<
div
className=
{
styles
.
info
}
>
<
div
className=
{
styles
.
name
}
>
给**的
</
div
>
<
div
className=
{
styles
.
name
}
>
{
item
.
userBaseInfo
.
nickName
}
</
div
>
<
div
className=
{
styles
.
desc
}
>
{
item
.
description
}
</
div
>
<
div
className=
{
styles
.
imgs
}
>
<
Image
.
PreviewGroup
...
...
@@ -204,7 +206,6 @@ export default function Forum() {
type=
"primary"
htmlType=
"submit"
className=
"btnComment"
onClick=
{
onCommentContent
}
>
评论
</
Button
>
...
...
pages/projectInfo/components/bids/index.tsx
浏览文件 @
4372450a
import
{
Button
,
Empty
,
Pagination
,
Spin
}
from
"antd"
;
import
{
useState
,
useEffect
}
from
"react"
;
import
{
useState
,
useEffect
,
useContext
}
from
"react"
;
import
{
UserContext
}
from
"~/lib/userProvider"
;
import
api
,
{
Item
}
from
"./api"
;
import
styles
from
"./index.module.scss"
;
...
...
@@ -21,6 +22,7 @@ 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
);
useEffect
(()
=>
{
//中断前一次请求
...
...
@@ -57,16 +59,22 @@ export default function Bids(props: Props) {
});
};
//申请合作
const
onApply
=
(
item
:
Item
)
=>
{
api
.
apply
({
tenderNewsId
:
item
.
id
,
})
.
then
((
res
)
=>
{
if
(
res
.
code
===
"200"
)
{
window
.
messageApi
.
success
(
"申请成功"
);
}
});
if
(
userInfo
)
{
api
.
apply
({
tenderNewsId
:
item
.
tenderNewsId
,
tenderInfoId
:
item
.
id
,
})
.
then
((
res
)
=>
{
if
(
res
.
code
===
"200"
)
{
window
.
messageApi
.
success
(
"申请成功"
);
}
});
}
else
{
setNeedLogin
(
true
);
}
};
return
(
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论