diff --git a/api/config.js b/api/config.js index bf55193..6550c23 100644 --- a/api/config.js +++ b/api/config.js @@ -37,118 +37,119 @@ const ALI_OSS_SECRETKET = process.env.ALI_OSS_SECRETKET || flags.aliOssSecretKey const ALI_OSS_BUCKET = process.env.ALI_OSS_BUCKET || flags.aliOssBucket; const ALI_OSS_REGION = process.env.ALI_OSS_REGION || flags.aliOssRegion; + if (!XUNJIAN_DB || !QINIU_DOMAIN_QNDMN_RESOURCE || !QINIU_BUCKET_RESOURCE || !QINIU_AK || !QINIU_SK) { - console.log('缺少启动参数,异常退出'); - args.showHelp(); - process.exit(-1); + console.log('缺少启动参数,异常退出'); + args.showHelp(); + process.exit(-1); } const product = { - port: flags.port || 8080, - staticDirs: ['static'], - mws: [ - { - entry: require('@fs/attachment').entry, - opts: { - qiniu: { - domain: QINIU_DOMAIN_QNDMN_RESOURCE, - bucket: QINIU_BUCKET_RESOURCE, - accessKey: QINIU_AK, - secretKey: QINIU_SK - }, - maxSize: 104857600, // 100M - } - }, { - entry: require('./app').entry, - opts: { - dev, - exclude: [ - // "*" - ], // 不做认证的路由,也可以使用 exclude: ["*"] 跳过所有路由 - qiniu: { - domain: QINIU_DOMAIN_QNDMN_RESOURCE, - bucket: QINIU_BUCKET_RESOURCE, - accessKey: QINIU_AK, - secretKey: QINIU_SK - }, - aliOss: { - accessKey: ALI_OSS_ACCESSKEY, - secretKey: ALI_OSS_SECRETKET, - bucket: ALI_OSS_BUCKET, - region: ALI_OSS_REGION - }, - sms: { - ///阿里云-安心云 - accessKey: 'LTAI5tAFdjz7j38aNF2C9Qe8', - accessSecret: '1trYkmiqfBtvZL6BxkNH2uQcQQPs0S' - }, - email: { - enabled: true, - host: 'smtp.exmail.qq.com', - port: 465, - sender: { - name: '中鼎服务', - address: 'fsiot@free-sun.com.cn', - password: 'Fs2689' - } - }, - } - } - ], - dc: { - url: XUNJIAN_DB, - opts: { - pool: { - max: 80, - min: 10, - idle: 10000 + port: flags.port || 8080, + staticDirs: ['static'], + mws: [ + { + entry: require('@fs/attachment').entry, + opts: { + qiniu: { + domain: QINIU_DOMAIN_QNDMN_RESOURCE, + bucket: QINIU_BUCKET_RESOURCE, + accessKey: QINIU_AK, + secretKey: QINIU_SK + }, + maxSize: 104857600, // 100M + } + }, { + entry: require('./app').entry, + opts: { + dev, + exclude: [ + // "*" + ], // 不做认证的路由,也可以使用 exclude: ["*"] 跳过所有路由 + qiniu: { + domain: QINIU_DOMAIN_QNDMN_RESOURCE, + bucket: QINIU_BUCKET_RESOURCE, + accessKey: QINIU_AK, + secretKey: QINIU_SK + }, + aliOss: { + accessKey: ALI_OSS_ACCESSKEY, + secretKey: ALI_OSS_SECRETKET, + bucket: ALI_OSS_BUCKET, + region: ALI_OSS_REGION + }, + sms: { + ///阿里云-安心云 + accessKey: 'LTAI5tAFdjz7j38aNF2C9Qe8', + accessSecret: '1trYkmiqfBtvZL6BxkNH2uQcQQPs0S' }, - define: { - freezeTableName: true, // 固定表名 - timestamps: false // 不含列 "createAt"/"updateAt"/"DeleteAt" + email: { + enabled: true, + host: 'smtp.exmail.qq.com', + port: 465, + sender: { + name: '中鼎服务', + address: 'fsiot@free-sun.com.cn', + password: 'Fs2689' + } }, - timezone: '+08:00', - logging: false - }, - models: [require('./app').models] - }, - logger: { - level: 'info', - json: false, - filename: path.join(__dirname, 'log', 'runtime.log'), - colorize: false, - maxsize: 1024 * 1024 * 5, - rotationFormat: false, - zippedArchive: true, - maxFiles: 10, - prettyPrint: true, - label: '', - timestamp: () => moment().format('YYYY-MM-DD HH:mm:ss.SSS'), - eol: os.EOL, - tailable: true, - depth: null, - showLevel: true, - maxRetries: 1 - } + } + } + ], + dc: { + url: XUNJIAN_DB, + opts: { + pool: { + max: 80, + min: 10, + idle: 10000 + }, + define: { + freezeTableName: true, // 固定表名 + timestamps: false // 不含列 "createAt"/"updateAt"/"DeleteAt" + }, + timezone: '+08:00', + logging: false + }, + models: [require('./app').models] + }, + logger: { + level: 'info', + json: false, + filename: path.join(__dirname, 'log', 'runtime.log'), + colorize: false, + maxsize: 1024 * 1024 * 5, + rotationFormat: false, + zippedArchive: true, + maxFiles: 10, + prettyPrint: true, + label: '', + timestamp: () => moment().format('YYYY-MM-DD HH:mm:ss.SSS'), + eol: os.EOL, + tailable: true, + depth: null, + showLevel: true, + maxRetries: 1 + } }; const development = { - port: product.port, - staticDirs: product.staticDirs, - mws: product.mws, - dc: product.dc, - logger: product.logger + port: product.port, + staticDirs: product.staticDirs, + mws: product.mws, + dc: product.dc, + logger: product.logger }; if (dev) { - // mws - for (let mw of development.mws) { - // if (mw.opts.exclude) mw.opts.exclude = ['*']; // 使用 ['*'] 跳过所有路由 - } - // logger - development.logger.filename = path.join(__dirname, 'log', 'development.log'); - development.logger.level = 'debug'; - development.dc.opts.logging = console.log; + // mws + for (let mw of development.mws) { + // if (mw.opts.exclude) mw.opts.exclude = ['*']; // 使用 ['*'] 跳过所有路由 + } + // logger + development.logger.filename = path.join(__dirname, 'log', 'development.log'); + development.logger.level = 'debug'; + development.dc.opts.logging = console.log; } module.exports = dev ? development : product; diff --git a/api/log/development.log b/api/log/development.log index 46f17c3..2033b4b 100644 --- a/api/log/development.log +++ b/api/log/development.log @@ -3865,3 +3865,35 @@ notNull Violation: project.describe cannot be null 2023-01-17 11:00:49.835 - debug: [FS-LOGGER] Init. 2023-01-17 11:00:50.799 - info: [FS-ATTACHMENT] Inject attachment mw into router. 2023-01-17 11:00:50.799 - info: [FS-AUTH] Inject auth and api mv into router. +2023-01-17 16:24:18.099 - debug: [FS-LOGGER] Init. +2023-01-17 16:24:19.169 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-01-17 16:24:19.169 - info: [FS-AUTH] Inject auth and api mv into router. +2023-01-17 16:29:24.545 - error: path: /patrolPlan, error: SequelizeDatabaseError: relation "patrol_plan" does not exist +2023-01-17 16:30:55.708 - error: path: /patrolPlan, error: SequelizeDatabaseError: relation "patrol_plan" does not exist +2023-01-17 17:04:11.489 - error: path: /patrolPlan, error: SequelizeDatabaseError: relation "patrol_plan" does not exist +2023-01-17 17:34:08.720 - debug: [FS-LOGGER] Init. +2023-01-17 17:34:09.424 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-01-17 17:34:09.425 - info: [FS-AUTH] Inject auth and api mv into router. +2023-01-17 17:54:21.406 - error: [FS-ERRHD] +{ + message: 'transaction is not defined', + stack: 'ReferenceError: transaction is not defined\n' + + ' at login (C:\\Users\\方式、\\Desktop\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)\n' + + ' at async auth (C:\\Users\\方式、\\Desktop\\Inspection\\api\\app\\lib\\middlewares\\authenticator.js:144:13)' +} +2023-01-17 17:54:32.256 - error: [FS-ERRHD] +{ + message: 'transaction is not defined', + stack: 'ReferenceError: transaction is not defined\n' + + ' at login (C:\\Users\\方式、\\Desktop\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)\n' + + ' at async auth (C:\\Users\\方式、\\Desktop\\Inspection\\api\\app\\lib\\middlewares\\authenticator.js:144:13)' +} +2023-01-17 17:54:56.524 - debug: [FS-LOGGER] Init. +2023-01-17 17:54:57.554 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-01-17 17:54:57.555 - info: [FS-AUTH] Inject auth and api mv into router. +2023-01-17 17:55:16.799 - debug: [FS-LOGGER] Init. +2023-01-17 17:55:16.964 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-01-17 17:55:16.965 - info: [FS-AUTH] Inject auth and api mv into router. +2023-01-17 18:19:08.094 - debug: [FS-LOGGER] Init. +2023-01-17 18:19:08.273 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-01-17 18:19:08.273 - info: [FS-AUTH] Inject auth and api mv into router. diff --git a/script/1.0.0/schema/2.create.project.sql b/script/1.0.0/schema/2.create.project.sql index 2fe61f1..eec307e 100644 --- a/script/1.0.0/schema/2.create.project.sql +++ b/script/1.0.0/schema/2.create.project.sql @@ -10,7 +10,7 @@ create table project describe varchar(255), user_id integer, img character varying[], - qr_code varchar(255) + qr_code varchar ); create table point @@ -22,6 +22,6 @@ create table point longitude integer, latitude integer, describe varchar(255), - qr_code varchar(255), + qr_code varchar, project_id integer ) \ No newline at end of file diff --git a/web/client/assets/images/login/login_a.png b/web/client/assets/images/login/login_a.png new file mode 100644 index 0000000..4c8a97e Binary files /dev/null and b/web/client/assets/images/login/login_a.png differ diff --git a/web/client/assets/images/login/login_b.png b/web/client/assets/images/login/login_b.png new file mode 100644 index 0000000..9e04927 Binary files /dev/null and b/web/client/assets/images/login/login_b.png differ diff --git a/web/client/src/sections/auth/containers/login.js b/web/client/src/sections/auth/containers/login.js index 8f6ea32..59a3c1c 100644 --- a/web/client/src/sections/auth/containers/login.js +++ b/web/client/src/sections/auth/containers/login.js @@ -6,256 +6,144 @@ import SHA1 from 'crypto-js/sha1'; import Hex from 'crypto-js/enc-hex'; import { ApiTable } from '$utils' import { Request } from '@peace/utils' -import { Button, Input, Form, Row, Col, message, Tabs } from 'antd'; +import { Button, Input, Form, Row, Col, message, Tabs, Tooltip } from 'antd'; import { login, LOGIN_ERROR } from '../actions/auth'; import { ExclamationCircleOutlined } from '@ant-design/icons'; import { Uploads } from '$components' +import { LockOutlined, UserOutlined } from '@ant-design/icons'; import '../style.less'; const FormItem = Form.Item; let codCountDownInterval = null const Login = props => { - const { dispatch, user, error, isRequesting } = props - const [username, setUserName] = useState('') - const [password, setPassword] = useState('') - const [phone, setPhone] = useState('') - const [code, setCode] = useState('') - const [inputChanged, setInputChanged] = useState(false) - const [curTabKey, setCurTabKey] = useState(1) - const [codSending, setCodSending] = useState(false) - const [codCountDown, setCodeCountDown] = useState(60) - const codCountDownRef = useRef(0) + const { dispatch, user, error, isRequesting } = props + const [username, setUserName] = useState('') + const [password, setPassword] = useState('') + const [phone, setPhone] = useState('') + const [code, setCode] = useState('') + const [inputChanged, setInputChanged] = useState(false) + const [curTabKey, setCurTabKey] = useState(1) + const [codSending, setCodSending] = useState(false) + const [codCountDown, setCodeCountDown] = useState(60) + const codCountDownRef = useRef(0) + const [form] = Form.useForm(); + useEffect(() => { - useEffect(() => { + }, []) - }, []) + useEffect(() => { + if (user && user.authorized) { + dispatch(push('/projectRegime/information')); + } + }, [user]) - useEffect(() => { - if (user && user.authorized) { - dispatch(push('/projectRegime/information')); - } - }, [user]) - - useEffect(() => { - if (codSending) { - setCodeCountDown(59) - codCountDownRef.current = 59 - codCountDownInterval = setInterval(() => { - codCountDownRef.current -= 1 - if (codCountDownRef.current == 0) { - setCodSending(false) - setCodeCountDown(60) - clearInterval(codCountDownInterval) - codCountDownInterval = null - } else { - setCodeCountDown(codCountDownRef.current) - } - }, 1000); - } else { - if (codCountDownInterval) { - clearInterval(codCountDownInterval) - codCountDownInterval = null - setCodeCountDown(60) + useEffect(() => { + if (codSending) { + setCodeCountDown(59) + codCountDownRef.current = 59 + codCountDownInterval = setInterval(() => { + codCountDownRef.current -= 1 + if (codCountDownRef.current == 0) { + setCodSending(false) + setCodeCountDown(60) + clearInterval(codCountDownInterval) + codCountDownInterval = null + } else { + setCodeCountDown(codCountDownRef.current) } - } - }, [codSending]) + }, 1000); + } else { + if (codCountDownInterval) { + clearInterval(codCountDownInterval) + codCountDownInterval = null + setCodeCountDown(60) + } + } + }, [codSending]) + + + + return ( +
- 中鼎国际工程项目指挥调度系统 -
-