Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wecom-sidebar
Project
Project
Details
Activity
Releases
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
wanghuihui
wecom-sidebar
Commits
ae87d478
Commit
ae87d478
authored
Feb 21, 2022
by
Aivs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:接口对接
parent
dc3b17d7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
28 deletions
+66
-28
index.ts
src/api/index.ts
+9
-2
Home.tsx
src/pages/Home.tsx
+31
-8
Order.tsx
src/pages/Order.tsx
+19
-8
person.tsx
src/pages/person.tsx
+7
-10
No files found.
src/api/index.ts
View file @
ae87d478
...
@@ -3,8 +3,8 @@ import axios from 'axios'
...
@@ -3,8 +3,8 @@ import axios from 'axios'
axios
.
defaults
.
headers
[
'Content-Type'
]
=
'application/json;charset=UTF-8'
;
axios
.
defaults
.
headers
[
'Content-Type'
]
=
'application/json;charset=UTF-8'
;
// 后端地址
// 后端地址
// const baseURL = 'http://192.168.30.239:5000
'
const
baseURL
=
'http://192.168.30.83:8989
'
const
baseURL
=
'https://base.exploring.cn/test-engine-user-center'
//
const baseURL = 'https://base.exploring.cn/test-engine-user-center'
// const baseURL = 'https://base.exploring.cn/wecom-server'
// const baseURL = 'https://base.exploring.cn/wecom-server'
// 创建 axios 实例
// 创建 axios 实例
...
@@ -124,4 +124,11 @@ export const updateBaseInfoFromCompanyWx = async (data:any) => {
...
@@ -124,4 +124,11 @@ export const updateBaseInfoFromCompanyWx = async (data:any) => {
const
response
=
await
api
.
post
(
'/user_center/updateBaseInfoFromCompanyWx'
,
data
)
const
response
=
await
api
.
post
(
'/user_center/updateBaseInfoFromCompanyWx'
,
data
)
return
response
.
data
;
return
response
.
data
;
}
}
// 获取订单信息
export
const
getOrderInfoByWxId
=
async
(
params
:
any
)
=>
{
const
response
=
await
api
.
get
(
'/user_center/getOrderInfoByWxId'
,
{
params
})
return
response
.
data
;
}
export
default
api
export
default
api
src/pages/Home.tsx
View file @
ae87d478
import
React
,
{
FC
,
useEffect
,
useState
}
from
"react"
;
import
React
,
{
FC
,
useEffect
,
useState
}
from
"react"
;
import
Cookies
from
"js-cookie"
;
import
Cookies
from
"js-cookie"
;
import
{
getBaseInfoByWxId
,
addWxLabel
,
getWxLabel
,
deleteWxLabel
,
updateBaseInfoFromCompanyWx
}
from
"../api"
;
import
{
getBaseInfoByWxId
,
addWxLabel
,
getWxLabel
,
deleteWxLabel
,
updateBaseInfoFromCompanyWx
,
getOrderInfoByWxId
}
from
"../api"
;
import
{
Spin
,
Form
,
Input
,
Button
,
Select
,
Radio
,
Tag
}
from
"antd"
;
import
{
Spin
,
Form
,
Input
,
Button
,
Select
,
Radio
,
Tag
}
from
"antd"
;
import
{
SearchOutlined
,
DownOutlined
,
UpOutlined
,
RightOutlined
,
LeftOutlined
}
from
'@ant-design/icons'
;
import
{
SearchOutlined
,
DownOutlined
,
UpOutlined
,
RightOutlined
,
LeftOutlined
}
from
'@ant-design/icons'
;
import
'./../css/home.css'
import
'./../css/home.css'
// import jt from './../assets/images/jt.png'
// import jt from './../assets/images/jt.png'
import
{
jsSdk
}
from
"../index"
import
{
jsSdk
}
from
"../index"
import
{
Link
}
from
"react-router-dom"
;
import
{
useHistory
,
Link
,
withRouter
}
from
"react-router-dom"
;
// import { spawn } from "child_process";
// import { spawn } from "child_process";
const
Home
:
FC
=
()
=>
{
const
Home
:
FC
=
()
=>
{
const
history
=
useHistory
()
const
[
loading
]
=
useState
<
boolean
>
(
false
);
const
[
loading
]
=
useState
<
boolean
>
(
false
);
const
[
userId
,
setUserId
]
=
useState
<
any
>
(
''
);
const
[
userId
,
setUserId
]
=
useState
<
any
>
(
''
);
const
[
customInfoEdit
,
setCustomInfoEdit
]
=
useState
<
boolean
>
(
false
);
const
[
customInfoEdit
,
setCustomInfoEdit
]
=
useState
<
boolean
>
(
false
);
...
@@ -50,14 +51,14 @@ const Home: FC = () => {
...
@@ -50,14 +51,14 @@ const Home: FC = () => {
"4"
:
'其它'
"4"
:
'其它'
}
}
)
)
const
[
orderList
]
=
useState
<
any
>
(
const
[
orderList
,
setOrderList
]
=
useState
<
any
>
(
[
[
{
{
name
:
'戈有好物'
,
name
:
'戈有好物'
,
price
:
"2345.23"
price
:
"2345.23"
},
},
{
{
name
:
'
缤纷逍
客'
,
name
:
'
纷享销
客'
,
price
:
"12.09万"
price
:
"12.09万"
},
},
{
{
...
@@ -79,6 +80,7 @@ const [gyqList] = useState<any>(
...
@@ -79,6 +80,7 @@ const [gyqList] = useState<any>(
]
]
)
)
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
const
[
orderInfo
,
setOrderInfo
]
=
useState
<
any
>
([])
const
layout
=
{
const
layout
=
{
labelCol
:
{
span
:
8
},
labelCol
:
{
span
:
8
},
...
@@ -163,6 +165,7 @@ const layout = {
...
@@ -163,6 +165,7 @@ const layout = {
if
(
userInfo
.
data
&&
userInfo
.
data
.
labelList
){
if
(
userInfo
.
data
&&
userInfo
.
data
.
labelList
){
setLabels
([...
userInfo
.
data
.
labelList
])
setLabels
([...
userInfo
.
data
.
labelList
])
}
}
getorderInfo
(
res
.
userId
)
}
}
const
getWxLabels
=
async
()
=>
{
const
getWxLabels
=
async
()
=>
{
let
data
:
any
=
{
let
data
:
any
=
{
...
@@ -202,12 +205,32 @@ const layout = {
...
@@ -202,12 +205,32 @@ const layout = {
// const onSearch=()=>{
// const onSearch=()=>{
// }
// }
//获取订单信息
const
getorderInfo
=
async
(
id
:
any
)
=>
{
// const res = await jsSdk.invoke<{ userId?: string }>('getCurExternalContact', {})
// if (!res || !res.userId) return
// setUserId(res.userId)
let
data
:
any
=
{
wxId
:
id
}
const
orderInfo
=
await
getOrderInfoByWxId
(
data
)
let
orderItem
=
[...
orderList
]
orderItem
[
2
].
price
=
orderInfo
.
data
.
clientOrderPrice
orderItem
[
1
].
price
=
orderInfo
.
data
.
fxxkPrice
orderItem
[
0
].
price
=
orderInfo
.
data
.
gyhwPrice
setOrderList
(
orderItem
)
setOrderInfo
(
orderInfo
.
data
)
}
const
Goto
=
async
()
=>
{
console
.
log
(
orderInfo
,
"ddddddddddddddd"
)
// // 页面跳转方法
history
.
push
({
pathname
:
'/Order'
,
state
:
{
orderInfo
}})
}
useEffect
(()
=>
{
useEffect
(()
=>
{
getUserInfo
();
getUserInfo
();
getExternalUserInfo
()
getExternalUserInfo
()
getWxLabels
()
getWxLabels
()
},
)
},[]
)
// const { getFieldsValue,getFieldDecorator } = this.props.form;
// const { getFieldsValue,getFieldDecorator } = this.props.form;
return
(
return
(
...
@@ -402,7 +425,7 @@ const layout = {
...
@@ -402,7 +425,7 @@ const layout = {
<
p
className=
'word'
>
订单信息
</
p
>
<
p
className=
'word'
>
订单信息
</
p
>
{
/* <img src={jt} alt="" className="more" onClick={testClick}/> */
}
{
/* <img src={jt} alt="" className="more" onClick={testClick}/> */
}
<
Link
to=
"/order"
><
div
className=
"more"
><
RightOutlined
/></
div
></
Link
>
<
div
className=
"more"
onClick=
{
Goto
}
><
RightOutlined
/></
div
>
</
div
>
</
div
>
<
div
className=
"order"
>
<
div
className=
"order"
>
{
{
...
@@ -411,7 +434,7 @@ const layout = {
...
@@ -411,7 +434,7 @@ const layout = {
<
span
className=
"blackWord"
>
{
item
.
name
}
</
span
>
<
span
className=
"blackWord"
>
{
item
.
name
}
</
span
>
<
p
>
<
p
>
<
span
className=
'greyWord'
>
订单总额:
</
span
>
<
span
className=
'greyWord'
>
订单总额:
</
span
>
<
span
className=
'greenWord mgr50'
>
{
item
.
price
}
元
</
span
>
<
span
className=
'greenWord mgr50'
>
{
item
.
price
}
</
span
>
</
p
>
</
p
>
</
div
>
</
div
>
)
)
...
...
src/pages/Order.tsx
View file @
ae87d478
import
*
as
React
from
'react'
import
*
as
React
from
'react'
import
{
useState
}
from
'react'
import
{
FC
,
useEffect
,
useState
}
from
'react'
import
{
LeftOutlined
,
DownOutlined
,
RightOutlined
}
from
'@ant-design/icons'
;
import
{
LeftOutlined
,
DownOutlined
,
RightOutlined
}
from
'@ant-design/icons'
;
import
'./../css/order.css'
import
'./../css/order.css'
import
{
useHistory
,
Link
,
withRouter
}
from
'react-router-dom'
import
{
useHistory
,
Link
,
withRouter
}
from
'react-router-dom'
const
Order
:
React
.
FC
=
()
=>
{
const
Order
:
React
.
FC
=
()
=>
{
const
history
=
useHistory
()
const
history
:
any
=
useHistory
()
const
[
openFlag
,
setOpenFlag
]
=
useState
<
any
>
([
true
,
false
,
false
,
false
])
const
[
openFlag
,
setOpenFlag
]
=
useState
<
any
>
([
true
,
false
,
false
,
false
])
const
[
customData
,
setCustomData
]
=
useState
<
any
>
([
const
[
customData
,
setCustomData
]
=
useState
<
any
>
([
{
{
...
@@ -23,17 +23,28 @@ const Order: React.FC = () => {
...
@@ -23,17 +23,28 @@ const Order: React.FC = () => {
team
:
'AB队'
team
:
'AB队'
}
}
])
])
const
[
orderInfo
,
setOrderInfo
]
=
useState
<
any
>
([])
const
open
=
async
(
index
:
any
)
=>
{
const
open
=
async
(
index
:
any
)
=>
{
let
arr
=
[...
openFlag
]
let
arr
=
[...
openFlag
]
arr
[
index
]
=
!
arr
[
index
]
arr
[
index
]
=
!
arr
[
index
]
setOpenFlag
(
arr
)
setOpenFlag
(
arr
)
}
}
const
Goto
=
async
(
props
:
any
,
id
:
any
)
=>
{
//路由跳转过来携带的数据
const
GetRouterData
=
async
()
=>
{
console
.
log
(
history
,
'props'
)
setOrderInfo
(
history
.
location
.
state
.
orderInfo
)
setCustomData
(
history
.
location
.
state
.
orderInfo
.
clientOrderInfos
)
debugger
}
const
Goto
=
async
(
props
:
any
,
userItem
:
any
)
=>
{
// // 页面跳转方法
// // 页面跳转方法
history
.
push
({
pathname
:
'/Person'
,
state
:
{
id
}})
history
.
push
({
pathname
:
'/Person'
,
state
:
{
userItem
}})
}
}
useEffect
(()
=>
{
GetRouterData
();
},[]
)
return
(
return
(
<
div
>
<
div
>
<
div
className=
"orderItem"
><
LeftOutlined
/>
订单信息
</
div
>
<
div
className=
"orderItem"
><
LeftOutlined
/>
订单信息
</
div
>
...
@@ -51,13 +62,13 @@ const Order: React.FC = () => {
...
@@ -51,13 +62,13 @@ const Order: React.FC = () => {
<
div
className=
"flex spaceBetween pad20"
>
<
div
className=
"flex spaceBetween pad20"
>
<
div
className=
"game"
>
<
div
className=
"game"
>
<
p
className=
'greyWord'
>
赛事名称
</
p
>
<
p
className=
'greyWord'
>
赛事名称
</
p
>
<
p
>
{
e
.
n
ame
}
</
p
>
<
p
>
{
e
.
gobiN
ame
}
</
p
>
</
div
>
</
div
>
<
div
className=
"game"
>
<
div
className=
"game"
>
<
p
className=
'greyWord'
>
分组
</
p
>
<
p
className=
'greyWord'
>
分组
</
p
>
<
p
>
{
e
.
team
}
</
p
>
<
p
>
{
e
.
rolesName
}
</
p
>
</
div
>
</
div
>
<
div
className=
"jt"
onClick=
{
Goto
.
bind
(
this
,
e
.
id
)
}
><
RightOutlined
/></
div
>
<
div
className=
"jt"
onClick=
{
Goto
.
bind
(
this
,
e
)
}
><
RightOutlined
/></
div
>
</
div
>
</
div
>
):
null
):
null
}
}
...
...
src/pages/person.tsx
View file @
ae87d478
...
@@ -8,7 +8,7 @@ import { useHistory} from 'react-router-dom'
...
@@ -8,7 +8,7 @@ import { useHistory} from 'react-router-dom'
const
Person
:
React
.
FC
=
()
=>
{
const
Person
:
React
.
FC
=
()
=>
{
const
location
=
useHistory
()
const
location
:
any
=
useHistory
()
const
[
customData
,
setCustomData
]
=
useState
<
any
>
({
const
[
customData
,
setCustomData
]
=
useState
<
any
>
({
id
:
33599
id
:
33599
})
})
...
@@ -18,10 +18,12 @@ const Person: React.FC = () => {
...
@@ -18,10 +18,12 @@ const Person: React.FC = () => {
//路由跳转过来携带的数据
//路由跳转过来携带的数据
const
GetRouterData
=
async
()
=>
{
const
GetRouterData
=
async
()
=>
{
console
.
log
(
location
,
'props'
)
console
.
log
(
location
,
'props'
)
debugger
setCustomData
(
location
.
location
.
state
.
userItem
)
}
}
useEffect
(()
=>
{
useEffect
(()
=>
{
GetRouterData
()
GetRouterData
()
},
)
},
[]
)
return
(
return
(
<
div
>
<
div
>
{
/* <Top text={'dddd'}/> */
}
{
/* <Top text={'dddd'}/> */
}
...
@@ -34,15 +36,15 @@ const Person: React.FC = () => {
...
@@ -34,15 +36,15 @@ const Person: React.FC = () => {
</
div
>
</
div
>
<
div
className=
"flex spaceBetween"
>
<
div
className=
"flex spaceBetween"
>
<
p
className=
'leftword'
>
证件姓名:
</
p
>
<
p
className=
'leftword'
>
证件姓名:
</
p
>
<
p
className=
'rightword'
>
{
customData
.
id
}
</
p
>
<
p
className=
'rightword'
>
{
customData
.
id
CardName
}
</
p
>
</
div
>
</
div
>
<
div
className=
"flex spaceBetween"
>
<
div
className=
"flex spaceBetween"
>
<
p
className=
'leftword'
>
出生日期:
</
p
>
<
p
className=
'leftword'
>
出生日期:
</
p
>
<
p
className=
'rightword'
>
{
customData
.
id
}
</
p
>
<
p
className=
'rightword'
>
{
customData
.
birthDay
}
</
p
>
</
div
>
</
div
>
<
div
className=
"flex spaceBetween"
>
<
div
className=
"flex spaceBetween"
>
<
p
className=
'leftword'
>
微信号:
</
p
>
<
p
className=
'leftword'
>
微信号:
</
p
>
<
p
className=
'rightword'
>
{
customData
.
i
d
}
</
p
>
<
p
className=
'rightword'
>
{
customData
.
wxI
d
}
</
p
>
</
div
>
</
div
>
<
div
className=
"flex spaceBetween"
>
<
div
className=
"flex spaceBetween"
>
<
p
className=
'leftword'
>
赛事名称:
</
p
>
<
p
className=
'leftword'
>
赛事名称:
</
p
>
...
@@ -80,11 +82,6 @@ const Person: React.FC = () => {
...
@@ -80,11 +82,6 @@ const Person: React.FC = () => {
<
p
className=
'leftword'
>
昵称:
</
p
>
<
p
className=
'leftword'
>
昵称:
</
p
>
<
p
className=
'rightword'
>
{
customData
.
id
}
</
p
>
<
p
className=
'rightword'
>
{
customData
.
id
}
</
p
>
</
div
>
</
div
>
<
div
className=
"flex spaceBetween"
>
<
p
className=
'leftword'
>
性别:
</
p
>
<
p
className=
'rightword'
>
{
customData
.
id
}
</
p
>
</
div
>
<
div
className=
"flex spaceBetween"
>
<
div
className=
"flex spaceBetween"
>
<
p
className=
'leftword'
>
头像:
</
p
>
<
p
className=
'leftword'
>
头像:
</
p
>
<
img
className=
'avatar'
alt=
""
src=
""
></
img
>
<
img
className=
'avatar'
alt=
""
src=
""
></
img
>
...
...
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