diff --git a/backend/assets/AppAsset.php b/backend/assets/AppAsset.php new file mode 100755 index 0000000..6b1209f --- /dev/null +++ b/backend/assets/AppAsset.php @@ -0,0 +1,26 @@ + 'backend', + 'basePath' => dirname(__DIR__), + 'controllerNamespace' => 'backend\controllers', + 'bootstrap' => ['log'], + 'modules' => [], + 'components' => [ + 'request' => [ + 'csrfParam' => '_csrf-backend', + ], + 'user' => [ + 'identityClass' => 'common\models\User', + 'enableAutoLogin' => true, + 'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true], + ], + 'session' => [ + // this is the name of the session cookie used for login on the app + 'name' => 'backend', + ], + '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/backend/config/params.php b/backend/config/params.php new file mode 100644 index 0000000..7f754b9 --- /dev/null +++ b/backend/config/params.php @@ -0,0 +1,4 @@ + 'admin@example.com', +]; diff --git a/backend/controllers/SiteController.php b/backend/controllers/SiteController.php new file mode 100755 index 0000000..f566346 --- /dev/null +++ b/backend/controllers/SiteController.php @@ -0,0 +1,112 @@ + [ + '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', + ], + 'upload'=>[ + 'class'=>'iron\actions\UploadAction', + ] + ]; + } + + /** + * 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() { + $searchModel = new CategorySearch(); + return $this->render('test', [ + 'name' => 'blobt', + 'model' => $searchModel + ]); + } + +} diff --git a/backend/models/.gitkeep b/backend/models/.gitkeep new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/backend/models/.gitkeep @@ -0,0 +1 @@ +* diff --git a/backend/views/layouts/base.php b/backend/views/layouts/base.php new file mode 100755 index 0000000..5d7aa88 --- /dev/null +++ b/backend/views/layouts/base.php @@ -0,0 +1,33 @@ + +beginPage() ?> + + + + + + + registerCsrfMetaTags() ?> + <?= Html::encode($this->title) ?> + head() ?> + + + beginBody() ?> + + + + endBody() ?> + + +endPage() ?> diff --git a/backend/views/layouts/breadcrumb.php b/backend/views/layouts/breadcrumb.php new file mode 100755 index 0000000..a159020 --- /dev/null +++ b/backend/views/layouts/breadcrumb.php @@ -0,0 +1,13 @@ + +title)): ?> +

title ?>params['subtitle'])): ?>params['subtitle'] ?>

+ + 'ol', + 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], +]); +?> \ No newline at end of file diff --git a/backend/views/layouts/footer.php b/backend/views/layouts/footer.php new file mode 100755 index 0000000..a0a801d --- /dev/null +++ b/backend/views/layouts/footer.php @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/backend/views/layouts/header.php b/backend/views/layouts/header.php new file mode 100755 index 0000000..2bbba81 --- /dev/null +++ b/backend/views/layouts/header.php @@ -0,0 +1,88 @@ + +
+ + + + +
\ No newline at end of file diff --git a/backend/views/layouts/main.php b/backend/views/layouts/main.php new file mode 100755 index 0000000..421217b --- /dev/null +++ b/backend/views/layouts/main.php @@ -0,0 +1,45 @@ + +beginPage() ?> + + + + + + + registerCsrfMetaTags() ?> + <?= Html::encode($this->title) ?> + head() ?> + + + beginBody() ?> +
+ render('header') ?> + + render('sidebar') ?> + +
+
+ render('breadcrumb') ?> +
+
+ +
+
+ + render('footer') ?> +
+ endBody() ?> + + +endPage() ?> diff --git a/backend/views/layouts/sidebar.php b/backend/views/layouts/sidebar.php new file mode 100755 index 0000000..a164ca5 --- /dev/null +++ b/backend/views/layouts/sidebar.php @@ -0,0 +1,27 @@ + + \ No newline at end of file diff --git a/backend/views/site/error.php b/backend/views/site/error.php new file mode 100755 index 0000000..0ba2574 --- /dev/null +++ b/backend/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/backend/views/site/index.php b/backend/views/site/index.php new file mode 100755 index 0000000..21cb7e4 --- /dev/null +++ b/backend/views/site/index.php @@ -0,0 +1,6 @@ +title = 'Dashboard'; +$this->params['subtitle'] = 'Control panel'; +$this->params['breadcrumbs'][] = $this->title; +?> \ No newline at end of file diff --git a/backend/views/site/login.php b/backend/views/site/login.php new file mode 100755 index 0000000..f7320ca --- /dev/null +++ b/backend/views/site/login.php @@ -0,0 +1,34 @@ +title = '系统登录'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+
+

title) ?>

+ +
+
+ 'login-form']); ?> + + field($model, 'username')->textInput(['autofocus' => true]) ?> + + field($model, 'password')->passwordInput() ?> + + field($model, 'rememberMe')->checkbox() ?> + +
+ 'btn btn-primary btn-lg btn-block', 'name' => 'login-button']) ?> +
+ + +
+
+
+
\ No newline at end of file diff --git a/backend/views/site/test.php b/backend/views/site/test.php new file mode 100755 index 0000000..f9eebef --- /dev/null +++ b/backend/views/site/test.php @@ -0,0 +1,68 @@ +title = '测试'; +$this->params['subtitle'] = '这是一个小小的测试'; +$this->params['breadcrumbs'][] = $this->title; + +/* @var $this yii\web\View */ +/* @var $model common\models\CategorySearch */ +/* @var $form yii\widgets\ActiveForm */ +?> + + + ['index'], + 'method' => 'get', + 'validateOnType' => true, + ]); +?> + +
+
+ field($model, 'id', [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "检索的id", + "class" => "form-control" + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ]) + ?> + + field($model, 'cat_name', [ + "template" => "{input}{error}", + "inputOptions" => [ + "placeholder" => "检索类名", + "class" => "form-control", + ], + "errorOptions" => [ + "class" => "error-tips" + ] + ]) + ?> + + field($model, "created_at", [ + "template" => "{input}{error}", + "errorOptions" => [ + "class" => "error-tips" + ] + ])->widget(DateRangePicker::className()); + ?> +
+
+
+ ', ['class' => 'btn btn-default']) ?> + ', ['class' => 'btn btn-default']) ?> +
+ + diff --git a/backend/web/assets/.gitignore b/backend/web/assets/.gitignore new file mode 100755 index 0000000..d6b7ef3 --- /dev/null +++ b/backend/web/assets/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/backend/web/css/reset.css b/backend/web/css/reset.css new file mode 100644 index 0000000..9ff51eb --- /dev/null +++ b/backend/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/backend/web/css/site.css b/backend/web/css/site.css new file mode 100644 index 0000000..23fa9ae --- /dev/null +++ b/backend/web/css/site.css @@ -0,0 +1,52 @@ +/*公共样式*/ + +/*登录页*/ +.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; +} + +/*修复select2插件 from表框颜色不生效*/ +.form-group.has-error .select2-selection, .form-group.has-error .select2-selection { + border-color: #dd4b39; + box-shadow: none; +} + +.form-group.has-success .select2-selection, .form-group.has-success .select2-selection { + border-color: #00a65a; + box-shadow: none; +} + +.icheck-label-group { + padding-top: 2px; +} + +.icheck-label-group label{ + margin-right: 20px; +} \ No newline at end of file diff --git a/backend/web/favicon.ico b/backend/web/favicon.ico new file mode 100644 index 0000000..580ed73 Binary files /dev/null and b/backend/web/favicon.ico differ diff --git a/backend/web/img/avatar.png b/backend/web/img/avatar.png new file mode 100644 index 0000000..55d6306 Binary files /dev/null and b/backend/web/img/avatar.png differ diff --git a/backend/web/img/avatar04.png b/backend/web/img/avatar04.png new file mode 100644 index 0000000..ef35fec Binary files /dev/null and b/backend/web/img/avatar04.png differ diff --git a/backend/web/img/avatar2.png b/backend/web/img/avatar2.png new file mode 100644 index 0000000..26a4d22 Binary files /dev/null and b/backend/web/img/avatar2.png differ diff --git a/backend/web/img/avatar3.png b/backend/web/img/avatar3.png new file mode 100644 index 0000000..c3bf8a5 Binary files /dev/null and b/backend/web/img/avatar3.png differ diff --git a/backend/web/img/avatar5.png b/backend/web/img/avatar5.png new file mode 100644 index 0000000..c561fc1 Binary files /dev/null and b/backend/web/img/avatar5.png differ diff --git a/backend/web/img/credit/american-express.png b/backend/web/img/credit/american-express.png new file mode 100644 index 0000000..fe01a2d Binary files /dev/null and b/backend/web/img/credit/american-express.png differ diff --git a/backend/web/img/credit/cirrus.png b/backend/web/img/credit/cirrus.png new file mode 100644 index 0000000..643a7d5 Binary files /dev/null and b/backend/web/img/credit/cirrus.png differ diff --git a/backend/web/img/credit/mastercard.png b/backend/web/img/credit/mastercard.png new file mode 100644 index 0000000..de112cc Binary files /dev/null and b/backend/web/img/credit/mastercard.png differ diff --git a/backend/web/img/credit/mestro.png b/backend/web/img/credit/mestro.png new file mode 100644 index 0000000..09adda7 Binary files /dev/null and b/backend/web/img/credit/mestro.png differ diff --git a/backend/web/img/credit/paypal.png b/backend/web/img/credit/paypal.png new file mode 100644 index 0000000..bb1e8ba Binary files /dev/null and b/backend/web/img/credit/paypal.png differ diff --git a/backend/web/img/credit/paypal2.png b/backend/web/img/credit/paypal2.png new file mode 100644 index 0000000..3bdf1ed Binary files /dev/null and b/backend/web/img/credit/paypal2.png differ diff --git a/backend/web/img/credit/visa.png b/backend/web/img/credit/visa.png new file mode 100644 index 0000000..2ef83fb Binary files /dev/null and b/backend/web/img/credit/visa.png differ diff --git a/backend/web/img/default-50x50.gif b/backend/web/img/default-50x50.gif new file mode 100644 index 0000000..2f5a14a Binary files /dev/null and b/backend/web/img/default-50x50.gif differ diff --git a/backend/web/img/icons.png b/backend/web/img/icons.png new file mode 100644 index 0000000..d47bc15 Binary files /dev/null and b/backend/web/img/icons.png differ diff --git a/backend/web/img/photo1.png b/backend/web/img/photo1.png new file mode 100644 index 0000000..c1922b4 Binary files /dev/null and b/backend/web/img/photo1.png differ diff --git a/backend/web/img/photo2.png b/backend/web/img/photo2.png new file mode 100644 index 0000000..f4c3b00 Binary files /dev/null and b/backend/web/img/photo2.png differ diff --git a/backend/web/img/photo3.jpg b/backend/web/img/photo3.jpg new file mode 100644 index 0000000..63daa81 Binary files /dev/null and b/backend/web/img/photo3.jpg differ diff --git a/backend/web/img/photo4.jpg b/backend/web/img/photo4.jpg new file mode 100644 index 0000000..c700ef3 Binary files /dev/null and b/backend/web/img/photo4.jpg differ diff --git a/backend/web/img/user1-128x128.jpg b/backend/web/img/user1-128x128.jpg new file mode 100644 index 0000000..b0ae99a Binary files /dev/null and b/backend/web/img/user1-128x128.jpg differ diff --git a/backend/web/img/user2-160x160.jpg b/backend/web/img/user2-160x160.jpg new file mode 100644 index 0000000..aec74cb Binary files /dev/null and b/backend/web/img/user2-160x160.jpg differ diff --git a/backend/web/img/user3-128x128.jpg b/backend/web/img/user3-128x128.jpg new file mode 100644 index 0000000..caf5f96 Binary files /dev/null and b/backend/web/img/user3-128x128.jpg differ diff --git a/backend/web/img/user4-128x128.jpg b/backend/web/img/user4-128x128.jpg new file mode 100644 index 0000000..eb8e2bb Binary files /dev/null and b/backend/web/img/user4-128x128.jpg differ diff --git a/backend/web/img/user5-128x128.jpg b/backend/web/img/user5-128x128.jpg new file mode 100644 index 0000000..b637aad Binary files /dev/null and b/backend/web/img/user5-128x128.jpg differ diff --git a/backend/web/img/user6-128x128.jpg b/backend/web/img/user6-128x128.jpg new file mode 100644 index 0000000..3ac2468 Binary files /dev/null and b/backend/web/img/user6-128x128.jpg differ diff --git a/backend/web/img/user7-128x128.jpg b/backend/web/img/user7-128x128.jpg new file mode 100644 index 0000000..97febc2 Binary files /dev/null and b/backend/web/img/user7-128x128.jpg differ diff --git a/backend/web/img/user8-128x128.jpg b/backend/web/img/user8-128x128.jpg new file mode 100644 index 0000000..6e717b4 Binary files /dev/null and b/backend/web/img/user8-128x128.jpg differ diff --git a/backend/web/index.php b/backend/web/index.php new file mode 100644 index 0000000..810e844 --- /dev/null +++ b/backend/web/index.php @@ -0,0 +1,20 @@ +run(); + + diff --git a/backend/web/js/common.js b/backend/web/js/common.js new file mode 100644 index 0000000..e69de29