Browse Source

adminlte整合基本完成

wechat_public_accounts
blobt 6 years ago
parent
commit
a146d110de
  1. 1
      common/config/bootstrap.php
  2. 7
      common/config/main.php
  3. 66
      composer.json
  4. 184
      composer.lock
  5. 170
      console/migrations/m140506_102106_rbac_init.php
  6. 60
      console/migrations/m170907_052038_rbac_add_index_on_auth_assignment_user_id.php
  7. 64
      console/migrations/m180523_151638_rbac_updates_indexes_without_prefix.php
  8. 42
      console/migrations/m190802_072830_add_category.php
  9. 57
      console/migrations/schema-mysql.sql
  10. 1
      kcadmin/assets/AppAsset.php
  11. 6
      kcadmin/config/main.php
  12. 6
      kcadmin/controllers/SiteController.php
  13. 13
      kcadmin/views/layouts/breadcrumb.php
  14. 7
      kcadmin/views/layouts/footer.php
  15. 88
      kcadmin/views/layouts/header.php
  16. 66
      kcadmin/views/layouts/main.php
  17. 27
      kcadmin/views/layouts/sidebar.php
  18. 4
      kcadmin/views/site/index.php
  19. 13
      kcadmin/views/site/test.php
  20. 149
      kcadmin/web/css/site.css
  21. BIN
      kcadmin/web/images/robust-logo-light.png
  22. BIN
      kcadmin/web/images/robust-logo-small.png
  23. BIN
      kcadmin/web/img/avatar.png
  24. BIN
      kcadmin/web/img/avatar04.png
  25. BIN
      kcadmin/web/img/avatar2.png
  26. BIN
      kcadmin/web/img/avatar3.png
  27. BIN
      kcadmin/web/img/avatar5.png
  28. BIN
      kcadmin/web/img/credit/american-express.png
  29. BIN
      kcadmin/web/img/credit/cirrus.png
  30. BIN
      kcadmin/web/img/credit/mastercard.png
  31. BIN
      kcadmin/web/img/credit/mestro.png
  32. BIN
      kcadmin/web/img/credit/paypal.png
  33. BIN
      kcadmin/web/img/credit/paypal2.png
  34. BIN
      kcadmin/web/img/credit/visa.png
  35. BIN
      kcadmin/web/img/default-50x50.gif
  36. BIN
      kcadmin/web/img/icons.png
  37. BIN
      kcadmin/web/img/photo1.png
  38. BIN
      kcadmin/web/img/photo2.png
  39. BIN
      kcadmin/web/img/photo3.jpg
  40. BIN
      kcadmin/web/img/photo4.jpg
  41. BIN
      kcadmin/web/img/user1-128x128.jpg
  42. BIN
      kcadmin/web/img/user2-160x160.jpg
  43. BIN
      kcadmin/web/img/user3-128x128.jpg
  44. BIN
      kcadmin/web/img/user4-128x128.jpg
  45. BIN
      kcadmin/web/img/user5-128x128.jpg
  46. BIN
      kcadmin/web/img/user6-128x128.jpg
  47. BIN
      kcadmin/web/img/user7-128x128.jpg
  48. BIN
      kcadmin/web/img/user8-128x128.jpg

1
common/config/bootstrap.php

@ -2,4 +2,3 @@
Yii::setAlias('@common', dirname(__DIR__)); Yii::setAlias('@common', dirname(__DIR__));
Yii::setAlias('@console', dirname(dirname(__DIR__)) . '/console'); Yii::setAlias('@console', dirname(dirname(__DIR__)) . '/console');
Yii::setAlias('@kcadmin', dirname(dirname(__DIR__)) . '/kcadmin'); Yii::setAlias('@kcadmin', dirname(dirname(__DIR__)) . '/kcadmin');
Yii::setAlias('@blobt', dirname(dirname(__DIR__)) . '/vendor/blobt');

7
common/config/main.php

@ -1,13 +1,18 @@
<?php <?php
return [ return [
'aliases' => [ 'aliases' => [
'@bower' => '@vendor/bower-asset', '@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
'@npm' => '@vendor/npm-asset',
'@blobt' => '@vendor/blobt'
], ],
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor', 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'components' => [ 'components' => [
'cache' => [ 'cache' => [
'class' => 'yii\caching\FileCache', 'class' => 'yii\caching\FileCache',
], ],
'authManager' => [
'class' => 'yii\rbac\DbManager',
],
], ],
]; ];

66
composer.json

@ -1,34 +1,38 @@
{ {
"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/"
},
"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"
},
"repositories": {
"asset_packagist": {
"type": "composer",
"url": "https://asset-packagist.org"
},
"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"
}
"packagist": {
"type": "composer",
"url": "https://packagist.phpcomposer.com"
}
},
"require-dev": {
"yiisoft/yii2-debug": "^2.0@dev",
"kint-php/kint": "dev-master",
"yiisoft/yii2-gii": "^2.0@dev"
}
} }

184
composer.lock

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "3a4228dae33737e4c38ff88dd6a56a10",
"content-hash": "f3ddaead9bc7b0924e8f9ccf68c842ff",
"packages": [ "packages": [
{ {
"name": "bower-asset/bootstrap", "name": "bower-asset/bootstrap",
@ -322,44 +322,6 @@
], ],
"time": "2018-02-23T01:58:20+00:00" "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", "name": "yiisoft/yii2",
"version": "dev-master", "version": "dev-master",
@ -577,57 +539,6 @@
"yii2" "yii2"
], ],
"time": "2019-05-28T08:14:44+00:00" "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": [ "packages-dev": [
@ -701,6 +612,44 @@
], ],
"time": "2019-07-11T17:29:14+00:00" "time": "2019-07-11T17:29:14+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-debug", "name": "yiisoft/yii2-debug",
"version": "2.1.5", "version": "2.1.5",
@ -757,15 +706,66 @@
"yii2" "yii2"
], ],
"time": "2019-06-04T14:21:49+00:00" "time": "2019-06-04T14:21:49+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"
} }
], ],
"aliases": [], "aliases": [],
"minimum-stability": "dev", "minimum-stability": "dev",
"stability-flags": { "stability-flags": {
"yiisoft/yii2-bootstrap": 20, "yiisoft/yii2-bootstrap": 20,
"yiisoft/yii2-gii": 20,
"yiisoft/yii2-debug": 20, "yiisoft/yii2-debug": 20,
"kint-php/kint": 20
"kint-php/kint": 20,
"yiisoft/yii2-gii": 20
}, },
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,

170
console/migrations/m140506_102106_rbac_init.php

@ -0,0 +1,170 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
use yii\base\InvalidConfigException;
use yii\rbac\DbManager;
/**
* Initializes RBAC tables.
*
* @author Alexander Kochetov <creocoder@gmail.com>
* @since 2.0
*/
class m140506_102106_rbac_init extends \yii\db\Migration
{
/**
* @throws yii\base\InvalidConfigException
* @return DbManager
*/
protected function getAuthManager()
{
$authManager = Yii::$app->getAuthManager();
if (!$authManager instanceof DbManager) {
throw new InvalidConfigException('You should configure "authManager" component to use database before executing this migration.');
}
return $authManager;
}
/**
* @return bool
*/
protected function isMSSQL()
{
return $this->db->driverName === 'mssql' || $this->db->driverName === 'sqlsrv' || $this->db->driverName === 'dblib';
}
protected function isOracle()
{
return $this->db->driverName === 'oci';
}
/**
* {@inheritdoc}
*/
public function up()
{
$authManager = $this->getAuthManager();
$this->db = $authManager->db;
$schema = $this->db->getSchema()->defaultSchema;
$tableOptions = null;
if ($this->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($authManager->ruleTable, [
'name' => $this->string(64)->notNull(),
'data' => $this->binary(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'PRIMARY KEY ([[name]])',
], $tableOptions);
$this->createTable($authManager->itemTable, [
'name' => $this->string(64)->notNull(),
'type' => $this->smallInteger()->notNull(),
'description' => $this->text(),
'rule_name' => $this->string(64),
'data' => $this->binary(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'PRIMARY KEY ([[name]])',
'FOREIGN KEY ([[rule_name]]) REFERENCES ' . $authManager->ruleTable . ' ([[name]])' .
$this->buildFkClause('ON DELETE SET NULL', 'ON UPDATE CASCADE'),
], $tableOptions);
$this->createIndex('idx-auth_item-type', $authManager->itemTable, 'type');
$this->createTable($authManager->itemChildTable, [
'parent' => $this->string(64)->notNull(),
'child' => $this->string(64)->notNull(),
'PRIMARY KEY ([[parent]], [[child]])',
'FOREIGN KEY ([[parent]]) REFERENCES ' . $authManager->itemTable . ' ([[name]])' .
$this->buildFkClause('ON DELETE CASCADE', 'ON UPDATE CASCADE'),
'FOREIGN KEY ([[child]]) REFERENCES ' . $authManager->itemTable . ' ([[name]])' .
$this->buildFkClause('ON DELETE CASCADE', 'ON UPDATE CASCADE'),
], $tableOptions);
$this->createTable($authManager->assignmentTable, [
'item_name' => $this->string(64)->notNull(),
'user_id' => $this->string(64)->notNull(),
'created_at' => $this->integer(),
'PRIMARY KEY ([[item_name]], [[user_id]])',
'FOREIGN KEY ([[item_name]]) REFERENCES ' . $authManager->itemTable . ' ([[name]])' .
$this->buildFkClause('ON DELETE CASCADE', 'ON UPDATE CASCADE'),
], $tableOptions);
if ($this->isMSSQL()) {
$this->execute("CREATE TRIGGER {$schema}.trigger_auth_item_child
ON {$schema}.{$authManager->itemTable}
INSTEAD OF DELETE, UPDATE
AS
DECLARE @old_name VARCHAR (64) = (SELECT name FROM deleted)
DECLARE @new_name VARCHAR (64) = (SELECT name FROM inserted)
BEGIN
IF COLUMNS_UPDATED() > 0
BEGIN
IF @old_name <> @new_name
BEGIN
ALTER TABLE {$authManager->itemChildTable} NOCHECK CONSTRAINT FK__auth_item__child;
UPDATE {$authManager->itemChildTable} SET child = @new_name WHERE child = @old_name;
END
UPDATE {$authManager->itemTable}
SET name = (SELECT name FROM inserted),
type = (SELECT type FROM inserted),
description = (SELECT description FROM inserted),
rule_name = (SELECT rule_name FROM inserted),
data = (SELECT data FROM inserted),
created_at = (SELECT created_at FROM inserted),
updated_at = (SELECT updated_at FROM inserted)
WHERE name IN (SELECT name FROM deleted)
IF @old_name <> @new_name
BEGIN
ALTER TABLE {$authManager->itemChildTable} CHECK CONSTRAINT FK__auth_item__child;
END
END
ELSE
BEGIN
DELETE FROM {$schema}.{$authManager->itemChildTable} WHERE parent IN (SELECT name FROM deleted) OR child IN (SELECT name FROM deleted);
DELETE FROM {$schema}.{$authManager->itemTable} WHERE name IN (SELECT name FROM deleted);
END
END;");
}
}
/**
* {@inheritdoc}
*/
public function down()
{
$authManager = $this->getAuthManager();
$this->db = $authManager->db;
if ($this->isMSSQL()) {
$this->execute('DROP TRIGGER {$schema}.trigger_auth_item_child;');
}
$this->dropTable($authManager->assignmentTable);
$this->dropTable($authManager->itemChildTable);
$this->dropTable($authManager->itemTable);
$this->dropTable($authManager->ruleTable);
}
protected function buildFkClause($delete = '', $update = '')
{
if ($this->isMSSQL()) {
return '';
}
if ($this->isOracle()) {
return ' ' . $delete;
}
return implode(' ', ['', $delete, $update]);
}
}

60
console/migrations/m170907_052038_rbac_add_index_on_auth_assignment_user_id.php

@ -0,0 +1,60 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
use yii\base\InvalidConfigException;
use yii\db\Migration;
use yii\rbac\DbManager;
/**
* Adds index on `user_id` column in `auth_assignment` table for performance reasons.
*
* @see https://github.com/yiisoft/yii2/pull/14765
*
* @author Ivan Buttinoni <ivan.buttinoni@cibi.it>
* @since 2.0.13
*/
class m170907_052038_rbac_add_index_on_auth_assignment_user_id extends Migration
{
public $column = 'user_id';
public $index = 'auth_assignment_user_id_idx';
/**
* @throws yii\base\InvalidConfigException
* @return DbManager
*/
protected function getAuthManager()
{
$authManager = Yii::$app->getAuthManager();
if (!$authManager instanceof DbManager) {
throw new InvalidConfigException('You should configure "authManager" component to use database before executing this migration.');
}
return $authManager;
}
/**
* {@inheritdoc}
*/
public function up()
{
$authManager = $this->getAuthManager();
$this->db = $authManager->db;
$this->createIndex($this->index, $authManager->assignmentTable, $this->column);
}
/**
* {@inheritdoc}
*/
public function down()
{
$authManager = $this->getAuthManager();
$this->db = $authManager->db;
$this->dropIndex($this->index, $authManager->assignmentTable);
}
}

64
console/migrations/m180523_151638_rbac_updates_indexes_without_prefix.php

@ -0,0 +1,64 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
use yii\base\InvalidConfigException;
use yii\db\Migration;
use yii\rbac\DbManager;
/**
* Updates indexes without a prefix.
*
* @see https://github.com/yiisoft/yii2/pull/15548
*
* @author Sergey Gonimar <sergey.gonimar@gmail.com>
* @since 2.0.16
*/
class m180523_151638_rbac_updates_indexes_without_prefix extends Migration
{
/**
* @throws yii\base\InvalidConfigException
* @return DbManager
*/
protected function getAuthManager()
{
$authManager = Yii::$app->getAuthManager();
if (!$authManager instanceof DbManager) {
throw new InvalidConfigException('You should configure "authManager" component to use database before executing this migration.');
}
return $authManager;
}
/**
* {@inheritdoc}
*/
public function up()
{
$authManager = $this->getAuthManager();
$this->dropIndex('auth_assignment_user_id_idx', $authManager->assignmentTable);
$this->createIndex('{{%idx-auth_assignment-user_id}}', $authManager->assignmentTable, 'user_id');
$this->dropIndex('idx-auth_item-type', $authManager->itemTable);
$this->createIndex('{{%idx-auth_item-type}}', $authManager->itemTable, 'type');
}
/**
* {@inheritdoc}
*/
public function down()
{
$authManager = $this->getAuthManager();
$this->dropIndex('{{%idx-auth_assignment-user_id}}', $authManager->assignmentTable);
$this->createIndex('auth_assignment_user_id_idx', $authManager->assignmentTable, 'user_id');
$this->dropIndex('{{%idx-auth_item-type}}', $authManager->itemTable);
$this->createIndex('idx-auth_item-type', $authManager->itemTable, 'type');
}
}

42
console/migrations/m190802_072830_add_category.php

@ -0,0 +1,42 @@
<?php
use yii\db\Migration;
/**
* Class m190802_072830_add_category
*/
class m190802_072830_add_category extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
echo "m190802_072830_add_category cannot be reverted.\n";
return false;
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m190802_072830_add_category cannot be reverted.\n";
return false;
}
*/
}

57
console/migrations/schema-mysql.sql

@ -0,0 +1,57 @@
/**
* Database schema required by \yii\rbac\DbManager.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Alexander Kochetov <creocoder@gmail.com>
* @link http://www.yiiframework.com/
* @copyright 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @since 2.0
*/
drop table if exists `auth_assignment`;
drop table if exists `auth_item_child`;
drop table if exists `auth_item`;
drop table if exists `auth_rule`;
create table `auth_rule`
(
`name` varchar(64) not null,
`data` blob,
`created_at` integer,
`updated_at` integer,
primary key (`name`)
) engine InnoDB;
create table `auth_item`
(
`name` varchar(64) not null,
`type` smallint not null,
`description` text,
`rule_name` varchar(64),
`data` blob,
`created_at` integer,
`updated_at` integer,
primary key (`name`),
foreign key (`rule_name`) references `auth_rule` (`name`) on delete set null on update cascade,
key `type` (`type`)
) engine InnoDB;
create table `auth_item_child`
(
`parent` varchar(64) not null,
`child` varchar(64) not null,
primary key (`parent`, `child`),
foreign key (`parent`) references `auth_item` (`name`) on delete cascade on update cascade,
foreign key (`child`) references `auth_item` (`name`) on delete cascade on update cascade
) engine InnoDB;
create table `auth_assignment`
(
`item_name` varchar(64) not null,
`user_id` varchar(64) not null,
`created_at` integer,
primary key (`item_name`, `user_id`),
foreign key (`item_name`) references `auth_item` (`name`) on delete cascade on update cascade,
key `auth_assignment_user_id_idx` (`user_id`)
) engine InnoDB;

1
kcadmin/assets/AppAsset.php

@ -12,7 +12,6 @@ class AppAsset extends AssetBundle
public $basePath = '@webroot'; public $basePath = '@webroot';
public $baseUrl = '@web'; public $baseUrl = '@web';
public $css = [ public $css = [
'css/reset.css',
'css/site.css', 'css/site.css',
]; ];
public $js = [ public $js = [

6
kcadmin/config/main.php

@ -1,9 +1,7 @@
<?php <?php
$params = array_merge( $params = array_merge(
require __DIR__ . '/../../common/config/params.php',
require __DIR__ . '/../../common/config/params-local.php',
require __DIR__ . '/params.php',
require __DIR__ . '/params-local.php'
require __DIR__ . '/../../common/config/params.php', require __DIR__ . '/../../common/config/params-local.php', require __DIR__ . '/params.php', require __DIR__ . '/params-local.php'
); );
return [ return [

6
kcadmin/controllers/SiteController.php

@ -35,7 +35,7 @@ class SiteController extends Controller {
'verbs' => [ 'verbs' => [
'class' => VerbFilter::className(), 'class' => VerbFilter::className(),
'actions' => [ 'actions' => [
'logout' => ['post'],
// 'logout' => ['post'],
], ],
], ],
]; ];
@ -98,10 +98,8 @@ class SiteController extends Controller {
} }
public function actionTest() { public function actionTest() {
$model = new LoginForm();
return $this->render('test', [ return $this->render('test', [
'name' => 'blobt',
'model' => $model
'name' => 'blobt'
]); ]);
} }

13
kcadmin/views/layouts/breadcrumb.php

@ -0,0 +1,13 @@
<?PHP
use yii\widgets\Breadcrumbs;
?>
<?php if (!empty($this->title)): ?>
<h1><?= $this->title ?><?php if (isset($this->params['subtitle'])): ?><small><?= $this->params['subtitle'] ?></small><?php endif ?></h1>
<?php endif ?>
<?php
echo Breadcrumbs::widget([
'tag' => 'ol',
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]);
?>

7
kcadmin/views/layouts/footer.php

@ -0,0 +1,7 @@
<footer class="main-footer">
<div class="pull-right hidden-xs">
<b>Version</b> 0.1.0
</div>
<strong>Copyright &copy; 2014-2019 <a href="https://kuaichuangkeji.com">KcAdmin</a>.</strong> All rights
reserved.
</footer>

88
kcadmin/views/layouts/header.php

@ -0,0 +1,88 @@
<?php
use yii\helpers\Html;
?>
<header class="main-header">
<!-- Logo -->
<a href="/" class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b>K</b>c</span>
<!-- logo for regular state and mobile devices -->
<span class="logo-lg"><b>KC</b>admin</span>
</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top">
<div class="navbar-menu">
<ul class="nav navbar-nav">
<li>
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
</li>
<!-- TODO:后续处理 -->
<!--li class="user user-menu">
<a href="#">
<i class="fa fa-dashboard"></i>
<span class="hidden-xs">面板</span>
</a>
</li>
<li class="user user-menu">
<a href="#">
<i class="fa fa-shopping-cart"></i>
<span class="hidden-xs">商城</span>
</a>
</li>
<li class="user user-menu">
<a href="#">
<i class="fa fa-wechat"></i>
<span class="hidden-xs">微信</span>
</a>
</li>
<li class="user user-menu">
<a href="#">
<i class="fa fa-cubes"></i>
<span class="hidden-xs">进销存</span>
</a>
</li>
<li class="user user-menu">
<a href="#">
<i class="fa fa-cogs"></i>
<span class="hidden-xs">系统</span>
</a>
</li-->
</ul>
</div>
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src="/img/user2-160x160.jpg" class="user-image" alt="User Image">
<span class="hidden-xs"><?= yii::$app->user->identity->username ?></span>
</a>
<ul class="dropdown-menu">
<!-- User image -->
<li class="user-header">
<img src="/img/user2-160x160.jpg" class="img-circle" alt="User Image">
<p>
<?= yii::$app->user->identity->username ?>
<small>Member since <?= date('m-d-Y', yii::$app->user->identity->created_at) ?></small>
</p>
</li>
<!-- Menu Footer-->
<li class="user-footer">
<div class="pull-left">
<?= Html::a('个人设置', ['/site/profile'], ['class' => 'btn btn-default btn-flat']) ?>
</div>
<div class="pull-right">
<?= Html::a('退出', ['/site/logout'], ['data-method' => 'post', 'class' => 'btn btn-default btn-flat']) ?>
</div>
</li>
</ul>
</li>
</ul>
</div>
</nav>
</header>

66
kcadmin/views/layouts/main.php

@ -7,8 +7,6 @@ use yii\helpers\Html;
use yii\bootstrap\Nav; use yii\bootstrap\Nav;
use yii\bootstrap\NavBar; use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs; use yii\widgets\Breadcrumbs;
use common\widgets\Alert;
use yii\bootstrap\Dropdown;
AppAsset::register($this); AppAsset::register($this);
?> ?>
@ -18,61 +16,29 @@ AppAsset::register($this);
<head> <head>
<meta charset="<?= Yii::$app->charset ?>"> <meta charset="<?= Yii::$app->charset ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<?php $this->registerCsrfMetaTags() ?> <?php $this->registerCsrfMetaTags() ?>
<title><?= Html::encode($this->title) ?></title> <title><?= Html::encode($this->title) ?></title>
<?php $this->head() ?> <?php $this->head() ?>
</head> </head>
<body>
<body class="hold-transition skin-blue-light sidebar-mini">
<?php $this->beginBody() ?> <?php $this->beginBody() ?>
<nav class="navbar">
<div class="navbar-header">
<a href="/"><img alt="branding logo" src="./images/robust-logo-light.png"/></a>
</div>
<div class="navbar-content">
<ul class="navbar-left nav">
<li><a href="#" class="glyphicon glyphicon-menu-hamburger f30"></a></li>
</ul>
<ul class="navbar-right nav">
<li>
<a href="#" data-toggle="dropdown" class="dropdown-toggle f24">
<i class="glyphicon glyphicon-user"></i><?= Yii::$app->user->identity->username ?> <b class="caret"></b>
</a>
<?php
echo Dropdown::widget([
'items' => [
['label' => '帐户设置', 'url' => '/user/profile'],
['label' => '退出', 'url' => '/site/logout'],
],
]);
?>
</li>
<li><a href="#" class="glyphicon glyphicon-envelope f20"></a></li>
</ul>
</div>
</nav>
<div class="sidebar">
<div class="sidebar-content">
<ul class="">
<li class="sidebar-item">
<a href="#" class="sidebar-item-title">Dashboard</a>
<ul class="sidebar-item-list">
<li>sasa</li>
<li>dola</li>
</ul>
</li>
<li class="sidebar-item">
<a href="#" class="sidebar-item-title">项目</a>
<ul class="sidebar-item-list">
<li>sasa</li>
<li>dola</li>
</ul>
</li>
</ul>
<div class="wrapper">
<?= $this->render('header') ?>
<?= $this->render('sidebar') ?>
<div class="content-wrapper">
<section class="content-header">
<?= $this->render('breadcrumb') ?>
</section>
<section class="content">
<?= $content ?>
</section>
</div> </div>
</div>
<?= $content ?>
<?= $this->render('footer') ?>
</div>
<?php $this->endBody() ?> <?php $this->endBody() ?>
</body> </body>
</html> </html>

27
kcadmin/views/layouts/sidebar.php

@ -0,0 +1,27 @@
<?php
use blobt\widgets\Menu;
?>
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<?php
echo Menu::widget([
'items' => [
['label' => 'MAIN NAVIGATION', 'is_header' => true],
['label' => 'IndexController', 'url' => '#', 'icon' => 'fa-hand-o-right', 'items' => [
['label' => 'Index', 'url' => ['site/index', 'tag' => 'new']],
['label' => 'Test', 'url' => ['site/test']],
]
],
['label' => 'GoodsController', 'url' => '#', 'icon' => 'fa-hand-o-right', 'items' => [
['label' => 'sasa', 'url' => ['goods/sasa', 'tag' => 'new']],
['label' => 'dada', 'url' => ['goods/dada', 'tag' => 'popular']],
]
]
]
]);
?>
</section>
<!-- /.sidebar -->
</aside>

4
kcadmin/views/site/index.php

@ -1,4 +1,6 @@
<?php <?php
/* @var $this yii\web\View */ /* @var $this yii\web\View */
$this->title = 'My Yii Application';
$this->title = 'Dashboard';
$this->params['subtitle'] = 'Control panel';
$this->params['breadcrumbs'][] = $this->title;
?> ?>

13
kcadmin/views/site/test.php

@ -3,15 +3,8 @@
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
use yii\helpers\Html; use yii\helpers\Html;
$this->title = '测试';
$this->params['subtitle'] = '这是一个小小的测试';
$this->params['breadcrumbs'][] = $this->title;
?> ?>
<h1><?= $name ?></h1> <h1><?= $name ?></h1>
<?php $form = ActiveForm::begin(['id' => 'login-form']); ?>
<?= $form->field($model, '用户:',['template' => '{input}'])->textInput(['autofocus' => true]) ?>
<div class="form-group">
<?= Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
</div>
<?php ActiveForm::end(); ?>

149
kcadmin/web/css/site.css

@ -1,23 +1,5 @@
/*公共样式*/ /*公共样式*/
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{ .login-body{
display: flex; display: flex;
@ -49,134 +31,3 @@ body{
.login-form h6 { .login-form h6 {
text-align: center; 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;
}

BIN
kcadmin/web/images/robust-logo-light.png

Before

Width: 117  |  Height: 25  |  Size: 3.9 KiB

BIN
kcadmin/web/images/robust-logo-small.png

Before

Width: 32  |  Height: 18  |  Size: 2.0 KiB

BIN
kcadmin/web/img/avatar.png

After

Width: 215  |  Height: 215  |  Size: 7.9 KiB

BIN
kcadmin/web/img/avatar04.png

After

Width: 215  |  Height: 215  |  Size: 13 KiB

BIN
kcadmin/web/img/avatar2.png

After

Width: 215  |  Height: 215  |  Size: 8.1 KiB

BIN
kcadmin/web/img/avatar3.png

After

Width: 215  |  Height: 215  |  Size: 9.0 KiB

BIN
kcadmin/web/img/avatar5.png

After

Width: 215  |  Height: 215  |  Size: 7.4 KiB

BIN
kcadmin/web/img/credit/american-express.png

After

Width: 51  |  Height: 32  |  Size: 2.1 KiB

BIN
kcadmin/web/img/credit/cirrus.png

After

Width: 51  |  Height: 32  |  Size: 1.5 KiB

BIN
kcadmin/web/img/credit/mastercard.png

After

Width: 51  |  Height: 32  |  Size: 1.6 KiB

BIN
kcadmin/web/img/credit/mestro.png

After

Width: 52  |  Height: 32  |  Size: 1.5 KiB

BIN
kcadmin/web/img/credit/paypal.png

After

Width: 101  |  Height: 64  |  Size: 2.0 KiB

BIN
kcadmin/web/img/credit/paypal2.png

After

Width: 51  |  Height: 32  |  Size: 1.2 KiB

BIN
kcadmin/web/img/credit/visa.png

After

Width: 51  |  Height: 32  |  Size: 1.0 KiB

BIN
kcadmin/web/img/default-50x50.gif

After

Width: 50  |  Height: 50  |  Size: 184 B

BIN
kcadmin/web/img/icons.png

After

Width: 61  |  Height: 37  |  Size: 1.1 KiB

BIN
kcadmin/web/img/photo1.png

After

Width: 1250  |  Height: 835  |  Size: 656 KiB

BIN
kcadmin/web/img/photo2.png

After

Width: 1254  |  Height: 836  |  Size: 412 KiB

BIN
kcadmin/web/img/photo3.jpg

After

Width: 2000  |  Height: 1333  |  Size: 383 KiB

BIN
kcadmin/web/img/photo4.jpg

After

Width: 2000  |  Height: 1320  |  Size: 1.1 MiB

BIN
kcadmin/web/img/user1-128x128.jpg

After

Width: 128  |  Height: 128  |  Size: 2.8 KiB

BIN
kcadmin/web/img/user2-160x160.jpg

After

Width: 160  |  Height: 160  |  Size: 6.9 KiB

BIN
kcadmin/web/img/user3-128x128.jpg

After

Width: 128  |  Height: 128  |  Size: 3.4 KiB

BIN
kcadmin/web/img/user4-128x128.jpg

After

Width: 128  |  Height: 128  |  Size: 3.4 KiB

BIN
kcadmin/web/img/user5-128x128.jpg

After

Width: 128  |  Height: 128  |  Size: 6.3 KiB

BIN
kcadmin/web/img/user6-128x128.jpg

After

Width: 128  |  Height: 128  |  Size: 4.2 KiB

BIN
kcadmin/web/img/user7-128x128.jpg

After

Width: 128  |  Height: 128  |  Size: 6.3 KiB

BIN
kcadmin/web/img/user8-128x128.jpg

After

Width: 128  |  Height: 128  |  Size: 4.9 KiB

Loading…
Cancel
Save