Browse Source

个人资料枚举,标签增加底色

lizhen_gitee 1 year ago
parent
commit
36abc13850

+ 1 - 1
application/admin/view/enum/tag/add.html

@@ -9,7 +9,7 @@
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Color')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input id="c-color" class="form-control" name="row[color]" type="text" value="">
+            <input id="c-color" class="form-control" name="row[color]" type="color" >
         </div>
     </div>
     <div class="form-group">

+ 1 - 1
application/admin/view/enum/tag/edit.html

@@ -9,7 +9,7 @@
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Color')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input id="c-color" class="form-control" name="row[color]" type="text" value="{$row.color|htmlentities}">
+            <input id="c-color" class="form-control" name="row[color]" type="color" value="{$row.color|htmlentities}">
         </div>
     </div>
     <div class="form-group">

+ 1 - 1
application/api/controller/Baseconfig.php

@@ -93,7 +93,7 @@ class Baseconfig extends Api
 //        $enum_job = Db::name('enum_job')->field('id,name')->order('weight desc,id desc')->select();
 //        $enum_marital = Db::name('enum_marital')->field('id,name')->order('weight desc,id desc')->select();
 //        $enum_education = Db::name('enum_education')->field('id,name')->order('weight desc,id desc')->select();
-        $enum_tag = Db::name('enum_tag')->field('id,name')->order('weight desc,id desc')->select();
+        $enum_tag = Db::name('enum_tag')->field('id,name,color')->order('weight desc,id desc')->select();
 //        $enum_wages = Db::name('enum_wages')->field('id,name')->order('weight desc,id desc')->select();
 
         $data = [

+ 1 - 1
public/assets/js/backend/enum/tag.js

@@ -27,7 +27,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
                         {field: 'name', title: __('Name'), operate: 'LIKE'},
-                        {field: 'color', title: __('Color'), operate: 'LIKE'},
+                        {field: 'color', title: __('Color'), operate: false, formatter: Table.api.formatter.color},
                         {field: 'weight', title: __('Weight')},
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]

+ 6 - 0
public/assets/js/require-table.js

@@ -643,6 +643,12 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
 
                     return '<audio controls="controls" src="' + value + '" /></audio>';
                 },
+                color: function (value, row, index) {
+                    value = value == null || value.length === 0 ? '' : value.toString();
+                    value = value ? value : '#ffffff';
+
+                    return '<input disabled type="color" value="' + value + '">';
+                },
                 image: function (value, row, index) {
                     value = value == null || value.length === 0 ? '' : value.toString();
                     value = value ? value : '/assets/img/blank.gif';