@@ -24,6 +24,9 @@ class Coach extends Backend
$this->model = new \app\admin\model\Coach;
$this->view->assign("genderList", $this->model->getGenderList());
$this->view->assign("statusList", $this->model->getStatusList());
+
+ //可选色值
+ $this->view->assign("bgcolorList", $this->model->getBgcolorList());
}
@@ -33,5 +33,6 @@ return [
'Status 1' => '正常',
'Whatsapp' => 'whatsapp账号',
'Tag.name' => '标签名',
- 'Tag.name_en' => '标签名(en)'
+ 'Tag.name_en' => '标签名(en)',
+ 'Bgcolor' => '背景色'
];
@@ -101,6 +101,50 @@ class Coach extends Model
return ['0' => __('Status 0'), '1' => __('Status 1')];
+ public function getBgcolorList(){
+ return $bgcolorList = [
+ '#E6EEFF',
+ '#BACFFE',
+ '#2D6CFB',
+ '#1380A3',
+ '#125B8F',
+ '#0272C1',
+ '#001D86',
+ '#001253',
+ '#E5DEF6',
+ '#C7B8EC',
+ '#A231A5',
+ '#C53E99',
+ '#A61C79',
+ '#7852D2',
+ '#6033CA',
+ '#6D084C',
+ '#FFF7CD',
+ '#FAB41D',
+ '#FF9F00',
+ '#D28300',
+ '#FA650E',
+ '#CA4B00',
+ '#712A00',
+ '#441900',
+ '#DCEEDA',
+ '#B7DDB3',
+ '#46A83D',
+ '#58A451',
+ '#44823F',
+ '#278252',
+ '#244B21',
+ '#0E220C',
+ '#FADDE0',
+ '#F4ABB4',
+ '#E84056',
+ '#D75B5B',
+ '#FF5350',
+ '#DD001D',
+ '#AE2929',
+ '#680707',
+ ];
+ }
public function getGenderTextAttr($value, $data)
{
@@ -164,6 +164,14 @@
<input id="c-whatsapp" class="form-control" name="row[whatsapp]" type="text" value="">
</div>
+ <div class="form-group">
+ <label class="control-label col-xs-12 col-sm-2">{:__('Bgcolor')}:</label>
+ <div class="radio">
+ {foreach name="bgcolorList" item="vo"}
+ <label for="row[bgcolor]-{$key}"><input id="row[bgcolor]-{$key}" name="row[bgcolor]" type="radio" value="{$vo}" /> <span style="background-color: {$vo}">{$vo}</span></label>
+ {/foreach}
+ </div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
@@ -164,6 +164,16 @@
<input id="c-whatsapp" class="form-control" name="row[whatsapp]" type="text" value="{$row.whatsapp|htmlentities}">
+ <div class="col-xs-12 col-sm-8">
+ <label for="row[bgcolor]-{$key}"><input id="row[bgcolor]-{$key}" name="row[bgcolor]" type="radio" value="{$vo}" {in name="vo" value="$row.bgcolor"}checked{/in} /> <span style="background-color: {$vo}">{$vo}</span></label>
@@ -56,6 +56,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// {field: 'tag.name', title: __('Tag.name'), operate: 'LIKE'},
// {field: 'tag.name_en', title: __('Tag.name_en'), operate: 'LIKE'},
{field: 'whatsapp', title: __('Whatsapp'), operate: 'LIKE'},
+ {field: 'bgcolor', title: __('Bgcolor'), formatter: Table.api.formatter.colortext},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
@@ -634,6 +634,10 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
//渲染fontawesome图标
return '<i class="' + value + '"></i> ' + value;
},
+ colortext: function (value, row, index) {
+ value = value === null ? '' : value.toString();
+ return '<span style="background-color: '+ value +'">'+ value +'</span>';
+ },
image: function (value, row, index) {
value = value == null || value.length === 0 ? '' : value.toString();
value = value ? value : '/assets/img/blank.gif';