mirror of https://gitee.com/karson/fastadmin.git
管理员表新增mobile字段
parent
b3c4692164
commit
85e0f4bacc
|
|
@ -33,7 +33,7 @@ CREATE TABLE `fa_admin` (
|
||||||
-- Records of fa_admin
|
-- Records of fa_admin
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
BEGIN;
|
BEGIN;
|
||||||
INSERT INTO `fa_admin` VALUES (1, 'admin', 'Admin', '', '', '/assets/img/avatar.png', 'admin@admin.com', 0, 1491635035, '127.0.0.1',1491635035, 1491635035, '', 'normal');
|
INSERT INTO `fa_admin` VALUES (1, 'admin', 'Admin', '', '', '/assets/img/avatar.png', 'admin@admin.com', '', 0, 1491635035, '127.0.0.1',1491635035, 1491635035, '', 'normal');
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,7 @@ class Admin extends Backend
|
||||||
$adminValidate->rule([
|
$adminValidate->rule([
|
||||||
'username' => 'require|regex:\w{3,30}|unique:admin,username,' . $row->id,
|
'username' => 'require|regex:\w{3,30}|unique:admin,username,' . $row->id,
|
||||||
'email' => 'require|email|unique:admin,email,' . $row->id,
|
'email' => 'require|email|unique:admin,email,' . $row->id,
|
||||||
|
'mobile' => 'regex:1[3-9]\d{9}|unique:admin,mobile,' . $row->id,
|
||||||
'password' => 'regex:\S{32}',
|
'password' => 'regex:\S{32}',
|
||||||
]);
|
]);
|
||||||
$result = $row->validate('Admin.edit')->save($params);
|
$result = $row->validate('Admin.edit')->save($params);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
'Email' => '电子邮箱',
|
||||||
|
'Mobile' => '手机号',
|
||||||
'Group' => '所属组别',
|
'Group' => '所属组别',
|
||||||
'Loginfailure' => '登录失败次数',
|
'Loginfailure' => '登录失败次数',
|
||||||
'Login time' => '最后登录',
|
'Login time' => '最后登录',
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ class Admin extends Validate
|
||||||
'nickname' => 'require',
|
'nickname' => 'require',
|
||||||
'password' => 'require|regex:\S{32}',
|
'password' => 'require|regex:\S{32}',
|
||||||
'email' => 'require|email|unique:admin,email',
|
'email' => 'require|email|unique:admin,email',
|
||||||
|
'mobile' => 'regex:1[3-9]\d{9}|unique:admin,mobile',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -33,8 +34,8 @@ class Admin extends Validate
|
||||||
* 验证场景
|
* 验证场景
|
||||||
*/
|
*/
|
||||||
protected $scene = [
|
protected $scene = [
|
||||||
'add' => ['username', 'email', 'nickname', 'password'],
|
'add' => ['username', 'email', 'nickname', 'password', 'mobile'],
|
||||||
'edit' => ['username', 'email', 'nickname', 'password'],
|
'edit' => ['username', 'email', 'nickname', 'password', 'mobile'],
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct(array $rules = [], $message = [], $field = [])
|
public function __construct(array $rules = [], $message = [], $field = [])
|
||||||
|
|
@ -44,6 +45,7 @@ class Admin extends Validate
|
||||||
'nickname' => __('Nickname'),
|
'nickname' => __('Nickname'),
|
||||||
'password' => __('Password'),
|
'password' => __('Password'),
|
||||||
'email' => __('Email'),
|
'email' => __('Email'),
|
||||||
|
'mobile' => __('Mobile'),
|
||||||
];
|
];
|
||||||
$this->message = array_merge($this->message, [
|
$this->message = array_merge($this->message, [
|
||||||
'username.regex' => __('Please input correct username'),
|
'username.regex' => __('Please input correct username'),
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,12 @@
|
||||||
<input type="email" class="form-control" id="email" name="row[email]" value="" data-rule="required;email" />
|
<input type="email" class="form-control" id="email" name="row[email]" value="" data-rule="required;email" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="mobile" class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input type="text" class="form-control" id="mobile" name="row[mobile]" value="" data-rule="mobile" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="nickname" class="control-label col-xs-12 col-sm-2">{:__('Nickname')}:</label>
|
<label for="nickname" class="control-label col-xs-12 col-sm-2">{:__('Nickname')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,12 @@
|
||||||
<input type="email" class="form-control" id="email" name="row[email]" value="{$row.email|htmlentities}" data-rule="required;email" />
|
<input type="email" class="form-control" id="email" name="row[email]" value="{$row.email|htmlentities}" data-rule="required;email" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="mobile" class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input type="text" class="form-control" id="mobile" name="row[mobile]" value="{$row.mobile|default=''|htmlentities}" data-rule="mobile" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="nickname" class="control-label col-xs-12 col-sm-2">{:__('Nickname')}:</label>
|
<label for="nickname" class="control-label col-xs-12 col-sm-2">{:__('Nickname')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
{field: 'nickname', title: __('Nickname')},
|
{field: 'nickname', title: __('Nickname')},
|
||||||
{field: 'groups_text', title: __('Group'), operate:false, formatter: Table.api.formatter.label},
|
{field: 'groups_text', title: __('Group'), operate:false, formatter: Table.api.formatter.label},
|
||||||
{field: 'email', title: __('Email')},
|
{field: 'email', title: __('Email')},
|
||||||
|
{field: 'mobile', title: __('Mobile')},
|
||||||
{field: 'status', title: __("Status"), searchList: {"normal":__('Normal'),"hidden":__('Hidden')}, formatter: Table.api.formatter.status},
|
{field: 'status', title: __("Status"), searchList: {"normal":__('Normal'),"hidden":__('Hidden')}, formatter: Table.api.formatter.status},
|
||||||
{field: 'logintime', title: __('Login time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
{field: 'logintime', title: __('Login time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
||||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: function (value, row, index) {
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: function (value, row, index) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue