新增曾用名
This commit is contained in:
@@ -85,6 +85,7 @@ class UserController extends Controller
|
||||
$activePosition = $targetUser->activePosition?->load('position.department')->position;
|
||||
$data = [
|
||||
'username' => $targetUser->username,
|
||||
'previous_name' => $targetUser->previous_name,
|
||||
'sex' => match ((int) $targetUser->sex) {
|
||||
1 => '男', 2 => '女', default => ''
|
||||
},
|
||||
|
||||
@@ -31,6 +31,7 @@ class UpdateProfileRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'previous_name' => ['nullable', 'string', 'max:50'],
|
||||
'sex' => ['required', 'in:0,1,2'],
|
||||
'headface' => ['required', 'string', 'max:50'], // 比如存放 01.gif - 50.gif
|
||||
'sign' => ['nullable', 'string', 'max:255'],
|
||||
|
||||
@@ -45,6 +45,7 @@ class User extends Authenticatable
|
||||
*/
|
||||
protected $fillable = [
|
||||
'username',
|
||||
'previous_name',
|
||||
'password',
|
||||
'email',
|
||||
'sex',
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('previous_name', 50)->nullable()->after('username')->comment('曾用名');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('previous_name');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -345,6 +345,7 @@ export async function savePassword() {
|
||||
*/
|
||||
export async function saveSettings() {
|
||||
const profileData = {
|
||||
previous_name: element("set-previous-name").value || "",
|
||||
sex: element("set-sex").value,
|
||||
email: element("set-email").value,
|
||||
email_code: element("set-email-code")?.value || "",
|
||||
|
||||
@@ -128,6 +128,12 @@
|
||||
<div style="margin-bottom:16px; border:1px solid #e0e0e0; border-radius:6px; padding:12px;">
|
||||
<div style="font-size:12px; font-weight:bold; color:#336699; margin-bottom:8px;">👤 个人资料</div>
|
||||
<div style="display:flex; flex-direction:column; gap:6px;">
|
||||
<div style="display:flex; align-items:center; gap:8px;">
|
||||
<label style="font-size:12px; width:50px; text-align:right;">曾用名:</label>
|
||||
<input id="set-previous-name" type="text" value="{{ Auth::user()->previous_name ?? '' }}"
|
||||
placeholder="设置曾用名(选填)"
|
||||
style="flex:1; padding:5px; border:1px solid #ccc; border-radius:4px; font-size:12px;">
|
||||
</div>
|
||||
<div style="display:flex; align-items:center; gap:8px;">
|
||||
<label style="font-size:12px; width:50px; text-align:right;">性别:</label>
|
||||
<select id="set-sex"
|
||||
@@ -779,7 +785,7 @@
|
||||
#vip-modal { display:none; position:fixed; inset:0; background:rgba(0,0,0,.6); z-index:9999; justify-content:center; align-items:center; }
|
||||
#vip-modal-inner { width:760px; max-width:96vw; max-height:90vh; background:#fff; border-radius:12px; overflow:hidden; display:flex; flex-direction:column; box-shadow:0 12px 40px rgba(0,0,0,.4); font-family:'Microsoft YaHei',SimSun,sans-serif; }
|
||||
#vip-modal-header { background:linear-gradient(135deg,#1e293b,#334155); color:#fff; padding:12px 18px; display:flex; align-items:center; flex-shrink:0; }
|
||||
|
||||
|
||||
.vip-tab-btn { background:rgba(255,255,255,.1); border:none; color:#cbd5e1; border-radius:8px; padding:6px 16px; font-size:13px; cursor:pointer; font-weight:bold; transition:all .2s; }
|
||||
.vip-tab-btn.active { background:#f59e0b; color:#fff; box-shadow:0 2px 4px rgba(0,0,0,.1); }
|
||||
|
||||
@@ -1102,7 +1108,7 @@
|
||||
#bank-modal-inner { width:520px; max-width:96vw; max-height:88vh; background:#fff; border-radius:8px; overflow:hidden; display:flex; flex-direction:column; box-shadow:0 8px 32px rgba(0,0,0,.3); font-family:'Microsoft YaHei',SimSun,sans-serif; }
|
||||
/* 头部 */
|
||||
#bank-modal-header { background:linear-gradient(135deg,#336699,#5a8fc0); color:#fff; padding:10px 16px; display:flex; align-items:center; flex-shrink:0; }
|
||||
|
||||
|
||||
/* Tabs */
|
||||
.bank-tab-btn { background:rgba(255,255,255,.15); border:none; color:#d0e8ff; border-radius:15px; padding:4px 14px; font-size:12px; cursor:pointer; font-weight:bold; transition:all .2s; }
|
||||
.bank-tab-btn.active { background:#fff; color:#336699; box-shadow:0 2px 4px rgba(0,0,0,.1); }
|
||||
@@ -1124,7 +1130,7 @@
|
||||
.bank-op-btn { height:34px; padding:0 20px; color:#fff; border:none; border-radius:4px; cursor:pointer; font-size:13px; font-weight:bold; transition:opacity .2s; }
|
||||
.bank-op-btn:hover { opacity:.85; }
|
||||
.bank-op-btn:disabled { opacity:.5; cursor:not-allowed; }
|
||||
|
||||
|
||||
/* 流水列表 */
|
||||
.bank-log-item { display:flex; justify-content:space-between; align-items:center; padding:8px 0; border-bottom:1px dashed #d0e4f5; font-size:12px; }
|
||||
.bank-log-item:last-child { border-bottom:none; }
|
||||
@@ -1202,7 +1208,7 @@
|
||||
降序 ↓
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="bank-ranking-list" style="flex:1; overflow-y:auto; padding:12px 16px;">
|
||||
<div style="text-align:center; color:#9db3d4; font-size:12px; padding:30px 0;">加载中...</div>
|
||||
</div>
|
||||
|
||||
@@ -45,6 +45,11 @@
|
||||
<div class="profile-info">
|
||||
<h4>
|
||||
<span x-text="userInfo.username"></span>
|
||||
<template x-if="userInfo.previous_name">
|
||||
<span style="font-size:11px; color:#999; font-weight:normal; margin-left:6px;">
|
||||
(曾用名: <span x-text="userInfo.previous_name"></span>)
|
||||
</span>
|
||||
</template>
|
||||
<span class="level-badge" x-text="'LV.' + userInfo.user_level"></span>
|
||||
<span class="sex-badge"
|
||||
x-text="userInfo.sex === '男' ? '♂' : (userInfo.sex === '女' ? '♀' : '')"
|
||||
|
||||
Reference in New Issue
Block a user