'添加轮播图类型'
This commit is contained in:
parent
19b0567070
commit
d3d35e493f
@ -155,6 +155,14 @@ class Banner extends \yii\db\ActiveRecord
|
||||
];
|
||||
}
|
||||
|
||||
public static function type()
|
||||
{
|
||||
return [
|
||||
'1' => 'banner',
|
||||
'2' => '轮播',
|
||||
];
|
||||
}
|
||||
|
||||
public static function getMedia($media)
|
||||
{
|
||||
$labels = self::statusLabels();
|
||||
|
||||
@ -29,6 +29,7 @@ class SlideEditForm extends AdminModel
|
||||
public $title;
|
||||
public $page_url;
|
||||
public $sort;
|
||||
public $type;
|
||||
|
||||
public $media;
|
||||
public $status;
|
||||
@ -40,7 +41,7 @@ class SlideEditForm extends AdminModel
|
||||
return [
|
||||
[['app_id', 'app_ext', 'title', 'page_url', 'video_url'], 'trim'],
|
||||
[['app_id', 'app_ext', 'title', 'page_url', 'video_url'], 'string'],
|
||||
[['cx_mch_id', 'user_id', 'zone_id', 'url_type', 'sort', 'status'],'integer'],
|
||||
[['cx_mch_id', 'user_id', 'zone_id', 'url_type', 'sort', 'status','type'],'integer'],
|
||||
[['status'], 'in', 'range' => [0, 1]],
|
||||
[['cx_mch_id', 'user_id', 'zone_id', 'url_type', 'model', 'status', 'media'], 'required'],
|
||||
[['img_url'], 'required', 'on' => 'img'],
|
||||
@ -51,6 +52,7 @@ class SlideEditForm extends AdminModel
|
||||
public function attributeLabels() {
|
||||
return [
|
||||
'app_id' => '小程序AppId',
|
||||
'type' => '类型',
|
||||
'title' => '标题',
|
||||
'page_url' => '链接地址',
|
||||
'url_type' => '链接类型',
|
||||
@ -78,6 +80,7 @@ class SlideEditForm extends AdminModel
|
||||
$this->model->img_url = $this->img_url;
|
||||
$this->model->title = $this->title;
|
||||
$this->model->sort = $this->sort;
|
||||
$this->model->type = $this->type;
|
||||
if($this->url_type == Banner::URL_TYPE_MP_PAGE){
|
||||
$this->model->page_url = $this->page_url;
|
||||
} else if($this->url_type == Banner::URL_TYPE_MP){
|
||||
|
||||
@ -21,6 +21,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
$url_type_labels = Banner::urlTypeLabels();
|
||||
$status_labels = Banner::statusLabels();
|
||||
$media_labels = Banner::mediaLabels();
|
||||
$type = Banner::type();
|
||||
?>
|
||||
<div class="layui-fluid">
|
||||
<div class="layui-card">
|
||||
@ -36,6 +37,16 @@ $media_labels = Banner::mediaLabels();
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux"></div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">类型</label>
|
||||
<div class="layui-input-block media">
|
||||
<?php foreach ($type as $key => $val):?>
|
||||
<input type="radio" name="type" value="<?=$key?>"
|
||||
title="<?=$val?>" <?= $model->type == $key ? 'checked=""' : ''?>>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux"></div>
|
||||
</div>
|
||||
<div class="block-url">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">链接类型</label>
|
||||
|
||||
@ -39,10 +39,10 @@ class BannerController extends Controller
|
||||
$list = Banner::getBannerList(Banner::ZONE_ID_WXAPP_INDEX);
|
||||
|
||||
$arr = [];
|
||||
$banner_arr = [12, 13, 14];
|
||||
|
||||
|
||||
foreach ($list as $key => $value) {
|
||||
if (in_array($value['id'], $banner_arr)) {
|
||||
if ($value['type'] == 1) {
|
||||
$arr[] = $value;
|
||||
unset($list[$key]);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user