diff --git a/.gitignore b/.gitignore index 4711ea7..17bceaf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,40 @@ -# ---> Yii -assets/* -!assets/.gitignore -protected/runtime/* -!protected/runtime/.gitignore -protected/data/*.db -themes/classic/views/ +# yii console commands +/yii +/yii_test +/yii_test.bat +/img +/frontend/images +# phpstorm project files +.idea +# netbeans project files +nbproject + +# zend studio for eclipse project files +.buildpath +.project +.settings + +# windows thumbnail cache +Thumbs.db + +# composer vendor dir +/vendor +!/vendor/kcdev/yii2/web/KcErrorAction.php +!/vendor/lmz +!/vendor/cgb +# composer itself is not needed +composer.phar + +# Mac DS_Store Files +.DS_Store + +# phpunit itself is not needed +phpunit.phar +# local phpunit config +/phpunit.xml + +# vagrant runtime +/.vagrant +vendor.zip +/vagrant diff --git a/common/config/.gitignore b/common/config/.gitignore new file mode 100644 index 0000000..7c090d2 --- /dev/null +++ b/common/config/.gitignore @@ -0,0 +1,4 @@ +codeception-local.php +main-local.php +params-local.php +test-local.php diff --git a/common/config/bootstrap.php b/common/config/bootstrap.php new file mode 100644 index 0000000..278f3db --- /dev/null +++ b/common/config/bootstrap.php @@ -0,0 +1,5 @@ + [ + '@bower' => '@vendor/bower-asset', + '@npm' => '@vendor/npm-asset', + ], + 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor', + 'components' => [ + 'cache' => [ + 'class' => 'yii\caching\FileCache', + ], + ], +]; diff --git a/common/config/params.php b/common/config/params.php new file mode 100644 index 0000000..b18cb95 --- /dev/null +++ b/common/config/params.php @@ -0,0 +1,8 @@ + 'admin@example.com', + 'supportEmail' => 'support@example.com', + 'senderEmail' => 'noreply@example.com', + 'senderName' => 'Example.com mailer', + 'user.passwordResetTokenExpire' => 3600, +]; diff --git a/common/models/LoginForm.php b/common/models/LoginForm.php new file mode 100644 index 0000000..99be60e --- /dev/null +++ b/common/models/LoginForm.php @@ -0,0 +1,85 @@ + '用户名', + 'password' => '密码', + 'rememberMe' => '记住' + ]; + } + + /** + * Validates the password. + * This method serves as the inline validation for password. + * + * @param string $attribute the attribute currently being validated + * @param array $params the additional name-value pairs given in the rule + */ + public function validatePassword($attribute, $params) { + if (!$this->hasErrors()) { + $user = $this->getUser(); + if (!$user || !$user->validatePassword($this->password)) { + $this->addError($attribute, 'Incorrect username or password.'); + } + } + } + + /** + * Logs in a user using the provided username and password. + * + * @return bool whether the user is logged in successfully + */ + public function login() { + if ($this->validate()) { + return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0); + } + + return false; + } + + /** + * Finds user by [[username]] + * + * @return User|null + */ + protected function getUser() { + if ($this->_user === null) { + $this->_user = User::findByUsername($this->username); + } + + return $this->_user; + } + +} diff --git a/common/models/User.php b/common/models/User.php new file mode 100644 index 0000000..5df9766 --- /dev/null +++ b/common/models/User.php @@ -0,0 +1,209 @@ + self::STATUS_INACTIVE], + ['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_INACTIVE, self::STATUS_DELETED]], + ]; + } + + /** + * {@inheritdoc} + */ + public static function findIdentity($id) + { + return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]); + } + + /** + * {@inheritdoc} + */ + public static function findIdentityByAccessToken($token, $type = null) + { + throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.'); + } + + /** + * Finds user by username + * + * @param string $username + * @return static|null + */ + public static function findByUsername($username) + { + return static::findOne(['username' => $username, 'status' => self::STATUS_ACTIVE]); + } + + /** + * Finds user by password reset token + * + * @param string $token password reset token + * @return static|null + */ + public static function findByPasswordResetToken($token) + { + if (!static::isPasswordResetTokenValid($token)) { + return null; + } + + return static::findOne([ + 'password_reset_token' => $token, + 'status' => self::STATUS_ACTIVE, + ]); + } + + /** + * Finds user by verification email token + * + * @param string $token verify email token + * @return static|null + */ + public static function findByVerificationToken($token) { + return static::findOne([ + 'verification_token' => $token, + 'status' => self::STATUS_INACTIVE + ]); + } + + /** + * Finds out if password reset token is valid + * + * @param string $token password reset token + * @return bool + */ + public static function isPasswordResetTokenValid($token) + { + if (empty($token)) { + return false; + } + + $timestamp = (int) substr($token, strrpos($token, '_') + 1); + $expire = Yii::$app->params['user.passwordResetTokenExpire']; + return $timestamp + $expire >= time(); + } + + /** + * {@inheritdoc} + */ + public function getId() + { + return $this->getPrimaryKey(); + } + + /** + * {@inheritdoc} + */ + public function getAuthKey() + { + return $this->auth_key; + } + + /** + * {@inheritdoc} + */ + public function validateAuthKey($authKey) + { + return $this->getAuthKey() === $authKey; + } + + /** + * Validates password + * + * @param string $password password to validate + * @return bool if password provided is valid for current user + */ + public function validatePassword($password) + { + return Yii::$app->security->validatePassword($password, $this->password_hash); + } + + /** + * Generates password hash from password and sets it to the model + * + * @param string $password + */ + public function setPassword($password) + { + $this->password_hash = Yii::$app->security->generatePasswordHash($password); + } + + /** + * Generates "remember me" authentication key + */ + public function generateAuthKey() + { + $this->auth_key = Yii::$app->security->generateRandomString(); + } + + /** + * Generates new password reset token + */ + public function generatePasswordResetToken() + { + $this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time(); + } + + public function generateEmailVerificationToken() + { + $this->verification_token = Yii::$app->security->generateRandomString() . '_' . time(); + } + + /** + * Removes password reset token + */ + public function removePasswordResetToken() + { + $this->password_reset_token = null; + } +} diff --git a/common/widgets/Alert.php b/common/widgets/Alert.php new file mode 100644 index 0000000..7281fa8 --- /dev/null +++ b/common/widgets/Alert.php @@ -0,0 +1,75 @@ +session->setFlash('error', 'This is the message'); + * Yii::$app->session->setFlash('success', 'This is the message'); + * Yii::$app->session->setFlash('info', 'This is the message'); + * ``` + * + * Multiple messages could be set as follows: + * + * ```php + * Yii::$app->session->setFlash('error', ['Error 1', 'Error 2']); + * ``` + * + * @author Kartik Visweswaran + * @author Alexander Makarov + */ +class Alert extends \yii\bootstrap\Widget +{ + /** + * @var array the alert types configuration for the flash messages. + * This array is setup as $key => $value, where: + * - key: the name of the session flash variable + * - value: the bootstrap alert type (i.e. danger, success, info, warning) + */ + public $alertTypes = [ + 'error' => 'alert-danger', + 'danger' => 'alert-danger', + 'success' => 'alert-success', + 'info' => 'alert-info', + 'warning' => 'alert-warning' + ]; + /** + * @var array the options for rendering the close button tag. + * Array will be passed to [[\yii\bootstrap\Alert::closeButton]]. + */ + public $closeButton = []; + + + /** + * {@inheritdoc} + */ + public function run() + { + $session = Yii::$app->session; + $flashes = $session->getAllFlashes(); + $appendClass = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; + + foreach ($flashes as $type => $flash) { + if (!isset($this->alertTypes[$type])) { + continue; + } + + foreach ((array) $flash as $i => $message) { + echo \yii\bootstrap\Alert::widget([ + 'body' => $message, + 'closeButton' => $this->closeButton, + 'options' => array_merge($this->options, [ + 'id' => $this->getId() . '-' . $type . '-' . $i, + 'class' => $this->alertTypes[$type] . $appendClass, + ]), + ]); + } + + $session->removeFlash($type); + } + } +} diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..2f09d88 --- /dev/null +++ b/composer.json @@ -0,0 +1,34 @@ +{ + "name": "blobt/kcbasic", + "description": "This is a fast template using for small project in KcDev.", + "type": "project", + "license": "MIT", + "authors": [ + { + "name": "blobt", + "email": "380255922@qq.com" + } + ], + "minimum-stability": "dev", + "require": { + "php": ">=7.1.0", + "yiisoft/yii2": "~2.0.14", + "yiisoft/yii2-bootstrap": "^2.0@dev", + "yiisoft/yii2-gii": "^2.0@dev" + }, + "repositories": { + "kc_packagist": { + "type": "composer", + "url": "https://packagist.kcshop.com.cn/" + }, + + "packagist": { + "type": "composer", + "url": "https://packagist.phpcomposer.com" + } + }, + "require-dev": { + "yiisoft/yii2-debug": "^2.0@dev", + "kint-php/kint": "dev-master" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..88d69ce --- /dev/null +++ b/composer.lock @@ -0,0 +1,776 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "3a4228dae33737e4c38ff88dd6a56a10", + "packages": [ + { + "name": "bower-asset/bootstrap", + "version": "v3.4.1", + "source": { + "type": "git", + "url": "https://github.com/twbs/bootstrap.git", + "reference": "68b0d231a13201eb14acd3dc84e51543d16e5f7e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twbs/bootstrap/zipball/68b0d231a13201eb14acd3dc84e51543d16e5f7e", + "reference": "68b0d231a13201eb14acd3dc84e51543d16e5f7e", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.9.1,<4.0" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": [ + "less/bootstrap.less", + "dist/js/bootstrap.js" + ], + "bower-asset-ignore": [ + "/.*", + "_config.yml", + "CNAME", + "composer.json", + "CONTRIBUTING.md", + "docs", + "js/tests", + "test-infra" + ] + }, + "license": [ + "MIT" + ], + "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", + "keywords": [ + "css", + "framework", + "front-end", + "js", + "less", + "mobile-first", + "responsive", + "web" + ], + "time": "2019-02-13T15:55:38+00:00" + }, + { + "name": "bower-asset/inputmask", + "version": "3.3.11", + "source": { + "type": "git", + "url": "https://github.com/RobinHerbots/Inputmask.git", + "reference": "5e670ad62f50c738388d4dcec78d2888505ad77b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/RobinHerbots/Inputmask/zipball/5e670ad62f50c738388d4dcec78d2888505ad77b", + "reference": "5e670ad62f50c738388d4dcec78d2888505ad77b", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.7" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": [ + "./dist/inputmask/inputmask.js", + "./dist/inputmask/inputmask.extensions.js", + "./dist/inputmask/inputmask.date.extensions.js", + "./dist/inputmask/inputmask.numeric.extensions.js", + "./dist/inputmask/inputmask.phone.extensions.js", + "./dist/inputmask/jquery.inputmask.js", + "./dist/inputmask/global/document.js", + "./dist/inputmask/global/window.js", + "./dist/inputmask/phone-codes/phone.js", + "./dist/inputmask/phone-codes/phone-be.js", + "./dist/inputmask/phone-codes/phone-nl.js", + "./dist/inputmask/phone-codes/phone-ru.js", + "./dist/inputmask/phone-codes/phone-uk.js", + "./dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js", + "./dist/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js", + "./dist/inputmask/dependencyLibs/inputmask.dependencyLib.js", + "./dist/inputmask/bindings/inputmask.binding.js" + ], + "bower-asset-ignore": [ + "**/*", + "!dist/*", + "!dist/inputmask/*", + "!dist/min/*", + "!dist/min/inputmask/*" + ] + }, + "license": [ + "http://opensource.org/licenses/mit-license.php" + ], + "description": "Inputmask is a javascript library which creates an input mask. Inputmask can run against vanilla javascript, jQuery and jqlite.", + "keywords": [ + "form", + "input", + "inputmask", + "jquery", + "mask", + "plugins" + ], + "time": "2017-11-21T11:46:23+00:00" + }, + { + "name": "bower-asset/jquery", + "version": "3.4.1", + "source": { + "type": "git", + "url": "https://github.com/jquery/jquery-dist.git", + "reference": "15bc73803f76bc53b654b9fdbbbc096f56d7c03d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jquery/jquery-dist/zipball/15bc73803f76bc53b654b9fdbbbc096f56d7c03d", + "reference": "15bc73803f76bc53b654b9fdbbbc096f56d7c03d", + "shasum": "" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "dist/jquery.js", + "bower-asset-ignore": [ + "package.json" + ] + }, + "license": [ + "MIT" + ], + "keywords": [ + "browser", + "javascript", + "jquery", + "library" + ], + "time": "2019-05-01T21:19:28+00:00" + }, + { + "name": "bower-asset/punycode", + "version": "v1.3.2", + "source": { + "type": "git", + "url": "https://github.com/bestiejs/punycode.js.git", + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bestiejs/punycode.js/zipball/38c8d3131a82567bfef18da09f7f4db68c84f8a3", + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3", + "shasum": "" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "punycode.js", + "bower-asset-ignore": [ + "coverage", + "tests", + ".*", + "component.json", + "Gruntfile.js", + "node_modules", + "package.json" + ] + }, + "time": "2014-10-22T12:02:42+00:00" + }, + { + "name": "bower-asset/yii2-pjax", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/jquery-pjax.git", + "reference": "c39f2393883f370d3c0d63d80a122534131b0f56" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/jquery-pjax/zipball/c39f2393883f370d3c0d63d80a122534131b0f56", + "reference": "c39f2393883f370d3c0d63d80a122534131b0f56", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.8" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "./jquery.pjax.js", + "bower-asset-ignore": [ + ".travis.yml", + "Gemfile", + "Gemfile.lock", + "CONTRIBUTING.md", + "vendor/", + "script/", + "test/" + ], + "branch-alias": { + "dev-master": "2.0.8-dev" + } + }, + "license": [ + "MIT" + ], + "time": "2017-10-14T08:42:41+00:00" + }, + { + "name": "cebe/markdown", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/cebe/markdown.git", + "reference": "eeb1bf622e80f337479e00a5db94c56e7cf1326b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cebe/markdown/zipball/eeb1bf622e80f337479e00a5db94c56e7cf1326b", + "reference": "eeb1bf622e80f337479e00a5db94c56e7cf1326b", + "shasum": "" + }, + "require": { + "lib-pcre": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "cebe/indent": "*", + "facebook/xhprof": "*@dev", + "phpunit/phpunit": "4.1.*" + }, + "bin": [ + "bin/markdown" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "cebe\\markdown\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Carsten Brandt", + "email": "mail@cebe.cc", + "homepage": "http://cebe.cc/", + "role": "Creator" + } + ], + "description": "A super fast, highly extensible markdown parser for PHP", + "homepage": "https://github.com/cebe/markdown#readme", + "keywords": [ + "extensible", + "fast", + "gfm", + "markdown", + "markdown-extra" + ], + "time": "2018-12-10T09:41:35+00:00" + }, + { + "name": "ezyang/htmlpurifier", + "version": "v4.10.0", + "source": { + "type": "git", + "url": "https://github.com/ezyang/htmlpurifier.git", + "reference": "d85d39da4576a6934b72480be6978fb10c860021" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/d85d39da4576a6934b72480be6978fb10c860021", + "reference": "d85d39da4576a6934b72480be6978fb10c860021", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "require-dev": { + "simpletest/simpletest": "^1.1" + }, + "type": "library", + "autoload": { + "psr-0": { + "HTMLPurifier": "library/" + }, + "files": [ + "library/HTMLPurifier.composer.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Edward Z. Yang", + "email": "admin@htmlpurifier.org", + "homepage": "http://ezyang.com" + } + ], + "description": "Standards compliant HTML filter written in PHP", + "homepage": "http://htmlpurifier.org/", + "keywords": [ + "html" + ], + "time": "2018-02-23T01:58:20+00:00" + }, + { + "name": "phpspec/php-diff", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/php-diff.git", + "reference": "0464787bfa7cd13576c5a1e318709768798bec6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/php-diff/zipball/0464787bfa7cd13576c5a1e318709768798bec6a", + "reference": "0464787bfa7cd13576c5a1e318709768798bec6a", + "shasum": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Diff": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Chris Boulton", + "homepage": "http://github.com/chrisboulton" + } + ], + "description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).", + "time": "2016-04-07T12:29:16+00:00" + }, + { + "name": "yiisoft/yii2", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-framework.git", + "reference": "f61cfa2ab22ddf82377f5c3428066689123b50e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/f61cfa2ab22ddf82377f5c3428066689123b50e5", + "reference": "f61cfa2ab22ddf82377f5c3428066689123b50e5", + "shasum": "" + }, + "require": { + "bower-asset/inputmask": "~3.2.2 | ~3.3.5", + "bower-asset/jquery": "3.4.*@stable | 3.3.*@stable | 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable", + "bower-asset/punycode": "1.3.*", + "bower-asset/yii2-pjax": "~2.0.1", + "cebe/markdown": "~1.0.0 | ~1.1.0 | ~1.2.0", + "ext-ctype": "*", + "ext-mbstring": "*", + "ezyang/htmlpurifier": "~4.6", + "lib-pcre": "*", + "php": ">=5.4.0", + "yiisoft/yii2-composer": "~2.0.4" + }, + "bin": [ + "yii" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com", + "homepage": "http://www.yiiframework.com/", + "role": "Founder and project lead" + }, + { + "name": "Alexander Makarov", + "email": "sam@rmcreative.ru", + "homepage": "http://rmcreative.ru/", + "role": "Core framework development" + }, + { + "name": "Maurizio Domba", + "homepage": "http://mdomba.info/", + "role": "Core framework development" + }, + { + "name": "Carsten Brandt", + "email": "mail@cebe.cc", + "homepage": "http://cebe.cc/", + "role": "Core framework development" + }, + { + "name": "Timur Ruziev", + "email": "resurtm@gmail.com", + "homepage": "http://resurtm.com/", + "role": "Core framework development" + }, + { + "name": "Paul Klimov", + "email": "klimov.paul@gmail.com", + "role": "Core framework development" + }, + { + "name": "Dmitry Naumenko", + "email": "d.naumenko.a@gmail.com", + "role": "Core framework development" + }, + { + "name": "Boudewijn Vahrmeijer", + "email": "info@dynasource.eu", + "homepage": "http://dynasource.eu", + "role": "Core framework development" + } + ], + "description": "Yii PHP Framework Version 2", + "homepage": "http://www.yiiframework.com/", + "keywords": [ + "framework", + "yii2" + ], + "time": "2019-07-10T18:16:39+00:00" + }, + { + "name": "yiisoft/yii2-bootstrap", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-bootstrap.git", + "reference": "40a00e20b66057cd32d0c8bbc9377dc0223e541a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-bootstrap/zipball/40a00e20b66057cd32d0c8bbc9377dc0223e541a", + "reference": "40a00e20b66057cd32d0c8bbc9377dc0223e541a", + "shasum": "" + }, + "require": { + "bower-asset/bootstrap": "3.4.* | 3.3.* | 3.2.* | 3.1.*", + "yiisoft/yii2": "~2.0.6" + }, + "require-dev": { + "phpunit/phpunit": "<7" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\bootstrap\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Paul Klimov", + "email": "klimov.paul@gmail.com" + }, + { + "name": "Alexander Makarov", + "email": "sam@rmcreative.ru", + "homepage": "http://rmcreative.ru/" + }, + { + "name": "Antonio Ramirez", + "email": "amigo.cobos@gmail.com" + }, + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com", + "homepage": "http://www.yiiframework.com/" + } + ], + "description": "The Twitter Bootstrap extension for the Yii framework", + "keywords": [ + "bootstrap", + "yii2" + ], + "time": "2019-05-23T16:20:29+00:00" + }, + { + "name": "yiisoft/yii2-composer", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-composer.git", + "reference": "fa0856bb95beb49d30f408639224b0e0ed26b4f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/fa0856bb95beb49d30f408639224b0e0ed26b4f3", + "reference": "fa0856bb95beb49d30f408639224b0e0ed26b4f3", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0" + }, + "require-dev": { + "composer/composer": "^1.0", + "phpunit/phpunit": "<7" + }, + "type": "composer-plugin", + "extra": { + "class": "yii\\composer\\Plugin", + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\composer\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + }, + { + "name": "Carsten Brandt", + "email": "mail@cebe.cc" + } + ], + "description": "The composer plugin for Yii extension installer", + "keywords": [ + "composer", + "extension installer", + "yii2" + ], + "time": "2019-05-28T08:14:44+00:00" + }, + { + "name": "yiisoft/yii2-gii", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-gii.git", + "reference": "d1c18f0dcbd72ab285acd320c56b1aa2554e06fa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-gii/zipball/d1c18f0dcbd72ab285acd320c56b1aa2554e06fa", + "reference": "d1c18f0dcbd72ab285acd320c56b1aa2554e06fa", + "shasum": "" + }, + "require": { + "phpspec/php-diff": "^1.1.0", + "yiisoft/yii2": "~2.0.14" + }, + "require-dev": { + "phpunit/phpunit": "<7", + "yiisoft/yii2-coding-standards": "~2.0" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\gii\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + } + ], + "description": "The Gii extension for the Yii framework", + "keywords": [ + "code generator", + "gii", + "yii2" + ], + "time": "2019-03-17T19:23:15+00:00" + } + ], + "packages-dev": [ + { + "name": "kint-php/kint", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/kint-php/kint.git", + "reference": "339b24fc0439d61644ddcc5d5f52cf5fdfbe3fa3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kint-php/kint/zipball/339b24fc0439d61644ddcc5d5f52cf5fdfbe3fa3", + "reference": "339b24fc0439d61644ddcc5d5f52cf5fdfbe3fa3", + "shasum": "" + }, + "require": { + "php": ">=5.3.6" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.0", + "phpunit/phpunit": "^4.0", + "seld/phar-utils": "^1.0", + "symfony/finder": "^2.0 || ^3.0 || ^4.0", + "vimeo/psalm": "^3.0" + }, + "suggest": { + "ext-ctype": "Simple data type tests", + "ext-iconv": "Provides fallback detection for ambiguous legacy string encodings such as the Windows and ISO 8859 code pages", + "ext-mbstring": "Provides string encoding detection", + "kint-php/kint-js": "Provides a simplified dump to console.log()", + "kint-php/kint-twig": "Provides d() and s() functions in twig templates", + "symfony/polyfill-ctype": "Replacement for ext-ctype if missing", + "symfony/polyfill-iconv": "Replacement for ext-iconv if missing", + "symfony/polyfill-mbstring": "Replacement for ext-mbstring if missing" + }, + "type": "library", + "autoload": { + "files": [ + "init.php" + ], + "psr-4": { + "Kint\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Rokas Šleinius", + "homepage": "https://github.com/raveren" + }, + { + "name": "Jonathan Vollebregt", + "homepage": "https://github.com/jnvsor" + }, + { + "name": "Contributors", + "homepage": "https://github.com/kint-php/kint/graphs/contributors" + } + ], + "description": "Kint - debugging tool for PHP developers", + "homepage": "https://kint-php.github.io/kint/", + "keywords": [ + "debug", + "kint", + "php" + ], + "time": "2019-07-11T17:29:14+00:00" + }, + { + "name": "yiisoft/yii2-debug", + "version": "2.1.5", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-debug.git", + "reference": "a6bbf55093e154e2eeb2c778af8717989495270e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-debug/zipball/a6bbf55093e154e2eeb2c778af8717989495270e", + "reference": "a6bbf55093e154e2eeb2c778af8717989495270e", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=5.4", + "yiisoft/yii2": "~2.0.13" + }, + "require-dev": { + "phpunit/phpunit": "<7", + "yiisoft/yii2-coding-standards": "~2.0", + "yiisoft/yii2-swiftmailer": "*" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\debug\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + }, + { + "name": "Simon Karlen", + "email": "simi.albi@outlook.com" + } + ], + "description": "The debugger extension for the Yii framework", + "keywords": [ + "debug", + "debugger", + "yii2" + ], + "time": "2019-06-04T14:21:49+00:00" + } + ], + "aliases": [], + "minimum-stability": "dev", + "stability-flags": { + "yiisoft/yii2-bootstrap": 20, + "yiisoft/yii2-gii": 20, + "yiisoft/yii2-debug": 20, + "kint-php/kint": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=7.1.0" + }, + "platform-dev": [] +} diff --git a/console/config/.gitignore b/console/config/.gitignore new file mode 100644 index 0000000..42799dd --- /dev/null +++ b/console/config/.gitignore @@ -0,0 +1,3 @@ +main-local.php +params-local.php +test-local.php diff --git a/console/config/bootstrap.php b/console/config/bootstrap.php new file mode 100644 index 0000000..b3d9bbc --- /dev/null +++ b/console/config/bootstrap.php @@ -0,0 +1 @@ + 'app-console', + 'basePath' => dirname(__DIR__), + 'bootstrap' => ['log'], + 'controllerNamespace' => 'console\controllers', + 'aliases' => [ + '@bower' => '@vendor/bower-asset', + '@npm' => '@vendor/npm-asset', + ], + 'controllerMap' => [ + 'fixture' => [ + 'class' => 'yii\console\controllers\FixtureController', + 'namespace' => 'common\fixtures', + ], + ], + 'components' => [ + 'log' => [ + 'targets' => [ + [ + 'class' => 'yii\log\FileTarget', + 'levels' => ['error', 'warning'], + ], + ], + ], + ], + 'params' => $params, +]; diff --git a/console/config/params.php b/console/config/params.php new file mode 100644 index 0000000..7f754b9 --- /dev/null +++ b/console/config/params.php @@ -0,0 +1,4 @@ + 'admin@example.com', +]; diff --git a/console/config/test.php b/console/config/test.php new file mode 100644 index 0000000..05e0b10 --- /dev/null +++ b/console/config/test.php @@ -0,0 +1,4 @@ +authManager; + while ($password == NULL) { + $password = $this->prompt("\n\n请输入admin用户密码(最少6位任意字符):"); + + if (strlen($password) < 6) { + $password = NULL; + continue; + } + break; + } + + $this->createAdmin($password); + } + + /** + * 数据迁移 + * @param sring $migrationPath 数据迁移代码目录 + */ + private function migrate($migrationPath = "@app/migrations") { + $migrate = Yii::createObject("yii\console\controllers\MigrateController", ["action", $this]); + $migrate->interactive = false; + $migrate->migrationPath = $migrationPath; + $migrate->runAction("up", []); + } + + /** + * TODO没有完善 + * 清空数据库 + */ + public function clearDb() { + Yii::$app->db->createCommand("SET FOREIGN_KEY_CHECKS = 0;")->execute(); + $dbname = explode('=', explode(';', Yii::$app->db->dsn)[1])[1]; + $sql = "SELECT CONCAT('drop table ',table_name,';') FROM information_schema.`TABLES` WHERE table_schema='{$dbname}';"; + $sqls = Yii::$app->db->createCommand($sql)->queryColumn(); + foreach ($sqls as $dropSql) { + Yii::$app->db->createCommand($dropSql)->execute(); + } + } + + /** + * 创建管理员 + * @param string $password 管理员密码 + */ + private function createAdmin($password) { + $auth = Yii::$app->authManager; + + $model = User::findOne("username = 'admin"); + + if (empty($model)) { + $model = new User(); + } + + $model->username = "admin"; + $model->email = "admin@kcshop.store"; + $model->setPassword($password); + $model->generateAuthKey(); + $model->status = User::STATUS_ACTIVE; + $model->created_at = $model->updated_at = time(); + if ($model->save()) { + //$oRole = $auth->getRole("超级管理员"); + //if ($auth->assign($oRole, $model->id)) { + $this->stdout("Create admin success!\n", Console::FG_GREEN); + //} + } + } + +} diff --git a/console/migrations/m130524_201442_init.php b/console/migrations/m130524_201442_init.php new file mode 100644 index 0000000..6b649f4 --- /dev/null +++ b/console/migrations/m130524_201442_init.php @@ -0,0 +1,33 @@ +db->driverName === 'mysql') { + // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci + $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; + } + + $this->createTable('{{%user}}', [ + 'id' => $this->primaryKey(), + 'username' => $this->string()->notNull()->unique(), + 'auth_key' => $this->string(32)->notNull(), + 'password_hash' => $this->string()->notNull(), + 'password_reset_token' => $this->string()->unique(), + 'email' => $this->string()->notNull()->unique(), + + 'status' => $this->smallInteger()->notNull()->defaultValue(10), + 'created_at' => $this->integer()->notNull(), + 'updated_at' => $this->integer()->notNull(), + ], $tableOptions); + } + + public function down() + { + $this->dropTable('{{%user}}'); + } +} diff --git a/console/migrations/m190124_110200_add_verification_token_column_to_user_table.php b/console/migrations/m190124_110200_add_verification_token_column_to_user_table.php new file mode 100644 index 0000000..4a20dc7 --- /dev/null +++ b/console/migrations/m190124_110200_add_verification_token_column_to_user_table.php @@ -0,0 +1,16 @@ +addColumn('{{%user}}', 'verification_token', $this->string()->defaultValue(null)); + } + + public function down() + { + $this->dropColumn('{{%user}}', 'verification_token'); + } +} diff --git a/console/models/.gitkeep b/console/models/.gitkeep new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/console/models/.gitkeep @@ -0,0 +1 @@ +* diff --git a/console/runtime/.gitignore b/console/runtime/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/console/runtime/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/environments/web_application/index.php b/environments/web_application/index.php new file mode 100644 index 0000000..1649b25 --- /dev/null +++ b/environments/web_application/index.php @@ -0,0 +1,17 @@ +run(); diff --git a/environments/web_application/main-local.php b/environments/web_application/main-local.php new file mode 100644 index 0000000..d9a8ceb --- /dev/null +++ b/environments/web_application/main-local.php @@ -0,0 +1,25 @@ + [ + 'request' => [ + // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation + 'cookieValidationKey' => '', + ], + ], +]; + +if (!YII_ENV_TEST) { + // configuration adjustments for 'dev' environment + $config['bootstrap'][] = 'debug'; + $config['modules']['debug'] = [ + 'class' => 'yii\debug\Module', + ]; + + $config['bootstrap'][] = 'gii'; + $config['modules']['gii'] = [ + 'class' => 'yii\gii\Module', + ]; +} + +return $config; diff --git a/environments/web_application/params-local.php b/environments/web_application/params-local.php new file mode 100644 index 0000000..d0b9c34 --- /dev/null +++ b/environments/web_application/params-local.php @@ -0,0 +1,3 @@ + $name) { + echo " [$i] $name\n"; +} +echo "\n Your choice [0-" . (count($types) - 1) . ', or "q" to quit] '; +$answer = trim(fgets(STDIN)); + +if (!ctype_digit($answer) || !in_array($answer, range(0, count($types) - 1))) { + printError("Please enter the correct nunmber"); + exit(); +} +$type = $answer; + +//TODO 后面希望通过这个脚本 可以创建web后台 H5前台 API等程序的基础模板,这些模板保存在environment目录里面 + + + +/** + * Prints error message. + * @param string $message message + */ +function printError($message) { + echo "\n " . formatMessage("Error. $message", ['fg-red']) . " \n"; +} + +/** + * Returns true if the stream supports colorization. ANSI colors are disabled if not supported by the stream. + * + * - windows without ansicon + * - not tty consoles + * + * @return boolean true if the stream supports ANSI colors, otherwise false. + */ +function ansiColorsSupported() { + return DIRECTORY_SEPARATOR === '\\' ? getenv('ANSICON') !== false || getenv('ConEmuANSI') === 'ON' : function_exists('posix_isatty') && @posix_isatty(STDOUT); +} + +/** + * Get ANSI code of style. + * @param string $name style name + * @return integer ANSI code of style. + */ +function getStyleCode($name) { + $styles = [ + 'bold' => 1, + 'fg-black' => 30, + 'fg-red' => 31, + 'fg-green' => 32, + 'fg-yellow' => 33, + 'fg-blue' => 34, + 'fg-magenta' => 35, + 'fg-cyan' => 36, + 'fg-white' => 37, + 'bg-black' => 40, + 'bg-red' => 41, + 'bg-green' => 42, + 'bg-yellow' => 43, + 'bg-blue' => 44, + 'bg-magenta' => 45, + 'bg-cyan' => 46, + 'bg-white' => 47, + ]; + return $styles[$name]; +} + +/** + * Formats message using styles if STDOUT supports it. + * @param string $message message + * @param string[] $styles styles + * @return string formatted message. + */ +function formatMessage($message, $styles) { + if (empty($styles) || !ansiColorsSupported()) { + return $message; + } + + return sprintf("\x1b[%sm", implode(';', array_map('getStyleCode', $styles))) . $message . "\x1b[0m"; +} +?> \ No newline at end of file diff --git a/kcadmin/assets/AppAsset.php b/kcadmin/assets/AppAsset.php new file mode 100644 index 0000000..0a10ea3 --- /dev/null +++ b/kcadmin/assets/AppAsset.php @@ -0,0 +1,26 @@ + 'kcadmin', + 'basePath' => dirname(__DIR__), + 'language' => 'zh-CN', + 'controllerNamespace' => 'kcadmin\controllers', + 'bootstrap' => ['log'], + 'modules' => [], + 'components' => [ + 'request' => [ + 'csrfParam' => '_csrf-kcadmin', + ], + 'user' => [ + 'identityClass' => 'common\models\User', + 'enableAutoLogin' => true, + 'identityCookie' => ['name' => '_identity-kcadmin', 'httpOnly' => true], + ], + 'session' => [ + // this is the name of the session cookie used for login on the app + 'name' => 'kcadmin', + ], + 'log' => [ + 'traceLevel' => YII_DEBUG ? 3 : 0, + 'targets' => [ + [ + 'class' => 'yii\log\FileTarget', + 'levels' => ['error', 'warning'], + ], + ], + ], + 'errorHandler' => [ + 'errorAction' => 'site/error', + ], + 'urlManager' => [ + 'enablePrettyUrl' => true, + 'showScriptName' => false, + 'rules' => [ + ], + ], + ], + 'params' => $params, +]; diff --git a/kcadmin/config/params.php b/kcadmin/config/params.php new file mode 100644 index 0000000..7f754b9 --- /dev/null +++ b/kcadmin/config/params.php @@ -0,0 +1,4 @@ + 'admin@example.com', +]; diff --git a/kcadmin/controllers/SiteController.php b/kcadmin/controllers/SiteController.php new file mode 100644 index 0000000..504d571 --- /dev/null +++ b/kcadmin/controllers/SiteController.php @@ -0,0 +1,108 @@ + [ + 'class' => AccessControl::className(), + 'rules' => [ + [ + 'actions' => ['login', 'error', 'test'], + 'allow' => true, + ], + [ + 'actions' => ['logout', 'index'], + 'allow' => true, + 'roles' => ['@'], + ], + ], + ], + 'verbs' => [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'logout' => ['post'], + ], + ], + ]; + } + + /** + * {@inheritdoc} + */ + public function actions() { + return [ + 'error' => [ + 'class' => 'yii\web\ErrorAction', + ], + ]; + } + + /** + * Displays homepage. + * + * @return string + */ + public function actionIndex() { + return $this->render('index'); + } + + /** + * Login action. + * + * @return string + */ + public function actionLogin() { + + $this->layout = 'base'; + + if (!Yii::$app->user->isGuest) { + return $this->goHome(); + } + + $model = new LoginForm(); + if ($model->load(Yii::$app->request->post()) && $model->login()) { + return $this->goBack(); + } else { + $model->password = ''; + + return $this->render('login', [ + 'model' => $model, + ]); + } + } + + /** + * Logout action. + * + * @return string + */ + public function actionLogout() { + Yii::$app->user->logout(); + + return $this->goHome(); + } + + public function actionTest() { + $model = new LoginForm(); + return $this->render('test', [ + 'name' => 'blobt', + 'model' => $model + ]); + } + +} diff --git a/kcadmin/models/.gitkeep b/kcadmin/models/.gitkeep new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/kcadmin/models/.gitkeep @@ -0,0 +1 @@ +* diff --git a/kcadmin/runtime/.gitignore b/kcadmin/runtime/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/kcadmin/runtime/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/kcadmin/views/layouts/base.php b/kcadmin/views/layouts/base.php new file mode 100644 index 0000000..5d7aa88 --- /dev/null +++ b/kcadmin/views/layouts/base.php @@ -0,0 +1,33 @@ + +beginPage() ?> + + + + + + + registerCsrfMetaTags() ?> + <?= Html::encode($this->title) ?> + head() ?> + + + beginBody() ?> + + + + endBody() ?> + + +endPage() ?> diff --git a/kcadmin/views/layouts/main.php b/kcadmin/views/layouts/main.php new file mode 100644 index 0000000..a23f7a0 --- /dev/null +++ b/kcadmin/views/layouts/main.php @@ -0,0 +1,79 @@ + +beginPage() ?> + + + + + + + registerCsrfMetaTags() ?> + <?= Html::encode($this->title) ?> + head() ?> + + + beginBody() ?> + + + + + endBody() ?> + + +endPage() ?> diff --git a/kcadmin/views/site/error.php b/kcadmin/views/site/error.php new file mode 100644 index 0000000..0ba2574 --- /dev/null +++ b/kcadmin/views/site/error.php @@ -0,0 +1,27 @@ +title = $name; +?> +
+ +

title) ?>

+ +
+ +
+ +

+ The above error occurred while the Web server was processing your request. +

+

+ Please contact us if you think this is a server error. Thank you. +

+ +
diff --git a/kcadmin/views/site/index.php b/kcadmin/views/site/index.php new file mode 100644 index 0000000..d0b0878 --- /dev/null +++ b/kcadmin/views/site/index.php @@ -0,0 +1,4 @@ +title = 'My Yii Application'; +?> \ No newline at end of file diff --git a/kcadmin/views/site/login.php b/kcadmin/views/site/login.php new file mode 100644 index 0000000..f7320ca --- /dev/null +++ b/kcadmin/views/site/login.php @@ -0,0 +1,34 @@ +title = '系统登录'; +$this->params['breadcrumbs'][] = $this->title; +?> + \ No newline at end of file diff --git a/kcadmin/views/site/test.php b/kcadmin/views/site/test.php new file mode 100644 index 0000000..1b58c62 --- /dev/null +++ b/kcadmin/views/site/test.php @@ -0,0 +1,17 @@ + +

+ + 'login-form']); ?> + +field($model, '用户:',['template' => '{input}'])->textInput(['autofocus' => true]) ?> + +
+ 'btn btn-primary', 'name' => 'login-button']) ?> +
+ + \ No newline at end of file diff --git a/kcadmin/web/assets/.gitignore b/kcadmin/web/assets/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/kcadmin/web/assets/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/kcadmin/web/css/reset.css b/kcadmin/web/css/reset.css new file mode 100644 index 0000000..9ff51eb --- /dev/null +++ b/kcadmin/web/css/reset.css @@ -0,0 +1,48 @@ +/* http://meyerweb.com/eric/tools/css/reset/ + v2.0 | 20110126 + License: none (public domain) +*/ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; +} \ No newline at end of file diff --git a/kcadmin/web/css/site.css b/kcadmin/web/css/site.css new file mode 100644 index 0000000..7caab26 --- /dev/null +++ b/kcadmin/web/css/site.css @@ -0,0 +1,182 @@ +/*公共样式*/ +body{ + /* font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;*/ + font-size: 1rem; + line-height: 1.45; + color: #373a3c; + background-color: #F1F1F1; +} + +.f30{ + font-size:30px; +} + +.f24{ + font-size:24px; +} + +.f20{ + font-size:20px; +} +/*登录页*/ +.login-body{ + display: flex; + align-items: center; + height: 100vh; +} + +.login-body .line { + border-bottom: 1px solid #dadada; + line-height: 0.1em; + margin: 10px 0 20px; +} + +.login-body .line span { + background: #fff; + padding: 0 10px; +} + +.login-form { + box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); + margin: 0 auto; +} + +.login-form h2{ + text-align: center; + margin-bottom: 20px; +} + +.login-form h6 { + text-align: center; +} + + +/*导航部分*/ +.navbar { + position: relative; + min-height: 58px; + margin-bottom: 20px; + padding: 0px; + transition: 300ms ease all; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08); + background: #FFFFFF; + border: 0px; +} + +.navbar-header{ + float: left; + width: 240px; + background: #1D2B36; + height: 58px; +} + +.navbar-header a{ + display: block; + margin-left: 20px; + margin-top: 15px; +} + +.navbar-content { + margin-left: 240px; + padding: 0rem 1rem; + transition: 300ms ease all; + background: inherit; + height: 58px; +} +.navbar-content .navbar-left { + float: left; + padding-left: 0; + margin-bottom: 0; + list-style: none; + height: 58px; + width: 300px; +} +.navbar-content > .navbar-left > li { + float: left; + height: 58px; + line-height: 58px; + margin-left: 25px; +} +.navbar-content > .navbar-left > li > a{ + text-decoration: none; + line-height: 58px; + color: #55595c; + position: relative; + display: block; + padding: 0; + background-color: #fff; +} +.navbar-content > .navbar-left > li > a:hover, +.navbar-content > .navbar-left > li > a:focus { + text-decoration: none; + background-color: inherit !important; +} + +.navbar-content .navbar-right { + float: right; + padding-right: 0; + margin-bottom: 0; + list-style: none; + height: 58px; + width: 500px; +} + +.navbar-content > .navbar-right > li { + float: right; + height: 58px; + line-height: 58px; + margin-right: 30px; +} + +.navbar-content > .navbar-right > li > a{ + text-decoration: none; + line-height: 58px; + color: #55595c; + position: relative; + display: block; + padding: 0; + background-color: #fff; +} +.navbar-content > .navbar-right > li > a:hover, +.navbar-content > .navbar-right > li > a:focus { + text-decoration: none; + background-color: inherit !important; +} + +.dropdown-menu > li > a { + font-size: 18px; +} + +.navbar-content .navbar-right i { + font-size: 16px; + margin-right: 8px; +} + +/*侧边栏*/ +.sidebar{ + width: 240px; + background: #1D2B36; +} + +.sidebar-content{ + height: 100%; + position: relative; +} + +.sidebar-content > ul { + overflow-x: hidden; + list-style: none; + margin: 0; + padding: 0; + font-size: 1rem; + overflow-y: hidden; +} + +.sidebar-content > ul > li{ + line-height: 2.8; + border: 1px solid red; +} + +.sidebar-item-list{ + display: none; +} \ No newline at end of file diff --git a/kcadmin/web/favicon.ico b/kcadmin/web/favicon.ico new file mode 100644 index 0000000..580ed73 Binary files /dev/null and b/kcadmin/web/favicon.ico differ diff --git a/kcadmin/web/images/robust-logo-light.png b/kcadmin/web/images/robust-logo-light.png new file mode 100644 index 0000000..703b197 Binary files /dev/null and b/kcadmin/web/images/robust-logo-light.png differ diff --git a/kcadmin/web/images/robust-logo-small.png b/kcadmin/web/images/robust-logo-small.png new file mode 100644 index 0000000..1ff4f99 Binary files /dev/null and b/kcadmin/web/images/robust-logo-small.png differ diff --git a/kcadmin/web/index.php b/kcadmin/web/index.php new file mode 100644 index 0000000..810e844 --- /dev/null +++ b/kcadmin/web/index.php @@ -0,0 +1,20 @@ +run(); + +