Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TOSTUMI
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
Maple
TOSTUMI
Commits
3699ba57
Commit
3699ba57
authored
Oct 22, 2020
by
1271610056@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
物业费管理时间格式处理
parent
a1294638
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
255 additions
and
182 deletions
+255
-182
proxy.ts
config/proxy.ts
+6
-6
login.ts
src/models/login.ts
+26
-24
ChargeDetail.tsx
src/pages/PropertyManagement/ChargeDetail.tsx
+56
-50
Users.tsx
src/pages/UserManagement/LIFEUserManagement/Users.tsx
+1
-0
index.tsx
src/pages/user/login/index.tsx
+81
-54
login.ts
src/services/login.ts
+7
-6
time.ts
src/utils/time.ts
+78
-42
TOS WEB端 接口文档(word)(1).docx
项目文档/TOS WEB端 接口文档(word)(1).docx
+0
-0
~$S WEB端 接口文档(word)(1).docx
项目文档/~$S WEB端 接口文档(word)(1).docx
+0
-0
No files found.
config/proxy.ts
View file @
3699ba57
...
...
@@ -27,7 +27,7 @@ export default {
changeOrigin
:
true
,
pathRewrite
:
{
'^'
:
''
},
},
/* '/tos/': {
/* '/tos/': {
target: 'http://47.74.233.180:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
...
...
@@ -39,7 +39,7 @@ export default {
},
},
test
:
{
/* '/api/': {
/* '/api/': {
target: 'https://preview.pro.ant.design',
changeOrigin: true,
pathRewrite: { '^': '' },
...
...
@@ -87,11 +87,11 @@ export default {
pathRewrite
:
{
'^'
:
''
},
},
'/tos/'
:
{
target
:
'http://47.74.233.180:8651'
,
changeOrigin
:
true
,
pathRewrite
:
{
'^'
:
''
},
target
:
'http://47.74.233.180:8651'
,
changeOrigin
:
true
,
pathRewrite
:
{
'^'
:
''
},
},
/* '/tos/': {
/* '/tos/': {
target: 'http://localhost:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
...
...
src/models/login.ts
View file @
3699ba57
import
{
stringify
}
from
'querystring'
;
import
{
history
,
Reducer
,
Effect
}
from
'umi'
;
import
{
AccountLogin
,
AccountCheckLogin
,
AccountOut
}
from
'@/services/login'
;
import
{
AccountLogin
,
AccountCheckLogin
,
AccountOut
}
from
'@/services/login'
;
import
{
setAuthority
}
from
'@/utils/authority'
;
import
{
getPageQuery
}
from
'@/utils/utils'
;
...
...
@@ -24,11 +24,10 @@ export interface LoginModelType {
logout
:
Effect
;
};
reducers
:
{
changeLoginStatus
:
Reducer
<
StateType
>
;
changeLoginStatus
:
Reducer
<
StateType
>
;
};
}
const
Model
:
LoginModelType
=
{
namespace
:
'login'
,
...
...
@@ -36,7 +35,7 @@ const Model: LoginModelType = {
status
:
undefined
,
token
:
''
,
userName
:
''
,
password
:
''
,
password
:
''
,
},
reducers
:
{
...
...
@@ -48,9 +47,9 @@ const Model: LoginModelType = {
type
:
payload
.
type
,
};
},
saveToken
(
state
,
{
token
,
userName
,
password
})
{
return
{...
state
,
token
,
userName
,
password
}
}
saveToken
(
state
,
{
token
,
userName
,
password
})
{
return
{
...
state
,
token
,
userName
,
password
};
}
,
},
effects
:
{
...
...
@@ -61,20 +60,25 @@ const Model: LoginModelType = {
payload
:
response
,
});
// Login successfully response.status === 'ok'
if
(
response
.
token
!=
null
)
{
console
.
log
(
"用户名密码登录成功"
)
console
.
log
(
response
)
const
userMessage
=
yield
call
(
AccountCheckLogin
,
payload
);
//请求时间网络
console
.
log
(
userMessage
)
console
.
log
(
userMessage
.
token
)
setCookie
(
"token"
,
userMessage
.
token
)
if
(
response
.
token
!=
null
)
{
console
.
log
(
'用户名密码登录成功'
);
console
.
log
(
response
)
;
const
userMessage
=
yield
call
(
AccountCheckLogin
,
payload
);
//请求时间网络
console
.
log
(
userMessage
)
;
console
.
log
(
userMessage
.
token
)
;
setCookie
(
'token'
,
userMessage
.
token
);
// tosUserName: "admin"
// tosUserPhone: "18818881888"
setCookie
(
"name"
,
response
.
token
.
tosUserName
)
setCookie
(
"phone"
,
response
.
token
.
tosUserPhone
)
setCookie
(
"id"
,
response
.
token
.
id
)
console
.
log
(
"获取到Token:"
+
getCookie
(
"token"
))
yield
put
({
type
:
'saveToken'
,
token
:
userMessage
.
token
,
userName
:
payload
.
userName
,
password
:
payload
.
password
});
setCookie
(
'name'
,
response
.
token
.
tosUserName
);
setCookie
(
'phone'
,
response
.
token
.
tosUserPhone
);
setCookie
(
'id'
,
response
.
token
.
id
);
console
.
log
(
'获取到Token:'
+
getCookie
(
'token'
));
yield
put
({
type
:
'saveToken'
,
token
:
userMessage
.
token
,
userName
:
payload
.
userName
,
password
:
payload
.
password
,
});
const
urlParams
=
new
URL
(
window
.
location
.
href
);
const
params
=
getPageQuery
();
let
{
redirect
}
=
params
as
{
redirect
:
string
};
...
...
@@ -92,12 +96,12 @@ const Model: LoginModelType = {
}
history
.
replace
(
redirect
||
'/'
);
}
else
{
console
.
error
(
response
)
message
.
error
(
"Login Error! Username or Password is wrong!"
,
3
)
console
.
error
(
response
)
;
message
.
error
(
'Login Error! Username or Password is wrong!'
,
3
);
}
},
*
logout
({},
{
call
,
put
})
{
*
logout
({},
{
call
,
put
})
{
const
{
redirect
}
=
getPageQuery
();
// Note: There may be security issues, please note
// const response = yield call(AccountOut, payload);
...
...
@@ -111,8 +115,6 @@ const Model: LoginModelType = {
}
},
},
};
export
default
Model
;
src/pages/PropertyManagement/ChargeDetail.tsx
View file @
3699ba57
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
styles
from
'./ChargeDetail.less'
;
import
{
Input
,
Menu
,
Table
,
Space
,
Pagination
,
Tooltip
}
from
'antd'
;
import
{
Input
,
Menu
,
Table
,
Space
,
Pagination
,
Tooltip
}
from
'antd'
;
import
{
Link
,
useIntl
,
connect
,
Dispatch
}
from
'umi'
;
import
PDF
from
'react-pdf-js'
;
//
import
PDF
from
'react-pdf-js'
;
//
import
{
render
}
from
'react-dom'
;
import
{
Document
}
from
'react-pdf/dist/entry.webpack'
;
...
...
@@ -16,75 +15,82 @@ import { timestampToTime2 } from '../../utils/time';
import
TitleBack
from
'../../components/TitleBack/TitleBack'
;
const
ChargeDetail
=
(
props
:
any
)
=>
{
const
{
CurData
}
=
props
;
const
{
formatMessage
}
=
useIntl
();
const
[
scale
,
setState
]
=
useState
(
1.3
)
const
[
pages
,
setPages
]
=
useState
(
1
)
const
[
curpage
,
setCurpage
]
=
useState
(
1
)
const
[
scale
,
setState
]
=
useState
(
1.3
)
;
const
[
pages
,
setPages
]
=
useState
(
1
);
const
[
curpage
,
setCurpage
]
=
useState
(
1
);
const
pdfpages
=
(
pages
:
any
)
=>
{
setPages
(
pages
)
setPages
(
pages
);
//alert(pages)
}
}
;
const
lookup
=
()
=>
{
if
(
scale
==
1.3
)
{
setState
(
2
)
setState
(
2
)
;
}
else
{
setState
(
1.3
)
setState
(
1.3
)
;
}
}
}
;
const
pageChange
=
(
curpage
:
any
)
=>
{
setCurpage
(
curpage
)
}
setCurpage
(
curpage
)
;
}
;
const
goToReturn
=
()
=>
{
history
.
back
()
}
history
.
back
()
;
}
;
console
.
log
(
CurData
);
return
(
<
div
className=
{
styles
.
base
}
>
{
/* 组件 */
}
<
TitleBack
title=
"Payment Settings"
sublist=
{
[
'Upload Time '
+
timestampToTime2
(
CurData
.
updateTime
.
time
)]
}
/>
<
div
className=
{
styles
.
box2
}
>
<
div
className=
{
styles
.
item21
}
>
Project
</
div
>
<
div
className=
{
styles
.
item22
}
>
{
CurData
.
billName
}
</
div
>
<
div
className=
{
styles
.
item23
}
>
{
CurData
.
communityName
}
</
div
>
<
div
className=
{
styles
.
item234
}
>
#
</
div
>
<
div
className=
{
styles
.
item24
}
>
{
CurData
.
floorNumber
}
</
div
>
<
div
className=
{
styles
.
item245
}
>
——
</
div
>
<
div
className=
{
styles
.
item25
}
>
{
CurData
.
roomNumber
}
</
div
>
<
div
className=
{
styles
.
item26
}
>
{
CurData
.
tosOwnerName
}
</
div
>
</
div
>
<>
{
stringSplit
(
CurData
.
billFileUrl
,
"m/cash"
)
}
</>
<
div
className=
{
styles
.
box4
}
>
<
Pagination
simple
defaultCurrent=
{
curpage
}
total=
{
pages
*
10
}
onChange=
{
pageChange
}
/>
</
div
>
{
CurData
?
(
<>
<
TitleBack
title=
"Payment Settings"
sublist=
{
[
'Upload Time '
+
timestampToTime2
(
CurData
.
updateTime
.
time
)]
}
/>
<><
Tooltip
title=
{
scale
==
1.3
?
"点击放大查看"
+
CurData
.
billFileUrl
:
"还原视图"
}
>
<
div
className=
{
scale
==
1.3
?
styles
.
box3out
:
null
}
>
<
div
className=
{
scale
==
1.3
?
styles
.
box3
:
styles
.
box3of
}
onClick=
{
lookup
}
>
<
PDF
key=
"pdfjs"
file=
{
stringSplit
(
CurData
.
billFileUrl
,
"m/cash"
)
}
workerSrc
=
"
//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.228/pdf.worker.js" scale={scale} page={curpage} onDocumentComplete={pdfpages} />
</
div
>
</
div
>
</
Tooltip
></>
<
div
className=
{
styles
.
box2
}
>
<
div
className=
{
styles
.
item21
}
>
Project (community)
</
div
>
<
div
className=
{
styles
.
item22
}
>
{
CurData
.
billName
}
</
div
>
<
div
className=
{
styles
.
item23
}
>
{
CurData
.
communityName
}
</
div
>
<
div
className=
{
styles
.
item24
}
>
{
CurData
.
floorNumber
}
</
div
>
<
div
className=
{
styles
.
item234
}
>
#
</
div
>
<
div
className=
{
styles
.
item25
}
>
{
CurData
.
roomNumber
}
</
div
>
<
div
className=
{
styles
.
item245
}
>
——
</
div
>
<
div
className=
{
styles
.
item26
}
>
{
CurData
.
tosOwnerName
}
</
div
>
</
div
>
<>
{
stringSplit
(
CurData
.
billFileUrl
,
'm/cash'
)
}
</>
<
div
className=
{
styles
.
box4
}
>
<
Pagination
simple
defaultCurrent=
{
curpage
}
total=
{
pages
*
10
}
onChange=
{
pageChange
}
/>
</
div
>
<>
<
Tooltip
title=
{
scale
==
1.3
?
'点击放大查看'
+
CurData
.
billFileUrl
:
'还原视图'
}
>
<
div
className=
{
scale
==
1.3
?
styles
.
box3out
:
null
}
>
<
div
className=
{
scale
==
1.3
?
styles
.
box3
:
styles
.
box3of
}
onClick=
{
lookup
}
>
<
PDF
key=
"pdfjs"
file=
{
stringSplit
(
CurData
.
billFileUrl
,
'm/cash'
)
}
workerSrc=
"//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.228/pdf.worker.js"
scale=
{
scale
}
page=
{
curpage
}
onDocumentComplete=
{
pdfpages
}
/>
</
div
>
</
div
>
</
Tooltip
>
</>
</>
)
:
null
}
</
div
>
);
};
function mapStateToProps(state:any)
{
const
{
CurData
}
=
state
.
PropertyManagement
;
function
mapStateToProps
(
state
:
any
)
{
const
{
CurData
}
=
state
.
PropertyManagement
;
return
{
CurData
CurData
,
};
}
export
default
connect
(
mapStateToProps
)(
ChargeDetail
);
src/pages/UserManagement/LIFEUserManagement/Users.tsx
View file @
3699ba57
...
...
@@ -157,6 +157,7 @@ const Users = (props:any) => {
ownerName
:
location
.
query
.
ownerName
!=
undefined
?
(
location
.
query
.
ownerName
)
:
null
,
communityArray
:
CommunityList
},
module
,
dispatch
);
console
.
log
(
"发送请求了123123123123123"
)
},[
location
])
...
...
src/pages/user/login/index.tsx
View file @
3699ba57
import
{
AlipayCircleOutlined
,
TaobaoCircleOutlined
,
WeiboCircleOutlined
,
ArrowLeftOutlined
}
from
'@ant-design/icons'
;
import
{
AlipayCircleOutlined
,
TaobaoCircleOutlined
,
WeiboCircleOutlined
,
ArrowLeftOutlined
,
}
from
'@ant-design/icons'
;
import
{
Alert
,
Checkbox
,
Input
}
from
'antd'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Link
,
connect
,
Dispatch
,
history
,
Redirect
}
from
'umi'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Link
,
connect
,
Dispatch
,
history
,
Redirect
}
from
'umi'
;
import
{
StateType
}
from
'@/models/login'
;
import
{
LoginParamsType
}
from
'@/services/login'
;
import
{
ConnectState
}
from
'@/models/connect'
;
...
...
@@ -22,80 +27,102 @@ const Login: React.FC<LoginProps> = (props) => {
const
{
status
,
type
:
loginType
}
=
userLogin
;
const
[
type
,
setType
]
=
useState
<
string
>
(
'account'
);
const
[
userName
,
setUsername
]
=
useState
(
""
);
const
[
password
,
setPasswd
]
=
useState
(
""
);
const
[
userName
,
setUsername
]
=
useState
(
''
);
const
[
password
,
setPasswd
]
=
useState
(
''
);
const
handleSubmit
=
(
values
:
LoginParamsType
)
=>
{
const
{
dispatch
}
=
props
;
console
.
log
({
...
values
,
type
,
userName
,
password
})
console
.
log
({
...
values
,
type
,
userName
,
password
});
console
.
log
(
props
);
console
.
log
(
dispatch
,
'dispatch'
);
dispatch
({
type
:
'login/login'
,
payload
:
{
userName
,
password
},
payload
:
{
userName
,
password
},
});
};
const
usernameHandle
=
(
e
:
any
)
=>
{
setUsername
(
e
.
target
.
value
)
}
setUsername
(
e
.
target
.
value
)
;
}
;
const
passwdHandle
=
(
e
:
any
)
=>
{
setPasswd
(
e
.
target
.
value
)
}
setPasswd
(
e
.
target
.
value
)
;
}
;
const
returnHandle
=
(
e
:
any
)
=>
{
history
.
push
(
"/user/login"
)
}
const
gotoForgetHandle
=
(
e
:
any
)
=>
{
history
.
push
(
"/user/forget"
)
}
const
returnHandle
=
(
e
:
any
)
=>
{
history
.
push
(
'/user/login'
);
}
;
const
gotoForgetHandle
=
(
e
:
any
)
=>
{
history
.
push
(
'/user/forget'
);
}
;
const
{
location
}
=
props
;
const
[
forgetflag
,
setForgetFlag
]
=
useState
(
false
)
useEffect
(()
=>
{
const
handleSend
=
(
e
:
any
)
=>
{
console
.
log
(
'触发了发送事件'
,
e
);
console
.
log
(
password
);
if
(
password
!==
''
&&
/^
[
a-z0-9
]
+
([
._
\\
-
]
*
[
a-z0-9
])
*@
([
a-z0-9
]
+
[
-a-z0-9
]
*
[
a-z0-9
]
+.
){1,63}[
a-z0-9
]
+$/
.
test
(
password
)
)
{
console
.
log
(
'邮箱正确!'
);
}
else
{
console
.
log
(
'邮箱格式错误!'
);
}
};
if
(
location
.
pathname
==
"/user/forget"
)
{
setForgetFlag
(
true
)
const
{
location
}
=
props
;
const
[
forgetflag
,
setForgetFlag
]
=
useState
(
false
);
useEffect
(()
=>
{
if
(
location
.
pathname
==
'/user/forget'
)
{
setForgetFlag
(
true
);
}
else
{
setForgetFlag
(
false
)
}
setForgetFlag
(
false
)
;
}
},
[
location
.
pathname
]);
return
(
<
div
>
{
forgetflag
?(
<
div
style=
{
{
position
:
"absolute"
,
top
:
-
50
,
cursor
:
"pointer"
}
}
onClick=
{
returnHandle
}
><
ArrowLeftOutlined
style=
{
{
fontSize
:
'28px'
}
}
/></
div
>
):(<
div
/>)
}
{
forgetflag
?
(
<
div
style=
{
{
position
:
'absolute'
,
top
:
-
50
,
cursor
:
'pointer'
}
}
onClick=
{
returnHandle
}
>
<
ArrowLeftOutlined
style=
{
{
fontSize
:
'28px'
}
}
/>
</
div
>
)
:
(
<
div
/>
)
}
<
LoginForm
activeKey=
{
type
}
onTabChange=
{
setType
}
onSubmit=
{
handleSubmit
}
>
<
div
className=
{
styles
.
box1
}
>
Account Number
</
div
>
<
input
className=
{
styles
.
input
}
onChange=
{
usernameHandle
}
/>
<
div
className=
{
styles
.
box1
}
>
{
forgetflag
?(
"Next"
):(
"Password"
)
}
</
div
>
{
forgetflag
?
(
<
div
className=
{
styles
.
box2
}
>
<
input
className=
{
styles
.
input5
}
onChange=
{
passwdHandle
}
type=
"password"
/>
<
div
className=
{
styles
.
button2
}
style=
{
{
float
:
"right"
}
}
>
Send
</
div
>
<
input
className=
{
styles
.
input
}
onChange=
{
usernameHandle
}
/>
<
div
className=
{
styles
.
box1
}
>
{
forgetflag
?
'Please enter email address'
:
'Password'
}
</
div
>
{
forgetflag
?
(
<
div
className=
{
styles
.
box2
}
>
<
input
className=
{
styles
.
input5
}
onChange=
{
passwdHandle
}
/>
<
div
className=
{
styles
.
button2
}
style=
{
{
float
:
'right'
}
}
onClick=
{
handleSend
}
>
Send
</
div
>
</
div
>
)
:
(
)
:
(
<
div
>
<
input
className=
{
styles
.
input2
}
onChange=
{
passwdHandle
}
type=
"password"
/>
<
div
>
<
input
className=
{
styles
.
input2
}
onChange=
{
passwdHandle
}
type=
"password"
/>
<
div
>
<
div
className=
{
styles
.
input3
}
onClick=
{
gotoForgetHandle
}
>
Forget Password
</
div
>
<
div
className=
{
styles
.
input4
}
>
{
status
===
'error'
&&
loginType
===
'account'
&&
!
submitting
&&
(
<
div
>
Wrong account or password
</
div
>
)
}
</
div
>
</
div
>
<
div
className=
{
styles
.
input3
}
onClick=
{
gotoForgetHandle
}
>
Forget Password
</
div
>
<
div
className=
{
styles
.
input4
}
>
{
status
===
'error'
&&
loginType
===
'account'
&&
!
submitting
&&
(
<
div
>
Wrong account or password
</
div
>
)
}
</
div
>
</
div
>
)
}
<
Submit
className=
{
styles
.
button
}
loading=
{
submitting
}
style=
{
{
width
:
330
}
}
>
{
forgetflag
?(
"Next"
):(
"登录"
)
}
</
Submit
>
</
div
>
)
}
<
Submit
className=
{
styles
.
button
}
loading=
{
submitting
}
style=
{
{
width
:
330
}
}
>
{
forgetflag
?
'Next'
:
'登录'
}
</
Submit
>
</
LoginForm
>
</
div
>
);
};
export
default
connect
(({
login
,
loading
}:
ConnectState
)
=>
({
userLogin
:
login
,
submitting
:
loading
.
effects
[
'login/login'
],
}))(
Login
);
export
default
connect
(({
login
,
loading
}:
ConnectState
)
=>
{
return
{
userLogin
:
login
,
submitting
:
loading
.
effects
[
'login/login'
],
};
})(
Login
);
src/services/login.ts
View file @
3699ba57
...
...
@@ -17,12 +17,13 @@ export async function getFakeCaptcha(mobile: string) {
}
export
async
function
AccountLogin
(
params
:
LoginParamsType
)
{
console
.
log
(
"登录请求"
)
return
request
(
'/tos/user/login'
,
{
method
:
'POST'
,
data
:
params
,
});
console
.
log
(
'登录请求'
);
console
.
log
(
params
);
return
request
(
'/tos/user/login'
,
{
method
:
'POST'
,
data
:
params
});
}
export
async
function
AccountOut
()
{
return
request
(
'/tos/user/login'
,
{
method
:
'POST'
});
return
request
(
'/tos/user/login'
,
{
method
:
'POST'
});
}
export
interface
LoginCheckParamsType
{
userName
:
string
;
...
...
@@ -31,6 +32,6 @@ export interface LoginCheckParamsType {
userId
:
string
;
}
export
async
function
AccountCheckLogin
(
params
:
LoginCheckParamsType
)
{
console
.
log
(
"登录确认请求"
)
return
request
(
'/tos/user/newCurrentUser'
,
{
method
:
'POST'
,
data
:
params
,
});
}
\ No newline at end of file
console
.
log
(
'登录确认请求'
);
return
request
(
'/tos/user/newCurrentUser'
,
{
method
:
'POST'
,
data
:
params
});
}
src/utils/time.ts
View file @
3699ba57
import
moment
from
'moment'
;
const
format
=
'HH:mm'
;
//2020/7/14/18:09:00
export
const
timestampToTime2
=
(
timestamp
:
any
)
=>
{
var
date
=
new
Date
(
timestamp
);
//*1000//getHours getMinutes getSeconds
export
const
timestampToTime2
=
(
timestamp
:
any
)
=>
{
var
date
=
new
Date
(
timestamp
);
//*1000//getHours getMinutes getSeconds
return
(
date
.
getFullYear
()
+
'/'
+
(
date
.
getMonth
()
+
1
<
10
?
'0'
+
(
date
.
getMonth
()
+
1
)
:
date
.
getMonth
()
+
1
)
+
' '
+
date
.
getDate
()
);
// return date.getFullYear()+'/' + (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + ' '+date.getDate()+' '+date.getHours()+':'+date.getMinutes()+':'+date.getSeconds()
};
return
date
.
getFullYear
()
+
'/'
+
(
date
.
getMonth
()
+
1
<
10
?
'0'
+
(
date
.
getMonth
()
+
1
)
:
date
.
getMonth
()
+
1
)
+
' '
+
date
.
getDate
()
+
' '
+
date
.
getHours
()
+
':'
+
date
.
getMinutes
()
+
':'
+
date
.
getSeconds
()
}
//月份补零
function
addTZero
(
time
)
{
let
tmp
=
time
+
1
<
10
?
'0'
+
(
time
+
1
)
:
(
time
+
1
)
return
tmp
let
tmp
=
time
+
1
<
10
?
'0'
+
(
time
+
1
)
:
time
+
1
;
return
tmp
;
}
function
addZero
(
time
)
{
let
tmp
=
time
+
1
<
10
?
'0'
+
time
:
time
return
tmp
let
tmp
=
time
+
1
<
10
?
'0'
+
time
:
time
;
return
tmp
;
}
const
month
=
(
"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sept,Oct,Nov,Dec"
).
split
(
","
)
const
MonthTurnNum
=
(
values
:
any
)
=>
{
const
month
=
'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sept,Oct,Nov,Dec'
.
split
(
','
);
const
MonthTurnNum
=
(
values
:
any
)
=>
{
var
i
=
0
;
month
.
map
((
item
,
index
)
=>
{
if
(
values
==
item
)
{
i
=
index
+
1
i
=
index
+
1
;
}
})
return
i
}
export
const
getStringToTime
=
(
time
:
any
)
=>
{
var
date
=
time
.
split
(
" "
)
var
result
=
addTZero
(
MonthTurnNum
(
date
[
0
]))
+
"-"
+
addZero
(
parseInt
(
date
[
1
].
slice
(
0
,
date
[
1
].
length
-
1
)))
+
" "
+
date
[
2
]
return
result
}
});
return
i
;
};
export
const
getStringToTime
=
(
time
:
any
)
=>
{
var
date
=
time
.
split
(
' '
);
var
result
=
addTZero
(
MonthTurnNum
(
date
[
0
]))
+
'-'
+
addZero
(
parseInt
(
date
[
1
].
slice
(
0
,
date
[
1
].
length
-
1
)))
+
' '
+
date
[
2
];
return
result
;
};
//03-08-2020 13:26
export
const
timestampToTime4
=
(
timestamp
:
any
)
=>
{
var
date
=
new
Date
(
timestamp
);
//*1000//getHours getMinutes getSeconds
var
date
=
new
Date
(
timestamp
);
//*1000//getHours getMinutes getSeconds
return
addZero
(
date
.
getDate
())
+
'-'
+
(
date
.
getMonth
()
+
1
<
10
?
'0'
+
(
date
.
getMonth
()
+
1
)
:
date
.
getMonth
()
+
1
)
+
'-'
+
date
.
getFullYear
()
+
' '
+
addZero
(
date
.
getHours
())
+
':'
+
addZero
(
date
.
getMinutes
())
}
return
(
addZero
(
date
.
getDate
())
+
'-'
+
(
date
.
getMonth
()
+
1
<
10
?
'0'
+
(
date
.
getMonth
()
+
1
)
:
date
.
getMonth
()
+
1
)
+
'-'
+
date
.
getFullYear
()
+
' '
+
addZero
(
date
.
getHours
())
+
':'
+
addZero
(
date
.
getMinutes
())
);
};
// 03-06 13:26
export
const
timestampToTime3
=
(
timestamp
:
any
)
=>
{
var
date
=
new
Date
(
timestamp
);
//*1000//getHours getMinutes getSeconds
export
const
timestampToTime3
=
(
timestamp
:
any
)
=>
{
var
date
=
new
Date
(
timestamp
);
//*1000//getHours getMinutes getSeconds
return
addZero
(
date
.
getDate
())
+
'-'
+
addTZero
(
date
.
getMonth
())
+
' '
+
addZero
(
date
.
getHours
())
+
':'
+
addZero
(
date
.
getMinutes
());
}
return
(
addZero
(
date
.
getDate
())
+
'-'
+
addTZero
(
date
.
getMonth
())
+
' '
+
addZero
(
date
.
getHours
())
+
':'
+
addZero
(
date
.
getMinutes
())
);
};
// 03-08-2020
export
const
timestampToTime
=
(
timestamp
:
any
)
=>
{
var
date
=
new
Date
(
timestamp
);
//*1000//getHours getMinutes getSeconds
var
date
=
new
Date
(
timestamp
);
//*1000//getHours getMinutes getSeconds
return
addZero
(
date
.
getDate
())
+
'-'
+
(
date
.
getMonth
()
+
1
<
10
?
'0'
+
(
date
.
getMonth
()
+
1
)
:
date
.
getMonth
()
+
1
)
+
'-'
+
date
.
getFullYear
();
}
return
(
addZero
(
date
.
getDate
())
+
'-'
+
(
date
.
getMonth
()
+
1
<
10
?
'0'
+
(
date
.
getMonth
()
+
1
)
:
date
.
getMonth
()
+
1
)
+
'-'
+
date
.
getFullYear
()
);
};
//时间转换
// 时间的拆分 var tmp = ["10:00-12:00", "13:00-14:00"]
export
const
timeToMoment
=
(
tmp
:
any
)
=>
{
if
(
tmp
==
null
)
return
null
if
(
tmp
==
null
)
return
null
;
// var result = new Array()
// tmp.map((item:any, index:any) => {
// var piece = item.split('-')
// result.push([moment(piece[0], format), moment(piece[1], format)])
// })
// return result;
var
piece
=
tmp
.
split
(
'-'
)
return
[
moment
(
piece
[
0
],
format
),
moment
(
piece
[
1
],
format
)]
}
var
piece
=
tmp
.
split
(
'-'
)
;
return
[
moment
(
piece
[
0
],
format
),
moment
(
piece
[
1
],
format
)]
;
}
;
export
const
MomentToTime
=
(
tmp
:
any
)
=>
{
if
(
tmp
==
null
)
return
null
export
const
MomentToTime
=
(
tmp
:
any
)
=>
{
if
(
tmp
==
null
)
return
null
;
return
(
tmp
.
format
(
"YYYY-MM-DD HH:mm:ss"
))
}
export
const
TimeToMoment2
=
(
tmp
:
any
)
=>
{
if
(
tmp
==
null
)
return
null
return
tmp
.
format
(
'YYYY-MM-DD HH:mm:ss'
);
}
;
export
const
TimeToMoment2
=
(
tmp
:
any
)
=>
{
if
(
tmp
==
null
)
return
null
;
return
moment
(
tmp
,
"YYYY-MM-DD HH:mm:ss"
)
}
return
moment
(
tmp
,
'YYYY-MM-DD HH:mm:ss'
);
}
;
项目文档/TOS WEB端 接口文档(word)(1).docx
deleted
100644 → 0
View file @
a1294638
File deleted
项目文档/~$S WEB端 接口文档(word)(1).docx
deleted
100644 → 0
View file @
a1294638
File deleted
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