作者 李忠强

更新

... ... @@ -23,6 +23,7 @@ class Litestorenews extends Backend
parent::_initialize();
$this->model = new \app\admin\model\litestore\Litestorenews;
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("typeList", $this->model->getTypeList());
}
/**
... ...
... ... @@ -7,5 +7,9 @@ return [
'Content' => '内容',
'Createtime' => '添加时间',
'Updatetime' => '更新时间',
'Status' => '状态'
'Status' => '状态',
'Type' => '类型',
'Type 1' => '邀请有奖',
'Type 2' => '商品详情',
'Goods_id' => '商品选择',
];
... ...
... ... @@ -26,7 +26,12 @@ class Litestorenews extends Model
public function getStatusList()
{
return ['normal' => __('Normal'),'hidden' => __('Hidden')];
}
}
public function getTypeList()
{
return ['1' => __('Type 1'),'2' => __('Type 2')];
}
public function getStatusTextAttr($value, $data)
... ...
... ... @@ -6,6 +6,12 @@
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Goods_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-title" data-source="litestore/Litestoregoods/index" data-field="goods_name" class="form-control selectpage" name="row[goods_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
... ... @@ -26,12 +32,24 @@
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="typeList" item="vo"}
<label for="row[type]-{$key}"><input id="row[type]-{$key}" name="row[type]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="normal"}checked{/in} /> {$vo}</label>
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="normal"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
... ...
... ... @@ -7,6 +7,12 @@
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Goods_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-title" data-source="litestore/Litestoregoods/index" data-field="goods_name" class="form-control selectpage" name="row[goods_id]" type="text" value="{$row.goods_id}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
... ... @@ -27,6 +33,18 @@
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="typeList" item="vo"}
<label for="row[type]-{$key}"><input id="row[type]-{$key}" name="row[type]" type="radio" value="{$key}" {in name="key" value="$row.type"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
... ...
... ... @@ -25,15 +25,18 @@ class Index extends Api
'code':'1',
'msg':'返回成功'
'data':'轮播图数组'
'type':'类型:1=邀请有奖,2=商品详情'
'goods_id':'商品id'
'image':'轮播图'
})
*/
public function banner()
{
$model = new News();
$list = $model->where('status','normal')->column('image');
$list = $model->where('status','normal')->field('type,goods_id,image')->select();
foreach ($list as $key => &$value){
$value = cdnurl($value,true);
$value['image'] = cdnurl($value['image'],true);
}
$this->success('banner',$list);
}
... ...
... ... @@ -32,6 +32,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'image', title: __('Image'), formatter: Table.api.formatter.image},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.status},
{field: 'status', title: __('Status'), searchList: {"normal":__('Normal'),"hidden":__('Hidden')}, formatter: Table.api.formatter.status},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
... ...