Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
adc98325
Commit
adc98325
authored
Dec 01, 2020
by
wufan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:完善axios
parent
3742cffc
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
48 deletions
+49
-48
src/common/js/axios.ts
+8
-17
src/common/js/service.ts
+7
-10
src/common/js/user.ts
+8
-12
src/data-source/store/request-apis.ts
+1
-1
src/domains/basic-domain/constants.ts
+4
-3
src/index.tsx
+20
-4
src/modules/store-manege/EmployeesManagePage.tsx
+1
-1
No files found.
src/common/js/axios.ts
View file @
adc98325
/*
/*
* @Author: 吴文洁
* @Author: 吴文洁
* @Date: 2020-08-31 09:34:31
* @Date: 2020-08-31 09:34:31
* @LastEditors:
吴文洁
* @LastEditors:
wufan
* @LastEditTime: 2020-
08-31 09:35:36
* @LastEditTime: 2020-
12-01 15:25:04
* @Description:
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
*/
...
@@ -32,28 +32,19 @@ class Axios {
...
@@ -32,28 +32,19 @@ class Axios {
params
:
any
,
params
:
any
,
options
:
FetchOptions
=
{
requestType
:
'json'
}
options
:
FetchOptions
=
{
requestType
:
'json'
}
):
Promise
<
any
>
{
):
Promise
<
any
>
{
const
_url
=
`
${
url
}
?
p=w&v=v
${
VERSION
}
&userType=
${
USER_TYPE
}
&token=
${
User
.
getToken
()}
&uid=
${
User
.
getUid
()}
&tid=
${
User
.
getTid
()}
&aid=
${
User
.
getAid
()
}
`
;
const
_url
=
`
${
url
}
?
storeId=
${
USER_TYPE
}
&token=
${
User
.
getToken
()}
&storeUserId=
${
User
.
getStoreUserId
()}
&userId=
${
User
.
getUserId
()}
}`
;
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
{
NewVersion
=
"5.0"
,
currentUserInstInfo
}
=
window
;
// const { instId } = currentUserInstInfo;
const
instance
:
AxiosInstance
=
axios
.
create
({
const
instance
:
AxiosInstance
=
axios
.
create
({
timeout
:
TIME_OUT
,
timeout
:
TIME_OUT
,
responseType
:
'json'
,
responseType
:
'json'
,
headers
:
{
headers
:
{
instId
:
'123'
,
storeId
:
User
.
getStoreId
(),
p
:
'w'
,
storeUserId
:
User
.
getStoreUserId
(),
v
:
'VERSION'
,
userId
:
User
.
getUserId
(),
vn
:
`v
${
VERSION
}
`
,
project
:
PROJECT
,
userType
:
USER_TYPE
,
cid
:
User
.
getCid
(),
uid
:
User
.
getUid
(),
tid
:
User
.
getTid
(),
token
:
User
.
getToken
(),
token
:
User
.
getToken
(),
bizAccountId
:
User
.
getAid
(),
product
:
"xmCloudClass"
,
xmVersion
:
NewVersion
?
'5.0'
:
'4.0'
,
'Content-Type'
:
options
.
requestType
===
'form'
?
'application/x-www-form-urlencoded'
:
'application/json; charset=UTF-8'
,
'Content-Type'
:
options
.
requestType
===
'json'
?
'application/json; charset=UTF-8'
:
'application/x-www-form-urlencoded'
,
}
}
});
});
...
...
src/common/js/service.ts
View file @
adc98325
/*
/*
* @Author: 吴文洁
* @Author: 吴文洁
* @Date: 2020-08-31 09:34:51
* @Date: 2020-08-31 09:34:51
* @LastEditors:
吴文洁
* @LastEditors:
wufan
* @LastEditTime: 2020-
08-31 09:35:25
* @LastEditTime: 2020-
12-01 15:25:58
* @Description:
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
*/
...
@@ -19,23 +19,21 @@ class Service {
...
@@ -19,23 +19,21 @@ class Service {
return
Axios
.
post
(
'POST'
,
`apollo/
${
url
}
`
,
params
,
option
);
return
Axios
.
post
(
'POST'
,
`apollo/
${
url
}
`
,
params
,
option
);
}
}
static
Hades
(
url
:
string
,
params
:
any
,
option
?:
any
)
{
return
Axios
.
post
(
'POST'
,
`hades/
${
url
}
`
,
params
,
option
);
}
static
Sales
(
url
:
string
,
params
:
any
,
option
:
any
)
{
static
Sales
(
url
:
string
,
params
:
any
,
option
:
any
)
{
return
Axios
.
post
(
'POST'
,
`sales/
${
url
}
`
,
params
,
option
);
return
Axios
.
post
(
'POST'
,
`sales/
${
url
}
`
,
params
,
option
);
}
}
static
post
(
url
:
string
,
params
:
any
,
option
:
any
)
{
static
post
JSON
(
url
:
string
,
params
:
any
,
option
:
any
)
{
return
Axios
.
post
(
'POST'
,
url
,
params
,
option
);
return
Axios
.
post
(
'POST'
,
url
,
params
,
option
);
}
}
static
MFS
(
url
:
string
,
params
:
any
,
option
:
any
)
{
static
MFS
(
url
:
string
,
params
:
any
,
option
:
any
)
{
return
Axios
.
post
(
'POST'
,
`mfs/
${
url
}
`
,
params
,
option
);
return
Axios
.
post
(
'POST'
,
`mfs/
${
url
}
`
,
params
,
option
);
}
}
static
postJSON
(
url
:
string
,
params
:
any
,
option
:
any
)
{
option
=
option
||
{};
option
.
contentType
=
'application/json; charset=UTF-8'
;
return
Axios
.
post
(
'post'
,
url
,
JSON
.
stringify
(
params
),
option
);
}
}
}
export
default
Service
;
export
default
Service
;
\ No newline at end of file
src/common/js/user.ts
View file @
adc98325
/*
/*
* @Author: 吴文洁
* @Author: 吴文洁
* @Date: 2020-08-31 09:34:25
* @Date: 2020-08-31 09:34:25
* @LastEditors:
吴文洁
* @LastEditors:
wufan
* @LastEditTime: 2020-
08-31 09:54:34
* @LastEditTime: 2020-
12-01 10:36:59
* @Description:
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
*/
...
@@ -12,20 +12,16 @@ import { PREFIX } from '@/domains/basic-domain/constants';
...
@@ -12,20 +12,16 @@ import { PREFIX } from '@/domains/basic-domain/constants';
class
User
{
class
User
{
get
Uid
()
{
get
StoreId
()
{
return
Storage
.
get
(
`
${
PREFIX
}
_
uid`
)
||
'1115167164014264433'
;
return
Storage
.
get
(
`
${
PREFIX
}
_
storeId`
)
}
}
get
Aid
()
{
get
StoreUserId
()
{
return
Storage
.
get
(
`
${
PREFIX
}
_
aid`
)
||
'1298172751712686082'
;
return
Storage
.
get
(
`
${
PREFIX
}
_
storeUserId`
)
}
}
getTid
()
{
getUserId
(){
return
Storage
.
get
(
`
${
PREFIX
}
_tid`
)
||
'1298172751712686082'
;
return
Storage
.
get
(
`
${
PREFIX
}
_userId`
)
}
getCid
()
{
return
Storage
.
get
(
`
${
PREFIX
}
_cid`
);
}
}
getToken
()
{
getToken
()
{
...
...
src/data-source/store/request-apis.ts
View file @
adc98325
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: wufan
* @Author: wufan
* @Date: 2020-11-25 18:25:02
* @Date: 2020-11-25 18:25:02
* @LastEditors: wufan
* @LastEditors: wufan
* @LastEditTime: 2020-1
1-30 17:17:17
* @LastEditTime: 2020-1
2-01 15:26:12
* @Description: Description
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
*/
...
...
src/domains/basic-domain/constants.ts
View file @
adc98325
/*
/*
* @Author: 陈剑宇
* @Author: 陈剑宇
* @Date: 2020-05-07 14:43:01
* @Date: 2020-05-07 14:43:01
* @LastEditTime: 2020-1
1-09 09:52:03
* @LastEditTime: 2020-1
2-01 11:03:11
* @LastEditors:
吴文洁
* @LastEditors:
wufan
* @Description:
* @Description:
* @FilePath: /wheat-web-demo/src/domains/basic-domain/constants.ts
* @FilePath: /wheat-web-demo/src/domains/basic-domain/constants.ts
*/
*/
...
@@ -24,6 +24,6 @@ export const TIME_OUT: number = 20000;
...
@@ -24,6 +24,6 @@ export const TIME_OUT: number = 20000;
export
const
USER_TYPE
:
string
=
'B'
;
export
const
USER_TYPE
:
string
=
'B'
;
export
const
PROJECT
=
'xmzj-web-b'
;
export
const
PROJECT
=
'xmzj-web-b'
;
export
const
VERSION
=
'5.4.8'
;
export
const
VERSION
=
'5.4.8'
;
export
const
PREFIX
=
'
xiaomai
'
;
export
const
PREFIX
=
'
cloud-class
'
;
// host
// host
export
const
BASIC_HOST
:
string
=
BASIC_HOST_MAP
[
ENV
];
export
const
BASIC_HOST
:
string
=
BASIC_HOST_MAP
[
ENV
];
\ No newline at end of file
src/index.tsx
View file @
adc98325
...
@@ -2,22 +2,23 @@
...
@@ -2,22 +2,23 @@
* @Author: 吴文洁
* @Author: 吴文洁
* @Date: 2020-04-27 20:35:34
* @Date: 2020-04-27 20:35:34
* @LastEditors: wufan
* @LastEditors: wufan
* @LastEditTime: 2020-1
1-30 11:02:00
* @LastEditTime: 2020-1
2-01 15:23:22
* @Description:
* @Description:
*/
*/
import
React
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
ReactDOM
from
'react-dom'
;
import
ReactDOM
from
'react-dom'
;
import
{
HashRouter
}
from
'react-router-dom'
;
import
{
HashRouter
}
from
'react-router-dom'
;
import
{
ConfigProvider
}
from
'antd'
;
import
{
ConfigProvider
}
from
'antd'
;
import
{
createHashHistory
}
from
'history'
;
import
{
createHashHistory
}
from
'history'
;
import
zh_CN
from
'antd/es/locale/zh_CN'
;
import
zh_CN
from
'antd/es/locale/zh_CN'
;
import
_
from
'underscore'
;
import
_
from
'underscore'
;
import
axios
,
{
AxiosInstance
,
AxiosRequestConfig
,
AxiosResponse
,
AxiosPromise
}
from
'axios'
;
import
{
RootRouter
}
from
'./routes/index'
;
import
{
RootRouter
}
from
'./routes/index'
;
import
'antd/dist/antd.less'
;
import
'antd/dist/antd.less'
;
import
'@/common/less/index.less'
;
import
'@/common/less/index.less'
;
import
'@/core/function'
import
'@/core/function'
;
import
User
from
'@/common/js/user'
;
import
'@/common/less/index.less'
;
import
'@/common/less/index.less'
;
const
history
=
createHashHistory
();
const
history
=
createHashHistory
();
...
@@ -39,6 +40,21 @@ window.RCHistory = _.extend({}, history, {
...
@@ -39,6 +40,21 @@ window.RCHistory = _.extend({}, history, {
}
}
});
});
export
async
function
mount
()
{
export
async
function
mount
()
{
// useEffect(()=>{
// fetchUserInsts();
// })
// function fetchUserInsts(){
// const userId = User.getUserId();
// axios.post("hades/public/store/getUserStore",{ userId })
// .then((res: any) => {
// const { storeGroupVOS, storeVOS } = res.result;
// })
// }
ReactDOM
.
render
(
ReactDOM
.
render
(
<
RootRouter
/>,
<
RootRouter
/>,
document
.
getElementById
(
'root'
));
document
.
getElementById
(
'root'
));
...
...
src/modules/store-manege/EmployeesManagePage.tsx
View file @
adc98325
...
@@ -57,7 +57,7 @@ function EmployeesManagePage() {
...
@@ -57,7 +57,7 @@ function EmployeesManagePage() {
const
[
choosedItem
,
setChooseItem
]
=
useState
({});
const
[
choosedItem
,
setChooseItem
]
=
useState
({});
useEffect
(()
=>
{
useEffect
(()
=>
{
//
getEmployeeList();
getEmployeeList
();
},
[
query
]);
},
[
query
]);
function
getEmployeeList
()
{
function
getEmployeeList
()
{
...
...
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