|
|
<!--pages/admin-user-edit/admin-user-edit.wxml-->
|
|
|
<view class="page-container">
|
|
|
<scroll-view class="scroll-container" scroll-y="true">
|
|
|
<view class="form-container">
|
|
|
<!-- 用户头像 -->
|
|
|
<view class="form-section">
|
|
|
<text class="section-label">用户头像</text>
|
|
|
<view class="avatar-section">
|
|
|
<image class="avatar" src="{{userInfo.avatar || 'https://via.placeholder.com/80x80/cccccc/ffffff?text=U'}}" mode="aspectFill"></image>
|
|
|
<view class="avatar-upload" bindtap="onChooseAvatar">
|
|
|
<text>更换头像</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
<!-- 基本信息 -->
|
|
|
<view class="form-section">
|
|
|
<text class="section-title">基本信息</text>
|
|
|
|
|
|
<view class="form-group">
|
|
|
<text class="label">学号</text>
|
|
|
<input
|
|
|
class="input"
|
|
|
type="text"
|
|
|
placeholder="请输入学号"
|
|
|
value="{{userInfo.sno}}"
|
|
|
bindinput="onInputSno"
|
|
|
disabled="{{!!userId}}"
|
|
|
/>
|
|
|
</view>
|
|
|
|
|
|
<view class="form-group">
|
|
|
<text class="label">姓名</text>
|
|
|
<input
|
|
|
class="input"
|
|
|
type="text"
|
|
|
placeholder="请输入姓名"
|
|
|
value="{{userInfo.sname}}"
|
|
|
bindinput="onInputSname"
|
|
|
/>
|
|
|
</view>
|
|
|
|
|
|
<view class="form-group">
|
|
|
<text class="label">手机号</text>
|
|
|
<input
|
|
|
class="input"
|
|
|
type="number"
|
|
|
placeholder="请输入手机号"
|
|
|
value="{{userInfo.phone}}"
|
|
|
bindinput="onInputPhone"
|
|
|
/>
|
|
|
</view>
|
|
|
|
|
|
<view class="form-group">
|
|
|
<text class="label">专业</text>
|
|
|
<input
|
|
|
class="input"
|
|
|
type="text"
|
|
|
placeholder="请输入专业"
|
|
|
value="{{userInfo.major}}"
|
|
|
bindinput="onInputMajor"
|
|
|
/>
|
|
|
</view>
|
|
|
|
|
|
<view class="form-group">
|
|
|
<text class="label">年级</text>
|
|
|
<picker mode="selector" range="{{grades}}" range-key="label" value="{{gradeIndex}}" bindchange="onGradeChange">
|
|
|
<view class="picker-input">
|
|
|
<text class="{{userInfo.grade ? '' : 'placeholder'}}">{{userInfo.grade || '请选择年级'}}</text>
|
|
|
<text class="picker-arrow">›</text>
|
|
|
</view>
|
|
|
</picker>
|
|
|
</view>
|
|
|
|
|
|
<view class="form-group">
|
|
|
<text class="label">宿舍</text>
|
|
|
<input
|
|
|
class="input"
|
|
|
type="text"
|
|
|
placeholder="请输入宿舍(如:1号楼101)"
|
|
|
value="{{userInfo.sushe}}"
|
|
|
bindinput="onInputSushe"
|
|
|
/>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
<!-- 密码设置(可选) -->
|
|
|
<view class="form-section">
|
|
|
<text class="section-title">密码设置(可选)</text>
|
|
|
<view class="form-group">
|
|
|
<text class="label">新密码</text>
|
|
|
<input
|
|
|
class="input"
|
|
|
type="password"
|
|
|
placeholder="留空则不修改密码"
|
|
|
value="{{newPassword}}"
|
|
|
bindinput="onInputPassword"
|
|
|
password
|
|
|
/>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
<!-- 提交按钮 -->
|
|
|
<view class="submit-section">
|
|
|
<button
|
|
|
class="submit-btn {{canSubmit ? 'active' : ''}}"
|
|
|
bindtap="onSubmit"
|
|
|
disabled="{{!canSubmit || submitting}}"
|
|
|
>
|
|
|
{{submitting ? '保存中...' : '保存修改'}}
|
|
|
</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
|
|
|
<!-- 加载状态 -->
|
|
|
<view class="loading-container" wx:if="{{loading}}">
|
|
|
<view class="loading-content">
|
|
|
<text class="loading-text">加载中...</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
|