Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
yidashi committed Feb 21, 2017
2 parents db1942b + 135022a commit 6fea64f
Show file tree
Hide file tree
Showing 24 changed files with 60 additions and 174 deletions.
4 changes: 0 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ BACKEND_PRETTY_URL = false
# Urls
# ----
SITE_URL = http:https://localhost:8080
FRONTEND_URL = http:https://localhost:8080
BACKEND_URL = http:https://localhost:8080/admin
// 文件访问地址
STORAGE_URL = http:https://localhost:8080/storage

# 搜索驱动(xunsearch需要安装xunsearch服务端)
SEARCH_ENGINE = local
Expand Down
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,9 @@
2. `composer install`

3. `php yii app`(windows 命令行乱码问题是因为windows命令行默认编码为gbk,项目编码为utf8,执行`chcp 65001`修改命令行编码为utf8即可。如在窗口中仍旧不能正确显示UTF-8字符。在命令行标题栏上点击右键,选择"属性"->"字体",将点阵字体修改为True Type字体"Lucida Console",然后点击确定将属性应用到当前窗口。)

4. `php yii serve` (自有服务器就不需要这一步了,下边的访问地址根据自己的服务器来)

5. 收工

前台访问地址: `http:https://localhost:8080/`

后台访问地址: `http:https://localhost:8080/admin/` 管理员 帐号 `hehe` 密码 `111111`

> 如果使用自己的服务器,修改下.env文件里 `SITE_URL` `FRONTEND_URL` `BACKEND_URL` `STORAGE_URL` 这几个配置

或者 直接访问项目地址用web方式安装!


## demo
Expand Down
4 changes: 2 additions & 2 deletions backend/static/css/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ body {
font-size:13px;
}
div.required label.control-label:after {
content: " *";
color: red;
content: " *";
color: red;
}
td{word-break: break-all}
.table thead tr th {
Expand Down
7 changes: 3 additions & 4 deletions backend/views/article/_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

/* @var $this yii\web\View */
/* @var $model common\models\Article */
/* @var $dataModel common\models\ArticleData */
/* @var $moduleModel common\models\ArticleExhibition */
/* @var $form backend\widgets\ActiveForm */
?>
Expand All @@ -27,7 +26,7 @@

<?= $form->field($model, 'category_id')->dropDownList(Category::getDropDownList(Tree::build(Category::lists($model->module)))) ?>

<?= $form->boxField($model, 'description')->textarea()?>
<?= $form->field($model, 'description')->textarea()?>

<?php foreach ($moduleModel->formAttributes() as $attribute): ?>
<?= $form->field($moduleModel, $attribute)->widget(\common\widgets\dynamicInput\DynamicInputWidget::className(), ['type' => $moduleModel->getAttributeType($attribute), 'data' => $moduleModel->getAttributeItems($attribute), 'options' => $moduleModel->getAttributeOptions($attribute)]) ?>
Expand All @@ -48,7 +47,7 @@
'pluginOptions' => ['autoclose' => true]
]
) ?>
<?= $form->boxField($model, 'cover', ['collapsed' => true])->widget(\common\widgets\upload\SingleWidget::className()) ?>
<?= $form->field($model, 'cover')->widget(\common\widgets\upload\SingleWidget::className()) ?>

<?= $form->field($model, 'is_top')->checkbox() ?>

Expand All @@ -60,7 +59,7 @@

<?= $form->field($model, 'view')->textInput() ?>

<?= $form->boxField($model, TagBehavior::$formName)->widget(TagsInput::className())->header(TagBehavior::$formLable); ?>
<?= $form->field($model, TagBehavior::$formName)->label(TagBehavior::$formLable)->widget(TagsInput::className()) ?>

<?= $form->field($model, 'source')->textInput() ?>

Expand Down
2 changes: 1 addition & 1 deletion backend/views/category/_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div class="box-body">
<?php $form = ActiveForm::begin(); ?>

<?= $form->field($model, 'pid')->dropDownList(Category::getDropDownList(Category::tree()), ['prompt' => '请选择']) ?>
<?= $form->field($model, 'pid')->dropDownList(Category::getDropDownList(Category::lists()), ['prompt' => '请选择']) ?>

<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>

Expand Down
2 changes: 1 addition & 1 deletion backend/views/layouts/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<li><?= Html::a('<i class="fa fa-home"></i>', Yii::$app->config->get('FRONTEND_URL'), ['target' => '_blank']) ?></li>
<li><?= Html::a('<i class="fa fa-home"></i>', Yii::$app->config->get('SITE_URL'), ['target' => '_blank']) ?></li>
<li id="log-dropdown" class="dropdown notifications-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-warning"></i>
Expand Down
2 changes: 1 addition & 1 deletion backend/widgets/grid/SwitcherColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class SwitcherColumn extends DataColumn

public $reload = 0;

public $route = 'switcher';
public $route = ['switcher'];

public function registerClientScript()
{
Expand Down
2 changes: 1 addition & 1 deletion common/config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


Yii::setAlias('storagePath', '@root/web/storage');
Yii::setAlias('storageUrl', env('STORAGE_URL', env('FRONTEND_URL/storage')));
Yii::setAlias('storageUrl', env('SITE_URL') . '/storage');


Yii::$container->set('yii\widgets\LinkPager', ['maxButtonCount' => 5, 'firstPageLabel' => '首页', 'lastPageLabel' => '末页']);
Expand Down
25 changes: 0 additions & 25 deletions common/models/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,31 +136,6 @@ public static function lists($module = null)
return $list;
}

public static function tree($list = null)
{
if (is_null($list)) {
$list = self::find()->asArray()->all();
}

$tree = Tree::build($list);
return $tree;
}

public static function treeList($tree = null, &$result = [], $deep = 0, $separator = '--')
{
if (is_null($tree)) {
$tree = self::tree();
}
$deep++;
foreach($tree as $list) {
$list['title'] = str_repeat($separator, $deep-1) . $list['title'];
$result[] = $list;
if (isset($list['children'])) {
self::treeList($list['children'], $result, $deep, $separator);
}
}
return $result;
}
public static function getDropDownList($tree = [], &$result = [], $deep = 0, $separator = '--')
{
$deep++;
Expand Down
50 changes: 0 additions & 50 deletions common/widgets/tag/Tag.php

This file was deleted.

23 changes: 0 additions & 23 deletions common/widgets/tag/TagAsset.php

This file was deleted.

1 change: 0 additions & 1 deletion common/widgets/tag/assets/jquery.tagsinput.min.css

This file was deleted.

1 change: 0 additions & 1 deletion common/widgets/tag/assets/jquery.tagsinput.min.js

This file was deleted.

10 changes: 6 additions & 4 deletions common/widgets/upload/MultipleWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ class MultipleWidget extends InputWidget
public function init()
{
parent::init();
if ($this->onlyImage === false) {
$this->url = $this->multiple ? ['/upload/files-upload'] : ['/upload/file-upload'];
} else {
$this->url = $this->multiple ? ['/upload/images-upload'] : ['/upload/image-upload'];
if (empty($this->url)) {
if ($this->onlyImage === false) {
$this->url = $this->multiple ? ['/upload/files-upload'] : ['/upload/file-upload'];
} else {
$this->url = $this->multiple ? ['/upload/images-upload'] : ['/upload/image-upload'];
}
}
if ($this->hasModel()) {
$this->name = $this->name ? : Html::getInputName($this->model, $this->attribute);
Expand Down
18 changes: 15 additions & 3 deletions console/controllers/AppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace console\controllers;


use common\modules\user\models\User;
use yii\console\Controller;
use Yii;
use yii\helpers\Console;
Expand Down Expand Up @@ -187,23 +188,34 @@ public function actionInstall()
$this->setEnv('YII_ENV', $appStatus);
// 迁移
Yii::$app->runAction('migrate/up', ['interactive' => false]);
//创建默认用户
$this->runAction('create-admin', ['interactive' => $this->interactive]);
$this->setEnv('SITE_URL', $this->prompt('siteUrl'));
// 清缓存
Yii::$app->runAction('cache/flush-all', ['interactive' => false]);
$this->setInstalled();
$end = <<<STR
+=================================================+
| Installation completed successfully, Thanks you |
| 安装成功,感谢选择和使用 yii2cmf |
+-------------------------------------------------+
| 说明和注意事项: |
| 图片不能正常显示需要到.env文件里修改对应URL
+------------------------------------------+
| 默认后台账号:hehe 密码: 111111
+=================================================+
STR;

$this->stdout($end, Console::FG_GREEN);
}

public function actionCreateAdmin()
{
$user = new User();
$user->setScenario("create");
$user->email = '[email protected]';
$user->username = 'hehe';
$user->password = '111111';
$user->create();
}
public function actionReset()
{
if (!$this->checkInstalled()) {
Expand Down
4 changes: 2 additions & 2 deletions database/migrations/m160726_093217_create_user_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function up()
'updated_at' => Schema::TYPE_INTEGER . "(10) NOT NULL"
], $tableOptions);

$this->insert('{{%user}}', [
/*$this->insert('{{%user}}', [
'username' => 'hehe',
'auth_key' => '1lQl4TG6sYlyWRqXZEWL0ZhQkPATVnMs',
'password_hash' => '$2y$13$lYlhIcBcs6jBr7yTd6YrWueckcs.Cvx70juIHs6wEfjtUwnA318VW',
Expand All @@ -65,7 +65,7 @@ public function up()
'locale' => 'zh-CN',
'created_at' => 1441766741,
'updated_at' => 1441766741,
]);
]);*/
}

/**
Expand Down
1 change: 0 additions & 1 deletion database/migrations/m161215_024158_create_book_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public function up()
'id' => 'book',
'name' => '文档wiki',
'bootstrap' => 'app-frontend|app-backend',
'class' => 'common\\modules\\book\\Module',
'status' => 1,
'type' => 1,
'created_at' => time(),
Expand Down
Loading

0 comments on commit 6fea64f

Please sign in to comment.