Commit 3699ba57 authored by 1271610056@qq.com's avatar 1271610056@qq.com

物业费管理时间格式处理

parent a1294638
import { stringify } from 'querystring'; import { stringify } from 'querystring';
import { history, Reducer, Effect } from 'umi'; 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 { setAuthority } from '@/utils/authority';
import { getPageQuery } from '@/utils/utils'; import { getPageQuery } from '@/utils/utils';
...@@ -28,7 +28,6 @@ export interface LoginModelType { ...@@ -28,7 +28,6 @@ export interface LoginModelType {
}; };
} }
const Model: LoginModelType = { const Model: LoginModelType = {
namespace: 'login', namespace: 'login',
...@@ -36,7 +35,7 @@ const Model: LoginModelType = { ...@@ -36,7 +35,7 @@ const Model: LoginModelType = {
status: undefined, status: undefined,
token: '', token: '',
userName: '', userName: '',
password:'', password: '',
}, },
reducers: { reducers: {
...@@ -48,9 +47,9 @@ const Model: LoginModelType = { ...@@ -48,9 +47,9 @@ const Model: LoginModelType = {
type: payload.type, type: payload.type,
}; };
}, },
saveToken(state, { token,userName,password }) { saveToken(state, { token, userName, password }) {
return{...state,token,userName,password} return { ...state, token, userName, password };
} },
}, },
effects: { effects: {
...@@ -61,20 +60,25 @@ const Model: LoginModelType = { ...@@ -61,20 +60,25 @@ const Model: LoginModelType = {
payload: response, payload: response,
}); });
// Login successfully response.status === 'ok' // Login successfully response.status === 'ok'
if (response.token !=null) { if (response.token != null) {
console.log("用户名密码登录成功") console.log('用户名密码登录成功');
console.log(response) console.log(response);
const userMessage = yield call(AccountCheckLogin, payload);//请求时间网络 const userMessage = yield call(AccountCheckLogin, payload); //请求时间网络
console.log(userMessage) console.log(userMessage);
console.log(userMessage.token) console.log(userMessage.token);
setCookie("token", userMessage.token) setCookie('token', userMessage.token);
// tosUserName: "admin" // tosUserName: "admin"
// tosUserPhone: "18818881888" // tosUserPhone: "18818881888"
setCookie("name", response.token.tosUserName) setCookie('name', response.token.tosUserName);
setCookie("phone", response.token.tosUserPhone) setCookie('phone', response.token.tosUserPhone);
setCookie("id", response.token.id) setCookie('id', response.token.id);
console.log("获取到Token:" + getCookie("token")) console.log('获取到Token:' + getCookie('token'));
yield put({type: 'saveToken',token: userMessage.token,userName:payload.userName,password:payload.password}); yield put({
type: 'saveToken',
token: userMessage.token,
userName: payload.userName,
password: payload.password,
});
const urlParams = new URL(window.location.href); const urlParams = new URL(window.location.href);
const params = getPageQuery(); const params = getPageQuery();
let { redirect } = params as { redirect: string }; let { redirect } = params as { redirect: string };
...@@ -92,12 +96,12 @@ const Model: LoginModelType = { ...@@ -92,12 +96,12 @@ const Model: LoginModelType = {
} }
history.replace(redirect || '/'); history.replace(redirect || '/');
} else { } else {
console.error(response) console.error(response);
message.error("Login Error! Username or Password is wrong!",3) message.error('Login Error! Username or Password is wrong!', 3);
} }
}, },
*logout({},{call,put}) { *logout({}, { call, put }) {
const { redirect } = getPageQuery(); const { redirect } = getPageQuery();
// Note: There may be security issues, please note // Note: There may be security issues, please note
// const response = yield call(AccountOut, payload); // const response = yield call(AccountOut, payload);
...@@ -111,8 +115,6 @@ const Model: LoginModelType = { ...@@ -111,8 +115,6 @@ const Model: LoginModelType = {
} }
}, },
}, },
}; };
export default Model; export default Model;
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from './ChargeDetail.less'; 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 { Link, useIntl, connect, Dispatch } from 'umi';
import PDF from 'react-pdf-js'; //
import PDF from 'react-pdf-js';//
import { render } from 'react-dom'; import { render } from 'react-dom';
import { Document } from 'react-pdf/dist/entry.webpack'; import { Document } from 'react-pdf/dist/entry.webpack';
...@@ -16,75 +15,82 @@ import { timestampToTime2 } from '../../utils/time'; ...@@ -16,75 +15,82 @@ import { timestampToTime2 } from '../../utils/time';
import TitleBack from '../../components/TitleBack/TitleBack'; import TitleBack from '../../components/TitleBack/TitleBack';
const ChargeDetail = (props: any) => { const ChargeDetail = (props: any) => {
const { CurData } = props; const { CurData } = props;
const { formatMessage } = useIntl(); const { formatMessage } = useIntl();
const [scale, setState] = useState(1.3);
const [scale, setState] = useState(1.3) const [pages, setPages] = useState(1);
const [pages,setPages] = useState(1) const [curpage, setCurpage] = useState(1);
const [curpage,setCurpage]=useState(1)
const pdfpages = (pages: any) => { const pdfpages = (pages: any) => {
setPages(pages);
setPages(pages)
//alert(pages) //alert(pages)
} };
const lookup = () => { const lookup = () => {
if (scale == 1.3) { if (scale == 1.3) {
setState(2) setState(2);
} else { } else {
setState(1.3) setState(1.3);
}
} }
};
const pageChange = (curpage: any) => { const pageChange = (curpage: any) => {
setCurpage(curpage) setCurpage(curpage);
} };
const goToReturn = () => { const goToReturn = () => {
history.back() history.back();
} };
console.log(CurData);
return ( return (
<div className={styles.base}> <div className={styles.base}>
{/* 组件 */} {CurData ? (
<>
<TitleBack
title="Payment Settings"
sublist={['Upload Time ' + timestampToTime2(CurData.updateTime.time)]}
/>
<TitleBack title="Payment Settings" sublist={['Upload Time '+timestampToTime2(CurData.updateTime.time)]}/>
<div className={styles.box2}> <div className={styles.box2}>
<div className={styles.item21}>Project</div> <div className={styles.item21}>Project (community)</div>
<div className={styles.item22}>{CurData.billName}</div> <div className={styles.item22}>{CurData.billName}</div>
<div className={styles.item23}>{CurData.communityName}</div> <div className={styles.item23}>{CurData.communityName}</div>
<div className={styles.item234}>#</div>
<div className={styles.item24}>{CurData.floorNumber}</div> <div className={styles.item24}>{CurData.floorNumber}</div>
<div className={styles.item245}>——</div> <div className={styles.item234}>#</div>
<div className={styles.item25}>{CurData.roomNumber}</div> <div className={styles.item25}>{CurData.roomNumber}</div>
<div className={styles.item245}>——</div>
<div className={styles.item26}>{CurData.tosOwnerName}</div> <div className={styles.item26}>{CurData.tosOwnerName}</div>
</div> </div>
<>{stringSplit(CurData.billFileUrl, "m/cash")}</> <>{stringSplit(CurData.billFileUrl, 'm/cash')}</>
<div className={styles.box4}> <div className={styles.box4}>
<Pagination simple defaultCurrent={curpage} total={pages*10} onChange={pageChange} /> <Pagination simple defaultCurrent={curpage} total={pages * 10} onChange={pageChange} />
</div> </div>
<>
<Tooltip title={scale == 1.3 ? '点击放大查看' + CurData.billFileUrl : '还原视图'}>
<><Tooltip title={scale == 1.3 ?"点击放大查看"+CurData.billFileUrl:"还原视图"}> <div className={scale == 1.3 ? styles.box3out : null}>
<div className={scale == 1.3 ?styles.box3out:null}> <div className={scale == 1.3 ? styles.box3 : styles.box3of} onClick={lookup}>
< div className={ scale == 1.3 ?styles.box3:styles.box3of} onClick={ lookup } > <PDF
<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} /> 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>
</div> </div>
</Tooltip></> </Tooltip>
</>
</>
) : null}
</div> </div>
); );
}; };
function mapStateToProps(state:any) { function mapStateToProps(state: any) {
const { CurData } = state.PropertyManagement; const { CurData } = state.PropertyManagement;
return { return {
CurData CurData,
}; };
} }
export default connect(mapStateToProps)(ChargeDetail); export default connect(mapStateToProps)(ChargeDetail);
...@@ -157,6 +157,7 @@ const Users = (props:any) => { ...@@ -157,6 +157,7 @@ const Users = (props:any) => {
ownerName:location.query.ownerName != undefined ? (location.query.ownerName) : null, ownerName:location.query.ownerName != undefined ? (location.query.ownerName) : null,
communityArray: CommunityList communityArray: CommunityList
}, module, dispatch); }, module, dispatch);
console.log("发送请求了123123123123123")
},[location]) },[location])
......
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 { Alert, Checkbox, Input } from 'antd';
import React, { useState,useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Link, connect, Dispatch,history, Redirect } from 'umi'; import { Link, connect, Dispatch, history, Redirect } from 'umi';
import { StateType } from '@/models/login'; import { StateType } from '@/models/login';
import { LoginParamsType } from '@/services/login'; import { LoginParamsType } from '@/services/login';
import { ConnectState } from '@/models/connect'; import { ConnectState } from '@/models/connect';
...@@ -22,80 +27,102 @@ const Login: React.FC<LoginProps> = (props) => { ...@@ -22,80 +27,102 @@ const Login: React.FC<LoginProps> = (props) => {
const { status, type: loginType } = userLogin; const { status, type: loginType } = userLogin;
const [type, setType] = useState<string>('account'); const [type, setType] = useState<string>('account');
const [userName, setUsername] = useState(""); const [userName, setUsername] = useState('');
const [password, setPasswd] = useState(""); const [password, setPasswd] = useState('');
const handleSubmit = (values: LoginParamsType) => { const handleSubmit = (values: LoginParamsType) => {
const { dispatch } = props; const { dispatch } = props;
console.log({ ...values, type,userName,password }) console.log({ ...values, type, userName, password });
console.log(props);
console.log(dispatch, 'dispatch');
dispatch({ dispatch({
type: 'login/login', type: 'login/login',
payload: {userName,password }, payload: { userName, password },
}); });
}; };
const usernameHandle = (e: any) => { const usernameHandle = (e: any) => {
setUsername(e.target.value) setUsername(e.target.value);
} };
const passwdHandle = (e: any) => { const passwdHandle = (e: any) => {
setPasswd(e.target.value) setPasswd(e.target.value);
} };
const returnHandle = (e: any)=> { const returnHandle = (e: any) => {
history.push("/user/login") history.push('/user/login');
} };
const gotoForgetHandle = (e: any)=> { const gotoForgetHandle = (e: any) => {
history.push("/user/forget") history.push('/user/forget');
};
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('邮箱格式错误!');
} }
};
const { location } = props; const { location } = props;
const [forgetflag,setForgetFlag]=useState(false) const [forgetflag, setForgetFlag] = useState(false);
useEffect(() => { useEffect(() => {
if (location.pathname == '/user/forget') {
if (location.pathname=="/user/forget") { setForgetFlag(true);
setForgetFlag(true)
} else { } else {
setForgetFlag(false) setForgetFlag(false);
} }
}, [location.pathname]); }, [location.pathname]);
return ( return (
<div> <div>
{ {forgetflag ? (
forgetflag?( <div style={{ position: 'absolute', top: -50, cursor: 'pointer' }} onClick={returnHandle}>
<div style={{ position: "absolute", top: -50, cursor: "pointer" }} onClick={returnHandle}><ArrowLeftOutlined style={{ fontSize: '28px' }} /></div> <ArrowLeftOutlined style={{ fontSize: '28px' }} />
):(<div />) </div>
} ) : (
<div />
)}
<LoginForm activeKey={type} onTabChange={setType} onSubmit={handleSubmit}> <LoginForm activeKey={type} onTabChange={setType} onSubmit={handleSubmit}>
<div className={styles.box1}>Account Number</div> <div className={styles.box1}>Account Number</div>
<input className={styles.input} onChange={usernameHandle}/> <input className={styles.input} onChange={usernameHandle} />
<div className={styles.box1}>{forgetflag?("Next"):("Password")}</div> <div className={styles.box1}>{forgetflag ? 'Please enter email address' : 'Password'}</div>
{ {forgetflag ? (
forgetflag ? (
<div className={styles.box2}> <div className={styles.box2}>
<input className={styles.input5} onChange={passwdHandle} type="password" /> <input className={styles.input5} onChange={passwdHandle} />
<div className={styles.button2} style={{float:"right"}}>Send</div> <div className={styles.button2} style={{ float: 'right' }} onClick={handleSend}>
Send
</div>
</div> </div>
) : ( ) : (
<div> <div>
<input className={styles.input2} onChange={passwdHandle} type="password"/> <input className={styles.input2} onChange={passwdHandle} type="password" />
<div> <div>
<div className={styles.input3} onClick={gotoForgetHandle}>Forget Password</div> <div className={styles.input3} onClick={gotoForgetHandle}>
Forget Password
</div>
<div className={styles.input4}> <div className={styles.input4}>
{status === 'error' && loginType === 'account' && !submitting && ( {status === 'error' && loginType === 'account' && !submitting && (
<div>Wrong account or password</div> <div>Wrong account or password</div>
)}</div> )}
</div> </div>
</div> </div>
) </div>
} )}
<Submit className={styles.button} loading={submitting} style={{ width: 330 }}>{forgetflag?("Next"):("登录")}</Submit> <Submit className={styles.button} loading={submitting} style={{ width: 330 }}>
{forgetflag ? 'Next' : '登录'}
</Submit>
</LoginForm> </LoginForm>
</div> </div>
); );
}; };
export default connect(({ login, loading }: ConnectState) => ({ export default connect(({ login, loading }: ConnectState) => {
return {
userLogin: login, userLogin: login,
submitting: loading.effects['login/login'], submitting: loading.effects['login/login'],
}))(Login); };
})(Login);
...@@ -17,8 +17,9 @@ export async function getFakeCaptcha(mobile: string) { ...@@ -17,8 +17,9 @@ export async function getFakeCaptcha(mobile: string) {
} }
export async function AccountLogin(params: LoginParamsType) { export async function AccountLogin(params: LoginParamsType) {
console.log("登录请求") console.log('登录请求');
return request('/tos/user/login', { method: 'POST', data: params, }); console.log(params);
return request('/tos/user/login', { method: 'POST', data: params });
} }
export async function AccountOut() { export async function AccountOut() {
...@@ -31,6 +32,6 @@ export interface LoginCheckParamsType { ...@@ -31,6 +32,6 @@ export interface LoginCheckParamsType {
userId: string; userId: string;
} }
export async function AccountCheckLogin(params: LoginCheckParamsType) { export async function AccountCheckLogin(params: LoginCheckParamsType) {
console.log("登录确认请求") console.log('登录确认请求');
return request('/tos/user/newCurrentUser', { method: 'POST', data: params, }); return request('/tos/user/newCurrentUser', { method: 'POST', data: params });
} }
import moment from 'moment'; import moment from 'moment';
const format = 'HH:mm'; const format = 'HH:mm';
//2020/7/14/18:09:00 //2020/7/14/18:09:00
export const timestampToTime2=(timestamp:any)=>{ export const timestampToTime2 = (timestamp: any) => {
var date = new Date(timestamp);//*1000//getHours getMinutes getSeconds 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) { function addTZero(time) {
let tmp = time + 1 < 10 ? '0' + (time+1) : (time + 1) let tmp = time + 1 < 10 ? '0' + (time + 1) : time + 1;
return tmp return tmp;
} }
function addZero(time) { function addZero(time) {
let tmp = time + 1 < 10 ? '0' + time : time let tmp = time + 1 < 10 ? '0' + time : time;
return tmp return tmp;
} }
const month = ("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sept,Oct,Nov,Dec").split(",") const month = 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sept,Oct,Nov,Dec'.split(',');
const MonthTurnNum = (values:any) => { const MonthTurnNum = (values: any) => {
var i = 0; var i = 0;
month.map((item, index) => { month.map((item, index) => {
if (values == item) { if (values == item) {
i=index+1 i = index + 1;
} }
}) });
return i return i;
} };
export const getStringToTime = (time:any) => { export const getStringToTime = (time: any) => {
var date = time.split(" ") var date = time.split(' ');
var result = addTZero(MonthTurnNum(date[0])) + "-" + addZero(parseInt(date[1].slice(0, date[1].length - 1))) + " " + date[2] var result =
return result addTZero(MonthTurnNum(date[0])) +
} '-' +
addZero(parseInt(date[1].slice(0, date[1].length - 1))) +
' ' +
date[2];
return result;
};
//03-08-2020 13:26 //03-08-2020 13:26
export const timestampToTime4 = (timestamp: any) => { 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 // 03-06 13:26
export const timestampToTime3=(timestamp:any)=>{ export const timestampToTime3 = (timestamp: any) => {
var date = new Date(timestamp);//*1000//getHours getMinutes getSeconds 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 // 03-08-2020
export const timestampToTime = (timestamp: any) => { 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"] // 时间的拆分 var tmp = ["10:00-12:00", "13:00-14:00"]
export const timeToMoment = (tmp: any) => { export const timeToMoment = (tmp: any) => {
if (tmp == null) return null if (tmp == null) return null;
// var result = new Array() // var result = new Array()
// tmp.map((item:any, index:any) => { // tmp.map((item:any, index:any) => {
// var piece = item.split('-') // var piece = item.split('-')
// result.push([moment(piece[0], format), moment(piece[1], format)]) // result.push([moment(piece[0], format), moment(piece[1], format)])
// }) // })
// return result; // return result;
var piece = tmp.split('-') var piece = tmp.split('-');
return [moment(piece[0], format), moment(piece[1], format)] return [moment(piece[0], format), moment(piece[1], format)];
} };
export const MomentToTime= (tmp: any) => { export const MomentToTime = (tmp: any) => {
if (tmp == null) return null if (tmp == null) return null;
return (tmp.format("YYYY-MM-DD HH:mm:ss")) return tmp.format('YYYY-MM-DD HH:mm:ss');
} };
export const TimeToMoment2= (tmp: any) => { export const TimeToMoment2 = (tmp: any) => {
if (tmp == null) return null if (tmp == null) return null;
return moment(tmp, "YYYY-MM-DD HH:mm:ss") return moment(tmp, 'YYYY-MM-DD HH:mm:ss');
} };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment