user-edit.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792
  1. <template>
  2. <view class="user-edit-container">
  3. <view class="header">
  4. <text class="title">{{ isEdit ? '完善个人信息' : '选择角色' }}</text>
  5. <text class="subtitle">{{ isEdit ? '以下信息可帮助您更好地使用服务' : '请选择您的身份类型' }}</text>
  6. </view>
  7. <!-- 角色选择(新用户首次登录时显示) -->
  8. <view class="role-select-section" v-if="!isEdit && showRoleSelect">
  9. <view
  10. class="role-card"
  11. :class="{ active: form.role === 'parent' }"
  12. @click="selectRole('parent')"
  13. >
  14. <text class="role-icon">👨‍👩‍👧</text>
  15. <text class="role-name">家长</text>
  16. <text class="role-desc">管理孩子任务、审核奖励</text>
  17. </view>
  18. <view
  19. class="role-card"
  20. :class="{ active: form.role === 'child' }"
  21. @click="selectRole('child')"
  22. >
  23. <text class="role-icon">👶</text>
  24. <text class="role-name">孩子</text>
  25. <text class="role-desc">执行任务、赚取积分</text>
  26. </view>
  27. <view
  28. class="role-card"
  29. :class="{ active: form.role === 'teacher' }"
  30. @click="selectRole('teacher')"
  31. >
  32. <text class="role-icon">👨‍🏫</text>
  33. <text class="role-name">成长规划师</text>
  34. <text class="role-desc">DAN测评、制定成长方案</text>
  35. </view>
  36. <button class="btn-next" @click="confirmRole" :disabled="!form.role">
  37. 下一步
  38. </button>
  39. </view>
  40. <!-- 详细信息填写(选择角色后显示) -->
  41. <view class="form-section" v-if="isEdit">
  42. <!-- 头像 -->
  43. <view class="form-item avatar-item">
  44. <text class="label">头像</text>
  45. <view class="avatar-upload" @click="chooseAvatar">
  46. <image v-if="form.avatar" :src="form.avatar" class="avatar-preview"></image>
  47. <view v-else class="avatar-placeholder">
  48. <text class="iconfont icon-plus">+</text>
  49. </view>
  50. </view>
  51. </view>
  52. <!-- 昵称 -->
  53. <view class="form-item">
  54. <text class="label">昵称 <text class="required">*</text></text>
  55. <input type="text" v-model="form.nickname" placeholder="请输入昵称" class="input" maxlength="20" />
  56. </view>
  57. <!-- 真实姓名 -->
  58. <view class="form-item">
  59. <text class="label">真实姓名</text>
  60. <input type="text" v-model="form.realName" placeholder="选填,用于家庭管理" class="input" maxlength="20" />
  61. </view>
  62. <!-- 性别(成长规划师必填) -->
  63. <view class="form-item">
  64. <text class="label">性别 <text class="required" v-if="form.role === 'teacher'">*</text></text>
  65. <radio-group class="role-select" @change="onGenderChange">
  66. <label class="role-option">
  67. <radio value="male" :checked="form.gender === 'male'" />
  68. <text>男</text>
  69. </label>
  70. <label class="role-option">
  71. <radio value="female" :checked="form.gender === 'female'" />
  72. <text>女</text>
  73. </label>
  74. </radio-group>
  75. </view>
  76. <!-- 身份证号(成长规划师必填) -->
  77. <view class="form-item">
  78. <text class="label">身份证号 <text class="required" v-if="form.role === 'teacher'">*</text></text>
  79. <input type="idcard" v-model="form.idCard" placeholder="选填,填写后自动生成生日" class="input" maxlength="18" @input="onIdCardInput" />
  80. </view>
  81. <!-- 生日 -->
  82. <view class="form-item">
  83. <text class="label">生日</text>
  84. <picker mode="date" :value="form.birthday" @change="onBirthdayChange">
  85. <view class="picker-input">{{ form.birthday || '请选择生日' }}</view>
  86. </picker>
  87. </view>
  88. <!-- 民族 -->
  89. <view class="form-item">
  90. <text class="label">民族</text>
  91. <picker mode="selector" :range="ethnicityOptions" :value="ethnicityIndex" @change="onEthnicityChange">
  92. <view class="picker-input">{{ form.ethnicity || '请选择民族' }}</view>
  93. </picker>
  94. </view>
  95. <!-- 血型 -->
  96. <view class="form-item">
  97. <text class="label">血型</text>
  98. <picker mode="selector" :range="bloodTypeOptions" :value="bloodTypeIndex" @change="onBloodTypeChange">
  99. <view class="picker-input">{{ form.bloodType || '请选择血型' }}</view>
  100. </picker>
  101. </view>
  102. <!-- 最高学历 -->
  103. <view class="form-item">
  104. <text class="label">最高学历</text>
  105. <picker mode="selector" :range="educationOptions" :value="educationIndex" @change="onEducationChange">
  106. <view class="picker-input">{{ form.highestEducation || '请选择最高学历' }}</view>
  107. </picker>
  108. </view>
  109. <!-- 婚姻状态 -->
  110. <view class="form-item">
  111. <text class="label">婚姻状态</text>
  112. <picker mode="selector" :range="maritalOptions" :value="maritalIndex" @change="onMaritalChange">
  113. <view class="picker-input">{{ form.maritalStatus || '请选择婚姻状态' }}</view>
  114. </picker>
  115. </view>
  116. <!-- 家长身份 -->
  117. <view class="form-item" v-if="form.role === 'parent'">
  118. <text class="label">家长身份</text>
  119. <picker mode="selector" :range="familyRoleOptions" :value="familyRoleIndex" @change="onFamilyRoleChange">
  120. <view class="picker-input">{{ form.familyRole || '请选择家长身份' }}</view>
  121. </picker>
  122. </view>
  123. <!-- 成长规划师额外字段 -->
  124. <view class="form-section-title" v-if="form.role === 'teacher'">成长规划师信息</view>
  125. <!-- 成长规划师证书号(成长规划师必填) -->
  126. <view class="form-item" v-if="form.role === 'teacher'">
  127. <text class="label">成长规划师证书号 <text class="required">*</text></text>
  128. <input type="text" v-model="form.teacherNo" placeholder="请输入成长规划师证书号" class="input" maxlength="50" />
  129. </view>
  130. <!-- 成长规划师照片(成长规划师必填) -->
  131. <view class="form-item" v-if="form.role === 'teacher'">
  132. <text class="label">成长规划师照片 <text class="required">*</text></text>
  133. <view class="photo-upload" @click="chooseTeacherPhoto">
  134. <image v-if="form.teacherPhoto" :src="form.teacherPhoto" class="photo-preview" mode="aspectFill"></image>
  135. <view v-else class="photo-placeholder">
  136. <text class="plus-icon">+</text>
  137. <text class="placeholder-text">上传照片</text>
  138. </view>
  139. </view>
  140. </view>
  141. <!-- 成长规划师证书照片(成长规划师必填) -->
  142. <view class="form-item" v-if="form.role === 'teacher'">
  143. <text class="label">成长规划师证书 <text class="required">*</text></text>
  144. <view class="photo-upload" @click="chooseCertificate">
  145. <image v-if="form.certificateImage" :src="form.certificateImage" class="photo-preview" mode="aspectFill"></image>
  146. <view v-else class="photo-placeholder">
  147. <text class="plus-icon">+</text>
  148. <text class="placeholder-text">上传证书</text>
  149. </view>
  150. </view>
  151. </view>
  152. </view>
  153. <!-- 家庭绑定(新用户注册时显示) -->
  154. <view class="family-section" v-if="isEdit && form.role !== 'teacher' && isNewUserFlow">
  155. <view class="section-title">家庭绑定</view>
  156. <!-- 邀请码输入 -->
  157. <view class="form-item">
  158. <text class="label">家庭邀请码</text>
  159. <input type="text" v-model="form.inviteCode" placeholder="选填,如有邀请码请输入" class="input" maxlength="8" />
  160. </view>
  161. <view class="family-actions">
  162. <button v-if="form.inviteCode" class="btn btn-primary" @click="joinFamilyAction" :loading="loading">
  163. 加入家庭
  164. </button>
  165. <button v-else class="btn btn-primary" @click="createFamilyAction" :loading="loading">
  166. 创建新家庭
  167. </button>
  168. <button class="btn btn-skip" @click="skip">
  169. 跳过
  170. </button>
  171. </view>
  172. </view>
  173. <!-- 修改个人资料保存按钮(非新用户流程时显示) -->
  174. <view class="family-section" v-if="isEdit && !isNewUserFlow && form.role !== 'teacher'">
  175. <view class="family-actions">
  176. <button class="btn btn-primary" @click="saveUserInfo" :loading="loading">
  177. 保存修改
  178. </button>
  179. </view>
  180. </view>
  181. <!-- 成长规划师提交按钮 -->
  182. <view class="family-section" v-if="isEdit && form.role === 'teacher' && isNewUserFlow">
  183. <view class="family-actions">
  184. <button class="btn btn-primary" @click="submitTeacherInfo" :loading="loading">
  185. 提交申请
  186. </button>
  187. </view>
  188. </view>
  189. </view>
  190. </template>
  191. <script>
  192. import { updateUserInfo, joinFamily, createFamily, directRegister, getUserInfo } from '../../utils/api.js'
  193. export default {
  194. data() {
  195. return {
  196. isEdit: false,
  197. showRoleSelect: true,
  198. isNewUserFlow: false, // 是否是新用户注册流程
  199. form: {
  200. role: '',
  201. avatar: '',
  202. nickname: '',
  203. realName: '',
  204. gender: '',
  205. idCard: '',
  206. birthday: '',
  207. inviteCode: '',
  208. phone: '',
  209. teacherNo: '',
  210. teacherPhoto: '',
  211. certificateImage: '',
  212. ethnicity: '',
  213. bloodType: '',
  214. highestEducation: '',
  215. maritalStatus: '',
  216. familyRole: ''
  217. },
  218. ethnicityOptions: ['汉族','蒙古族','回族','藏族','维吾尔族','苗族','彝族','壮族','布依族','朝鲜族','满族','侗族','瑶族','白族','土家族','哈尼族','哈萨克族','傣族','黎族','其他'],
  219. bloodTypeOptions: ['A','B','AB','O','未知'],
  220. educationOptions: ['小学','初中','高中','中专','大专','本科','硕士','博士'],
  221. maritalOptions: ['未婚','已婚','离异','丧偶'],
  222. familyRoleOptions: ['爸爸','妈妈','爷爷','奶奶','姥爷','姥姥','其他'],
  223. loading: false,
  224. userId: '',
  225. token: ''
  226. }
  227. },
  228. computed: {
  229. ethnicityIndex() {
  230. return this.ethnicityOptions.indexOf(this.form.ethnicity)
  231. },
  232. bloodTypeIndex() {
  233. return this.bloodTypeOptions.indexOf(this.form.bloodType)
  234. },
  235. educationIndex() {
  236. return this.educationOptions.indexOf(this.form.highestEducation)
  237. },
  238. maritalIndex() {
  239. return this.maritalOptions.indexOf(this.form.maritalStatus)
  240. },
  241. familyRoleIndex() {
  242. return this.familyRoleOptions.indexOf(this.form.familyRole)
  243. }
  244. },
  245. onLoad(options) {
  246. if (options.token && options.userId) {
  247. this.token = options.token
  248. this.userId = options.userId
  249. // 检查是否需要选择角色(新用户)- 只有明确传递 needsRoleSelect=true 才显示选择
  250. this.showRoleSelect = options.needsRoleSelect === 'true'
  251. this.isEdit = !this.showRoleSelect
  252. this.isNewUserFlow = options.needsRoleSelect === 'true'
  253. } else if (options.phone && options.needsRoleSelect === 'true') {
  254. // 测试环境:没有token,只有手机号,是新用户注册流程
  255. this.showRoleSelect = true
  256. this.isEdit = false
  257. this.isNewUserFlow = true
  258. // 将手机号传递给表单
  259. this.form.phone = options.phone
  260. } else {
  261. // 其他情况:默认进入编辑模式(如从"我的"页面进入)
  262. this.showRoleSelect = false
  263. this.isEdit = true
  264. this.isNewUserFlow = false
  265. }
  266. // 非新用户流程时,加载已有用户信息
  267. if (this.isEdit && !this.isNewUserFlow) {
  268. this.loadUserInfo()
  269. }
  270. },
  271. methods: {
  272. selectRole(role) {
  273. this.form.role = role
  274. },
  275. confirmRole() {
  276. if (!this.form.role) {
  277. uni.showToast({ title: '请选择角色', icon: 'none' })
  278. return
  279. }
  280. this.showRoleSelect = false
  281. this.isEdit = true
  282. // 测试环境:直接注册用户(不需要验证码)
  283. if (!this.token && this.form.phone) {
  284. // 自动进入家庭绑定流程
  285. }
  286. },
  287. chooseAvatar() {
  288. uni.chooseImage({
  289. count: 1,
  290. success: (res) => {
  291. this.form.avatar = res.tempFilePaths[0]
  292. }
  293. })
  294. },
  295. chooseTeacherPhoto() {
  296. uni.chooseImage({
  297. count: 1,
  298. success: (res) => {
  299. this.form.teacherPhoto = res.tempFilePaths[0]
  300. }
  301. })
  302. },
  303. chooseCertificate() {
  304. uni.chooseImage({
  305. count: 1,
  306. success: (res) => {
  307. this.form.certificateImage = res.tempFilePaths[0]
  308. }
  309. })
  310. },
  311. onGenderChange(e) {
  312. this.form.gender = e.detail.value
  313. },
  314. onIdCardInput(e) {
  315. const idCard = e.detail.value
  316. if (idCard.length === 18) {
  317. // 根据身份证号自动提取生日
  318. const year = idCard.substring(6, 10)
  319. const month = idCard.substring(10, 12)
  320. const day = idCard.substring(12, 14)
  321. this.form.birthday = `${year}-${month}-${day}`
  322. }
  323. },
  324. onBirthdayChange(e) {
  325. this.form.birthday = e.detail.value
  326. },
  327. onEthnicityChange(e) {
  328. this.form.ethnicity = this.ethnicityOptions[e.detail.value]
  329. },
  330. onBloodTypeChange(e) {
  331. this.form.bloodType = this.bloodTypeOptions[e.detail.value]
  332. },
  333. onEducationChange(e) {
  334. this.form.highestEducation = this.educationOptions[e.detail.value]
  335. },
  336. onMaritalChange(e) {
  337. this.form.maritalStatus = this.maritalOptions[e.detail.value]
  338. },
  339. onFamilyRoleChange(e) {
  340. this.form.familyRole = this.familyRoleOptions[e.detail.value]
  341. },
  342. // 加载已有用户信息
  343. async loadUserInfo() {
  344. try {
  345. const res = await getUserInfo()
  346. if (res.code === 200 && res.data) {
  347. const userData = res.data
  348. this.form.nickname = userData.nickname || ''
  349. this.form.realName = userData.realName || ''
  350. this.form.gender = userData.gender || ''
  351. this.form.idCard = userData.idCard || ''
  352. // 生日只取日期部分,去掉时间
  353. this.form.birthday = userData.birthday ? userData.birthday.split(' ')[0] : ''
  354. this.form.avatar = userData.avatar || ''
  355. this.form.role = userData.role || ''
  356. this.form.phone = userData.phone || ''
  357. this.form.ethnicity = userData.ethnicity || ''
  358. this.form.bloodType = userData.bloodType || ''
  359. this.form.highestEducation = userData.highestEducation || ''
  360. this.form.maritalStatus = userData.maritalStatus || ''
  361. this.form.familyRole = userData.familyRole || ''
  362. }
  363. } catch (e) {
  364. console.error('加载用户信息失败', e)
  365. }
  366. },
  367. // 保存修改
  368. async saveUserInfo() {
  369. if (!this.form.nickname) {
  370. uni.showToast({ title: '请输入昵称', icon: 'none' })
  371. return
  372. }
  373. this.loading = true
  374. try {
  375. await updateUserInfo({
  376. nickname: this.form.nickname,
  377. realName: this.form.realName,
  378. gender: this.form.gender,
  379. idCard: this.form.idCard,
  380. birthday: this.form.birthday,
  381. avatar: this.form.avatar,
  382. ethnicity: this.form.ethnicity,
  383. bloodType: this.form.bloodType,
  384. highestEducation: this.form.highestEducation,
  385. maritalStatus: this.form.maritalStatus,
  386. familyRole: this.form.familyRole
  387. })
  388. uni.showToast({ title: '保存成功', icon: 'success' })
  389. setTimeout(() => {
  390. uni.navigateBack()
  391. }, 1500)
  392. } catch (e) {
  393. uni.showToast({ title: '保存失败', icon: 'none' })
  394. } finally {
  395. this.loading = false
  396. }
  397. },
  398. async submitTeacherInfo() {
  399. // 验证必填字段
  400. if (!this.form.nickname) {
  401. uni.showToast({ title: '请输入昵称', icon: 'none' })
  402. return
  403. }
  404. if (!this.form.gender) {
  405. uni.showToast({ title: '请选择性别', icon: 'none' })
  406. return
  407. }
  408. if (!this.form.idCard) {
  409. uni.showToast({ title: '请输入身份证号', icon: 'none' })
  410. return
  411. }
  412. if (!this.form.teacherNo) {
  413. uni.showToast({ title: '请输入成长规划师证书号', icon: 'none' })
  414. return
  415. }
  416. if (!this.form.teacherPhoto) {
  417. uni.showToast({ title: '请上传成长规划师照片', icon: 'none' })
  418. return
  419. }
  420. if (!this.form.certificateImage) {
  421. uni.showToast({ title: '请上传成长规划师证书', icon: 'none' })
  422. return
  423. }
  424. this.loading = true
  425. try {
  426. await updateUserInfo({
  427. ...this.form,
  428. roles: this.form.role
  429. })
  430. uni.showToast({ title: '提交成功,请等待审核' })
  431. setTimeout(() => {
  432. uni.switchTab({
  433. url: '/pages/index/parent-index'
  434. })
  435. }, 1500)
  436. } catch (e) {
  437. uni.showToast({ title: '提交失败', icon: 'none' })
  438. } finally {
  439. this.loading = false
  440. }
  441. },
  442. async joinFamilyAction() {
  443. if (!this.form.inviteCode) {
  444. uni.showToast({ title: '请输入邀请码', icon: 'none' })
  445. return
  446. }
  447. if (!this.form.nickname) {
  448. uni.showToast({ title: '请输入昵称', icon: 'none' })
  449. return
  450. }
  451. this.loading = true
  452. try {
  453. let userId = this.userId
  454. // 测试环境:没有token,需要先注册用户
  455. if (!this.token && this.form.phone) {
  456. const regRes = await directRegister({
  457. phone: this.form.phone,
  458. nickname: this.form.nickname,
  459. avatar: this.form.avatar,
  460. role: this.form.role,
  461. birthday: this.form.birthday,
  462. gender: this.form.gender,
  463. inviteCode: this.form.inviteCode
  464. })
  465. userId = regRes.data.userId
  466. // 保存登录信息
  467. uni.setStorageSync('token', regRes.data.token)
  468. uni.setStorageSync('userId', userId)
  469. uni.setStorageSync('role', regRes.data.role)
  470. uni.setStorageSync('familyId', regRes.data.familyId)
  471. } else {
  472. await updateUserInfo(this.form)
  473. await joinFamily(this.form.inviteCode)
  474. }
  475. uni.showToast({ title: '加入成功' })
  476. setTimeout(() => {
  477. this.navigateToHome()
  478. }, 1500)
  479. } catch (e) {
  480. uni.showToast({ title: e.message || '加入失败', icon: 'none' })
  481. } finally {
  482. this.loading = false
  483. }
  484. },
  485. async createFamilyAction() {
  486. if (!this.form.nickname) {
  487. uni.showToast({ title: '请输入昵称', icon: 'none' })
  488. return
  489. }
  490. this.loading = true
  491. try {
  492. let userId = this.userId
  493. // 测试环境:没有token,需要先注册用户
  494. if (!this.token && this.form.phone) {
  495. const regRes = await directRegister({
  496. phone: this.form.phone,
  497. nickname: this.form.nickname,
  498. avatar: this.form.avatar,
  499. role: this.form.role,
  500. birthday: this.form.birthday,
  501. gender: this.form.gender
  502. })
  503. userId = regRes.data.userId
  504. // 保存登录信息
  505. uni.setStorageSync('token', regRes.data.token)
  506. uni.setStorageSync('userId', userId)
  507. uni.setStorageSync('role', regRes.data.role)
  508. uni.setStorageSync('familyId', regRes.data.familyId)
  509. } else {
  510. await updateUserInfo(this.form)
  511. await createFamily(this.form.nickname + '的家庭')
  512. }
  513. uni.showToast({ title: '创建成功' })
  514. setTimeout(() => {
  515. this.navigateToHome()
  516. }, 1500)
  517. } catch (e) {
  518. uni.showToast({ title: e.message || '创建失败', icon: 'none' })
  519. } finally {
  520. this.loading = false
  521. }
  522. },
  523. skip() {
  524. this.navigateToHome()
  525. },
  526. navigateToHome() {
  527. const role = this.form.role || 'parent'
  528. if (role === 'parent') {
  529. uni.switchTab({ url: '/pages/index/parent-index' })
  530. } else if (role === 'child') {
  531. uni.switchTab({ url: '/pages/index/child-index' })
  532. } else if (role === 'teacher') {
  533. uni.switchTab({ url: '/pages/teacher/index' })
  534. }
  535. }
  536. }
  537. }
  538. </script>
  539. <style scoped>
  540. .user-edit-container {
  541. min-height: 100vh;
  542. background: #f5f5f5;
  543. padding: 30rpx;
  544. }
  545. .header {
  546. margin-bottom: 40rpx;
  547. text-align: center;
  548. }
  549. .title {
  550. font-size: 40rpx;
  551. font-weight: bold;
  552. color: #333;
  553. display: block;
  554. margin-bottom: 10rpx;
  555. }
  556. .subtitle {
  557. font-size: 28rpx;
  558. color: #999;
  559. }
  560. /* 角色选择 */
  561. .role-select-section {
  562. margin-bottom: 40rpx;
  563. }
  564. .role-card {
  565. background: #fff;
  566. border-radius: 16rpx;
  567. padding: 40rpx;
  568. margin-bottom: 20rpx;
  569. display: flex;
  570. flex-direction: column;
  571. align-items: center;
  572. border: 2rpx solid transparent;
  573. transition: all 0.3s;
  574. }
  575. .role-card.active {
  576. border-color: #4CAF50;
  577. background: #f8fdf8;
  578. }
  579. .role-icon {
  580. font-size: 80rpx;
  581. margin-bottom: 16rpx;
  582. }
  583. .role-name {
  584. font-size: 32rpx;
  585. font-weight: bold;
  586. color: #333;
  587. margin-bottom: 8rpx;
  588. }
  589. .role-desc {
  590. font-size: 24rpx;
  591. color: #999;
  592. }
  593. .btn-next {
  594. background: #4CAF50;
  595. color: #fff;
  596. border-radius: 40rpx;
  597. margin-top: 20rpx;
  598. }
  599. /* 表单 */
  600. .form-section {
  601. background: #fff;
  602. border-radius: 16rpx;
  603. padding: 30rpx;
  604. margin-bottom: 30rpx;
  605. }
  606. .form-section-title {
  607. font-size: 30rpx;
  608. font-weight: bold;
  609. color: #333;
  610. margin-bottom: 20rpx;
  611. padding-bottom: 16rpx;
  612. border-bottom: 1rpx solid #f0f0f0;
  613. }
  614. .form-item {
  615. margin-bottom: 30rpx;
  616. }
  617. .label {
  618. display: block;
  619. font-size: 28rpx;
  620. color: #333;
  621. margin-bottom: 16rpx;
  622. }
  623. .required {
  624. color: #f44336;
  625. }
  626. .input, .picker-input {
  627. padding: 20rpx;
  628. background: #f5f5f5;
  629. border-radius: 12rpx;
  630. font-size: 28rpx;
  631. }
  632. .role-select {
  633. display: flex;
  634. gap: 40rpx;
  635. }
  636. .role-option {
  637. display: flex;
  638. align-items: center;
  639. gap: 8rpx;
  640. }
  641. /* 头像上传 */
  642. .avatar-upload {
  643. width: 150rpx;
  644. height: 150rpx;
  645. }
  646. .avatar-preview {
  647. width: 150rpx;
  648. height: 150rpx;
  649. border-radius: 50%;
  650. }
  651. .avatar-placeholder {
  652. width: 150rpx;
  653. height: 150rpx;
  654. background: #f5f5f5;
  655. border-radius: 50%;
  656. display: flex;
  657. align-items: center;
  658. justify-content: center;
  659. font-size: 60rpx;
  660. color: #ccc;
  661. }
  662. /* 照片上传 */
  663. .photo-upload {
  664. width: 300rpx;
  665. height: 200rpx;
  666. }
  667. .photo-preview {
  668. width: 300rpx;
  669. height: 200rpx;
  670. border-radius: 12rpx;
  671. }
  672. .photo-placeholder {
  673. width: 300rpx;
  674. height: 200rpx;
  675. background: #f5f5f5;
  676. border-radius: 12rpx;
  677. display: flex;
  678. flex-direction: column;
  679. align-items: center;
  680. justify-content: center;
  681. }
  682. .plus-icon {
  683. font-size: 60rpx;
  684. color: #ccc;
  685. }
  686. .placeholder-text {
  687. font-size: 24rpx;
  688. color: #999;
  689. margin-top: 8rpx;
  690. }
  691. /* 家庭绑定 */
  692. .family-section {
  693. background: #fff;
  694. border-radius: 16rpx;
  695. padding: 30rpx;
  696. }
  697. .section-title {
  698. font-size: 30rpx;
  699. font-weight: bold;
  700. color: #333;
  701. margin-bottom: 20rpx;
  702. }
  703. .family-actions {
  704. display: flex;
  705. flex-direction: column;
  706. gap: 20rpx;
  707. margin-top: 30rpx;
  708. }
  709. .btn {
  710. border-radius: 40rpx;
  711. font-size: 30rpx;
  712. }
  713. .btn-primary {
  714. background: #4CAF50;
  715. color: #fff;
  716. }
  717. .btn-skip {
  718. background: #f5f5f5;
  719. color: #999;
  720. }
  721. </style>