Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
web
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
web
Commits
a4157264
提交
a4157264
authored
6月 05, 2023
作者:
翁进城
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into feature/chuck
上级
39ee7e23
832edfc8
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
69 行增加
和
19 行删除
+69
-19
request.ts
api/request.ts
+23
-1
index.tsx
components/filter/compoents/regionItem/index.tsx
+2
-2
userProvider.tsx
lib/userProvider.tsx
+4
-0
index.page.tsx
pages/JoinPolicy/index.page.tsx
+6
-1
index.page.tsx
pages/certification/index.page.tsx
+5
-1
index.page.tsx
pages/mall/index.page.tsx
+1
-1
index.tsx
pages/projectInfo/components/bids/index.tsx
+1
-1
index.tsx
pages/projectInfo/components/cases/index.tsx
+1
-1
index.tsx
pages/projectInfo/components/news/index.tsx
+19
-7
index.page.tsx
pages/projectInfo/index.page.tsx
+3
-3
type.d.ts
typings/type.d.ts
+4
-1
没有找到文件。
api/request.ts
浏览文件 @
a4157264
import
config
from
'./config'
;
let
loginTimeout
:
NodeJS
.
Timeout
|
undefined
;
/**
* 请求封装
* @param url 请求url
...
...
@@ -43,12 +45,31 @@ export default function request(url: string, method: String = 'get', data?: any,
}
}
/**
* 错误消息
* @param msg
*/
function
errMsg
(
msg
:
string
)
{
if
(
!
options
.
hideError
)
{
window
.
messageApi
.
error
(
msg
);
}
}
/**
* 未登录消息展示,1.5秒内限制只展示一次
* @returns
*/
function
loginErrorMsg
(){
console
.
log
(
'loginTimeout'
,
loginTimeout
)
if
(
loginTimeout
){
return
;
}
loginTimeout
=
setTimeout
(()
=>
{
errMsg
(
'请先登录'
);
loginTimeout
=
undefined
;
},
1500
)
}
return
fetch
(
config
.
baseUrl
+
url
,
options
)
.
then
((
r
)
=>
{
try
{
...
...
@@ -85,7 +106,8 @@ export default function request(url: string, method: String = 'get', data?: any,
if
(
data
.
code
!==
'200'
)
{
//未登录判断
if
(
data
.
code
===
'5008'
){
errMsg
(
'请先登录'
);
loginErrorMsg
();
window
.
logout
();
}
else
{
errMsg
(
data
.
message
||
'请求出错'
);
}
...
...
components/filter/compoents/regionItem/index.tsx
浏览文件 @
a4157264
...
...
@@ -47,7 +47,7 @@ export default function RegionItem(props: Props) {
};
})
}
/>
<
Select
{
/*
<Select
value={selectCity}
bordered={false}
popupMatchSelectWidth={false}
...
...
@@ -60,7 +60,7 @@ export default function RegionItem(props: Props) {
label: item.name,
};
})}
/>
/>
*/
}
</
Space
>
</
div
>
</
div
>
...
...
lib/userProvider.tsx
浏览文件 @
a4157264
...
...
@@ -35,6 +35,10 @@ const UserProvider = ({ children }: Props) => {
setUserInfo
(
JSON
.
parse
(
window
.
localStorage
.
getItem
(
"userInfo"
)
||
""
)
||
undefined
);
window
.
setUserInfo
=
setUserInfo
;
window
.
setNeedLogin
=
setNeedLogin
;
window
.
logout
=
logout
;
}
catch
(
e
)
{}
},
[]);
...
...
pages/JoinPolicy/index.page.tsx
浏览文件 @
a4157264
...
...
@@ -4,6 +4,7 @@ import { useEffect, useState } from "react";
import
LayoutView
from
"~/components/layout"
;
import
api
from
"./api"
;
import
styles
from
"./index.module.scss"
;
import
{
phoneNumber
}
from
"~/lib/validateUtils"
;
export
default
function
JoinPolicy
()
{
const
router
=
useRouter
();
...
...
@@ -92,7 +93,11 @@ export default function JoinPolicy() {
},
]
}
>
<
Input
placeholder=
"请输入手机号"
maxLength=
{
11
}
></
Input
>
<
Input
placeholder=
"请输入手机号"
maxLength=
{
11
}
onInput=
{
phoneNumber
}
></
Input
>
</
Form
.
Item
>
<
Form
.
Item
name=
"remark"
>
<
Input
.
TextArea
placeholder=
"其它信息"
></
Input
.
TextArea
>
...
...
pages/certification/index.page.tsx
浏览文件 @
a4157264
...
...
@@ -91,7 +91,11 @@ export default function Certification() {
});
}
setTimeout
(()
=>
{
Router
.
push
(
"/"
);
if
(
Router
.
query
.
type
==
'back'
){
Router
.
back
();
}
else
{
Router
.
push
(
"/"
);
}
},
1000
);
}
});
...
...
pages/mall/index.page.tsx
浏览文件 @
a4157264
...
...
@@ -83,7 +83,7 @@ export default function Mall(props: Props) {
<
Layout
>
<
div
className=
"page"
style=
{
{
paddingTop
:
"18px"
}
}
>
<
Filter
types=
{
[
"类目"
,
"地域"
,
"品牌"
,
"部件"
,
"型号"
,
"成色"
]
}
types=
{
[
"类目"
,
"地域"
,
"品牌"
,
"部件"
,
/* "型号", "成色" */
]
}
showResultItem
onChange=
{
onFilterChange
}
></
Filter
>
...
...
pages/projectInfo/components/bids/index.tsx
浏览文件 @
a4157264
...
...
@@ -101,7 +101,7 @@ export default function Bids(props: Props) {
<
Button
type=
"primary"
className=
{
styles
.
btn
}
>
<
div
className=
{
styles
.
text1
}
>
{
item
.
tenderPrice
}
万
</
div
>
<
div
className=
{
styles
.
text2
}
onClick=
{
()
=>
onApply
(
item
)
}
>
申请
合作
商务
合作
</
div
>
</
Button
>
)
}
...
...
pages/projectInfo/components/cases/index.tsx
浏览文件 @
a4157264
...
...
@@ -86,7 +86,7 @@ export default function Cases(props: Props) {
Router
.
push
(
"/projectInfo/caseArticle/"
+
item
.
id
)
}
>
申请合作
联系品牌厂家
</
Button
>
</
div
>
);
...
...
pages/projectInfo/components/news/index.tsx
浏览文件 @
a4157264
...
...
@@ -2,10 +2,11 @@ import { RightOutlined } from "@ant-design/icons";
import
{
Button
,
Col
,
Empty
,
Pagination
,
Row
,
Spin
}
from
"antd"
;
import
styles
from
"./index.module.scss"
;
import
Image
from
"next/image"
;
import
{
useState
,
useEffect
}
from
"react"
;
import
{
useState
,
useEffect
,
useContext
}
from
"react"
;
import
api
,
{
Item
}
from
"./api"
;
import
{
useRouter
}
from
"next/router"
;
import
Router
from
"next/router"
;
import
Moment
from
"moment"
;
import
{
UserContext
}
from
"~/lib/userProvider"
;
type
Props
=
{
params
?:
{
...
...
@@ -25,7 +26,7 @@ export default function News(props: Props) {
});
const
[
count
,
setCount
]
=
useState
(
0
);
const
[
abort
,
setAbort
]
=
useState
<
AbortController
|
null
>
(
null
);
const
router
=
useRouter
(
);
const
{
userInfo
,
setNeedLogin
}
=
useContext
(
UserContext
);
useEffect
(()
=>
{
//中断前一次请求
...
...
@@ -62,6 +63,19 @@ export default function News(props: Props) {
});
};
//获取产品信息事件
const
onGetInfo
=
()
=>
{
if
(
userInfo
){
if
(
userInfo
.
companyAuthStatus
){
}
else
{
Router
.
push
(
"/certification?type=back"
);
}
}
else
{
setNeedLogin
(
true
);
}
}
return
(
<
Spin
spinning=
{
loading
}
delay=
{
500
}
>
<
Row
justify=
"space-between"
style=
{
{
height
:
606
}
}
>
...
...
@@ -86,11 +100,9 @@ export default function News(props: Props) {
<
Button
type=
"primary"
style=
{
{
width
:
120
,
height
:
40
,
flexShrink
:
0
}
}
onClick=
{
()
=>
router
.
push
(
"/projectInfo/newsArticle/"
+
item
.
id
)
}
onClick=
{
onGetInfo
}
>
申请合作
获取产品资料
</
Button
>
</
div
>
);
...
...
pages/projectInfo/index.page.tsx
浏览文件 @
a4157264
...
...
@@ -23,7 +23,7 @@ export interface Params {
}
const
items
=
(
params
:
any
)
=>
[
"项目需求"
,
"招投标项目"
,
"业务
案例"
,
"行业新闻"
].
map
((
value
)
=>
{
[
/* "项目需求", */
"招投标项目"
,
"项目
案例"
,
"行业新闻"
].
map
((
value
)
=>
{
let
children
:
JSX
.
Element
|
string
=
<></>;
switch
(
value
)
{
...
...
@@ -35,7 +35,7 @@ const items = (params: any) =>
children
=
<
Bids
params=
{
params
}
></
Bids
>;
break
;
case
"
业务
案例"
:
case
"
项目
案例"
:
children
=
<
Cases
params=
{
params
}
></
Cases
>;
break
;
...
...
@@ -120,7 +120,7 @@ export default function ProjectInfo() {
fieldNames=
{
{
label
:
"name"
,
value
:
"id"
,
children
:
"childInfo"
,
//
children: "childInfo",
}
}
changeOnSelect
/>
...
...
typings/type.d.ts
浏览文件 @
a4157264
...
...
@@ -5,6 +5,9 @@ declare global {
messageApi
:
MessageInstance
;
//全局消息提示api
WxLogin
:
any
;
//微信登录对象
_AMapSecurityConfig
:
{
securityJsCode
:
string
};
//高德地图api密钥配置
AMap
:
any
AMap
:
any
;
setUserInfo
:
Dispatch
<
SetStateAction
<
UserInfoResp
|
null
|
undefined
>>
;
//设置userInfo
setNeedLogin
:
Dispatch
<
SetStateAction
<
Boolean
>>
;
//需要登录操作
logout
:
()
=>
void
;
//退出登录
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论