From 12273d9f7b41721001fb515f89998411f040e1b2 Mon Sep 17 00:00:00 2001 From: blobt <380255922@qq.com> Date: Tue, 13 Aug 2019 14:52:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=A7=8B=E5=BC=80=E5=8F=91date=20rang?= =?UTF-8?q?e=20picker=E5=B0=8F=E7=89=A9=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/models/Category.php | 18 +++++--- common/models/CategorySearch.php | 2 +- kcadmin/assets/AppAsset.php | 1 + kcadmin/views/category/_search.php | 67 ++++++++++++++++++------------ kcadmin/views/category/index.php | 30 +++++++++---- kcadmin/views/site/test.php | 60 +++++++++++++++++++++++++- kcadmin/web/js/common.js | 3 ++ 7 files changed, 139 insertions(+), 42 deletions(-) create mode 100644 kcadmin/web/js/common.js diff --git a/common/models/Category.php b/common/models/Category.php index 7b5feff..cf98e09 100644 --- a/common/models/Category.php +++ b/common/models/Category.php @@ -19,6 +19,14 @@ use yii\behaviors\TimestampBehavior; */ class Category extends \yii\db\ActiveRecord { + const ICON_TYPE_BOOSTARAP = 1; + const ICON_TYPE_AWESOME = 2; + + public static $iconType = [ + self::ICON_TYPE_BOOSTARAP => "boostrap", + self::ICON_TYPE_AWESOME => "awesome" + ]; + /** * {@inheritdoc} */ @@ -26,20 +34,18 @@ class Category extends \yii\db\ActiveRecord { return 'category'; } - - /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', - 'cat_name' => 'Cat Name', + 'cat_name' => '类名', 'icon' => 'Icon', - 'icon_type' => 'Icon Type', - 'description' => 'Description', + 'icon_type' => '图标类型', + 'description' => '描述', 'sort_order' => 'Sort Order', - 'created_at' => 'Created At', + 'created_at' => '添加日期', 'updated_at' => 'Updated At', ]; } diff --git a/common/models/CategorySearch.php b/common/models/CategorySearch.php index c22a1d6..1cc05e6 100644 --- a/common/models/CategorySearch.php +++ b/common/models/CategorySearch.php @@ -16,7 +16,7 @@ class CategorySearch extends Category { */ public function rules() { return [ - [['id', 'icon_type', 'sort_order', 'created_at', 'updated_at'], 'integer'], + [['cat_name','id', 'icon_type', 'sort_order', 'created_at', 'updated_at'], 'integer'], [['cat_name', 'icon', 'description'], 'safe'], ]; } diff --git a/kcadmin/assets/AppAsset.php b/kcadmin/assets/AppAsset.php index 43351e5..64d62bb 100644 --- a/kcadmin/assets/AppAsset.php +++ b/kcadmin/assets/AppAsset.php @@ -15,6 +15,7 @@ class AppAsset extends AssetBundle 'css/site.css', ]; public $js = [ + 'js/common.js' ]; public $depends = [ 'yii\web\YiiAsset', diff --git a/kcadmin/views/category/_search.php b/kcadmin/views/category/_search.php index 77ac48e..0343634 100644 --- a/kcadmin/views/category/_search.php +++ b/kcadmin/views/category/_search.php @@ -8,34 +8,47 @@ use yii\widgets\ActiveForm; /* @var $form yii\widgets\ActiveForm */ ?> -