Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
web
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
web
Commits
ce8238b6
提交
ce8238b6
authored
12月 15, 2023
作者:
ZhangLingKun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
功能:请前往小程序继续操作
上级
80af4322
流水线
#7620
已通过 于阶段
in 4 分 58 秒
变更
5
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
135 行增加
和
56 行删除
+135
-56
index.tsx
src/components/layout/header/index.tsx
+26
-21
index.tsx
src/components/layout/index.tsx
+6
-7
index.tsx
src/components/qrcodeModal/index.tsx
+70
-24
[id].tsx
src/pages/cart/submit/[id].tsx
+27
-4
globalData.ts
src/store/module/globalData.ts
+6
-0
没有找到文件。
src/components/layout/header/index.tsx
浏览文件 @
ce8238b6
...
@@ -7,6 +7,7 @@ import { useRouter } from 'next/router';
...
@@ -7,6 +7,7 @@ import { useRouter } from 'next/router';
import
{
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
CommonAPI
}
from
'@/api'
;
import
{
CommonAPI
}
from
'@/api'
;
import
{
HeaderWrap
}
from
'@/components/layout/header/styled'
;
import
{
HeaderWrap
}
from
'@/components/layout/header/styled'
;
import
QrcodePopover
from
'@/components/qrcodePopover'
;
import
{
RootState
}
from
'@/store'
;
import
{
RootState
}
from
'@/store'
;
import
{
AddressState
,
setAddress
}
from
'@/store/module/address'
;
import
{
AddressState
,
setAddress
}
from
'@/store/module/address'
;
import
{
setGlobalData
}
from
'@/store/module/globalData'
;
import
{
setGlobalData
}
from
'@/store/module/globalData'
;
...
@@ -64,6 +65,14 @@ const HeaderView: React.FC<{
...
@@ -64,6 +65,14 @@ const HeaderView: React.FC<{
getAccountInfo
().
then
();
getAccountInfo
().
then
();
}
}
},
[]);
},
[]);
// 顶部Tab列表
const
tabList
=
[
{
label
:
'个人中心'
,
value
:
'pages/mine/index'
},
{
label
:
'购物车'
,
value
:
'page-cart/cart-list/index'
},
{
label
:
'我的订单'
,
value
:
'pages/order/index'
},
{
label
:
'消息'
,
value
:
'pages/message/index'
},
{
label
:
'联系客服'
,
value
:
'page-mine/help-center/index'
},
];
// 右上角按钮
// 右上角按钮
const
items
:
MenuProps
[
'items'
]
=
[
const
items
:
MenuProps
[
'items'
]
=
[
{
{
...
@@ -124,21 +133,13 @@ const HeaderView: React.FC<{
...
@@ -124,21 +133,13 @@ const HeaderView: React.FC<{
</
div
>
</
div
>
<
div
className=
"header-nav"
>
<
div
className=
"header-nav"
>
<
div
className=
"nav-tab"
>
<
div
className=
"nav-tab"
>
<
Button
type=
{
'link'
}
className=
"tab-item"
>
{
tabList
?.
map
((
i
,
j
)
=>
(
个人中心
<
QrcodePopover
path=
{
i
.
value
}
key=
{
j
}
>
</
Button
>
<
Button
type=
{
'link'
}
className=
"tab-item"
>
<
Button
type=
{
'link'
}
className=
"tab-item"
>
{
i
.
label
}
购物车
</
Button
>
</
Button
>
</
QrcodePopover
>
<
Button
type=
{
'link'
}
className=
"tab-item"
>
))
}
我的订单
</
Button
>
<
Button
type=
{
'link'
}
className=
"tab-item"
>
消息
</
Button
>
<
Button
type=
{
'link'
}
className=
"tab-item"
>
联系客服
</
Button
>
</
div
>
</
div
>
{
!!
userInfo
?.
id
&&
(
{
!!
userInfo
?.
id
&&
(
<
div
className=
"nav-user"
>
<
div
className=
"nav-user"
>
...
@@ -165,12 +166,16 @@ const HeaderView: React.FC<{
...
@@ -165,12 +166,16 @@ const HeaderView: React.FC<{
登录
登录
</
Button
>
</
Button
>
)
}
)
}
<
Button
type=
{
'primary'
}
className=
"action-item"
>
<
QrcodePopover
path=
{
'page-service/service-flyer/index'
}
>
发布需求
<
Button
type=
{
'primary'
}
className=
"action-item"
>
</
Button
>
发布任务
<
Button
type=
{
'primary'
}
className=
"action-item"
>
</
Button
>
加盟入驻
</
QrcodePopover
>
</
Button
>
<
QrcodePopover
path=
{
'page-identity/identity-list/index'
}
>
<
Button
type=
{
'primary'
}
className=
"action-item"
>
加盟入驻
</
Button
>
</
QrcodePopover
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
src/components/layout/index.tsx
浏览文件 @
ce8238b6
import
React
,
{
useState
}
from
'react'
;
import
React
from
'react'
;
import
{
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
useDispatch
,
useSelector
}
from
'react-redux'
;
import
ContentView
from
'@/components/layout/content'
;
import
ContentView
from
'@/components/layout/content'
;
import
FooterView
from
'@/components/layout/footer'
;
import
FooterView
from
'@/components/layout/footer'
;
...
@@ -13,8 +13,6 @@ const LayoutView: React.FC<{
...
@@ -13,8 +13,6 @@ const LayoutView: React.FC<{
children
?:
React
.
ReactNode
;
children
?:
React
.
ReactNode
;
placeholder
?:
boolean
;
placeholder
?:
boolean
;
}
>
=
({
children
,
placeholder
})
=>
{
}
>
=
({
children
,
placeholder
})
=>
{
// 打开二维码弹窗
const
[
qrcodeShow
,
setQrcodeShow
]
=
useState
<
boolean
>
(
false
);
// store
// store
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
// system
// system
...
@@ -22,10 +20,11 @@ const LayoutView: React.FC<{
...
@@ -22,10 +20,11 @@ const LayoutView: React.FC<{
(
state
:
RootState
)
=>
state
.
globalData
,
(
state
:
RootState
)
=>
state
.
globalData
,
)
as
GlobalDataState
;
)
as
GlobalDataState
;
// 关闭弹窗
// 关闭弹窗
const
handleClose
=
()
=>
{
const
handle
Modal
Close
=
()
=>
{
dispatch
(
dispatch
(
setGlobalData
({
setGlobalData
({
loginModalVisible
:
false
,
loginModalVisible
:
false
,
qrcodeModalVisible
:
false
,
}),
}),
);
);
};
};
...
@@ -47,12 +46,12 @@ const LayoutView: React.FC<{
...
@@ -47,12 +46,12 @@ const LayoutView: React.FC<{
{
/* 登录弹窗 */
}
{
/* 登录弹窗 */
}
<
LoginModalView
<
LoginModalView
open=
{
globalData
?.
loginModalVisible
}
open=
{
globalData
?.
loginModalVisible
}
onCancel=
{
handleClose
}
onCancel=
{
handle
Modal
Close
}
/>
/>
{
/* 功能正在完善中 */
}
{
/* 功能正在完善中 */
}
<
QrcodeModalView
<
QrcodeModalView
open=
{
qrcodeShow
}
open=
{
globalData
?.
qrcodeModalVisible
}
onCancel=
{
()
=>
setQrcodeShow
(
false
)
}
onCancel=
{
handleModalClose
}
/>
/>
</
LayoutWrap
>
</
LayoutWrap
>
);
);
...
...
src/components/qrcodeModal/index.tsx
浏览文件 @
ce8238b6
import
React
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Modal
}
from
'antd'
;
import
{
message
,
Modal
}
from
'antd'
;
import
{
useSelector
}
from
'react-redux'
;
import
styled
from
'styled-components'
;
import
styled
from
'styled-components'
;
import
{
CommonAPI
}
from
'@/api'
;
import
{
RootState
}
from
'@/store'
;
import
{
GlobalDataState
}
from
'@/store/module/globalData'
;
const
QrcodeModalView
=
({
open
,
onCancel
,
}:
{
open
:
boolean
;
onCancel
:
()
=>
void
;
})
=>
{
// system
const
globalData
=
useSelector
(
(
state
:
RootState
)
=>
state
.
globalData
,
)
as
GlobalDataState
;
// 登录二维码的地址
const
[
qrCodeData
,
setQrCodeData
]
=
useState
<
string
>
();
// 获取登录二维码
const
getQrcodeLogin
=
async
()
=>
{
// 获取二维码
const
res
=
await
CommonAPI
.
getAppletQRCode
({
page
:
globalData
?.
qrcodeModalPath
||
'pages/welcome/index'
,
scene
:
globalData
?.
qrcodeModalScene
||
'type=share'
,
});
if
(
res
&&
res
.
code
===
'200'
)
{
if
(
!
res
.
result
)
{
message
.
warning
(
'获取登录二维码失败'
);
return
;
}
// 设置当前登录的二维码
setQrCodeData
(
`data:image/png;base64,
${
res
.
result
}
`
);
}
};
// 组件挂载
useEffect
(()
=>
{
if
(
!
open
)
return
;
getQrcodeLogin
().
then
();
},
[
open
]);
return
(
<
Modal
title=
"提示"
open=
{
open
}
footer=
{
null
}
onCancel=
{
onCancel
}
width=
{
350
}
>
<
QrcodeModalWrap
>
<
div
className=
"qrcode"
>
{
qrCodeData
&&
(
<
img
className=
"animate__animated animate__faster animate__fadeIn"
style=
{
{
width
:
'100%'
,
height
:
'100%'
}
}
src=
{
qrCodeData
}
alt=
"云享飞小程序"
/>
)
}
</
div
>
<
div
className=
"title"
>
请前往小程序继续操作
</
div
>
</
QrcodeModalWrap
>
</
Modal
>
);
};
export
default
QrcodeModalView
;
export
const
QrcodeModalWrap
=
styled
.
div
`
export
const
QrcodeModalWrap
=
styled
.
div
`
position: relative;
position: relative;
...
@@ -14,11 +78,11 @@ export const QrcodeModalWrap = styled.div`
...
@@ -14,11 +78,11 @@ export const QrcodeModalWrap = styled.div`
padding-top: 1rem;
padding-top: 1rem;
.qrcode {
.qrcode {
width: 12.68rem;
width: 12.68rem;
height: 1
5
.68rem;
height: 1
2
.68rem;
background-image: url('https://file.iuav.com/file/sharefly-qrcode-wx.jpg');
//
background-image: url('https://file.iuav.com/file/sharefly-qrcode-wx.jpg');
//background-size: 100% 100%;
//background-size: 100% 100%;
background-size: cover;
//
background-size: cover;
background-position: center;
//
background-position: center;
}
}
.title {
.title {
color: #000;
color: #000;
...
@@ -27,21 +91,3 @@ export const QrcodeModalWrap = styled.div`
...
@@ -27,21 +91,3 @@ export const QrcodeModalWrap = styled.div`
font-weight: bold;
font-weight: bold;
}
}
`
;
`
;
const
QrcodeModalView
=
({
open
,
onCancel
,
}:
{
open
:
boolean
;
onCancel
:
()
=>
void
;
})
=>
{
return
(
<
Modal
title=
"提示"
open=
{
open
}
footer=
{
null
}
onCancel=
{
onCancel
}
>
<
QrcodeModalWrap
>
<
div
className=
"qrcode"
></
div
>
<
div
className=
"title"
>
功能正在完善中
</
div
>
<
div
className=
"title"
>
请前往小程序以获得更好体验
</
div
>
</
QrcodeModalWrap
>
</
Modal
>
);
};
export
default
QrcodeModalView
;
src/pages/cart/submit/[id].tsx
浏览文件 @
ce8238b6
...
@@ -3,7 +3,7 @@ import { Input } from 'antd';
...
@@ -3,7 +3,7 @@ import { Input } from 'antd';
import
Big
from
'big.js'
;
import
Big
from
'big.js'
;
import
{
GetServerSidePropsContext
}
from
'next'
;
import
{
GetServerSidePropsContext
}
from
'next'
;
import
{
useRouter
}
from
'next/router'
;
import
{
useRouter
}
from
'next/router'
;
import
{
useSelector
}
from
'react-redux'
;
import
{
use
Dispatch
,
use
Selector
}
from
'react-redux'
;
import
styled
from
'styled-components'
;
import
styled
from
'styled-components'
;
import
{
InterDataType
}
from
'@/api/interface'
;
import
{
InterDataType
}
from
'@/api/interface'
;
import
{
AppMallGoodsDetails
}
from
'@/api/interface/mall'
;
import
{
AppMallGoodsDetails
}
from
'@/api/interface/mall'
;
...
@@ -13,7 +13,7 @@ import LayoutView from '@/components/layout';
...
@@ -13,7 +13,7 @@ import LayoutView from '@/components/layout';
import
PaymentCheckout
from
'@/components/payment-checkout'
;
import
PaymentCheckout
from
'@/components/payment-checkout'
;
import
SubmitAddressView
from
'@/components/submit-comp/submit-address'
;
import
SubmitAddressView
from
'@/components/submit-comp/submit-address'
;
import
SubmitProductView
from
'@/components/submit-comp/submit-product'
;
import
SubmitProductView
from
'@/components/submit-comp/submit-product'
;
import
{
GlobalDataState
}
from
'@/store/module/globalData'
;
import
{
GlobalDataState
,
setGlobalData
}
from
'@/store/module/globalData'
;
import
{
formatMoney
}
from
'@/utils/money'
;
import
{
formatMoney
}
from
'@/utils/money'
;
// 商品详情类型
// 商品详情类型
...
@@ -44,6 +44,8 @@ const MallCartSubmitView: React.FC<{
...
@@ -44,6 +44,8 @@ const MallCartSubmitView: React.FC<{
}
>
=
({
productDetail
})
=>
{
}
>
=
({
productDetail
})
=>
{
// 路由钩子
// 路由钩子
const
router
=
useRouter
();
const
router
=
useRouter
();
// store
const
dispatch
=
useDispatch
();
// globalData
// globalData
const
globalData
=
useSelector
(
const
globalData
=
useSelector
(
(
state
:
any
)
=>
state
.
globalData
,
(
state
:
any
)
=>
state
.
globalData
,
...
@@ -69,6 +71,24 @@ const MallCartSubmitView: React.FC<{
...
@@ -69,6 +71,24 @@ const MallCartSubmitView: React.FC<{
const
productSpecNum
=
Big
(
globalData
?.
productSpecNum
||
1
);
const
productSpecNum
=
Big
(
globalData
?.
productSpecNum
||
1
);
return
salePrice
.
mul
(
productSpecNum
)?.
toNumber
();
return
salePrice
.
mul
(
productSpecNum
)?.
toNumber
();
};
};
// 提交订单
const
handleSubmit
=
()
=>
{
if
(
!
productDetail
?.
id
)
return
;
const
{
id
,
specId
,
type
}
=
router
.
query
as
{
[
key
:
string
]:
string
};
const
path
=
`k=
${
id
}
&sId=
${
specId
}
&sNum=
${
globalData
?.
productSpecNum
||
1
}
&
t
=
$
{
type
}
`;
dispatch(
setGlobalData({
qrcodeModalVisible: true,
qrcodeModalPath:
path.length >= 32
? 'page-product/product-detail/index'
: 'page-order/product-confirm/index',
qrcodeModalScene: path.length >= 32 ? `
id
=
$
{
id
}
` : path,
}),
);
};
return (
return (
<LayoutView>
<LayoutView>
<MallCartSubmitWrap>
<MallCartSubmitWrap>
...
@@ -110,8 +130,11 @@ const MallCartSubmitView: React.FC<{
...
@@ -110,8 +130,11 @@ const MallCartSubmitView: React.FC<{
</div>
</div>
<PaymentCheckout cost={getCheckoutPrice()} />
<PaymentCheckout cost={getCheckoutPrice()} />
</div>
</div>
<
div
className=
"checkout-submit select-none cursor-pointer"
>
<div
提交订单
className="checkout-submit select-none cursor-pointer"
onClick={handleSubmit}
>
{router?.query?.type === '1' ? '提交订单' : '提交意向'}
</div>
</div>
</div>
</div>
</MallCartSubmitWrap>
</MallCartSubmitWrap>
...
...
src/store/module/globalData.ts
浏览文件 @
ce8238b6
...
@@ -6,6 +6,9 @@ import { UserAddressSelectList } from '@/api/interface/user';
...
@@ -6,6 +6,9 @@ import { UserAddressSelectList } from '@/api/interface/user';
export
type
GlobalDataState
=
{
export
type
GlobalDataState
=
{
loginModalVisible
:
boolean
;
loginModalVisible
:
boolean
;
qrcodeModalVisible
:
boolean
;
qrcodeModalPath
?:
string
;
qrcodeModalScene
?:
string
;
userAddressList
?:
InterDataType
<
UserAddressSelectList
>
;
userAddressList
?:
InterDataType
<
UserAddressSelectList
>
;
userAddressSelectId
?:
number
;
userAddressSelectId
?:
number
;
productSpecNum
?:
number
;
productSpecNum
?:
number
;
...
@@ -13,6 +16,9 @@ export type GlobalDataState = {
...
@@ -13,6 +16,9 @@ export type GlobalDataState = {
const
initialState
:
GlobalDataState
=
{
const
initialState
:
GlobalDataState
=
{
loginModalVisible
:
false
,
loginModalVisible
:
false
,
qrcodeModalVisible
:
false
,
qrcodeModalPath
:
undefined
,
qrcodeModalScene
:
undefined
,
userAddressList
:
undefined
,
userAddressList
:
undefined
,
userAddressSelectId
:
undefined
,
userAddressSelectId
:
undefined
,
productSpecNum
:
undefined
,
productSpecNum
:
undefined
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论