dengyinhuan
2 years ago
20 changed files with 312 additions and 56 deletions
@ -0,0 +1,64 @@ |
|||
'use strict'; |
|||
async function varfiyCode(ctx) { |
|||
try { |
|||
const { models } = ctx.fs.dc; |
|||
const { pushBySms, pushByEmail } = ctx.app.fs.utils |
|||
const { phone, type ,email} = ctx.request.body |
|||
|
|||
// 伪造的请求可能由相同的sig参数组成
|
|||
// const checkSigUsed = await models.PhoneValidateCode.findOne({
|
|||
// where: { sig: sig }
|
|||
// });
|
|||
// if (checkSigUsed) {
|
|||
// throw '参数错误!'
|
|||
// }
|
|||
|
|||
// // 验证sig正确性
|
|||
// const checkSig = Hex.stringify(SHA1(phone + r));
|
|||
// if (!r || !sig || sig != checkSig) {
|
|||
// throw '参数错误!'
|
|||
// }
|
|||
|
|||
let varifyCode = '' |
|||
for (let i = 0; i < 6; i++) { |
|||
varifyCode += Math.floor(Math.random() * 10) |
|||
} |
|||
|
|||
if(type.includes(1)){ |
|||
await pushBySms({ |
|||
phone: phone, |
|||
templateCode: 'SMS_261950020', |
|||
templateParam: { |
|||
code: varifyCode |
|||
}, |
|||
}) |
|||
} |
|||
if(type.includes(2)){ |
|||
await pushByEmail({ |
|||
email: email, |
|||
title: '测试', |
|||
text:'你知道吗' |
|||
}) |
|||
} |
|||
|
|||
// await models.PhoneValidateCode.create({
|
|||
// phone: phone,
|
|||
// code: varifyCode,
|
|||
// sig: sig,
|
|||
// expired: moment().add(10, 'minutes').format('YYYY-MM-DD HH:mm:ss')
|
|||
// })
|
|||
|
|||
ctx.status = 204; |
|||
} catch (error) { |
|||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|||
ctx.status = 400; |
|||
ctx.body = { |
|||
message: typeof error == 'string' ? error : '获取验证码失败' |
|||
} |
|||
} |
|||
} |
|||
|
|||
module.exports = { |
|||
varfiyCode, |
|||
// pushByEmail
|
|||
} |
@ -0,0 +1,11 @@ |
|||
'use strict'; |
|||
|
|||
const yujingguanli = require('../../controllers/patrolManage/yujingguanli'); |
|||
|
|||
module.exports = function (app, router, opts) { |
|||
|
|||
|
|||
app.fs.api.logAttr['POST/yujingguanli'] = { content: '下发预警邮件', visible: true }; |
|||
router.post('/yujingguanli', yujingguanli.varfiyCode); |
|||
|
|||
}; |
@ -1,4 +1,5 @@ |
|||
ALTER TABLE patrol_record_issue_handle ADD yanshoushijian timestamp(6); |
|||
ALTER TABLE patrol_record_issue_handle ADD yanshoucishu integer; |
|||
ALTER TABLE patrol_record_issue_handle ADD yujingshijian timestamp(6); |
|||
ALTER TABLE patrol_record_issue_handle ADD yujingafchishu integer; |
|||
ALTER TABLE patrol_record_issue_handle ADD isgaojing bool; |
|||
|
@ -0,0 +1,13 @@ |
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function putxinxi (data) { |
|||
return dispatch => basicAction({ |
|||
type: 'post', |
|||
data, |
|||
dispatch: dispatch, |
|||
actionType: 'PUT_XINXI', |
|||
url: ApiTable.yujingguanli, |
|||
msg: { option: '发送信息' }, |
|||
}); |
|||
} |
@ -0,0 +1,9 @@ |
|||
'use strict'; |
|||
|
|||
|
|||
|
|||
|
|||
export default { |
|||
|
|||
|
|||
} |
@ -0,0 +1,9 @@ |
|||
'use strict'; |
|||
|
|||
|
|||
|
|||
import Shouye from './shouye' |
|||
|
|||
|
|||
|
|||
export { Shouye }; |
@ -0,0 +1,62 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Spin, Card, Form, Input, Select, Button, Table, Modal, Popconfirm, Tooltip } from 'antd'; |
|||
import moment from "moment"; |
|||
import '../style.less'; |
|||
import { push } from 'react-router-redux'; |
|||
import { Model } from 'echarts'; |
|||
|
|||
|
|||
const Information = (props) => { |
|||
const { dispatch, actions, user, loading } = props |
|||
const topdata =[] |
|||
|
|||
|
|||
|
|||
return ( |
|||
<> |
|||
<div className='shouyetop'> |
|||
<div className='shouyetopitem'> |
|||
<div className='shouyetopitem-left' > |
|||
<div>今日巡检</div> |
|||
<div>0</div> |
|||
</div> |
|||
<div className='shouyetopitem-right'> |
|||
<div>完成巡检:2个</div> |
|||
<div>巡检上报:2个</div> |
|||
</div> |
|||
</div> |
|||
<div className='shouyetopitem'> |
|||
<div className='shouyetopitem-left' > |
|||
<div>今日巡检</div> |
|||
<div>0</div> |
|||
</div> |
|||
<div className='shouyetopitem-right'> |
|||
<div>完成巡检:2个</div> |
|||
<div>巡检上报:2个</div> |
|||
</div> |
|||
</div> |
|||
<div className='shouyetopitem'> |
|||
<div className='shouyetopitem-left' > |
|||
<div>今日巡检</div> |
|||
<div>0</div> |
|||
</div> |
|||
<div className='shouyetopitem-right'> |
|||
<div>完成巡检:2个</div> |
|||
<div>巡检上报:2个</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</> |
|||
) |
|||
} |
|||
|
|||
function mapStateToProps (state) { |
|||
const { auth, global } = state; |
|||
return { |
|||
user: auth.user, |
|||
actions: global.actions, |
|||
}; |
|||
} |
|||
|
|||
export default connect(mapStateToProps)(Information); |
@ -0,0 +1,15 @@ |
|||
'use strict'; |
|||
|
|||
import reducers from './reducers'; |
|||
import routes from './routes'; |
|||
import actions from './actions'; |
|||
import { getNavItem } from './nav-item'; |
|||
|
|||
export default { |
|||
key: 'shouye', |
|||
name: '首页', |
|||
reducers: reducers, |
|||
routes: routes, |
|||
actions: actions, |
|||
getNavItem: getNavItem |
|||
}; |
@ -0,0 +1,21 @@ |
|||
import React from 'react'; |
|||
import { Link } from 'react-router-dom'; |
|||
import { Menu } from 'antd'; |
|||
import { SettingOutlined } from '@ant-design/icons'; |
|||
import { Func } from '$utils'; |
|||
const SubMenu = Menu.SubMenu; |
|||
|
|||
export function getNavItem (user, dispatch) { |
|||
// return <SubMenu key="shouye" icon={<SettingOutlined />} title={'首页'}>
|
|||
// {/* {Func.isAuthorized('STRU_INFO_CONFIG') &&<Menu.Item key="information">
|
|||
// <Link to="/projectRegime/information">结构物基础信息管理</Link>
|
|||
// </Menu.Item>}
|
|||
// {Func.isAuthorized('QR_CODE_CONFIG') &&<Menu.Item key="qrCode">
|
|||
// <Link to="/projectRegime/qrCode">二维码管理</Link>
|
|||
// </Menu.Item>} */}
|
|||
// </SubMenu>
|
|||
return <Menu.Item key="shouye"> |
|||
<Link to="/shouye">首页</Link> |
|||
</Menu.Item> |
|||
|
|||
} |
@ -0,0 +1,5 @@ |
|||
'use strict'; |
|||
|
|||
export default { |
|||
|
|||
} |
@ -0,0 +1,32 @@ |
|||
'use strict'; |
|||
import { Shouye } from './containers'; |
|||
|
|||
export default [{ |
|||
type: 'inner', |
|||
route: { |
|||
path: '/shouye', |
|||
key: 'shouye', |
|||
breadcrumb: '首页', |
|||
component: Shouye, |
|||
// 不设置 component 则面包屑禁止跳转
|
|||
// childRoutes: [{
|
|||
// path: '/information',
|
|||
// key: 'information',
|
|||
// breadcrumb: '结构物基础信息管理',
|
|||
// component: Information,
|
|||
// childRoutes: [ {
|
|||
// path: '/:id',
|
|||
// key: ':id',
|
|||
// component: Point,
|
|||
// breadcrumb: '点位',
|
|||
// },
|
|||
// ]
|
|||
// }, {
|
|||
// path: '/qrCode',
|
|||
// key: 'qrCode',
|
|||
// component: QrCode,
|
|||
// breadcrumb: '二维码管理',
|
|||
// },
|
|||
// ]
|
|||
} |
|||
}]; |
@ -0,0 +1,20 @@ |
|||
.shouyetop{ |
|||
display: flex; |
|||
justify-content: space-between; |
|||
.shouyetopitem{ |
|||
width: 25%; |
|||
display: flex; |
|||
justify-content: space-between; |
|||
box-shadow: 0 0 10px #F0F2F5; |
|||
border:1px solid #F0F2F5; |
|||
color: rgba(0, 0, 0, 0.45); |
|||
font-size: 1.875rem; |
|||
height: 7.125rem; |
|||
.shouyetopitem-left{ |
|||
width: 50%; |
|||
} |
|||
.shouyetopitem-right{ |
|||
width: 50%; |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue