From 3d715690292f8c0b383f5e9eafc5fca27cea85f1 Mon Sep 17 00:00:00 2001 From: 李忠强 <1354905998@qq.com> Date: Sat, 22 Jan 2022 19:37:49 +0800 Subject: [PATCH] 更新 --- application/admin/controller/litestore/Litestorenews.php | 1 + application/admin/lang/zh-cn/litestore/litestorenews.php | 6 +++++- application/admin/model/litestore/Litestorenews.php | 7 ++++++- application/admin/view/litestore/litestorenews/add.html | 22 ++++++++++++++++++++-- application/admin/view/litestore/litestorenews/edit.html | 18 ++++++++++++++++++ application/api/controller/Index.php | 7 +++++-- public/assets/js/backend/litestore/litestorenews.js | 1 + 7 files changed, 56 insertions(+), 6 deletions(-) diff --git a/application/admin/controller/litestore/Litestorenews.php b/application/admin/controller/litestore/Litestorenews.php index 10d09e6..324cd6a 100644 --- a/application/admin/controller/litestore/Litestorenews.php +++ b/application/admin/controller/litestore/Litestorenews.php @@ -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()); } /** diff --git a/application/admin/lang/zh-cn/litestore/litestorenews.php b/application/admin/lang/zh-cn/litestore/litestorenews.php index 767b577..294801e 100644 --- a/application/admin/lang/zh-cn/litestore/litestorenews.php +++ b/application/admin/lang/zh-cn/litestore/litestorenews.php @@ -7,5 +7,9 @@ return [ 'Content' => '内容', 'Createtime' => '添加时间', 'Updatetime' => '更新时间', - 'Status' => '状态' + 'Status' => '状态', + 'Type' => '类型', + 'Type 1' => '邀请有奖', + 'Type 2' => '商品详情', + 'Goods_id' => '商品选择', ]; diff --git a/application/admin/model/litestore/Litestorenews.php b/application/admin/model/litestore/Litestorenews.php index b482718..76ae9a3 100644 --- a/application/admin/model/litestore/Litestorenews.php +++ b/application/admin/model/litestore/Litestorenews.php @@ -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) diff --git a/application/admin/view/litestore/litestorenews/add.html b/application/admin/view/litestore/litestorenews/add.html index 09fc3ef..6c4d3eb 100644 --- a/application/admin/view/litestore/litestorenews/add.html +++ b/application/admin/view/litestore/litestorenews/add.html @@ -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> diff --git a/application/admin/view/litestore/litestorenews/edit.html b/application/admin/view/litestore/litestorenews/edit.html index 5edfe99..c23a4e8 100644 --- a/application/admin/view/litestore/litestorenews/edit.html +++ b/application/admin/view/litestore/litestorenews/edit.html @@ -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"> diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php index 0893cda..2d6d74c 100644 --- a/application/api/controller/Index.php +++ b/application/api/controller/Index.php @@ -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); } diff --git a/public/assets/js/backend/litestore/litestorenews.js b/public/assets/js/backend/litestore/litestorenews.js index 2ab418f..42a119d 100644 --- a/public/assets/js/backend/litestore/litestorenews.js +++ b/public/assets/js/backend/litestore/litestorenews.js @@ -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} ] -- libgit2 0.24.0