Browse Source

开发alert提示

wechat_public_accounts
linyaostalker 5 years ago
parent
commit
7eefb0da0a
  1. 7
      backend/views/layouts/main.php
  2. 2
      backend/views/layouts/sidebar.php
  3. 5
      common/widgets/Alert.php

7
backend/views/layouts/main.php

@ -1,3 +1,4 @@
<?php
/* @var $this \yii\web\View */
/* @var $content string */
@ -5,6 +6,7 @@
use backend\assets\AppAsset;
use yii\helpers\Html;
use yii\widgets\Breadcrumbs;
use common\widgets\Alert;
AppAsset::register($this);
?>
@ -27,6 +29,11 @@ AppAsset::register($this);
<?= $this->render('sidebar') ?>
<div class="content-wrapper">
<?php
if (Yii::$app->session->hasFlash('error') || Yii::$app->session->hasFlash('success')) {
echo Alert::widget();
}
?>
<section class="content-header">
<?= $this->render('breadcrumb') ?>
</section>

2
backend/views/layouts/sidebar.php

@ -21,8 +21,8 @@ use iron\widgets\Menu;
]
],
['label' => '商品管理', 'url' => '#', 'icon' => 'far fa-archive', 'items' => [
['label' => '规格管理', 'url' => ['/antgoods/attribute/index']],
['label' => '后台商品分类', 'url' => ['/antgoods/category/index']],
['label' => '规格管理', 'url' => ['/antgoods/attribute/index']],
['label' => '前端商品分类', 'url' => ['/antgoods/shop-category/index']],
['label' => '品牌管理', 'url' => ['/antgoods/brand/index']],
['label' => '供应商管理', 'url' => ['/antgoods/supplier/index']],

5
common/widgets/Alert.php

@ -2,6 +2,7 @@
namespace common\widgets;
use Yii;
use yii\bootstrap4\Widget;
/**
* Alert widget renders a message from session flash. All flash messages are displayed
@ -22,7 +23,7 @@ use Yii;
* @author Kartik Visweswaran <kartikv2@gmail.com>
* @author Alexander Makarov <sam@rmcreative.ru>
*/
class Alert extends \yii\bootstrap\Widget
class Alert extends Widget
{
/**
* @var array the alert types configuration for the flash messages.
@ -59,7 +60,7 @@ class Alert extends \yii\bootstrap\Widget
}
foreach ((array) $flash as $i => $message) {
echo \yii\bootstrap\Alert::widget([
echo \yii\bootstrap4\Alert::widget([
'body' => $message,
'closeButton' => $this->closeButton,
'options' => array_merge($this->options, [

Loading…
Cancel
Save