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
ab4db4a8
Commit
ab4db4a8
authored
Nov 27, 2020
by
wufan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:增加mfs接口定义
parent
772e5991
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
167 additions
and
89 deletions
+167
-89
src/common/js/axios.ts
+0
-82
src/common/js/service.ts
+6
-1
src/components/Button.tsx
+47
-0
src/data-source/store/request-apis.ts
+3
-2
src/modules/store-manege/EmployeeAddOrEditModal.less
+0
-0
src/modules/store-manege/EmployeeAddOrEditModal.tsx
+88
-0
src/modules/store-manege/EmployeesManagePage.tsx
+22
-4
tsconfig.json
+1
-0
No files found.
src/common/js/axios.ts
View file @
ab4db4a8
...
...
@@ -105,91 +105,10 @@ class Axios {
})
})
}
}
export
default
Axios
;
/**
* @method fetch
* @description 封装get方法
* @param params
* @param url
* @returns { Promise }
*/
export
function
fetch
(
url
:
string
,
params
:
any
=
{},
verify
:
boolean
=
true
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
axios
.
get
(
url
,
{
params
:
verify
?
getVerifyParams
(
params
)
:
params
,
}).
then
((
response
)
=>
{
resolve
(
response
.
data
);
}).
catch
((
err
)
=>
{
reject
(
err
);
});
});
}
/**
* @method post
* @description 封装post方法
* @param data
* @param url
* @returns { Promise }
*/
export
function
post
(
url
:
string
,
data
:
any
=
{},
verify
:
boolean
=
true
)
{
const
params
=
verify
?
getVerifyParams
()
:
{};
const
stringifyData
=
qs
.
stringify
(
data
);
return
new
Promise
((
resolve
,
reject
)
=>
{
axios
.
post
(
url
,
stringifyData
,
{
params
,
}).
then
((
response
)
=>
{
resolve
(
response
.
data
);
}).
catch
((
err
)
=>
{
reject
(
err
);
});
});
}
/**
* @method getVerifyParams
* @description 如果需要验证则在请求参数上带上token和uid等参数
* @param data
* @returns { void }
*/
const
getVerifyParams
=
(
data
:
any
=
{})
=>
{
const
params
=
{
// aid: Storage.getAid(),
// tid: Storage.getTid(),
// token: Storage.getToken(),
// uid: Storage.getUid(),
};
return
Object
.
assign
({},
data
,
params
);
};
/**
* @method postJSON
* @description 封装postJSON方法
* @param data
* @param url
* @returns { Promise }
*/
export
function
postJSON
(
url
:
string
,
data
:
any
=
{},
verify
:
boolean
=
true
)
{
const
params
=
verify
?
getVerifyParams
()
:
{};
return
new
Promise
((
resolve
,
reject
)
=>
{
Axios
.
post
(
"post"
,
url
,
data
).
then
((
response
)
=>
{
resolve
(
response
.
data
);
}).
catch
((
err
)
=>
{
reject
(
err
);
});
});
}
export
function
Apollo
(
url
:
string
,
data
:
any
=
{},
verify
:
boolean
=
true
)
{
return
postJSON
(
`apollo/
${
url
}
`
,
data
,
verify
);
}
\ No newline at end of file
src/common/js/service.ts
View file @
ab4db4a8
...
...
@@ -15,7 +15,7 @@ class Service {
return
Axios
.
post
(
'POST'
,
`business/
${
url
}
`
,
params
,
option
);
}
static
Apollo
(
url
:
string
,
params
:
any
,
option
:
any
)
{
static
Apollo
(
url
:
string
,
params
:
any
,
option
?
:
any
)
{
return
Axios
.
post
(
'POST'
,
`apollo/
${
url
}
`
,
params
,
option
);
}
...
...
@@ -26,6 +26,10 @@ class Service {
static
post
(
url
:
string
,
params
:
any
,
option
:
any
)
{
return
Axios
.
post
(
'POST'
,
url
,
params
,
option
);
}
static
MFS
(
url
:
string
,
params
:
any
,
option
:
any
)
{
return
Axios
.
post
(
'POST'
,
`mfs/
${
url
}
`
,
params
,
option
);
}
}
export
default
Service
;
\ No newline at end of file
src/components/Button.tsx
0 → 100644
View file @
ab4db4a8
/*
* @Author: zhujian
* @Date: 2019-07-24 13:38:39
* @Last Modified by: 孙冰清
* @Last Modified time: 2019-07-25 14:19:26
*/
import
React
from
'react'
;
import
{
Button
}
from
'antd'
;
interface
ButtonProps
{
prefixCls
?:
'xm-btn'
;
disabled
?:
false
;
size
?:
any
;
style
?:
any
;
icon
?:
null
;
iconPosition
?:
'left'
;
title
?:
'Button'
;
onClick
?:
any
;
id
?:
string
;
children
?:
any
;
type
?:
any
;
}
const
XMButton
=
(
props
:
ButtonProps
)
=>
{
const
{
size
,
style
,
disabled
,
title
,
onClick
,
id
,
children
,
type
}
=
props
;
let
clickStatus
=
false
;
function
_onClick
():
void
{
if
(
clickStatus
)
{
return
;
}
clickStatus
=
true
;
onClick
&&
onClick
();
setTimeout
(()
=>
{
clickStatus
=
false
;
},
1000
);
}
return
(
<
Button
type=
{
type
}
style=
{
style
}
id=
{
id
}
size=
{
size
}
disabled=
{
disabled
}
onClick=
{
_onClick
}
>
{
title
||
children
}
</
Button
>
);
};
export
default
XMButton
;
src/data-source/store/request-apis.ts
View file @
ab4db4a8
import
{
Apollo
}
from
"@/common/js/axios
"
;
import
Service
from
"@/common/js/service
"
;
export
function
getEmployeeList
(
params
:
object
)
{
return
Apollo
(
"public/businessMicroWebsite/getMicroWebsiteCouponList"
,
params
);
return
Service
.
Apollo
(
"public/businessMicroWebsite/getMicroWebsiteCouponList"
,
params
);
}
\ No newline at end of file
src/modules/store-manege/EmployeeAddOrEditModal.less
0 → 100644
View file @
ab4db4a8
src/modules/store-manege/EmployeeAddOrEditModal.tsx
0 → 100644
View file @
ab4db4a8
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Modal
,
Form
,
Button
,
Input
}
from
'antd'
;
import
_
from
'underscore'
;
import
'./EmployeeAddOrEditModal.less'
;
declare
let
window
:
any
;
interface
AddEmployeeModalProps
{
isOpen
:
boolean
,
choosedItem
:{
name
?:
string
,
phone
?:
string
,
role
?:
string
,
avatar
?:
string
}
}
function
AddEmployeeModal
(
props
:
AddEmployeeModalProps
)
{
const
[
name
,
setName
]
=
useState
(
""
);
const
[
phone
,
setPhone
]
=
useState
(
""
);
const
[
role
,
setRole
]
=
useState
(
""
);
const
[
avatar
,
setavatar
]
=
useState
(
""
);
useEffect
(()
=>
{
if
(
props
.
choosedItem
.
name
){
setName
(
name
);
setPhone
(
phone
);
setRole
(
role
);
setavatar
(
avatar
)
}
},
[
props
.
choosedItem
])
const
layout
=
{
labelCol
:
{
span
:
8
},
wrapperCol
:
{
span
:
16
},
};
const
onFinish
=
(
values
:
any
)
=>
{
console
.
log
(
'Success:'
,
values
);
};
const
onFinishFailed
=
(
errorInfo
:
any
)
=>
{
console
.
log
(
'Failed:'
,
errorInfo
);
};
return
(
<
Modal
visible=
{
props
.
isOpen
}
footer=
{
null
}
className=
"employee-add-modal"
>
<
Form
{
...
layout
}
name=
"basic"
initialValues=
{
{
remember
:
true
}
}
onFinish=
{
onFinish
}
onFinishFailed=
{
onFinishFailed
}
>
<
Form
.
Item
label=
"员工姓名"
name=
"name"
rules=
{
[{
required
:
true
,
message
:
''
}]
}
>
<
Input
value=
{
name
}
placeholder=
"请输入员工名称"
maxLength=
{
15
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"手机号码"
name=
"name"
rules=
{
[{
required
:
true
,
message
:
''
}]
}
>
<
Input
value=
{
phone
}
placeholder=
"请输入手机号"
maxLength=
{
11
}
/>
</
Form
.
Item
>
</
Form
>
</
Modal
>
)
}
export
default
AddEmployeeModal
;
\ No newline at end of file
src/modules/store-manege/EmployeesManagePage.tsx
View file @
ab4db4a8
...
...
@@ -2,7 +2,7 @@
* @Author: wufan
* @Date: 2020-07-09 14:03:09
* @Last Modified by: mikey.zhaopeng
* @Last Modified time: 2020-11-2
6 17:00:47
* @Last Modified time: 2020-11-2
7 14:46:10
* 店铺管理-员工管理
*/
import
React
,
{
useEffect
,
useState
}
from
"react"
;
...
...
@@ -14,6 +14,7 @@ import { CheckBox } from "@/components";
import
{
Button
,
Table
,
Tooltip
,
Modal
,
message
,
Row
,
Col
,
Input
}
from
"antd"
;
import
{
storeRoleEnum
}
from
"@/domains/store-domain/constants"
;
import
StoreService
from
"@/domains/store-domain/storeService"
;
import
EmployeeAddOrEditModal
from
'./EmployeeAddOrEditModal'
;
import
"./EmployeesManagePage.less"
;
const
{
confirm
}
=
Modal
;
...
...
@@ -28,6 +29,11 @@ function EmployeesManagePage() {
phone
:
"18767118672"
,
identity
:
"0"
,
},
{
name
:
"吕布"
,
phone
:
"18767118672"
,
identity
:
"0"
,
}
]);
const
[
query
,
setQuery
]
=
useState
({
current
:
0
,
...
...
@@ -39,8 +45,10 @@ function EmployeesManagePage() {
});
const
[
total
,
setTotal
]
=
useState
(
0
);
const
[
model
,
setModel
]
=
useState
(
null
);
const
[
isModalOpen
,
setIsModalOpen
]
=
useState
(
false
);
const
[
isManager
,
setIsManager
]
=
useState
(
true
);
const
[
isNormal
,
setIsNormal
]
=
useState
(
true
);
const
[
choosedItem
,
setChooseItem
]
=
useState
({});
useEffect
(()
=>
{
getEmployeeList
();
...
...
@@ -113,11 +121,18 @@ function EmployeesManagePage() {
];
}
function
handleEditEmployee
(
record
:
object
)
{}
function
handleEditEmployee
(
record
:
object
)
{
setIsModalOpen
(
true
);
setChooseItem
(
record
);
}
function
handleDeleteEmployee
(
record
:
object
)
{
}
function
handleDeleteEmployee
(
record
:
object
)
{
function
handleToAddEmployee
()
{}
}
function
handleToAddEmployee
()
{
setIsModalOpen
(
true
);
}
function
handleQuery
(
name
:
string
,
value
:
any
)
{
const
_query
=
_
.
clone
(
query
);
...
...
@@ -228,6 +243,9 @@ function EmployeesManagePage() {
/>
</
div
>
</
div
>
{
isModalOpen
&&
<
EmployeeAddOrEditModal
isOpen=
{
isModalOpen
}
choosedItem=
{
choosedItem
}
/>
}
{
model
}
</
div
>
</
div
>
...
...
tsconfig.json
View file @
ab4db4a8
{
"compilerOptions"
:
{
"target"
:
"es5"
,
"experimentalDecorators"
:
true
,
"lib"
:
[
"dom"
,
"dom.iterable"
,
...
...
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