Система контроля и управления доступом в некатегорированные помещения

Разработка системы контроля и управления доступом в некатегорированные помещения, реализуемой в виде аппаратно-программного комплекса с клиент-серверной архитектурой. Разработка и описание алгоритмов функционирования системы, ее программной части.

Рубрика Программирование, компьютеры и кибернетика
Вид дипломная работа
Язык русский
Дата добавления 22.02.2019
Размер файла 1,8 M

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath)

const nodePaths = (process.env.NODE_PATH || '')

.split(process.platform === 'win32' ? ';' : ':')

.filter(Boolean)

.map(resolveApp)

const paths = {

appBuild: resolveApp('build'),

appHtml: resolveApp('src/index.html'),

appIndex: resolveApp('src/index.jsx'),

appPackageJson: resolveApp('package.json'),

appSrc: resolveApp('src'),

appConfig: resolveApp('src/config'),

appNodeModules: resolveApp('node_modules'),

publicAssets: resolveApp('public'),

scssPath: resolveApp('scss'),

nodePaths,

}

const CleanPlugin = require('clean-webpack-plugin')

const HtmlWebpackPlugin = require('html-webpack-plugin')

const PreloadWebpackPlugin = require('preload-webpack-plugin')

const ExtractTextPlugin = require('extract-text-webpack-plugin')

const CopyWebpackPlugin = require('copy-webpack-plugin')

const CompressionPlugin = require('compression-webpack-plugin')

const BabiliPlugin = require('babili-webpack-plugin')

module.exports = (params) => {

const env = params.env

const isLocal = params.local

const isProduction = env === 'production'

const ifLocal = (plugin, fallback) => isLocal ? plugin : fallback

const ifProduction = (plugin, fallback) => isProduction ? plugin : fallback

return {

devtool: isProduction ? 'cheap-module-source-map' : 'eval',

context: paths.appSrc,

entry: {

main: paths.appIndex,

vendor: _.compact([

ifLocal('webpack-dev-server/client?/'),

'babel-polyfill',

'react',

'react-dom',

'react-router',

'react-bootstrap',

'react-addons-css-transition-group',

'lodash',

'classnames',

]),

},

output: {

path: paths.appBuild,

filename: `assets/js/[name]${isLocal ? '' : '.[chunkhash:8]'}.js`,

chunkFilename: `assets/js/[name]${isLocal ? '' : '.[chunkhash:8]'}.chunk.js`,

publicPath: '/',

},

resolve: {

extensions: [ '.js', '.jsx' ],

modules: [

paths.appSrc,

'node_modules',

],

},

module: {

rules: [

/* {

enforce: 'pre',

test: /\.jsx?$/,

include: paths.appSrc,

use: 'eslint-loader',

}, */

{

test: /\.jsx?$/,

exclude: /node_modules/,

use: [

{

loader: 'babel-loader',

},

],

},

{

test: /\.s?css$/,

loader: ExtractTextPlugin.extract({

fallback: 'style-loader',

use: [

'css-loader?modules&importLoaders=0&localIdentName=[local]',

'postcss-loader',

'sass-loader',

],

}),

},

{

test: /\.(gif|png|jpg|jpeg\ttf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,

use: 'file-loader',

},

],

},

plugins: _.compact([

new webpack.LoaderOptionsPlugin({

debug: !isProduction,

minimize: isProduction,

}),

new webpack.optimize.CommonsChunkPlugin({

name: 'vendor',

minChunks: Infinity,

filename: 'assets/js/vendor.[chunkhash:8].js',

}),

new CleanPlugin(paths.appBuild),

new webpack.DefinePlugin({

'process.env': {

NODE_ENV: JSON.stringify(env),

},

CONFIG: JSON.stringify(require(`${paths.appConfig}/config.${env}.json`)),

}),

new BabiliPlugin(),

new HtmlWebpackPlugin({

template: paths.appHtml,

production: isProduction,

inject: true,

}),

new PreloadWebpackPlugin({

rel: 'prefetch',

fileBlacklist: [ /\.map$/ ],

}),

new ExtractTextPlugin({

filename: `assets/css/[name]${isLocal ? '' : '.[chunkhash:8]'}.css`,

allChunks: true,

}),

new CopyWebpackPlugin([

{

from: paths.publicAssets,

to: 'assets',

},

]),

new CompressionPlugin({

asset: '[path].gz[query]',

algorithm: 'gzip',

test: /\.js$|\.css$/,

threshold: 0,

minRatio: 0.8,

}),

ifProduction(null, new webpack.NamedModulesPlugin()),

ifProduction(new webpack.optimize.AggressiveMergingPlugin()),

ifProduction(new webpack.optimize.UglifyJsPlugin({

comments: false, // remove comments

compress: {

unused: true,

dead_code: true, // big one--strip code that will never execute

warnings: false, // good for prod apps so users can't peek behind curtain

drop_debugger: true,

conditionals: true,

evaluate: true,

drop_console: true, // strips console statements

sequences: true,

booleans: true,

pure_getters: true,

unsafe: true,

unsafe_comps: true,

screw_ie8: true,

},

output: {

comments: false,

},

exclude: [ /\.min\.js$/gi ],

sourceMap: true,

})),

]),

devServer: {

contentBase: paths.appSrc,

// hot: true,

},

}

}

ФАЙЛ FRONT/INDEX.JSX

import React from 'react'

import ReactDOM from 'react-dom'

import App from './App'

ReactDOM.render(

<App/>,

document.getElementById('app'),

)

ФАЙЛ FRONT/INDEX.HTML

<!DOCTYPE html>

<html lang="ru">

<head>

<meta charset="UTF-8" />

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<meta name="viewport" content="width=device-width, initial-scale=1" />

<title>Панель администрирования</title>

<link rel="stylesheet"

href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"

integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7"

crossorigin="anonymous" />

<link rel="stylesheet"

href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"/>

<link rel="apple-touch-icon" sizes="57x57" href="/assets/icons/apple-icon-57x57.png" />

<link rel="apple-touch-icon" sizes="60x60" href="/assets/icons/apple-icon-60x60.png" />

<link rel="apple-touch-icon" sizes="72x72" href="/assets/icons/apple-icon-72x72.png" />

<link rel="apple-touch-icon" sizes="76x76" href="/assets/icons/apple-icon-76x76.png" />

<link rel="apple-touch-icon" sizes="114x114" href="/assets/icons/apple-icon-114x114.png" />

<link rel="apple-touch-icon" sizes="120x120" href="/assets/icons/apple-icon-120x120.png" />

<link rel="apple-touch-icon" sizes="144x144" href="/assets/icons/apple-icon-144x144.png" />

<link rel="apple-touch-icon" sizes="152x152" href="/assets/icons/apple-icon-152x152.png" />

<link rel="apple-touch-icon" sizes="180x180" href="/assets/icons/apple-icon-180x180.png" />

<link rel="icon" type="image/png" sizes="192x192" href="/assets/icons/android-icon-192x192.png" />

<link rel="icon" type="image/png" sizes="16x16" href="/assets/icons/favicon-16x16.png" />

<link rel="icon" type="image/png" sizes="32x32" href="/assets/icons/favicon-32x32.png" />

<link rel="icon" type="image/png" sizes="96x96" href="/assets/icons/favicon-96x96.png" />

<link rel="manifest" href="/assets/manifest.json" />

<meta name="msapplication-TileColor" content="#ffffff" />

<meta name="msapplication-TileImage" content="/assets/icons/ms-icon-144x144.png" />

<meta name="theme-color" content="#ffffff" />

<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit&hl=ru" async defer></script>

</head>

<body>

<div id="app" class="full-height"></div>

</body>

</html>

ФАЙЛ FRONT/APP.JSX

import React from 'react'

import { Router, browserHistory } from 'react-router/es'

import routes from './routes'

const App = () => (

<Router history={ browserHistory } routes={ routes }/>

)

export default App

ФАЙЛ FRONT/ROUTES/HELPERS.JS

const errorLoading = (err) => {

console.error('Dynamic page loading failed', err)

}

const loadRoute = (cb) => (module) => cb(null, module.default)

const pageChangedTransition = (prevState, nextState) => {

if (prevState.location.pathname !== nextState.location.pathname) {

window.scrollTo(0, 0)

}

}

export {

loadRoute,

errorLoading,

pageChangedTransition,

}

ФАЙЛ FRONT/SERVICES/XHR.JS

import request from 'superagent'

const RequestWrap = (fn) => {

const promise = new Promise((resolve, reject) => {

fn.end((err, response) => {

if (err) {

reject(err)

}

resolve(response.body)

})

})

promise.end = promise.then

promise.abort = fn.abort.bind(fn)

return promise

}

const getJSON = (url, params = null) => (

RequestWrap(request.get(url)

.query(params)

.set('Content-Type', 'application/json;charset=utf-8')

.accept('application/json'))

)

const sendJSON = (url, data) => (

RequestWrap(request.post(url)

.set('Content-Type', 'application/json;charset=utf-8')

.accept('application/json')

.send(data))

)

const sendForm = (url, data) => (

RequestWrap(request.post(url)

.set('Content-Type', 'application/x-www-form-urlencoded')

.send(data))

)

const sendData = (url, data) => (

RequestWrap(request.post(url)

.set('Content-Type', 'text/plain')

.accept('application/json')

.send(data))

)

export default {

getJSON,

sendJSON,

sendForm,

sendData,

}

ФАЙЛ FRONT/CONTAINERS/APP.JSX

import React, { PropTypes } from 'react'

import ReactCSSTransitionGroup from 'react-addons-css-transition-group'

import '../../scss/index.scss'

import '../../scss/animations.scss'

const App = ({ location, children }) => (

<ReactCSSTransitionGroup

className="full-height"

component="div"

transitionName="page-transition"

transitionEnterTimeout={ 500 }

transitionLeaveTimeout={ 500 }

>

{ React.cloneElement(children, {

key: location.pathname,

}) }

</ReactCSSTransitionGroup>

)

App.propTypes = {

location: PropTypes.shape().isRequired,

children: PropTypes.node.isRequired,

}

export default App

ФАЙЛ FRONT/COMPONENTS/SHARED/CHECKBOX.JSX

import React, {Component, PropTypes} from 'react'

import uniqueId from 'lodash/uniqueId'

import classnames from 'classnames/bind'

import styles from './styles.scss'

const cx = classnames.bind(styles)

export default class AlCheckbox extends Component {

static propTypes = {

label: PropTypes.node,

name: PropTypes.string.isRequired,

className: PropTypes.string,

inputClassName: PropTypes.string,

value: PropTypes.string.isRequired,

onChange: PropTypes.func.isRequired,

}

static defaultProps = {

value: false,

}

state = {

checkboxID: uniqueId('al_checkbox_')

}

render() {

const {

label,

value,

className,

inputClassName,

} = this.props

const {

checkboxID

} = this.state

return (

<div className={ cx('checkbox', 'form-input', className) }>

<input

id={ checkboxID }

type="checkbox"

className={ cx('form-control', inputClassName) }

value={ value }

onChange={ this.onChange} />

<label htmlFor={ checkboxID }>

{ label }

</label>

</div>

)

}

onChange = (e) => {

console.log(e)

}

}

ФАЙЛ FRONT/COMPONENTS/SHARED/INPUT.JSX

import React, { Component, PropTypes } from 'react'

import MaskedInput from 'react-input-mask'

import cx from 'classnames'

import _ from 'lodash'

import '../../../../scss/Shared/Input/index.scss'

export default class AlInput extends Component {

static propTypes = {

type: PropTypes.string,

label: PropTypes.string,

name: PropTypes.string.isRequired,

className: PropTypes.string,

inputClassName: PropTypes.string,

value: PropTypes.string.isRequired,

validationErrors: PropTypes.array,

onChange: PropTypes.func.isRequired,

onFocus: PropTypes.func,

onLostFocus: PropTypes.func,

}

static defaultProps = {

type: 'text',

value: '',

onChange: _.noop,

onFocus: _.noop,

onLostFocus: _.noop,

}

state = {

inputID: _.uniqueId('al_input_'),

inputFocused: false,

}

renderValidationState = (value, validationErrors) => {

if (validationErrors) {

const errorsToRender = [ <i key='icon' className='fa fa-exclamation-triangle'/> ]

const errorMessage = validationErrors[0]

const noWrap = !!validationErrors[1]

if (noWrap) {

errorsToRender.push(`${errorMessage}`)

} else {

errorsToRender.push(`${errorMessage} ${value}`)

}

return errorsToRender

}

return value

}

renderInput = (type) => {

const {

inputClassName,

value,

validationErrors,

} = this.props

const {

inputID,

} = this.state

const inputCommonProps = {

id: inputID,

type,

className: cx('form-control', inputClassName, { error: validationErrors }),

value,

onChange: this.onChange,

onFocus: this.inputOnFocus,

onBlur: this.inputOnLostFocus,

}

switch (type) {

case 'phone': {

return (

<MaskedInput

{ ...inputCommonProps }

mask="+7 (999) 999-99-99"

/>

)

}

default: {

return (

<input

{ ...inputCommonProps }

/>

)

}

}

}

render() {

const {

type,

label,

value,

validationErrors,

className,

} = this.props

const {

inputID,

inputFocused,

} = this.state

const isInputActive = inputFocused || (value && value.length > 0);

return (

<div className={ cx('al-input', 'form-input', className) }>

{ this.renderInput(type) }

{ label ?

<label

htmlFor={ inputID }

className={ cx({ active: isInputActive, error: validationErrors }) }

>

{ this.renderValidationState(label, validationErrors) }

</label> : null

}

</div>

)

}

onChange = (e) => {

const {

name,

type,

} = this.props

const value = this.parseValue(type, e.target.value)

this.props.onChange(name, value)

}

inputOnFocus = () => {

const {

name,

} = this.props

this.setState({

inputFocused: true,

})

const field = _.last(name.split('.'))

this.props.onFocus(field)

}

inputOnLostFocus = () => {

const {

name,

} = this.props

this.setState({

inputFocused: false,

})

const field = _.last(name.split('.'))

this.props.onLostFocus(field)

}

parseValue = (type, value) => {

switch (type) {

case 'phone': {

return value.replace(/[^+\d]*/ig, '')

}

default: {

return value

}

}

}

}

ФАЙЛ FRONT/COMPONENTS/SHARED/LOADINGBUTTON.JSX

import React, { Component } from 'react'

import LaddaButton from 'react-ladda'

import * as Constants from 'react-ladda/dist/constants'

import _ from 'lodash'

import '../../../../scss/Shared/LoadingButton/index.scss'

class LoadingButton extends Component {

static propTypes = LaddaButton.propTypes

static defaultProps = {

onClick: _.noop,

}

onClick = (e) => {

e.preventDefault()

e.stopPropagation()

const {

loading,

} = this.props

if (!loading) {

this.props.onClick.apply(this, arguments)

}

}

render() {

return (

<LaddaButton

{ ...this.props }

onClick={ this.onClick }

/>

)

}

}

export {

LoadingButton as default,

Constants,

}

ФАЙЛ FRONT/COMPONENTS/SHARED/NAVITEM.JSX

import React, { PropTypes } from 'react'

import cx from 'classnames'

const NavItem = ({ children, className, accent }) => (

<li

role="presentation"

className={ cx(className, { accent }) }

>

{ children }

</li>

)

NavItem.propTypes = {

children: PropTypes.node.isRequired,

className: PropTypes.string,

accent: PropTypes.bool,

}

NavItem.defaultProps = {

className: '',

accent: false,

}

export default NavItem

ФАЙЛ FRONT/COMPONENTS/SHARED/NOWRAP.JSX

import React, { PropTypes } from 'react'

import cx from 'classnames'

const NoWrap = ({ className, children, ...props }) => (

<span

className={ cx(className, 'nowrap') }

{ ...props }

>

{ children }

</span>

)

NoWrap.propTypes = {

className: PropTypes.string,

children: PropTypes.node.isRequired,

}

NoWrap.defaultProps = {

className: null,

}

export default NoWrap

ФАЙЛ FRONT/COMPONENTS/SHARED/SCROLLCHOR.JSX

import React, { PropTypes } from 'react'

import Scrollchor from 'react-scrollchor'

const AlScrollchor = ({ animate, navHeight, ...props }) => {

let newProps = {

animate,

...props,

}

if ((animate && animate.offset) || navHeight) {

newProps = {

...newProps,

animate: {

...animate,

offset: -navHeight + ((animate && animate.offset) || 0),

},

}

}

return (

<Scrollchor

{ ...newProps }

/>

)

}

AlScrollchor.propTypes = {

...Scrollchor.propTypes,

navHeight: PropTypes.number,

}

AlScrollchor.defaultProps = {

navHeight: 80,

}

export default AlScrollchor

ФАЙЛ FRONT/COMPONENTS/SHARED/SELECT.JSX

import React, { Component, PropTypes } from 'react'

import Select from 'react-select'

import cx from 'classnames'

import _ from 'lodash'

import '../../../../scss/Shared/Select/index.scss'

export default class AlSelect extends Component {

static propTypes = {

options: PropTypes.arrayOf(PropTypes.object).isRequired,

value: PropTypes.string.isRequired,

name: PropTypes.string.isRequired,

label: PropTypes.string,

className: PropTypes.string,

selectClassName: PropTypes.string,

tabIndex: PropTypes.string,

onChange: PropTypes.func,

}

static defaultProps = {

type: 'text',

value: '',

onChange: _.noop,

}

state = {

selectID: _.uniqueId('al_select_'),

}

renderLabel = (label) => {

if (label) {

const {

selectID,

} = this.state

return (

<label

htmlFor={ selectID }

className="active"

>

{ label }

</label>

)

}

}

render() {

const {

options,

value,

label,

className,

tabIndex,

} = this.props

return (

<div className={ cx('al-select', 'form-input', className) }>

<Select

className="form-control"

options={ options }

value={ value }

clearable={ false }

searchable={ false }

tabIndex={ tabIndex }

onChange={ this.onChange }

/>

{ this.renderLabel(label) }

</div>

)

}

onChange = ({ value }) => {

const {

name,

} = this.props

this.props.onChange(name, value)

}

}

ПРИЛОЖЕНИЕ В. ПРЕЗЕНТАЦИЯ

Размещено на Allbest.ru

...

Подобные документы

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.