mirror of https://gitee.com/karson/fastadmin.git
Compare commits
9 Commits
cbc3477cb4
...
56253711b7
| Author | SHA1 | Date |
|---|---|---|
|
|
56253711b7 | |
|
|
838a441b2a | |
|
|
e3dd067cef | |
|
|
92f294d24d | |
|
|
be099f6254 | |
|
|
a13996f84e | |
|
|
4c66764541 | |
|
|
87f7013c94 | |
|
|
c13b9eb147 |
|
|
@ -884,7 +884,7 @@ EOD;
|
|||
}
|
||||
$stateNoClass = 'fa-flip-horizontal text-gray';
|
||||
$formAddElement = $this->getReplacedStub('html/' . $inputType, ['field' => $field, 'fieldName' => $fieldName, 'fieldYes' => $yes, 'fieldNo' => $no, 'attrStr' => Form::attributes($attrArr), 'fieldValue' => $defaultValue, 'fieldSwitchClass' => $defaultValue == $yes ? '' : $stateNoClass]);
|
||||
$formEditElement = $this->getReplacedStub('html/' . $inputType, ['field' => $field, 'fieldName' => $fieldName, 'fieldYes' => $yes, 'fieldNo' => $no, 'attrStr' => Form::attributes($attrArr), 'fieldValue' => "{\$row.{$field}}", 'fieldSwitchClass' => "{neq name=\"\$row.{$field}\" value=\"{$yes}\"}fa-flip-horizontal text-gray{/neq}"]);
|
||||
$formEditElement = $this->getReplacedStub('html/' . $inputType . '-edit', ['field' => $field, 'fieldName' => $fieldName, 'fieldYes' => $yes, 'fieldNo' => $no, 'attrStr' => Form::attributes($attrArr), 'fieldValue' => "{\$row.{$field}}", 'fieldSwitchClass' => "{neq name=\"\$row.{$field}\" value=\"{$yes}\"}fa-flip-horizontal text-gray{/neq}"]);
|
||||
} elseif ($inputType == 'citypicker') {
|
||||
$attrArr['class'] = implode(' ', $cssClassArr);
|
||||
$attrArr['data-toggle'] = "city-picker";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
<input {%attrStr%} name="{%fieldName%}" type="hidden" value="{%fieldValue%}">
|
||||
<a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-{%field%}" data-yes="{%fieldYes%}" data-no="{%fieldNo%}" >
|
||||
{if in_array($row.{%field%}, ['{%fieldYes%}', '{%fieldNo%}'])}
|
||||
<i class="fa fa-toggle-on text-success {neq name="$row.{%field%}" value="{%fieldYes%}"}fa-flip-horizontal text-gray{/neq} fa-2x"></i>
|
||||
{else/}
|
||||
<span class="switcher-unknown-val" data-toggle="tooltip" title="{:__('Status unknown, please manually change the status')}"><i class="fa fa-question-circle text-warning"></i></span>
|
||||
{/if}
|
||||
</a>
|
||||
|
|
@ -309,7 +309,7 @@ class Group extends Backend
|
|||
continue;
|
||||
}
|
||||
$state = array('selected' => in_array($v['id'], $currentRuleIds) && !in_array($v['id'], $hasChildrens));
|
||||
$nodeList[] = array('id' => $v['id'], 'parent' => $v['pid'] ? $v['pid'] : '#', 'text' => __($v['title']), 'type' => 'menu', 'state' => $state);
|
||||
$nodeList[] = array('id' => $v['id'], 'parent' => $v['pid'] ? $v['pid'] : '#', 'text' => __($v['title']), 'type' => in_array($v['id'], $hasChildrens) ? 'menu' : 'file', 'state' => $state);
|
||||
}
|
||||
$this->success('', null, $nodeList);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ class User extends Backend
|
|||
|
||||
return json($result);
|
||||
}
|
||||
$this->assignconfig('multi_delete_user', config('fastadmin.multi_delete_user'));
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
|
@ -93,14 +94,38 @@ class User extends Backend
|
|||
if (!$this->request->isPost()) {
|
||||
$this->error(__("Invalid parameters"));
|
||||
}
|
||||
$ids = $ids ? $ids : $this->request->post("ids");
|
||||
$row = $this->model->get($ids);
|
||||
$this->modelValidate = true;
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
$ids = $ids ?: $this->request->post("ids");
|
||||
$ids = array_filter(explode(',', $ids));
|
||||
if (!(config('fastadmin.multi_delete_user') ?: false)) {
|
||||
if (count($ids) > 1) {
|
||||
$this->error(__('Multi delete is not allowed'));
|
||||
}
|
||||
$row = $this->model->get($ids);
|
||||
$this->modelValidate = true;
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
$result = Auth::instance()->delete($row['id']);
|
||||
$count = $result ? 1 : 0;
|
||||
if ($count) {
|
||||
$this->success();
|
||||
}
|
||||
} else {
|
||||
//允许批量删除
|
||||
$list = $this->model->where('id', 'in', $ids)->select();
|
||||
$count = 0;
|
||||
foreach ($list as $item) {
|
||||
$result = Auth::instance()->delete($item['id']);
|
||||
if ($result) {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($count) {
|
||||
$this->success(__('%s rows deleted succeeded, %s rows deleted failed', $count, count($ids) - $count));
|
||||
} else {
|
||||
$this->error(__('No rows were deleted'));
|
||||
}
|
||||
Auth::instance()->delete($row['id']);
|
||||
$this->success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +1,37 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'Id' => 'ID',
|
||||
'Group_id' => '组别ID',
|
||||
'Username' => '用户名',
|
||||
'Nickname' => '昵称',
|
||||
'Password' => '密码',
|
||||
'Salt' => '密码盐',
|
||||
'Email' => '电子邮箱',
|
||||
'Mobile' => '手机号',
|
||||
'Avatar' => '头像',
|
||||
'Level' => '等级',
|
||||
'Gender' => '性别',
|
||||
'Male' => '男',
|
||||
'FeMale' => '女',
|
||||
'Birthday' => '生日',
|
||||
'Bio' => '格言',
|
||||
'Score' => '积分',
|
||||
'Successions' => '连续登录天数',
|
||||
'Maxsuccessions' => '最大连续登录天数',
|
||||
'Prevtime' => '上次登录时间',
|
||||
'Logintime' => '登录时间',
|
||||
'Loginip' => '登录IP',
|
||||
'Loginfailure' => '失败次数',
|
||||
'Joinip' => '加入IP',
|
||||
'Jointime' => '加入时间',
|
||||
'Createtime' => '创建时间',
|
||||
'Updatetime' => '更新时间',
|
||||
'Token' => 'Token',
|
||||
'Status' => '状态',
|
||||
'Username must be 3 to 30 characters' => '用户名只能由3-30位数字、字母、下划线组合',
|
||||
'Password must be 6 to 30 characters' => '密码长度必须在6-30位之间,不能包含空格',
|
||||
'Leave password blank if dont want to change' => '不修改密码请留空',
|
||||
'Id' => 'ID',
|
||||
'Group_id' => '组别ID',
|
||||
'Username' => '用户名',
|
||||
'Nickname' => '昵称',
|
||||
'Password' => '密码',
|
||||
'Salt' => '密码盐',
|
||||
'Email' => '电子邮箱',
|
||||
'Mobile' => '手机号',
|
||||
'Avatar' => '头像',
|
||||
'Level' => '等级',
|
||||
'Gender' => '性别',
|
||||
'Male' => '男',
|
||||
'FeMale' => '女',
|
||||
'Birthday' => '生日',
|
||||
'Bio' => '格言',
|
||||
'Score' => '积分',
|
||||
'Successions' => '连续登录天数',
|
||||
'Maxsuccessions' => '最大连续登录天数',
|
||||
'Prevtime' => '上次登录时间',
|
||||
'Logintime' => '登录时间',
|
||||
'Loginip' => '登录IP',
|
||||
'Loginfailure' => '失败次数',
|
||||
'Joinip' => '加入IP',
|
||||
'Jointime' => '加入时间',
|
||||
'Createtime' => '创建时间',
|
||||
'Updatetime' => '更新时间',
|
||||
'Token' => 'Token',
|
||||
'Status' => '状态',
|
||||
'Username must be 3 to 30 characters' => '用户名只能由3-30位数字、字母、下划线组合',
|
||||
'Password must be 6 to 30 characters' => '密码长度必须在6-30位之间,不能包含空格',
|
||||
'Leave password blank if dont want to change' => '不修改密码请留空',
|
||||
'Multi delete is not allowed' => '不支持批量删除会员',
|
||||
'%s rows deleted succeeded, %s rows deleted failed' => '操作成功,其中%s行删除成功,%s行删除失败',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -13,11 +13,6 @@
|
|||
<link href="__CDN__/assets/css/skins/{$Think.config.fastadmin.adminskin|htmlentities}.css?v={$Think.config.site.version|htmlentities}" rel="stylesheet">
|
||||
{/if}
|
||||
|
||||
<!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="__CDN__/assets/js/html5shiv.js"></script>
|
||||
<script src="__CDN__/assets/js/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<script type="text/javascript">
|
||||
var require = {
|
||||
config: {:json_encode($config)}
|
||||
|
|
|
|||
|
|
@ -166,12 +166,13 @@ class Auth
|
|||
$time = time();
|
||||
|
||||
$data = [
|
||||
'group_id' => config('fastadmin.user_default_group') ?: 0,
|
||||
'username' => $username,
|
||||
'password' => $password,
|
||||
'email' => $email,
|
||||
'mobile' => $mobile,
|
||||
'level' => 1,
|
||||
'score' => 0,
|
||||
'score' => config('fastadmin.user_initial_score') ?: 0,
|
||||
'avatar' => '',
|
||||
];
|
||||
$params = array_merge($data, [
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class User extends Model
|
|||
public function getAvatarAttr($value, $data)
|
||||
{
|
||||
if (!$value) {
|
||||
$value = config('fastadmin.user_letter_avatar') ? letter_avatar($data['nickname']) : (config('fastadmin.user_default_avatar') ?: '/assets/img/avatar.png');
|
||||
$value = config('fastadmin.user_letter_avatar') && $data && ($data['nickname'] ?? '') ? letter_avatar($data['nickname']) : (config('fastadmin.user_default_avatar') ?: '/assets/img/avatar.png');
|
||||
}
|
||||
return cdnurl($value, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -289,6 +289,10 @@ return [
|
|||
'user_letter_avatar' => true,
|
||||
//会员默认头像,仅当user_letter_avatar为false时有效
|
||||
'user_default_avatar' => '/assets/img/avatar.png',
|
||||
//会员默认组别
|
||||
'user_default_group' => 0,
|
||||
//会员初始积分
|
||||
'user_initial_score' => 0,
|
||||
//是否启用会员等级规则,支持none/auto/up,none表示不影响等级,auto表示自动升降级,up表示只升不降
|
||||
'user_level_rule' => '',
|
||||
//会员等级积分字典,键名表示等级,值表示所需的积分
|
||||
|
|
@ -311,6 +315,8 @@ return [
|
|||
'multipletab' => true,
|
||||
//是否默认展示子菜单
|
||||
'show_submenu' => false,
|
||||
//是否开启批量删除会员
|
||||
'multi_delete_user' => false,
|
||||
//后台皮肤,为空时表示使用skin-black-blue
|
||||
'adminskin' => '',
|
||||
//后台是否启用面包屑
|
||||
|
|
|
|||
|
|
@ -14,11 +14,6 @@
|
|||
|
||||
<link href="__CDN__/assets/css/frontend{$Think.config.app_debug?'':'.min'}.css?v={$Think.config.site.version|htmlentities}" rel="stylesheet">
|
||||
|
||||
<!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="__CDN__/assets/js/html5shiv.js"></script>
|
||||
<script src="__CDN__/assets/js/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<script type="text/javascript">
|
||||
var require = {
|
||||
config: {:json_encode($config)}
|
||||
|
|
|
|||
|
|
@ -520,14 +520,22 @@ class FormBuilder
|
|||
$yes = $options['yes'];
|
||||
$no = $options['no'];
|
||||
}
|
||||
$grayclass = $yes == $value ? "": "fa-flip-horizontal text-gray";
|
||||
$disabled = (isset($options['disabled']) && $options['disabled']) || in_array('disabled', $options) ? "disabled" : '';
|
||||
$color = $options['color'] ?? 'success';
|
||||
unset($options['yes'], $options['no'], $options['color'], $options['disabled']);
|
||||
$attr = $this->attributes($options);
|
||||
if (in_array($value, [(string)$yes, (string)$no])) {
|
||||
$grayclass = $yes == $value ? "" : "fa-flip-horizontal text-gray";
|
||||
$innerElement = "<i class=\"fa fa-toggle-on text-{$color} {$grayclass} fa-2x\"></i>";
|
||||
} else {
|
||||
$title = __('Status unknown, please manually change the status');
|
||||
$innerElement = <<<EOD
|
||||
<span class="switcher-unknown-val" data-toggle="tooltip" title="{$title}"><i class="fa fa-question-circle text-warning"></i></span>
|
||||
EOD;
|
||||
}
|
||||
$html = <<<EOD
|
||||
{$btn}
|
||||
<a href="javascript:;" data-toggle="switcher" class="btn-switcher {$disabled}" data-input-id="c-{$domname}" data-yes="{$yes}" data-no="{$no}" {$attr}><i class="fa fa-toggle-on text-{$color} {$grayclass} fa-2x"></i></a>
|
||||
<a href="javascript:;" data-toggle="switcher" class="btn-switcher {$disabled}" data-input-id="c-{$domname}" data-yes="{$yes}" data-no="{$no}" {$attr}>{$innerElement}</a>
|
||||
EOD;
|
||||
return $html;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ define(['fast', 'template', 'moment'], function (Fast, Template, Moment) {
|
|||
var Frontend = {
|
||||
api: Fast.api,
|
||||
init: function () {
|
||||
//配置Toastr的参数
|
||||
Toastr.options.positionClass = "toast-top-right";
|
||||
|
||||
var si = {};
|
||||
//发送验证码
|
||||
$(document).on("click", ".btn-captcha", function (e) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue