diff --git a/api/.vscode/launch.json b/api/.vscode/launch.json index 18401bb..1adc141 100644 --- a/api/.vscode/launch.json +++ b/api/.vscode/launch.json @@ -15,7 +15,8 @@ "args": [ "-p 4900", // 研发 - "-g postgres://postgres:123456@10.8.30.166:5432/XunJian", + // "-g postgres://postgres:123456@10.8.30.39:5432/PumpStation", + "-g postgres://FashionAdmin:123456@10.8.30.156:5432/PumpStation", // 测试 // "--apiEmisUrl http://10.8.30.161:1111", // "--qnak XuDgkao6cL0HidoMAPnA5OB10Mc_Ew08mpIfRJK5", diff --git a/api/app/lib/controllers/auth/index.js b/api/app/lib/controllers/auth/index.js index 85a6ab1..7a163b4 100644 --- a/api/app/lib/controllers/auth/index.js +++ b/api/app/lib/controllers/auth/index.js @@ -5,158 +5,128 @@ const MD5 = require('crypto-js/md5'); const moment = require('moment'); const uuid = require('uuid'); -async function login(ctx, next) { - try { - const transaction = await ctx.fs.dc.orm.transaction(); - - const models = ctx.fs.dc.models; - const params = ctx.request.body; - let password = Hex.stringify(MD5(params.password)); - const userRes = await models.User.findOne({ - where: { - username: params.username, - password: password, - delete: false, - enable: true - }, - attributes: { exclude: ['password'] }, - include: [{ - attributes: ["resourceId"], - model: models.UserResource - }] - }); - - - if (!userRes) { - ctx.status = 400; - ctx.body = { - "message": "账号或密码错误" - } - } - - if (userRes) - if (userRes && !userRes.enable) { - ctx.status = 400; - ctx.body = { message: "该用户已被禁用" } - } else { - const token = uuid.v4(); - let deptInfo = null; - if (userRes) { - const { departmentId } = userRes.dataValues; - deptInfo = await models.Department.findOne({ - where: { - id: departmentId - } - }) - } - - if (!userRes) { - ctx.status = 400; - ctx.body = { message: "暂无登录权限,请联系管理员" } - return; - } - - let userData = userRes.dataValues; - let userRslt = Object.assign(userData, { - authorized: true, - token: token, - userResources: userRes ? userRes.userResources.map(r => r.resourceId) : [], - type: deptInfo ? deptInfo.type : '', - deptName: deptInfo ? deptInfo.name : '', - }); - await models.UserToken.create({ - token: token, - userInfo: userRslt, - expired: moment().add(30, 'days').format() - }); - - ctx.status = 200; - ctx.body = userRslt; - } - await transaction.commit(); - } catch (error) { - await transaction.rollback(); - ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); - ctx.status = 400; - ctx.body = { - "message": "登录失败" - } - } +async function login (ctx, next) { + try { + // const transaction = await ctx.fs.dc.orm.transaction(); + + const models = ctx.fs.dc.models; + const params = ctx.request.body; + let password = Hex.stringify(MD5(params.password)); + const userRes = await models.User.findOne({ + where: { + username: params.username, + password: password, + } + }); + + + if (userRes) { + const token = uuid.v4(); + const userInfo = { + authorized: true, + ...userRes.dataValues, + token, + }; + // 记录token + const expiredDay = 7; + const expired = moment().add(expiredDay, 'day').format('YYYY-MM-DD HH:mm:ss') + await models.UserToken.create({ + token: token, + userInfo: userInfo, + expired: expired + }); + ctx.status = 200; + ctx.body = userInfo; + } else { + ctx.status = 400; + ctx.body = { + "message": "账号或密码错误" + } + } + // await transaction.commit(); + } catch (error) { + // await transaction.rollback(); + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { + "message": "登录失败" + } + } } -async function varfiyCode(ctx) { - try { - const { models } = ctx.fs.dc; - const { pushBySms, pushByEmail } = ctx.app.fs.utils - const { phone, sig, r } = 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) - } - - // await pushBySms({ - // phone: phone, - // templateCode: 'SMS_248250074', - // templateParam: { - // code: varifyCode - // }, - // }) - - 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 : '获取验证码失败' - } - } +async function varfiyCode (ctx) { + try { + const { models } = ctx.fs.dc; + const { pushBySms, pushByEmail } = ctx.app.fs.utils + const { phone, sig, r } = 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) + } + + // await pushBySms({ + // phone: phone, + // templateCode: 'SMS_248250074', + // templateParam: { + // code: varifyCode + // }, + // }) + + 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 : '获取验证码失败' + } + } } -async function logout(ctx) { - try { - const models = ctx.fs.dc.models; - const params = ctx.request.body; - - await models.UserToken.destroy({ - where: { - token: params.token, - } - }); - - ctx.status = 204; - } catch (error) { - ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); - ctx.status = 400; - ctx.body = { - message: typeof error == 'string' ? error : undefined - } - } +async function logout (ctx) { + try { + const models = ctx.fs.dc.models; + const params = ctx.request.body; + + await models.UserToken.destroy({ + where: { + token: params.token, + } + }); + + ctx.status = 204; + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { + message: typeof error == 'string' ? error : undefined + } + } } module.exports = { - login, - varfiyCode, - logout, + login, + varfiyCode, + logout, }; \ No newline at end of file diff --git a/api/app/lib/index.js b/api/app/lib/index.js index ee32d26..c6224e4 100644 --- a/api/app/lib/index.js +++ b/api/app/lib/index.js @@ -53,25 +53,25 @@ module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Seq require(`./models/${filename}`)(dc) }); - const { Department, User, UserResource, Resource, Project, Point, PatrolPlan - } = dc.models; + // const { Department, User, UserResource, Resource, Project, Point, PatrolPlan + // } = dc.models; - UserResource.belongsTo(User, { foreignKey: 'userId', targetKey: 'id' }); - User.hasMany(UserResource, { foreignKey: 'userId', sourceKey: 'id' }); + // UserResource.belongsTo(User, { foreignKey: 'userId', targetKey: 'id' }); + // User.hasMany(UserResource, { foreignKey: 'userId', sourceKey: 'id' }); - UserResource.belongsTo(Resource, { foreignKey: 'resourceId', targetKey: 'code' }); - Resource.hasMany(UserResource, { foreignKey: 'resourceId', sourceKey: 'code' }); - Resource.hasMany(Resource, { foreignKey: 'parentResource', sourceKey: 'code' }); + // UserResource.belongsTo(Resource, { foreignKey: 'resourceId', targetKey: 'code' }); + // Resource.hasMany(UserResource, { foreignKey: 'resourceId', sourceKey: 'code' }); + // Resource.hasMany(Resource, { foreignKey: 'parentResource', sourceKey: 'code' }); - User.belongsTo(Department, { foreignKey: 'departmentId', targetKey: 'id' }); - Department.hasMany(User, { foreignKey: 'departmentId', sourceKey: 'id' }); + // User.belongsTo(Department, { foreignKey: 'departmentId', targetKey: 'id' }); + // Department.hasMany(User, { foreignKey: 'departmentId', sourceKey: 'id' }); - Point.belongsTo(Project, { foreignKey: 'projectId', targetKey: 'id' }); - Project.hasMany(Point, { foreignKey: 'projectId', sourceKey: 'id' }); + // Point.belongsTo(Project, { foreignKey: 'projectId', targetKey: 'id' }); + // Project.hasMany(Point, { foreignKey: 'projectId', sourceKey: 'id' }); - PatrolPlan.belongsTo(Project, { foreignKey: 'structureId', targetKey: 'id' }); - Project.hasMany(PatrolPlan, { foreignKey: 'structureId', sourceKey: 'id' }); + // PatrolPlan.belongsTo(Project, { foreignKey: 'structureId', targetKey: 'id' }); + // Project.hasMany(PatrolPlan, { foreignKey: 'structureId', sourceKey: 'id' }); - PatrolPlan.belongsTo(User, { foreignKey: 'userId', targetKey: 'id' }); - User.hasMany(PatrolPlan, { foreignKey: 'userId', sourceKey: 'id' }); + // PatrolPlan.belongsTo(User, { foreignKey: 'userId', targetKey: 'id' }); + // User.hasMany(PatrolPlan, { foreignKey: 'userId', sourceKey: 'id' }); }; diff --git a/api/app/lib/models/department.js b/api/app/lib/models/department.js deleted file mode 100644 index db844db..0000000 --- a/api/app/lib/models/department.js +++ /dev/null @@ -1,56 +0,0 @@ -/* eslint-disable*/ -'use strict'; - -module.exports = dc => { - const DataTypes = dc.ORM; - const sequelize = dc.orm; - const Department = sequelize.define("department", { - id: { - type: DataTypes.INTEGER, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: true, - field: "id", - autoIncrement: true, - unique: "department_id_uindex" - }, - name: { - type: DataTypes.STRING, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: false, - field: "name", - autoIncrement: false - }, - dependence: { - type: DataTypes.INTEGER, - allowNull: true, - defaultValue: null, - comment: "上级部门/从属", - primaryKey: false, - field: "dependence", - autoIncrement: false - }, - type: { - type: DataTypes.INTEGER, - allowNull: true, - defaultValue: null, - comment: "", - primaryKey: false, - field: "type", - autoIncrement: false - } - }, { - tableName: "department", - comment: "", - indexes: [] - }); - - dc.models.Department = Department; - - - - return Department; -}; \ No newline at end of file diff --git a/api/app/lib/models/patrol_plan.js b/api/app/lib/models/patrol_plan.js deleted file mode 100644 index 91e5ddd..0000000 --- a/api/app/lib/models/patrol_plan.js +++ /dev/null @@ -1,105 +0,0 @@ -/* eslint-disable*/ -'use strict'; - -module.exports = dc => { - const DataTypes = dc.ORM; - const sequelize = dc.orm; - const PatrolPlan = sequelize.define("PatrolPlan", { - id: { - type: DataTypes.INTEGER, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: true, - field: "id", - autoIncrement: true, - unique: "patrol_plan_id_uindex" - }, - name: { - type: DataTypes.STRING, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: false, - field: "name", - autoIncrement: false - }, - way: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "way", - autoIncrement: false - }, - structureId: { - type: DataTypes.INTEGER, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "structure_id", - autoIncrement: false - }, - startTime: { - type: DataTypes.DATE, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "start_time", - autoIncrement: false - }, - endTime: { - type: DataTypes.DATE, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "end_time", - autoIncrement: false - }, - frequency: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "frequency", - autoIncrement: false - }, - points: { - type: DataTypes.JSONB, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "points", - autoIncrement: false - }, - userId: { - type: DataTypes.INTEGER, - allowNull: true, - comment: null, - primaryKey: false, - field: "user_id", - autoIncrement: false, - }, - patrolCount: { - type: DataTypes.INTEGER, - allowNull: false, - defaultValue: 0, - comment: null, - primaryKey: false, - field: "patrol_count", - autoIncrement: false - }, - }, { - tableName: "patrol_plan", - comment: "", - indexes: [] - }); - dc.models.PatrolPlan = PatrolPlan; - return PatrolPlan; -}; \ No newline at end of file diff --git a/api/app/lib/models/patrol_record.js b/api/app/lib/models/patrol_record.js deleted file mode 100644 index a71d7ca..0000000 --- a/api/app/lib/models/patrol_record.js +++ /dev/null @@ -1,55 +0,0 @@ -/* eslint-disable*/ -'use strict'; - -module.exports = dc => { - const DataTypes = dc.ORM; - const sequelize = dc.orm; - const PatrolRecord = sequelize.define("PatrolRecord", { - id: { - field: "id", - type: DataTypes.INTEGER, - allowNull: false, - primaryKey: true, - autoIncrement: true, - }, - patrolPlanId: { - field: "patrol_plan_id", - type: DataTypes.INTEGER, - allowNull: false, - primaryKey: false, - autoIncrement: false - }, - lastInspectionTime: { - field: "last_inspection_time", - type: DataTypes.DATE, - allowNull: true, - }, - inspectionTime: { - field: "inspection_time", - type: DataTypes.DATE, - allowNull: true, - }, - points: { - field: "points", - type: DataTypes.JSONB, - allowNull: true, - }, - alarm: { - field: "alarm", - type: DataTypes.BOOLEAN, - allowNull: false, - defaultValue: false, - }, - pointId: { - field: "point_id", - type: DataTypes.INTEGER, - allowNull: false, - }, - }, { - tableName: "patrol_record", - comment: "", - indexes: [] - }); - dc.models.PatrolRecord = PatrolRecord; - return PatrolRecord; -}; \ No newline at end of file diff --git a/api/app/lib/models/point.js b/api/app/lib/models/point.js deleted file mode 100644 index 978fc7c..0000000 --- a/api/app/lib/models/point.js +++ /dev/null @@ -1,79 +0,0 @@ -/* eslint-disable*/ -'use strict'; - -module.exports = dc => { - const DataTypes = dc.ORM; - const sequelize = dc.orm; - const Point = sequelize.define("point", { - id: { - type: DataTypes.INTEGER, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: true, - field: "id", - autoIncrement: true, - unique: "point_id_uindex" - }, - projectId: { - type: DataTypes.INTEGER, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "project_id", - autoIncrement: false - }, - name: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "name", - autoIncrement: false - }, - longitude: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "longitude", - autoIncrement: false - }, - latitude: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "latitude", - autoIncrement: false - }, - describe: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "describe", - autoIncrement: false - }, - qrCode: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "qr_code", - autoIncrement: false - }, - }, { - tableName: "point", - comment: "", - indexes: [] - }); - dc.models.Point = Point; - return Point; -}; \ No newline at end of file diff --git a/api/app/lib/models/project.js b/api/app/lib/models/project.js deleted file mode 100644 index 8543137..0000000 --- a/api/app/lib/models/project.js +++ /dev/null @@ -1,97 +0,0 @@ -/* eslint-disable*/ -'use strict'; - -module.exports = dc => { - const DataTypes = dc.ORM; - const sequelize = dc.orm; - const Project = sequelize.define("project", { - id: { - type: DataTypes.INTEGER, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: true, - field: "id", - autoIncrement: true, - unique: "project_id_uindex" - }, - img: { - type: DataTypes.ARRAY(DataTypes.STRING), - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: false, - field: "img", - autoIncrement: false - }, - userId: { - type: DataTypes.INTEGER, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: false, - field: "user_id", - autoIncrement: false - }, - name: { - type: DataTypes.STRING, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: false, - field: "name", - autoIncrement: false - }, - type: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "type", - autoIncrement: false - }, - longitude: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "longitude", - autoIncrement: false - }, - latitude: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "latitude", - autoIncrement: false - }, - describe: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "describe", - autoIncrement: false - }, - qrCode: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "qr_code", - autoIncrement: false - }, - }, { - tableName: "project", - comment: "", - indexes: [] - }); - dc.models.Project = Project; - return Project; -}; \ No newline at end of file diff --git a/api/app/lib/models/resource.js b/api/app/lib/models/resource.js deleted file mode 100644 index f8ab18c..0000000 --- a/api/app/lib/models/resource.js +++ /dev/null @@ -1,44 +0,0 @@ -/* eslint-disable*/ -'use strict'; - -module.exports = dc => { - const DataTypes = dc.ORM; - const sequelize = dc.orm; - const Resource = sequelize.define("resource", { - code: { - type: DataTypes.STRING, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: true, - field: "code", - autoIncrement: false, - unique: "resource_code_uindex" - }, - name: { - type: DataTypes.STRING, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: false, - field: "name", - autoIncrement: false, - unique: "resource_name_uindex" - }, - parentResource: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "parent_resource", - autoIncrement: false - } - }, { - tableName: "resource", - comment: "", - indexes: [] - }); - dc.models.Resource = Resource; - return Resource; -}; \ No newline at end of file diff --git a/api/app/lib/models/user.js b/api/app/lib/models/user.js index 3ea7040..a3196b9 100644 --- a/api/app/lib/models/user.js +++ b/api/app/lib/models/user.js @@ -13,7 +13,7 @@ module.exports = dc => { primaryKey: true, field: "id", autoIncrement: true, - unique: "user_id_uindex" + unique: "t_user_id_uindex" }, name: { type: DataTypes.STRING, @@ -42,62 +42,8 @@ module.exports = dc => { field: "password", autoIncrement: false }, - departmentId: { - type: DataTypes.INTEGER, - allowNull: false, - defaultValue: null, - comment: "部门id", - primaryKey: false, - field: "department_id", - autoIncrement: false - }, - email: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "email", - autoIncrement: false - }, - enable: { - type: DataTypes.BOOLEAN, - allowNull: false, - defaultValue: null, - comment: "启用状态", - primaryKey: false, - field: "enable", - autoIncrement: false - }, - delete: { - type: DataTypes.BOOLEAN, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: false, - field: "delete", - autoIncrement: false - }, - phone: { - type: DataTypes.STRING, - allowNull: false, - defaultValue: null, - comment: "手机号(小程序使用手机号登录)", - primaryKey: false, - field: "phone", - autoIncrement: false - }, - post: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "职位", - primaryKey: false, - field: "post", - autoIncrement: false - } }, { - tableName: "user", + tableName: "t_user", comment: "", indexes: [] }); diff --git a/api/app/lib/models/user_resource.js b/api/app/lib/models/user_resource.js deleted file mode 100644 index dc8581b..0000000 --- a/api/app/lib/models/user_resource.js +++ /dev/null @@ -1,52 +0,0 @@ -/* eslint-disable*/ -'use strict'; - -module.exports = dc => { - const DataTypes = dc.ORM; - const sequelize = dc.orm; - const UserResource = sequelize.define("userResource", { - id: { - type: DataTypes.INTEGER, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: true, - field: "id", - autoIncrement: true, - unique: "post_resource_id_uindex" - }, - userId: { - type: DataTypes.INTEGER, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: false, - field: "user_id", - autoIncrement: false, - references: { - key: "id", - model: "post" - } - }, - resourceId: { - type: DataTypes.STRING, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: false, - field: "resource", - autoIncrement: false, - references: { - key: "code", - model: "resource" - } - } - }, { - tableName: "user_resource", - comment: "", - indexes: [] - }); - - dc.models.UserResource = UserResource; - return UserResource; -}; \ No newline at end of file diff --git a/api/app/lib/models/user_token.js b/api/app/lib/models/user_token.js index 3f2354e..9cd835a 100644 --- a/api/app/lib/models/user_token.js +++ b/api/app/lib/models/user_token.js @@ -13,7 +13,7 @@ module.exports = dc => { primaryKey: true, field: "token", autoIncrement: false, - unique: "user_token_token_uindex" + unique: "t_user_token_token_uindex" }, userInfo: { type: DataTypes.JSONB, @@ -34,7 +34,7 @@ module.exports = dc => { autoIncrement: false } }, { - tableName: "user_token", + tableName: "t_user_token", comment: "", indexes: [] }); diff --git a/scripts/0.1/schema/0.1user.sql b/scripts/0.1/schema/0.1user.sql new file mode 100644 index 0000000..0969ab7 --- /dev/null +++ b/scripts/0.1/schema/0.1user.sql @@ -0,0 +1,26 @@ +create table t_user +( + id serial not null + constraint t_user_pk + primary key, + name varchar(255), + username varchar(255) not null, + password varchar(255) not null +); + +comment on table t_user is '用户表'; + +comment on column t_user.id is '唯一标识'; + +comment on column t_user.name is '姓名'; + +comment on column t_user.username is '用户名'; + +comment on column t_user.password is '密码'; + + +create unique index t_user_id_uindex + on t_user (id); + + +INSERT INTO public.t_user (id, name, username, password) VALUES (DEFAULT, '超级管理员', 'SuperAdmin', 'e10adc3949ba59abbe56e057f20f883e') \ No newline at end of file diff --git a/web/client/assets/images/map.svg b/web/client/assets/images/map.svg new file mode 100644 index 0000000..03ae03a --- /dev/null +++ b/web/client/assets/images/map.svg @@ -0,0 +1,22 @@ + + \ No newline at end of file diff --git a/web/client/assets/images/monitor/end.png b/web/client/assets/images/monitor/end.png new file mode 100644 index 0000000..32e9a76 Binary files /dev/null and b/web/client/assets/images/monitor/end.png differ diff --git a/web/client/assets/images/monitor/lower-left.png b/web/client/assets/images/monitor/lower-left.png new file mode 100644 index 0000000..75e3866 Binary files /dev/null and b/web/client/assets/images/monitor/lower-left.png differ diff --git a/web/client/assets/images/monitor/lower-right.png b/web/client/assets/images/monitor/lower-right.png new file mode 100644 index 0000000..323a78c Binary files /dev/null and b/web/client/assets/images/monitor/lower-right.png differ diff --git a/web/client/assets/images/monitor/point.png b/web/client/assets/images/monitor/point.png new file mode 100644 index 0000000..5359019 Binary files /dev/null and b/web/client/assets/images/monitor/point.png differ diff --git a/web/client/assets/images/monitor/pump-p.png b/web/client/assets/images/monitor/pump-p.png new file mode 100644 index 0000000..dea7a1c Binary files /dev/null and b/web/client/assets/images/monitor/pump-p.png differ diff --git a/web/client/assets/images/monitor/pumpPP.png b/web/client/assets/images/monitor/pumpPP.png new file mode 100644 index 0000000..c9727d2 Binary files /dev/null and b/web/client/assets/images/monitor/pumpPP.png differ diff --git a/web/client/assets/images/monitor/pumpPo.png b/web/client/assets/images/monitor/pumpPo.png new file mode 100644 index 0000000..ae56cf8 Binary files /dev/null and b/web/client/assets/images/monitor/pumpPo.png differ diff --git a/web/client/assets/images/number/good1.png b/web/client/assets/images/number/good1.png new file mode 100644 index 0000000..4191798 Binary files /dev/null and b/web/client/assets/images/number/good1.png differ diff --git a/web/client/assets/images/number/good10.png b/web/client/assets/images/number/good10.png new file mode 100644 index 0000000..bd930e7 Binary files /dev/null and b/web/client/assets/images/number/good10.png differ diff --git a/web/client/assets/images/number/good11.png b/web/client/assets/images/number/good11.png new file mode 100644 index 0000000..b37e6b3 Binary files /dev/null and b/web/client/assets/images/number/good11.png differ diff --git a/web/client/assets/images/number/good12.png b/web/client/assets/images/number/good12.png new file mode 100644 index 0000000..87722ee Binary files /dev/null and b/web/client/assets/images/number/good12.png differ diff --git a/web/client/assets/images/number/good2.png b/web/client/assets/images/number/good2.png new file mode 100644 index 0000000..8a8d049 Binary files /dev/null and b/web/client/assets/images/number/good2.png differ diff --git a/web/client/assets/images/number/good3.png b/web/client/assets/images/number/good3.png new file mode 100644 index 0000000..7aaa37c Binary files /dev/null and b/web/client/assets/images/number/good3.png differ diff --git a/web/client/assets/images/number/good4.png b/web/client/assets/images/number/good4.png new file mode 100644 index 0000000..1fac22f Binary files /dev/null and b/web/client/assets/images/number/good4.png differ diff --git a/web/client/assets/images/number/good5.png b/web/client/assets/images/number/good5.png new file mode 100644 index 0000000..882c39b Binary files /dev/null and b/web/client/assets/images/number/good5.png differ diff --git a/web/client/assets/images/number/good6.png b/web/client/assets/images/number/good6.png new file mode 100644 index 0000000..2f68253 Binary files /dev/null and b/web/client/assets/images/number/good6.png differ diff --git a/web/client/assets/images/number/good7.png b/web/client/assets/images/number/good7.png new file mode 100644 index 0000000..492db45 Binary files /dev/null and b/web/client/assets/images/number/good7.png differ diff --git a/web/client/assets/images/number/good8.png b/web/client/assets/images/number/good8.png new file mode 100644 index 0000000..6c68beb Binary files /dev/null and b/web/client/assets/images/number/good8.png differ diff --git a/web/client/assets/images/number/good9.png b/web/client/assets/images/number/good9.png new file mode 100644 index 0000000..6e0fc66 Binary files /dev/null and b/web/client/assets/images/number/good9.png differ diff --git a/web/client/assets/images/number/problem1.png b/web/client/assets/images/number/problem1.png new file mode 100644 index 0000000..a2beb61 Binary files /dev/null and b/web/client/assets/images/number/problem1.png differ diff --git a/web/client/assets/images/number/problem10.png b/web/client/assets/images/number/problem10.png new file mode 100644 index 0000000..b6f1934 Binary files /dev/null and b/web/client/assets/images/number/problem10.png differ diff --git a/web/client/assets/images/number/problem11.png b/web/client/assets/images/number/problem11.png new file mode 100644 index 0000000..61d5589 Binary files /dev/null and b/web/client/assets/images/number/problem11.png differ diff --git a/web/client/assets/images/number/problem12.png b/web/client/assets/images/number/problem12.png new file mode 100644 index 0000000..2d1c811 Binary files /dev/null and b/web/client/assets/images/number/problem12.png differ diff --git a/web/client/assets/images/number/problem2.png b/web/client/assets/images/number/problem2.png new file mode 100644 index 0000000..7ac2bc8 Binary files /dev/null and b/web/client/assets/images/number/problem2.png differ diff --git a/web/client/assets/images/number/problem3.png b/web/client/assets/images/number/problem3.png new file mode 100644 index 0000000..59c86d8 Binary files /dev/null and b/web/client/assets/images/number/problem3.png differ diff --git a/web/client/assets/images/number/problem4.png b/web/client/assets/images/number/problem4.png new file mode 100644 index 0000000..00d7a7f Binary files /dev/null and b/web/client/assets/images/number/problem4.png differ diff --git a/web/client/assets/images/number/problem5.png b/web/client/assets/images/number/problem5.png new file mode 100644 index 0000000..4f14967 Binary files /dev/null and b/web/client/assets/images/number/problem5.png differ diff --git a/web/client/assets/images/number/problem6.png b/web/client/assets/images/number/problem6.png new file mode 100644 index 0000000..8880b6c Binary files /dev/null and b/web/client/assets/images/number/problem6.png differ diff --git a/web/client/assets/images/number/problem7.png b/web/client/assets/images/number/problem7.png new file mode 100644 index 0000000..1d12ee9 Binary files /dev/null and b/web/client/assets/images/number/problem7.png differ diff --git a/web/client/assets/images/number/problem8.png b/web/client/assets/images/number/problem8.png new file mode 100644 index 0000000..117c457 Binary files /dev/null and b/web/client/assets/images/number/problem8.png differ diff --git a/web/client/assets/images/number/problem9.png b/web/client/assets/images/number/problem9.png new file mode 100644 index 0000000..6fce066 Binary files /dev/null and b/web/client/assets/images/number/problem9.png differ diff --git a/web/client/index.html b/web/client/index.html index 8edf655..fdf026a 100644 --- a/web/client/index.html +++ b/web/client/index.html @@ -12,7 +12,7 @@ } + src="https://webapi.amap.com/maps?v=2.0&key=00f9a29dedcdbd8befec3dfe0cef5003&plugin=AMap.AutoComplete,AMap.PlaceSearch,aMap.DistrictSearch"> diff --git a/web/client/src/layout/containers/layout/index.js b/web/client/src/layout/containers/layout/index.js index 34f3d57..b04d7aa 100644 --- a/web/client/src/layout/containers/layout/index.js +++ b/web/client/src/layout/containers/layout/index.js @@ -34,7 +34,7 @@ const LayoutContainer = props => { const resize_ = (collapsed) => { const extraHeight = headerHeight + footerHeight; - console.log(document.body.clientHeight); + dispatch(resize( document.body.clientHeight - extraHeight - 12, document.body.clientWidth - (collapsed ? 120 : 220) diff --git a/web/client/src/layout/containers/layout/index.less b/web/client/src/layout/containers/layout/index.less index d55219a..ce3bc72 100644 --- a/web/client/src/layout/containers/layout/index.less +++ b/web/client/src/layout/containers/layout/index.less @@ -1,2 +1,3 @@ @import '~perfect-scrollbar/css/perfect-scrollbar.css'; -@import '~nprogress/nprogress.css'; \ No newline at end of file +@import '~nprogress/nprogress.css'; +@import '~simplebar-react/dist/simplebar.min.css'; \ No newline at end of file diff --git a/web/client/src/sections/auth/containers/login.js b/web/client/src/sections/auth/containers/login.js index 708058f..63b673b 100644 --- a/web/client/src/sections/auth/containers/login.js +++ b/web/client/src/sections/auth/containers/login.js @@ -157,7 +157,6 @@ const Login = props => { function mapStateToProps (state) { const { auth, global } = state; - console.log(global); return { user: auth.user, error: auth.error, diff --git a/web/client/src/sections/bigScreen/components/amap.js b/web/client/src/sections/bigScreen/components/amap.js index 24f5a60..240485d 100644 --- a/web/client/src/sections/bigScreen/components/amap.js +++ b/web/client/src/sections/bigScreen/components/amap.js @@ -1,48 +1,114 @@ import React, { useEffect, useState } from 'react'; let map = ''; -const Amap = (props) => { - const [mapComplete, setMapComplete] = useState(false); - - useEffect(() => { - drawMap(); - }, []); - const drawMap = () => { - try { - if (AMap) loadMap(); - } catch (e) { - var script = document.createElement("script"); - script.src = "https://webapi.amap.com/maps?v=2.0&key=00f9a29dedcdbd8befec3dfe0cef5003&plugin=AMap.AutoComplete,AMap.PlaceSearch"; - document.body.appendChild(script); - loadMap(); - } - } - - const loadMap = () => { - map = new AMap.Map("amapId", { - resizeEnable: true, - center: [115.99255, 28.503617], // 地图中心点,初始定位加载显示楼块 - zoom: 14, // 地图显示的缩放级别 - zooms: [5, 20], - pitch: 0, // 地图俯仰角度,有效范围 0 度- 83 度 - viewMode: '3D', // 地图模式 - mapStyle: 'amap://styles/fb26776387242721c2fc32e2cb1daccc', // 主题样式 - // rotation: 60 - // showLabel: false - }); - - map.on('complete', function () { - console.log("map-complete") - setMapComplete(true); - }); - window.onload = function () { - console.log("window.onload") - } - }; - - return