2024-03-22 14:48:35 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use yii\helpers\Html;
|
|
|
|
use yii\web\YiiAsset;
|
|
|
|
use yii\widgets\DetailView;
|
|
|
|
|
|
|
|
/** @var yii\web\View $this */
|
|
|
|
/** @var app\models\User $model */
|
|
|
|
|
2024-03-23 14:28:36 +08:00
|
|
|
$this->title = '用户ID: '.$model->id;
|
|
|
|
$this->params['breadcrumbs'][] = ['label' => '用户管理', 'url' => ['user']];
|
2024-03-22 14:48:35 +08:00
|
|
|
$this->params['breadcrumbs'][] = $this->title;
|
2024-03-23 14:28:36 +08:00
|
|
|
$alreadyDisabled = $model->status == 0;
|
|
|
|
$isCurrentUser = Yii::$app->user->id == $model->id;
|
|
|
|
$str = $alreadyDisabled ? '启用' : '禁用';
|
2024-03-22 14:48:35 +08:00
|
|
|
YiiAsset::register($this);
|
|
|
|
?>
|
|
|
|
<div class="user-view">
|
|
|
|
|
2024-03-23 14:28:36 +08:00
|
|
|
<h1>用户详情</h1>
|
2024-03-22 14:48:35 +08:00
|
|
|
|
|
|
|
<p>
|
2024-03-23 14:28:36 +08:00
|
|
|
<?= Html::a('修改信息', ['user-update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
|
|
|
<?= Html::a($str.'用户', ['user-delete', 'id' => $model->id], [
|
2024-03-22 14:48:35 +08:00
|
|
|
'class' => 'btn btn-danger',
|
|
|
|
'data' => [
|
2024-03-23 14:28:36 +08:00
|
|
|
'confirm' => '你确定要'.$str.'这个用户吗?',
|
2024-03-22 14:48:35 +08:00
|
|
|
'method' => 'post',
|
|
|
|
],
|
2024-03-23 14:28:36 +08:00
|
|
|
'disabled' => $isCurrentUser,
|
|
|
|
'title'=> $isCurrentUser ? '不能'.$str.'自己的账户' : '点击'.$str.'用户',
|
2024-03-22 14:48:35 +08:00
|
|
|
]) ?>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<?= DetailView::widget([
|
|
|
|
'model' => $model,
|
|
|
|
'attributes' => [
|
|
|
|
'id',
|
|
|
|
'username',
|
|
|
|
'name',
|
|
|
|
'password',
|
|
|
|
'auth_key',
|
|
|
|
'email:email',
|
|
|
|
'status',
|
|
|
|
'created_at',
|
|
|
|
'last_login',
|
|
|
|
'last_login_ip',
|
|
|
|
'bio:ntext',
|
|
|
|
'role',
|
|
|
|
'encryption_key',
|
|
|
|
'otp_secret',
|
|
|
|
'is_encryption_enabled',
|
|
|
|
'is_otp_enabled',
|
|
|
|
'storage_limit',
|
|
|
|
'recovery_codes',
|
|
|
|
'dark_mode',
|
|
|
|
'vault_secret',
|
|
|
|
'vault_salt',
|
|
|
|
],
|
|
|
|
]) ?>
|
|
|
|
|
|
|
|
</div>
|