Browse Source

Merge branch 'dev' of ssh://gitea.anxinyun.cn:2022/gao.zhiyuan/OperationalService into dev

release_0.0.1
deartibers 2 years ago
parent
commit
ccfda4ed32
  1. 1
      api/.vscode/launch.json
  2. 77
      api/app/lib/controllers/auth/index.js
  3. 65
      api/app/lib/models/action_log.js
  4. 97
      api/app/lib/models/alarm_push_config.js
  5. 88
      api/app/lib/models/app_alarm.js
  6. 52
      api/app/lib/models/app_inspection.js
  7. 56
      api/app/lib/models/project_app.js
  8. 70
      api/app/lib/models/project_correlation.js
  9. 47
      api/app/lib/models/quick_link.js
  10. 88
      api/app/lib/models/user.js
  11. 17
      api/app/lib/routes/auth/index.js
  12. 51
      api/app/lib/service/socket.js
  13. 37
      api/config.js
  14. 4
      api/sequelize-automate.config.js
  15. 13
      web/client/src/layout/actions/webSocket.js
  16. 2
      web/client/src/layout/components/header/index.jsx
  17. 5
      web/client/src/sections/auth/actions/auth.js
  18. 4
      web/client/src/sections/auth/containers/login.jsx

1
api/.vscode/launch.json

@ -19,6 +19,7 @@
"--redisHost 10.8.30.112",
"--redisPort 6379",
"--axyApiUrl http://127.0.0.1:4100",
"--apiEmisUrl http://10.8.30.112:14000",
"--godUrl https://restapi.amap.com/v3",
"--godKey 21c2d970e1646bb9a795900dd00093ce",
"--mqttVideoServer mqtt://10.8.30.71:30883"

77
api/app/lib/controllers/auth/index.js

@ -0,0 +1,77 @@
'use strict';
const Hex = require('crypto-js/enc-hex');
const MD5 = require('crypto-js/md5');
const moment = require('moment');
const uuid = require('uuid');
async function login (ctx, next) {
// const transaction = await ctx.fs.dc.orm.transaction();
try {
const models = ctx.fs.dc.models;
const params = ctx.request.body;
const emisLoginRes = await ctx.app.fs.emisRequest.post('login', {
data: params
})
if (!emisLoginRes) {
throw "账号或密码错误"
} else {
const pomsRegisterRes = await models.User.findOne({
where: {
pepUserId: emisLoginRes.id
}
})
if (!pomsRegisterRes) {
throw '当前账号尚未在此系统启用'
}
emisLoginRes.pomsUserInfo = pomsRegisterRes.dataValues
await models.User.update({
lastInTime: moment().format(),
inTimes: pomsRegisterRes.inTimes + 1
}, {
where: {
id: emisLoginRes.id
}
})
ctx.status = 200;
ctx.body = emisLoginRes;
}
// await transaction.commit();
} catch (error) {
// await transaction.rollback();
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
message:
typeof error == 'string' ? error
: error.response.body.message || "登录失败"
}
}
}
async function logout (ctx) {
try {
const models = ctx.fs.dc.models;
const params = ctx.request.body;
await ctx.app.fs.emisRequest.put('logout', {
data: params
})
ctx.status = 204;
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
}
}
}
module.exports = {
login,
logout,
};

65
api/app/lib/models/action_log.js

@ -0,0 +1,65 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const ActionLog = sequelize.define("actionLog", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "action_log_id_uindex"
},
userId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "user_id",
autoIncrement: false,
references: {
key: "id",
model: "user"
}
},
time: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "time",
autoIncrement: false
},
action: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "动态内容",
primaryKey: false,
field: "action",
autoIncrement: false
},
expandParams: {
type: DataTypes.JSONB,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "expand_params",
autoIncrement: false
}
}, {
tableName: "action_log",
comment: "",
indexes: []
});
dc.models.ActionLog = ActionLog;
return ActionLog;
};

97
api/app/lib/models/alarm_push_config.js

@ -0,0 +1,97 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const AlarmPushConfig = sequelize.define("alarmPushConfig", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "alarm_push_config_id_uindex"
},
name: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "name",
autoIncrement: false
},
pepProjectId: {
type: DataTypes.ARRAY(DataTypes.INTEGER),
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "pep_project_id",
autoIncrement: false
},
alarmType: {
type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true,
defaultValue: null,
comment: "监听的告警类型",
primaryKey: false,
field: "alarm_type",
autoIncrement: false
},
receiverPepUserId: {
type: DataTypes.ARRAY(DataTypes.INTEGER),
allowNull: true,
defaultValue: null,
comment: "接收人id 项企",
primaryKey: false,
field: "receiver_pep_user_id",
autoIncrement: false
},
timeType: {
type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true,
defaultValue: null,
comment: "通知时效",
primaryKey: false,
field: "time_type",
autoIncrement: false
},
createTime: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "create_time",
autoIncrement: false
},
createUserId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "create_user_id",
autoIncrement: false
},
disable: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "disable",
autoIncrement: false
}
}, {
tableName: "alarm_push_config",
comment: "",
indexes: []
});
dc.models.AlarmPushConfig = AlarmPushConfig;
return AlarmPushConfig;
};

88
api/app/lib/models/app_alarm.js

@ -0,0 +1,88 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const AppAlarm = sequelize.define("appAlarm", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "app_alarm_id_uindex"
},
serialNumber: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "自定义编号",
primaryKey: false,
field: "serial_number",
autoIncrement: false
},
pepProjectId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: "对应的项目id",
primaryKey: false,
field: "pep_project_id",
autoIncrement: false
},
appDomain: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "应用域名",
primaryKey: false,
field: "app_domain",
autoIncrement: false
},
alarmContent: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "告警信息",
primaryKey: false,
field: "alarm_content",
autoIncrement: false
},
createTime: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "create_time",
autoIncrement: false
},
updateTime: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "update_time",
autoIncrement: false
},
confirm: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "确认信息",
primaryKey: false,
field: "confirm",
autoIncrement: false
}
}, {
tableName: "app_alarm",
comment: "",
indexes: []
});
dc.models.AppAlarm = AppAlarm;
return AppAlarm;
};

52
api/app/lib/models/app_inspection.js

@ -0,0 +1,52 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const AppInspection = sequelize.define("appInspection", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "app_inspection_id_uindex"
},
pepProjectId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "pep_project_id",
autoIncrement: false
},
createTime: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "create_time",
autoIncrement: false
},
screenshot: {
type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true,
defaultValue: null,
comment: "截图存储路径",
primaryKey: false,
field: "screenshot",
autoIncrement: false
}
}, {
tableName: "app_inspection",
comment: "",
indexes: []
});
dc.models.AppInspection = AppInspection;
return AppInspection;
};

56
api/app/lib/models/project_app.js

@ -0,0 +1,56 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const ProjectApp = sequelize.define("projectApp", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "project_app_id_uindex"
},
name: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "name",
autoIncrement: false
},
url: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "url",
autoIncrement: false
},
projectId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "project_id",
autoIncrement: false,
references: {
key: "id",
model: "projectCorrelation"
}
}
}, {
tableName: "project_app",
comment: "",
indexes: []
});
dc.models.ProjectApp = ProjectApp;
return ProjectApp;
};

70
api/app/lib/models/project_correlation.js

@ -0,0 +1,70 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const ProjectCorrelation = sequelize.define("projectCorrelation", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "project_correlation_id_uindex"
},
anxinProjectId: {
type: DataTypes.ARRAY(DataTypes.INTEGER),
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "anxin_project_id",
autoIncrement: false
},
pepProjectId: {
type: DataTypes.ARRAY(DataTypes.INTEGER),
allowNull: false,
defaultValue: null,
comment: "项目管理的项目id",
primaryKey: false,
field: "pep_project_id",
autoIncrement: false
},
createTime: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "create_time",
autoIncrement: false
},
createUser: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "create_user",
autoIncrement: false
},
name: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "name",
autoIncrement: false
}
}, {
tableName: "project_correlation",
comment: "",
indexes: []
});
dc.models.ProjectCorrelation = ProjectCorrelation;
return ProjectCorrelation;
};

47
api/app/lib/models/quick_link.js

@ -0,0 +1,47 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const QuickLink = sequelize.define("quickLink", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "quick_link_id_uindex"
},
userId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "user_id",
autoIncrement: false,
references: {
key: "id",
model: "user"
}
},
link: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "link",
autoIncrement: false
}
}, {
tableName: "quick_link",
comment: "",
indexes: []
});
dc.models.QuickLink = QuickLink;
return QuickLink;
};

88
api/app/lib/models/user.js

@ -0,0 +1,88 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const User = sequelize.define("user", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "user_id_uindex"
},
pepUserId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: "项企对应用户id",
primaryKey: false,
field: "pep_user_id",
autoIncrement: false
},
role: {
type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true,
defaultValue: null,
comment: "角色 也对应权限 admin 管理员 / all 全部角色 / data_analyst 数据分析 / after_sale 售后运维 / resource_manage 资源管理 / customer_service 客户服务",
primaryKey: false,
field: "role",
autoIncrement: false
},
correlationProject: {
type: DataTypes.ARRAY(DataTypes.INTEGER),
allowNull: true,
defaultValue: null,
comment: "关联的项目管理的项目id",
primaryKey: false,
field: "correlation_project",
autoIncrement: false
},
lastInTime: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "last_in_time",
autoIncrement: false
},
inTimes: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: "0",
comment: null,
primaryKey: false,
field: "in_times",
autoIncrement: false
},
onlineDuration: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: "在线时长 单位 s",
primaryKey: false,
field: "online_duration",
autoIncrement: false
},
lastInAddress: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "上次登录地点",
primaryKey: false,
field: "last_in_address",
autoIncrement: false
}
}, {
tableName: "user",
comment: "",
indexes: []
});
dc.models.User = User;
return User;
};

17
api/app/lib/routes/auth/index.js

@ -0,0 +1,17 @@
'use strict';
const auth = require('../../controllers/auth');
module.exports = function (app, router, opts) {
/**
* @api {Post} login 登录.
* @apiVersion 1.0.0
* @apiGroup Auth
*/
app.fs.api.logAttr['POST/login'] = { content: '登录', visible: true };
router.post('/login', auth.login);
app.fs.api.logAttr['PUT/logout'] = { content: '登出', visible: false };
router.put('/logout', auth.logout);
};

51
api/app/lib/service/socket.js

@ -1,33 +1,40 @@
'use strict';
const moment = require('moment')
module.exports = async function factory (app, opts) {
app.socket.on('connection', async (socket) => {
console.info('WEB_SOCKET ' + socket.handshake.query.token + ' 已连接:' + socket.id);
console.info('WEB_SOCKET token:' + socket.handshake.query.token + ' 已连接:id ' + socket.id + ' 时间:' + moment(socket.handshake.time).format());
socket.on('disconnecting', async (reason) => {
console.info('WEB_SOCKET ' + socket.handshake.query.token + ' 已断开连接:' + reason);
const connectSeconds = moment().diff(moment(socket.handshake.time), 'seconds')
console.info('WEB_SOCKET token:' + socket.handshake.query.token + ' 已断开连接:' + reason + ' 连接时长:' + connectSeconds + 's');
const { models } = app.fs.dc
await models.User.increment({
onlineDuration: connectSeconds
}, {
where: {
id: socket.handshake.query.pomsUserId
}
})
})
})
// 使用测试 保持链接
setInterval(async () => {
const { connected } = app.socket.sockets
const roomId = 'ROOM_' + Math.random()
// if (connected) {
// for (let c in connected) {
// connected[c].join(roomId)
// }
// app.socket.to(roomId).emit('TEST', { someProperty: `【星域 ROOM:${roomId}】呼叫自然选择号!!!`, })
// }
app.socket.emit('TEST', { someProperty: '【广播】呼叫青铜时代号!!!', })
// app.socket.emit('CAMERA_ONLINE', {
// ipctype: 'yingshi',
// online: Math.random() > 0.5 ? 'ON' : 'OFF',
// gbId: Math.floor(Math.random() * 100),
// name: 'cameraName'
// })
}, 3000)
// setInterval(async () => {
// const { connected } = app.socket.sockets
// const roomId = 'ROOM_' + Math.random()
// // if (connected) {
// // for (let c in connected) {
// // connected[c].join(roomId)
// // }
// // app.socket.to(roomId).emit('TEST', { someProperty: `【星域 ROOM:${roomId}】呼叫自然选择号!!!`, })
// // }
// app.socket.emit('TEST', { someProperty: '【广播】呼叫青铜时代号!!!', })
// }, 3000)
}

37
api/config.js

@ -17,6 +17,7 @@ args.option('redisPort', 'redisPort');
args.option('redisPswd', 'redisPassword');
args.option('axyApiUrl', '安心云 api');
args.option('apiEmisUrl', '企业管理 api');
args.option('godUrl', '高德地图API请求地址');
args.option('godKey', '高德地图API key');
@ -35,6 +36,8 @@ const IOTA_REDIS_SERVER_PWD = process.env.IOTA_REDIS_SERVER_PWD || flags.redisPs
// 安心云api
const AXY_API_URL = process.env.AXY_API_URL || flags.axyApiUrl;
// 企业管理 api
const API_EMIS_URL = process.env.API_EMIS_URL || flags.apiEmisUrl;
// 高德地图的参数
const GOD_URL = process.env.GOD_URL || flags.godUrl || 'https://restapi.amap.com/v3';
@ -43,8 +46,11 @@ const GOD_KEY = process.env.GOD_KEY || flags.godKey;
// 视频后台 mqtt 信息推送地址
const MQTT_VIDEO_SERVER = process.env.MQTT_VIDEO_SERVER || flags.mqttVideoServer;
if (!POMS_DB || !IOTA_REDIS_SERVER_HOST || !IOTA_REDIS_SERVER_PORT || !GOD_KEY || !MQTT_VIDEO_SERVER ||
!AXY_API_URL
if (
!POMS_DB ||
!IOTA_REDIS_SERVER_HOST || !IOTA_REDIS_SERVER_PORT || !GOD_KEY || !MQTT_VIDEO_SERVER ||
!AXY_API_URL ||
!API_EMIS_URL
) {
console.log('缺少启动参数,异常退出');
args.showHelp();
@ -96,20 +102,21 @@ const product = {
password: 'Fs2689'
}
},
pssaRequest: [
{// name 会作为一个 request 出现在 ctx.app.fs
name: 'axyRequest',
root: AXY_API_URL
}, {
name: 'godRequest',
root: GOD_URL,
params: {
query: {
key: GOD_KEY
}
pssaRequest: [{// name 会作为一个 request 出现在 ctx.app.fs
name: 'axyRequest',
root: AXY_API_URL
}, {
name: 'emisRequest',
root: API_EMIS_URL
}, {
name: 'godRequest',
root: GOD_URL,
params: {
query: {
key: GOD_KEY
}
},
]
}
},]
}
}
],

4
api/sequelize-automate.config.js

@ -1,7 +1,7 @@
module.exports = {
// 数据库配置 与 sequelize 相同
dbOptions: {
database: 'video_access',
database: 'orational_service',
username: 'postgres',
password: '123',
dialect: 'postgres',
@ -26,7 +26,7 @@ module.exports = {
dir: './app/lib/models', // 指定输出 models 文件的目录
typesDir: 'models', // 指定输出 TypeScript 类型定义的文件目录,只有 TypeScript / Midway 等会有类型定义
emptyDir: false, // !!! 谨慎操作 生成 models 之前是否清空 `dir` 以及 `typesDir`
tables: ['mirror',], // 指定生成哪些表的 models,如 ['user', 'user_post'];如果为 null,则忽略改属性
tables: null, // 指定生成哪些表的 models,如 ['user', 'user_post'];如果为 null,则忽略改属性
skipTables: [], // 指定跳过哪些表的 models,如 ['user'];如果为 null,则忽略改属性
tsNoCheck: false, // 是否添加 `@ts-nocheck` 注释到 models 文件中
ignorePrefix: [], // 生成的模型名称忽略的前缀,因为 项目中有以下表名是以 t_ 开头的,在实际模型中不需要, 可以添加多个 [ 't_data_', 't_',] ,长度较长的 前缀放前面

13
web/client/src/layout/actions/webSocket.js

@ -2,18 +2,20 @@
import io from 'socket.io-client';
export const INIT_WEB_SOCKET = 'INIT_WEB_SOCKET'
export function initWebSocket ({ ioUrl, token }) {
export function initWebSocket ({ ioUrl, token, pomsUserId }) {
if (!ioUrl) {
ioUrl = localStorage.getItem('apiRoot')
ioUrl = JSON.parse(ioUrl).root
}
if (!token) {
const user = sessionStorage.getItem('pomsUser')
let user = sessionStorage.getItem('pomsUser')
if (user) {
token = JSON.parse(user).token
user = JSON.parse(user)
token = user.token
pomsUserId = user.pomsUserInfo.id
}
}
if (!ioUrl || !token) {
if (!ioUrl || !token || !pomsUserId) {
return {
type: '',
}
@ -25,7 +27,8 @@ export function initWebSocket ({ ioUrl, token }) {
// 'http://10.8.30.7:4000'
, {
query: {
token: token
token: token,
pomsUserId: pomsUserId
},
});
dispatch({

2
web/client/src/layout/components/header/index.jsx

@ -15,8 +15,6 @@ const Header = (props) => {
onClick={({ itemKey }) => {
if (itemKey == "logout") {
dispatch(actions.auth.logout(user));
const iotAuth = document.getElementById('iotAuth').contentWindow;
iotAuth.postMessage({ action: 'logout' }, '*');
if (socket) {
socket.disconnect();
}

5
web/client/src/sections/auth/actions/auth.js

@ -1,6 +1,7 @@
'use strict';
import { ApiTable, AxyRequest, EmisRequest } from '$utils'
import { Request } from '@peace/utils';
export const INIT_AUTH = 'INIT_AUTH';
export function initAuth (userData) {
@ -42,7 +43,7 @@ export function login (username, password) {
// },
// });
return EmisRequest.post(ApiTable.login, { username, password, code: 'POMS' })
return Request.post(ApiTable.login, { username, password, code: 'POMS' })
.then(user => {
sessionStorage.setItem('pomsUser', JSON.stringify(user));
return dispatch({
@ -65,7 +66,7 @@ export const LOGOUT = 'LOGOUT';
export function logout () {
const user = JSON.parse(sessionStorage.getItem('pomsUser'))
user && user.token ?
EmisRequest.post(ApiTable.logout, {
Request.put(ApiTable.logout, {
token: user.token,
code: 'POMS'
}) : null;

4
web/client/src/sections/auth/containers/login.jsx

@ -70,7 +70,7 @@ const Login = props => {
onSubmit={values => {
dispatch(login(values.username, values.password)).then(res => {
const data = res.payload.user
dispatch(actions.layout.initWebSocket({ ioUrl: apiRoot, token: data.token }))
dispatch(actions.layout.initWebSocket({ ioUrl: apiRoot, token: data.token ,pomsUserId:data.pomsUserInfo.id}))
})
}}
getFormApi={formApi => form.current = formApi}
@ -94,7 +94,7 @@ const Login = props => {
prefix={<IconLock style={{ color: '#1859C1', marginRight: 14, marginLeft: 8 }} />}
style={{ background: 'rgba(24, 89, 193, 0.08)', height: 40 }}
/>
<Button htmlType='submit' block theme="solid" style={{ marginTop: 17, height: 40, backgroundColor: '#1859C1' }}>立即登录</Button>
<Button htmlType='submit' block theme="solid" loading={isRequesting} style={{ marginTop: 17, height: 40, backgroundColor: '#1859C1' }}>立即登录</Button>
</Form>
</div>
</div>

Loading…
Cancel
Save