user-edit.vue 22 KB

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