Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenshaokai
jinfa-platform
Commits
7418f22f
Commit
7418f22f
authored
Nov 25, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:对接积分兑换
parent
1281ab95
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
47 deletions
+33
-47
index.tsx
src/pages/lxMall/commodity/index.tsx
+3
-4
index.tsx
src/pages/lxMall/index/index.tsx
+7
-10
LXShopLayout.tsx
src/pages/lxMall/layouts/LXShopLayout.tsx
+2
-8
index.tsx
src/pages/lxMall/pay/components/balance/index.tsx
+3
-6
index.tsx
src/pages/lxMall/pay/components/credit/index.tsx
+4
-4
index.tsx
src/pages/lxMall/pay/components/point/index.tsx
+5
-6
index.tsx
src/pages/lxMall/pointsMall/index.tsx
+4
-5
cryptoAes.ts
src/utils/cryptoAes.ts
+5
-4
No files found.
src/pages/lxMall/commodity/index.tsx
View file @
7418f22f
...
@@ -26,7 +26,7 @@ interface CommodityPropsType {
...
@@ -26,7 +26,7 @@ interface CommodityPropsType {
}
}
interface
f
ilterQuery
{
interface
F
ilterQuery
{
current
:
number
;
current
:
number
;
pageSize
:
number
;
pageSize
:
number
;
name
?:
string
;
name
?:
string
;
...
@@ -98,7 +98,7 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
...
@@ -98,7 +98,7 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
userInfo
&&
layoutType
===
LAYOUT_TYPE
.
mall
)
{
if
(
userInfo
&&
layoutType
===
LAYOUT_TYPE
.
mall
)
{
le
t
temp
=
JSON
.
parse
(
JSON
.
stringify
(
filterConfig
))
cons
t
temp
=
JSON
.
parse
(
JSON
.
stringify
(
filterConfig
))
temp
.
unshift
(
FILTER_TYPE
.
commonlyUsed
)
temp
.
unshift
(
FILTER_TYPE
.
commonlyUsed
)
setFilterConfig
(
temp
)
setFilterConfig
(
temp
)
}
}
...
@@ -108,7 +108,7 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
...
@@ -108,7 +108,7 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
},
[
layoutType
])
},
[
layoutType
])
const
fetchCommodityList
=
(
currentParam
?:
number
)
=>
{
const
fetchCommodityList
=
(
currentParam
?:
number
)
=>
{
let
param
:
f
ilterQuery
=
{
let
param
:
F
ilterQuery
=
{
current
:
currentParam
?
currentParam
:
current
,
current
:
currentParam
?
currentParam
:
current
,
pageSize
pageSize
}
}
...
@@ -149,7 +149,6 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
...
@@ -149,7 +149,6 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
break
break
}
}
//@ts-ignore
getFn
&&
getFn
(
param
,
{
headers
}).
then
(
res
=>
{
getFn
&&
getFn
(
param
,
{
headers
}).
then
(
res
=>
{
setLoading
(
false
)
setLoading
(
false
)
if
(
res
.
code
===
1000
)
{
if
(
res
.
code
===
1000
)
{
...
...
src/pages/lxMall/index/index.tsx
View file @
7418f22f
...
@@ -37,11 +37,10 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
...
@@ -37,11 +37,10 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
},
[
mallTemplateId
])
},
[
mallTemplateId
])
const
findFirstAdvertsByType
=
()
=>
{
const
findFirstAdvertsByType
=
()
=>
{
let
params
=
{
const
params
:
any
=
{
templateId
:
mallTemplateId
,
templateId
:
mallTemplateId
,
type
:
1
type
:
1
}
}
//@ts-ignore
PublicApi
.
getTemplatePlatformFindAdvertsByType
(
params
).
then
(
res
=>
{
PublicApi
.
getTemplatePlatformFindAdvertsByType
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
if
(
res
.
code
===
1000
)
{
setFirstAdvertList
(
res
.
data
)
setFirstAdvertList
(
res
.
data
)
...
@@ -50,11 +49,10 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
...
@@ -50,11 +49,10 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
}
}
const
findSecondAdvertsByType
=
()
=>
{
const
findSecondAdvertsByType
=
()
=>
{
let
params
=
{
const
params
:
any
=
{
templateId
:
mallTemplateId
,
templateId
:
mallTemplateId
,
type
:
2
type
:
2
}
}
//@ts-ignore
PublicApi
.
getTemplatePlatformFindAdvertsByType
(
params
).
then
(
res
=>
{
PublicApi
.
getTemplatePlatformFindAdvertsByType
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
if
(
res
.
code
===
1000
)
{
setSecondAdvertList
(
res
.
data
)
setSecondAdvertList
(
res
.
data
)
...
@@ -81,12 +79,11 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
...
@@ -81,12 +79,11 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
*/
*/
const
fetchCategoryById
=
(
categoryId
)
=>
{
const
fetchCategoryById
=
(
categoryId
)
=>
{
return
new
Promise
((
resolve
)
=>
{
return
new
Promise
((
resolve
)
=>
{
let
param
=
{
const
param
:
any
=
{
templateId
:
mallTemplateId
,
templateId
:
mallTemplateId
,
categoryId
categoryId
}
}
// @ts-ignore
PublicApi
.
getTemplatePlatformFindFirstCategoryDetail
(
param
).
then
(
res
=>
{
PublicApi
.
getTemplatePlatformFindFirstCategoryDetail
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
resolve
(
res
.
data
)
...
@@ -96,12 +93,12 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
...
@@ -96,12 +93,12 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
}
}
const
getCategoryComponents
=
async
()
=>
{
const
getCategoryComponents
=
async
()
=>
{
le
t
result
=
[]
cons
t
result
=
[]
le
t
firstCategory
:
any
=
await
fetchFirstCategory
()
cons
t
firstCategory
:
any
=
await
fetchFirstCategory
()
for
(
le
t
item
of
firstCategory
)
{
for
(
cons
t
item
of
firstCategory
)
{
if
(
item
.
id
)
{
if
(
item
.
id
)
{
le
t
categoryDetail
:
any
=
await
fetchCategoryById
(
item
.
id
)
cons
t
categoryDetail
:
any
=
await
fetchCategoryById
(
item
.
id
)
result
.
push
(
result
.
push
(
<
FloorLine
<
FloorLine
linkUrl=
{
`/commodity?categoryId=${item.id}&categoryName=${btoa(encodeURIComponent(item.name))}`
}
linkUrl=
{
`/commodity?categoryId=${item.id}&categoryName=${btoa(encodeURIComponent(item.name))}`
}
...
...
src/pages/lxMall/layouts/LXShopLayout.tsx
View file @
7418f22f
...
@@ -27,11 +27,6 @@ interface LXMallLayoutPropsType {
...
@@ -27,11 +27,6 @@ interface LXMallLayoutPropsType {
SiteStore
?:
any
;
SiteStore
?:
any
;
}
}
interface
queryType
{
shopId
:
number
;
memberId
:
number
;
}
const
LXShopLayout
:
React
.
FC
<
LXMallLayoutPropsType
>
=
(
props
)
=>
{
const
LXShopLayout
:
React
.
FC
<
LXMallLayoutPropsType
>
=
(
props
)
=>
{
const
{
children
,
location
}
=
props
const
{
children
,
location
}
=
props
...
@@ -56,7 +51,7 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
...
@@ -56,7 +51,7 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
const
getWebMallInfo
=
()
=>
{
const
getWebMallInfo
=
()
=>
{
const
shopInfo
=
GlobalConfig
.
web
.
shopInfo
const
shopInfo
=
GlobalConfig
.
web
.
shopInfo
le
t
webMallInfo
=
shopInfo
.
filter
(
item
=>
item
.
environment
===
1
&&
item
.
type
===
1
)[
0
]
cons
t
webMallInfo
=
shopInfo
.
filter
(
item
=>
item
.
environment
===
1
&&
item
.
type
===
1
)[
0
]
setMallInfo
(
webMallInfo
)
setMallInfo
(
webMallInfo
)
}
}
...
@@ -67,7 +62,6 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
...
@@ -67,7 +62,6 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
},
[
query
])
},
[
query
])
const
fetchShopInfo
=
(
memberId
)
=>
{
const
fetchShopInfo
=
(
memberId
)
=>
{
//@ts-ignore
PublicApi
.
getTemplateShopFindShop
({
memberId
}).
then
(
res
=>
{
PublicApi
.
getTemplateShopFindShop
({
memberId
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
if
(
res
.
code
===
1000
)
{
setShopInfo
(
res
.
data
)
setShopInfo
(
res
.
data
)
...
@@ -79,7 +73,7 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
...
@@ -79,7 +73,7 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
}
}
useEffect
(()
=>
{
useEffect
(()
=>
{
le
t
body
=
document
.
getElementsByTagName
(
'body'
)[
0
];
cons
t
body
=
document
.
getElementsByTagName
(
'body'
)[
0
];
if
(
shopInfo
)
{
if
(
shopInfo
)
{
body
.
className
=
shopInfo
.
fileName
?
`theme-shop-
${
shopInfo
.
fileName
}
`
:
templateName
;
body
.
className
=
shopInfo
.
fileName
?
`theme-shop-
${
shopInfo
.
fileName
}
`
:
templateName
;
}
else
{
}
else
{
...
...
src/pages/lxMall/pay/components/balance/index.tsx
View file @
7418f22f
...
@@ -43,12 +43,12 @@ const BablancePayWay: React.FC<BablancePayWayPropsType> = (props) => {
...
@@ -43,12 +43,12 @@ const BablancePayWay: React.FC<BablancePayWayPropsType> = (props) => {
},
[
orderInfo
,
payInfo
])
},
[
orderInfo
,
payInfo
])
const
fetchBalanceInfo
=
()
=>
{
const
fetchBalanceInfo
=
()
=>
{
let
param
=
{
const
param
:
any
=
{
payType
:
payInfo
.
ruleConfigurationId
,
payType
:
payInfo
.
ruleConfigurationId
,
parentMemberId
:
orderInfo
.
supplyMembersId
,
parentMemberId
:
orderInfo
.
supplyMembersId
,
parentMemberRoleId
:
orderInfo
.
supplyMembersRoleId
parentMemberRoleId
:
orderInfo
.
supplyMembersRoleId
}
}
//@ts-ignore
PublicApi
.
getPayAssetAccountGetUserBalance
(
param
).
then
(
res
=>
{
PublicApi
.
getPayAssetAccountGetUserBalance
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
if
(
res
.
code
===
1000
)
{
setBalanceInfo
(
res
.
data
)
setBalanceInfo
(
res
.
data
)
...
@@ -57,8 +57,6 @@ const BablancePayWay: React.FC<BablancePayWayPropsType> = (props) => {
...
@@ -57,8 +57,6 @@ const BablancePayWay: React.FC<BablancePayWayPropsType> = (props) => {
setPageLoading
(
false
)
setPageLoading
(
false
)
onChange
(
true
,
res
.
message
)
onChange
(
true
,
res
.
message
)
}
}
}).
catch
(()
=>
{
})
})
}
}
...
@@ -80,14 +78,13 @@ const BablancePayWay: React.FC<BablancePayWayPropsType> = (props) => {
...
@@ -80,14 +78,13 @@ const BablancePayWay: React.FC<BablancePayWayPropsType> = (props) => {
message
.
info
(
"请输入支付密码"
)
message
.
info
(
"请输入支付密码"
)
return
return
}
}
let
param
=
{
const
param
:
any
=
{
id
:
Number
(
orderId
),
id
:
Number
(
orderId
),
paymentInformationId
:
Number
(
payInfo
.
paymentInformationId
),
paymentInformationId
:
Number
(
payInfo
.
paymentInformationId
),
payTypeId
:
payInfo
.
paymentChannelsId
,
payTypeId
:
payInfo
.
paymentChannelsId
,
payPassword
:
encryptedByAES
(
payPassword
)
payPassword
:
encryptedByAES
(
payPassword
)
}
}
setConfirmLoading
(
true
)
setConfirmLoading
(
true
)
//@ts-ignore
PublicApi
.
postOrderPendingOrderPay
(
param
).
then
(
res
=>
{
PublicApi
.
postOrderPendingOrderPay
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
if
(
res
.
code
===
1000
)
{
message
.
destroy
()
message
.
destroy
()
...
...
src/pages/lxMall/pay/components/credit/index.tsx
View file @
7418f22f
...
@@ -10,6 +10,7 @@ import { numFormat } from '@/utils/numberFomat'
...
@@ -10,6 +10,7 @@ import { numFormat } from '@/utils/numberFomat'
import
{
linkToUrl
}
from
'../../utils'
import
{
linkToUrl
}
from
'../../utils'
import
{
LAYOUT_TYPE
}
from
'@/constants'
import
{
LAYOUT_TYPE
}
from
'@/constants'
import
styles
from
'./index.less'
import
styles
from
'./index.less'
import
{
encryptedByAES
}
from
'@/utils/cryptoAes'
import
{
message
,
Button
,
Spin
}
from
'antd'
import
{
message
,
Button
,
Spin
}
from
'antd'
interface
CreditPayWayPropsType
{
interface
CreditPayWayPropsType
{
...
@@ -43,7 +44,7 @@ const CreditPayWay: React.FC<CreditPayWayPropsType> = (props) => {
...
@@ -43,7 +44,7 @@ const CreditPayWay: React.FC<CreditPayWayPropsType> = (props) => {
},
[
orderInfo
])
},
[
orderInfo
])
const
fetchCreditInfo
=
()
=>
{
const
fetchCreditInfo
=
()
=>
{
let
param
=
{
const
param
:
any
=
{
parentMemberId
:
orderInfo
.
supplyMembersId
,
parentMemberId
:
orderInfo
.
supplyMembersId
,
parentMemberRoleId
:
orderInfo
.
supplyMembersRoleId
parentMemberRoleId
:
orderInfo
.
supplyMembersRoleId
}
}
...
@@ -77,14 +78,13 @@ const CreditPayWay: React.FC<CreditPayWayPropsType> = (props) => {
...
@@ -77,14 +78,13 @@ const CreditPayWay: React.FC<CreditPayWayPropsType> = (props) => {
message
.
error
(
"请输入支付密码"
)
message
.
error
(
"请输入支付密码"
)
return
return
}
}
let
param
=
{
const
param
:
any
=
{
id
:
Number
(
orderId
),
id
:
Number
(
orderId
),
paymentInformationId
:
Number
(
payInfo
.
paymentInformationId
),
paymentInformationId
:
Number
(
payInfo
.
paymentInformationId
),
payTypeId
:
payInfo
.
paymentChannelsId
,
payTypeId
:
payInfo
.
paymentChannelsId
,
payPassword
:
Number
(
payPassword
)
payPassword
:
encryptedByAES
(
payPassword
)
}
}
setConfirmLoading
(
true
)
setConfirmLoading
(
true
)
//@ts-ignore
PublicApi
.
postOrderPendingOrderPay
(
param
).
then
(
res
=>
{
PublicApi
.
postOrderPendingOrderPay
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
if
(
res
.
code
===
1000
)
{
message
.
destroy
()
message
.
destroy
()
...
...
src/pages/lxMall/pay/components/point/index.tsx
View file @
7418f22f
...
@@ -47,11 +47,11 @@ const PointPayWay: React.FC<PointPayWayPropsType> = (props) => {
...
@@ -47,11 +47,11 @@ const PointPayWay: React.FC<PointPayWayPropsType> = (props) => {
},
[
orderInfo
])
},
[
orderInfo
])
const
fetchPointInfo
=
()
=>
{
const
fetchPointInfo
=
()
=>
{
let
param
=
{
const
param
:
any
=
{
memberId
:
orderInfo
.
supplyMembersId
,
memberId
:
orderInfo
.
supplyMembersId
,
roleId
:
orderInfo
.
supplyMembersRoleId
roleId
:
orderInfo
.
supplyMembersRoleId
}
}
//@ts-ignore
PublicApi
.
getMemberBusinessLrcRightPointGet
(
param
).
then
(
res
=>
{
PublicApi
.
getMemberBusinessLrcRightPointGet
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
if
(
res
.
code
===
1000
)
{
setPointInfo
(
res
.
data
)
setPointInfo
(
res
.
data
)
...
@@ -60,8 +60,6 @@ const PointPayWay: React.FC<PointPayWayPropsType> = (props) => {
...
@@ -60,8 +60,6 @@ const PointPayWay: React.FC<PointPayWayPropsType> = (props) => {
setPageLoading
(
false
)
setPageLoading
(
false
)
onChange
(
true
,
res
.
message
)
onChange
(
true
,
res
.
message
)
}
}
}).
catch
(()
=>
{
})
})
}
}
...
@@ -83,14 +81,15 @@ const PointPayWay: React.FC<PointPayWayPropsType> = (props) => {
...
@@ -83,14 +81,15 @@ const PointPayWay: React.FC<PointPayWayPropsType> = (props) => {
message
.
error
(
"请输入支付密码"
)
message
.
error
(
"请输入支付密码"
)
return
return
}
}
let
param
=
{
const
param
:
any
=
{
id
:
Number
(
orderId
),
id
:
Number
(
orderId
),
relType
,
paymentInformationId
:
Number
(
payInfo
.
paymentInformationId
),
paymentInformationId
:
Number
(
payInfo
.
paymentInformationId
),
payTypeId
:
payInfo
.
paymentChannelsId
,
payTypeId
:
payInfo
.
paymentChannelsId
,
payPassword
:
encryptedByAES
(
payPassword
)
payPassword
:
encryptedByAES
(
payPassword
)
}
}
setConfirmLoading
(
true
)
setConfirmLoading
(
true
)
//@ts-ignore
PublicApi
.
postOrderPendingOrderPay
(
param
).
then
(
res
=>
{
PublicApi
.
postOrderPendingOrderPay
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
if
(
res
.
code
===
1000
)
{
message
.
destroy
()
message
.
destroy
()
...
...
src/pages/lxMall/pointsMall/index.tsx
View file @
7418f22f
import
React
,
{
useState
,
useEffect
}
from
'react'
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
CaretUpOutlined
,
CaretDownOutlined
,
UnorderedListOutlined
,
AppstoreOutlined
,
CloseOutlined
}
from
'@ant-design/icons'
import
{
CaretUpOutlined
,
CaretDownOutlined
,
CloseOutlined
}
from
'@ant-design/icons'
import
Filter
from
'../components/Filter'
import
Filter
from
'../components/Filter'
import
{
FILTER_TYPE
}
from
'@/constants'
import
{
FILTER_TYPE
}
from
'@/constants'
import
{
Pagination
}
from
'antd'
import
{
Pagination
}
from
'antd'
...
@@ -13,7 +13,7 @@ import { PublicApi } from '@/services/api'
...
@@ -13,7 +13,7 @@ import { PublicApi } from '@/services/api'
import
{
LAYOUT_TYPE
}
from
'@/constants'
import
{
LAYOUT_TYPE
}
from
'@/constants'
import
cx
from
'classnames'
import
cx
from
'classnames'
import
{
PostSearchShopEnterpriseGetCommodityListResponseDetail
}
from
'@/services/SearchApi'
import
{
PostSearchShopEnterpriseGetCommodityListResponseDetail
}
from
'@/services/SearchApi'
import
bannerImg
from
'@/assets/imgs/banner_2.png'
//
import bannerImg from '@/assets/imgs/banner_2.png'
import
styles
from
'./index.less'
import
styles
from
'./index.less'
interface
CommodityPropsType
{
interface
CommodityPropsType
{
...
@@ -23,7 +23,7 @@ interface CommodityPropsType {
...
@@ -23,7 +23,7 @@ interface CommodityPropsType {
shopId
:
number
;
shopId
:
number
;
}
}
interface
f
ilterQuery
{
interface
F
ilterQuery
{
current
:
number
;
current
:
number
;
pageSize
:
number
;
pageSize
:
number
;
name
?:
string
;
name
?:
string
;
...
@@ -73,7 +73,7 @@ const PointsMall: React.FC<CommodityPropsType> = (props) => {
...
@@ -73,7 +73,7 @@ const PointsMall: React.FC<CommodityPropsType> = (props) => {
},
[])
},
[])
const
fetchCommodityList
=
(
currentParam
?:
number
)
=>
{
const
fetchCommodityList
=
(
currentParam
?:
number
)
=>
{
let
param
:
f
ilterQuery
=
{
let
param
:
F
ilterQuery
=
{
current
:
currentParam
?
currentParam
:
current
,
current
:
currentParam
?
currentParam
:
current
,
pageSize
pageSize
}
}
...
@@ -98,7 +98,6 @@ const PointsMall: React.FC<CommodityPropsType> = (props) => {
...
@@ -98,7 +98,6 @@ const PointsMall: React.FC<CommodityPropsType> = (props) => {
break
break
}
}
//@ts-ignore
getFn
(
param
,
{
headers
}).
then
(
res
=>
{
getFn
(
param
,
{
headers
}).
then
(
res
=>
{
setLoading
(
false
)
setLoading
(
false
)
if
(
res
.
code
===
1000
)
{
if
(
res
.
code
===
1000
)
{
...
...
src/utils/cryptoAes.ts
View file @
7418f22f
import
CryptoJS
from
'crypto-js'
import
CryptoJS
from
'crypto-js'
var
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'GzSsyLingxi2.0.0'
);
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'GzSsyLingxi2.0.0'
);
// var iv = CryptoJS.enc.Utf8.parse('JlM6cyqmrC2zKNsx');
// var iv = CryptoJS.enc.Utf8.parse('JlM6cyqmrC2zKNsx');
/**
/**
...
@@ -8,8 +8,8 @@ var key = CryptoJS.enc.Utf8.parse('GzSsyLingxi2.0.0');
...
@@ -8,8 +8,8 @@ var key = CryptoJS.enc.Utf8.parse('GzSsyLingxi2.0.0');
* 加密方法
* 加密方法
*/
*/
export
const
encryptedByAES
=
(
source
:
string
)
=>
{
export
const
encryptedByAES
=
(
source
:
string
)
=>
{
var
password
=
CryptoJS
.
enc
.
Utf8
.
parse
(
source
);
const
password
=
CryptoJS
.
enc
.
Utf8
.
parse
(
source
);
var
encrypted
=
CryptoJS
.
AES
.
encrypt
(
password
,
key
,
{
mode
:
CryptoJS
.
mode
.
ECB
,
padding
:
CryptoJS
.
pad
.
Pkcs7
});
//CryptoJS.pad.Pkcs7
const
encrypted
=
CryptoJS
.
AES
.
encrypt
(
password
,
key
,
{
mode
:
CryptoJS
.
mode
.
ECB
,
padding
:
CryptoJS
.
pad
.
Pkcs7
});
//CryptoJS.pad.Pkcs7
return
encrypted
.
toString
()
// 加密后的base64
return
encrypted
.
toString
()
// 加密后的base64
}
}
...
@@ -18,6 +18,6 @@ export const encryptedByAES = (source: string) => {
...
@@ -18,6 +18,6 @@ export const encryptedByAES = (source: string) => {
* 解密方法
* 解密方法
*/
*/
export
const
decryptedByAES
=
(
source
:
string
)
=>
{
export
const
decryptedByAES
=
(
source
:
string
)
=>
{
var
decrypted
=
CryptoJS
.
AES
.
decrypt
(
source
,
key
,
{
mode
:
CryptoJS
.
mode
.
ECB
,
padding
:
CryptoJS
.
pad
.
Pkcs7
});
//CryptoJS.pad.Pkcs7
const
decrypted
=
CryptoJS
.
AES
.
decrypt
(
source
,
key
,
{
mode
:
CryptoJS
.
mode
.
ECB
,
padding
:
CryptoJS
.
pad
.
Pkcs7
});
//CryptoJS.pad.Pkcs7
return
decrypted
.
toString
(
CryptoJS
.
enc
.
Utf8
)
// 解密后的原始字符串
return
decrypted
.
toString
(
CryptoJS
.
enc
.
Utf8
)
// 解密后的原始字符串
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment