diff --git a/controllers/AdminController.php b/controllers/AdminController.php index a6666c6..6f59ed4 100644 --- a/controllers/AdminController.php +++ b/controllers/AdminController.php @@ -102,8 +102,8 @@ class AdminController extends Controller Yii::$app->response->format = Response::FORMAT_JSON; $oldValue = $model->name; - - if ($model->load($_POST)) { + // TODO: Implement the logic to update the value of the model + if ($model->load($_POST)) { // read or convert your posted information $value = $model->name; diff --git a/views/admin/user_view.php b/views/admin/user_view.php index 8628f1f..8facda8 100644 --- a/views/admin/user_view.php +++ b/views/admin/user_view.php @@ -16,8 +16,6 @@ $this->title = '用户ID: ' . $model->id; $this->params['breadcrumbs'][] = ['label' => '用户管理', 'url' => ['user']]; $this->params['breadcrumbs'][] = $this->title; $alreadyDisabled = $model->status == 0; -$isCurrentUser = Yii::$app->user->id == $model->id ? 'disabled' : ''; -$str = $alreadyDisabled ? '启用' : '禁用'; $IPLocation = new IPLocation(); YiiAsset::register($this); FontAwesomeAsset::register($this); @@ -26,18 +24,28 @@ FontAwesomeAsset::register($this);

用户详情

+ + $model->id], [ +// 'class' => 'btn btn-danger ' . $isCurrentUser, +// 'data' => [ +// 'confirm' => '你确定要' . $str . '这个用户吗?', +// 'method' => 'post', +// ], +// 'title' => '点击' . $str . '用户', +// ]) ?> +

- $model->id], ['class' => 'btn btn-primary']) ?> - $model->id], [ - 'class' => 'btn btn-danger ' . $isCurrentUser, + $model->id], [ + 'class' => 'btn btn-danger'.($model->is_otp_enabled == 0 ? ' disabled' : ''), 'data' => [ - 'confirm' => '你确定要' . $str . '这个用户吗?', + 'confirm' => '你确定要取消这个用户的多因素登录吗?', 'method' => 'post', ], - 'title' => '点击' . $str . '用户', + 'title' => '点击取消用户的多因素登录', ]) ?>

+ $model, 'attributes' => [ @@ -58,17 +66,19 @@ FontAwesomeAsset::register($this); return $model->getGravatar(email: $model->email, s: 100, img: true); }], ['attribute' => 'status', 'label' => '账户状态', 'format' => 'raw', 'value' => function ($model) { -// return $model->status == 0 ? '禁用' : '启用'; - //TODO 未完成 + if(Yii::$app->user->id == $model->id){ + return $model->status == 0 ? '禁用' : '启用'; + } return Editable::widget([ 'name' => 'status', + 'value' => $model->status == 0 ? '禁用' : '启用', 'asPopover' => true, 'header' => '账户状态', 'format' => Editable::FORMAT_BUTTON, 'inputType' => Editable::INPUT_DROPDOWN_LIST, - 'data' => [1,2,3], // any list of values + 'data' => [0 => '禁用', + 1 => '启用',], 'options' => ['class' => 'form-control'], - 'editableValueOptions' => ['class' => 'text-danger'] ]); }], ['attribute' => 'created_at', 'label' => '创建时间', 'value' => function ($model) { @@ -86,7 +96,19 @@ FontAwesomeAsset::register($this); return $model->last_login_ip; } }], - ['attribute' => 'bio', 'label' => '用户简介'], + ['attribute' => 'bio', 'label' => '用户简介','format'=>'raw','value'=>function ($model) { + return Editable::widget([ + 'name'=>'bio', + 'asPopover' => true, + 'displayValue' => '查看', + 'inputType' => Editable::INPUT_TEXTAREA, + 'value' => $model->bio, + 'header' => '用户简介', + 'submitOnEnter' => false, + 'size'=>'lg', + 'options' => ['class'=>'form-control', 'rows'=>5] + ]); + }], ['attribute' => 'role', 'label' => '用户身份', 'value' => function ($model) { return $model->role == 'user' ? '用户' : '管理员'; }], diff --git a/web/css/fuckyou-navpadding.css b/web/css/fuckyou-navpadding.css index 2d5bf95..9cc4e57 100644 --- a/web/css/fuckyou-navpadding.css +++ b/web/css/fuckyou-navpadding.css @@ -1,4 +1,4 @@ /*解决Editable显示modal时nav乱跳问题*/ -#w3 { - /*padding-right: 0 !important;*/ +#header nav { + padding-right: 0 !important; } \ No newline at end of file