index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956
  1. <template>
  2. <view class="basic-info-page">
  3. <!-- 自定义头部 -->
  4. <view class="custom-header" :style="{ paddingTop: statusBarHeight + 'px' }">
  5. <view class="header-content">
  6. <view class="back-btn" @click="handleBack">
  7. <text class="back-icon">‹</text>
  8. </view>
  9. <text class="header-title">{{ t('pagesContent.my.info.title') }}</text>
  10. <view class="placeholder"></view>
  11. </view>
  12. </view>
  13. <!-- 页面内容 -->
  14. <view class="page-body">
  15. <!-- 加载状态 -->
  16. <view v-if="loading" class="loading-state">
  17. <text class="loading-text">{{ t('pagesContent.my.info.loading') }}</text>
  18. </view>
  19. <!-- 信息列表 -->
  20. <view v-else class="info-list">
  21. <!-- 头像 -->
  22. <view class="info-item avatar-item">
  23. <text class="item-label">{{ t('pagesContent.my.info.avatar') }}</text>
  24. <view class="avatar-wrapper">
  25. <image
  26. class="avatar-image"
  27. :src="basicInfo.avatar || '/static/default-avatar.svg'"
  28. mode="aspectFill"
  29. />
  30. <view class="edit-btn" @click="handleEditAvatar">
  31. <text class="edit-btn-text">修改</text>
  32. </view>
  33. </view>
  34. </view>
  35. <!-- 昵称 -->
  36. <view class="info-item">
  37. <text class="item-label">{{ t('pagesContent.my.info.nickname') }}</text>
  38. <view class="value-wrapper">
  39. <text class="item-value">{{ basicInfo.nickname || '-' }}</text>
  40. <view class="edit-btn" @click="handleEditNickname">
  41. <text class="edit-btn-text">修改</text>
  42. </view>
  43. </view>
  44. </view>
  45. <!-- 手机号 -->
  46. <view class="info-item">
  47. <text class="item-label">{{ t('pagesContent.my.info.phoneNumber') }}</text>
  48. <text class="item-value">{{ basicInfo.phoneNumber || '-' }}</text>
  49. </view>
  50. <!-- 性别 -->
  51. <view class="info-item">
  52. <text class="item-label">{{ t('pagesContent.my.info.gender') }}</text>
  53. <view class="value-wrapper">
  54. <view class="gender-value">
  55. <text class="item-value" :class="genderClass">{{ genderDisplay }}</text>
  56. </view>
  57. <view class="edit-btn" @click="handleEditGender">
  58. <text class="edit-btn-text">修改</text>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <!-- 修改头像弹窗 -->
  65. <view v-if="showAvatarModal" class="modal-overlay" @click="closeAvatarModal">
  66. <view class="modal-content" @click.stop>
  67. <view class="modal-header">
  68. <text class="modal-title">修改头像</text>
  69. <view class="modal-close" @click="closeAvatarModal">
  70. <text class="close-icon">×</text>
  71. </view>
  72. </view>
  73. <view class="modal-body">
  74. <view class="upload-area" @click="handleSelectImage">
  75. <image
  76. v-if="tempAvatar"
  77. class="preview-image"
  78. :src="tempAvatar"
  79. mode="aspectFill"
  80. />
  81. <view v-else class="upload-placeholder">
  82. <text class="placeholder-text">点击选择图片</text>
  83. </view>
  84. </view>
  85. <view class="modal-actions">
  86. <view class="action-btn cancel-btn" @click="closeAvatarModal">
  87. <text class="btn-text">取消</text>
  88. </view>
  89. <view class="action-btn confirm-btn" @click="confirmUpdateAvatar">
  90. <text class="btn-text">确认</text>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. <!-- 修改昵称弹窗 -->
  97. <view v-if="showNicknameModal" class="modal-overlay" @click="closeNicknameModal">
  98. <view class="modal-content" @click.stop>
  99. <view class="modal-header">
  100. <text class="modal-title">修改昵称</text>
  101. <view class="modal-close" @click="closeNicknameModal">
  102. <text class="close-icon">×</text>
  103. </view>
  104. </view>
  105. <view class="modal-body">
  106. <input
  107. class="modal-input"
  108. v-model="tempNickname"
  109. placeholder="请输入昵称"
  110. maxlength="20"
  111. />
  112. <view class="modal-actions">
  113. <view class="action-btn cancel-btn" @click="closeNicknameModal">
  114. <text class="btn-text">取消</text>
  115. </view>
  116. <view class="action-btn confirm-btn" @click="confirmUpdateNickname">
  117. <text class="btn-text">确认</text>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. <!-- 修改性别弹窗 -->
  124. <view v-if="showGenderModal" class="modal-overlay" @click="closeGenderModal">
  125. <view class="modal-content" @click.stop>
  126. <view class="modal-header">
  127. <text class="modal-title">修改性别</text>
  128. <view class="modal-close" @click="closeGenderModal">
  129. <text class="close-icon">×</text>
  130. </view>
  131. </view>
  132. <view class="modal-body">
  133. <picker
  134. mode="selector"
  135. :range="genderDictListWithLabel"
  136. range-key="displayLabel"
  137. :value="selectedGenderIndex"
  138. @change="handleGenderChange"
  139. >
  140. <view class="picker-value">
  141. <text class="value-text">{{ selectedGenderLabel || '请选择性别' }}</text>
  142. <text class="arrow-icon">▼</text>
  143. </view>
  144. </picker>
  145. <view class="modal-actions">
  146. <view class="action-btn cancel-btn" @click="closeGenderModal">
  147. <text class="btn-text">取消</text>
  148. </view>
  149. <view class="action-btn confirm-btn" @click="confirmUpdateGender">
  150. <text class="btn-text">确认</text>
  151. </view>
  152. </view>
  153. </view>
  154. </view>
  155. </view>
  156. </view>
  157. </template>
  158. <script setup>
  159. import { ref, computed, onMounted } from 'vue'
  160. import { useI18n } from 'vue-i18n'
  161. import { getBasicInfo, updateAvatar, updateNickname, updateGender, uploadToOss } from '@/apis/auth'
  162. import { getDictDataByType } from '@/apis/dict'
  163. const { t, locale } = useI18n()
  164. // 定义事件
  165. const emit = defineEmits(['back'])
  166. // 状态栏高度
  167. const statusBarHeight = ref(0)
  168. // 基本信息
  169. const basicInfo = ref({
  170. nickname: '',
  171. phoneNumber: '',
  172. avatar: '',
  173. gender: ''
  174. })
  175. // 加载状态
  176. const loading = ref(false)
  177. // 性别字典数据
  178. const genderDictList = ref([])
  179. // 弹窗状态
  180. const showAvatarModal = ref(false)
  181. const showNicknameModal = ref(false)
  182. const showGenderModal = ref(false)
  183. // 临时数据
  184. const tempAvatar = ref('')
  185. const tempAvatarOssId = ref('')
  186. const tempNickname = ref('')
  187. const tempGender = ref('')
  188. // 性别显示(为字典项添加displayLabel属性)
  189. const genderDictListWithLabel = computed(() => {
  190. return genderDictList.value.map(item => {
  191. try {
  192. const labelObj = JSON.parse(item.dictLabel)
  193. const localeKey = locale.value.replace('-', '_')
  194. return {
  195. ...item,
  196. displayLabel: labelObj[localeKey] || labelObj['zh_CN'] || item.dictLabel
  197. }
  198. } catch (error) {
  199. return {
  200. ...item,
  201. displayLabel: item.dictLabel
  202. }
  203. }
  204. })
  205. })
  206. // 选中的性别索引
  207. const selectedGenderIndex = computed(() => {
  208. if (!tempGender.value) return 0
  209. return genderDictListWithLabel.value.findIndex(item =>
  210. String(item.dictValue) === String(tempGender.value)
  211. )
  212. })
  213. // 选中的性别标签
  214. const selectedGenderLabel = computed(() => {
  215. if (!tempGender.value) return ''
  216. const item = genderDictListWithLabel.value.find(item =>
  217. String(item.dictValue) === String(tempGender.value)
  218. )
  219. return item?.displayLabel || ''
  220. })
  221. // 性别显示
  222. const genderDisplay = computed(() => {
  223. if (basicInfo.value.gender === null || basicInfo.value.gender === undefined || basicInfo.value.gender === '') return '-'
  224. // 从字典数据中查找匹配的项,使用dictValue匹配gender
  225. const genderItem = genderDictList.value.find(item =>
  226. String(item.dictValue) === String(basicInfo.value.gender)
  227. )
  228. if (!genderItem) return '-'
  229. // 解析dictLabel的JSON字符串
  230. try {
  231. const labelObj = JSON.parse(genderItem.dictLabel)
  232. // 将locale格式从 zh-CN 转换为 zh_CN
  233. const localeKey = locale.value.replace('-', '_')
  234. // 根据当前语言返回对应的标签
  235. return labelObj[localeKey] || labelObj['zh_CN'] || genderItem.dictLabel
  236. } catch (error) {
  237. // 如果解析失败,直接返回dictLabel
  238. return genderItem.dictLabel
  239. }
  240. })
  241. // 性别样式类
  242. const genderClass = computed(() => {
  243. if (basicInfo.value.gender === null || basicInfo.value.gender === undefined || basicInfo.value.gender === '') return ''
  244. const genderItem = genderDictList.value.find(item =>
  245. String(item.dictValue) === String(basicInfo.value.gender)
  246. )
  247. return genderItem?.listClass || ''
  248. })
  249. onMounted(() => {
  250. // 获取系统信息
  251. const windowInfo = uni.getWindowInfo()
  252. statusBarHeight.value = windowInfo.statusBarHeight || 0
  253. // 获取字典数据
  254. fetchGenderDict()
  255. // 获取基本信息
  256. fetchBasicInfo()
  257. })
  258. // 获取性别字典数据
  259. const fetchGenderDict = async () => {
  260. try {
  261. const response = await getDictDataByType('sys_user_sex')
  262. if (response && response.data) {
  263. genderDictList.value = response.data
  264. }
  265. } catch (error) {
  266. console.error('获取性别字典失败:', error)
  267. }
  268. }
  269. // 打开修改头像弹窗
  270. const handleEditAvatar = () => {
  271. tempAvatar.value = basicInfo.value.avatar || ''
  272. tempAvatarOssId.value = ''
  273. showAvatarModal.value = true
  274. }
  275. // 关闭修改头像弹窗
  276. const closeAvatarModal = () => {
  277. showAvatarModal.value = false
  278. tempAvatar.value = ''
  279. tempAvatarOssId.value = ''
  280. }
  281. // 选择图片
  282. const handleSelectImage = () => {
  283. uni.chooseImage({
  284. count: 1,
  285. sizeType: ['compressed'],
  286. sourceType: ['album', 'camera'],
  287. success: async (res) => {
  288. tempAvatar.value = res.tempFilePaths[0]
  289. }
  290. })
  291. }
  292. // 确认修改头像
  293. const confirmUpdateAvatar = async () => {
  294. if (!tempAvatar.value) {
  295. uni.showToast({
  296. title: '请选择图片',
  297. icon: 'none'
  298. })
  299. return
  300. }
  301. try {
  302. uni.showLoading({
  303. title: '上传中...',
  304. mask: true
  305. })
  306. // 先上传图片到OSS
  307. const uploadResponse = await uploadToOss(tempAvatar.value)
  308. if (uploadResponse && uploadResponse.code === 200 && uploadResponse.data) {
  309. // 使用返回的ossId更新头像
  310. const updateResponse = await updateAvatar({
  311. avatar: uploadResponse.data.ossId
  312. })
  313. uni.hideLoading()
  314. if (updateResponse && updateResponse.code === 200) {
  315. uni.showToast({
  316. title: '修改成功',
  317. icon: 'success'
  318. })
  319. closeAvatarModal()
  320. // 重新获取基本信息
  321. fetchBasicInfo()
  322. } else {
  323. uni.showToast({
  324. title: updateResponse.msg || '修改失败',
  325. icon: 'none'
  326. })
  327. }
  328. } else {
  329. uni.hideLoading()
  330. uni.showToast({
  331. title: uploadResponse.msg || '上传失败',
  332. icon: 'none'
  333. })
  334. }
  335. } catch (error) {
  336. uni.hideLoading()
  337. console.error('修改头像失败:', error)
  338. uni.showToast({
  339. title: '修改失败',
  340. icon: 'none'
  341. })
  342. }
  343. }
  344. // 打开修改昵称弹窗
  345. const handleEditNickname = () => {
  346. tempNickname.value = basicInfo.value.nickname || ''
  347. showNicknameModal.value = true
  348. }
  349. // 关闭修改昵称弹窗
  350. const closeNicknameModal = () => {
  351. showNicknameModal.value = false
  352. tempNickname.value = ''
  353. }
  354. // 确认修改昵称
  355. const confirmUpdateNickname = async () => {
  356. if (!tempNickname.value || !tempNickname.value.trim()) {
  357. uni.showToast({
  358. title: '请输入昵称',
  359. icon: 'none'
  360. })
  361. return
  362. }
  363. try {
  364. uni.showLoading({
  365. title: '修改中...',
  366. mask: true
  367. })
  368. const response = await updateNickname({
  369. nickname: tempNickname.value.trim()
  370. })
  371. uni.hideLoading()
  372. if (response && response.code === 200) {
  373. uni.showToast({
  374. title: '修改成功',
  375. icon: 'success'
  376. })
  377. closeNicknameModal()
  378. // 重新获取基本信息
  379. fetchBasicInfo()
  380. } else {
  381. uni.showToast({
  382. title: response.msg || '修改失败',
  383. icon: 'none'
  384. })
  385. }
  386. } catch (error) {
  387. uni.hideLoading()
  388. console.error('修改昵称失败:', error)
  389. uni.showToast({
  390. title: '修改失败',
  391. icon: 'none'
  392. })
  393. }
  394. }
  395. // 打开修改性别弹窗
  396. const handleEditGender = () => {
  397. tempGender.value = basicInfo.value.gender || ''
  398. showGenderModal.value = true
  399. }
  400. // 关闭修改性别弹窗
  401. const closeGenderModal = () => {
  402. showGenderModal.value = false
  403. tempGender.value = ''
  404. }
  405. // 性别选择变化
  406. const handleGenderChange = (e) => {
  407. const index = e.detail.value
  408. tempGender.value = genderDictListWithLabel.value[index].dictValue
  409. }
  410. // 确认修改性别
  411. const confirmUpdateGender = async () => {
  412. if (!tempGender.value && tempGender.value !== 0) {
  413. uni.showToast({
  414. title: '请选择性别',
  415. icon: 'none'
  416. })
  417. return
  418. }
  419. try {
  420. uni.showLoading({
  421. title: '修改中...',
  422. mask: true
  423. })
  424. const response = await updateGender({
  425. gender: tempGender.value
  426. })
  427. uni.hideLoading()
  428. if (response && response.code === 200) {
  429. uni.showToast({
  430. title: '修改成功',
  431. icon: 'success'
  432. })
  433. closeGenderModal()
  434. // 重新获取基本信息
  435. fetchBasicInfo()
  436. } else {
  437. uni.showToast({
  438. title: response.msg || '修改失败',
  439. icon: 'none'
  440. })
  441. }
  442. } catch (error) {
  443. uni.hideLoading()
  444. console.error('修改性别失败:', error)
  445. uni.showToast({
  446. title: '修改失败',
  447. icon: 'none'
  448. })
  449. }
  450. }
  451. // 获取基本信息
  452. const fetchBasicInfo = async () => {
  453. try {
  454. loading.value = true
  455. const response = await getBasicInfo()
  456. if (response && response.data) {
  457. basicInfo.value = response.data
  458. }
  459. } catch (error) {
  460. console.error('获取基本信息失败:', error)
  461. uni.showToast({
  462. title: t('pagesContent.my.info.loadFailed'),
  463. icon: 'none',
  464. duration: 2000
  465. })
  466. } finally {
  467. loading.value = false
  468. }
  469. }
  470. // 返回
  471. const handleBack = () => {
  472. uni.navigateBack({
  473. fail: () => {
  474. // 如果返回失败(比如没有上一页),则跳转到我的页面
  475. uni.reLaunch({
  476. url: '/pages/my/index'
  477. })
  478. }
  479. })
  480. }
  481. </script>
  482. <style lang="scss" scoped>
  483. .basic-info-page {
  484. width: 100%;
  485. min-height: 100vh;
  486. display: flex;
  487. flex-direction: column;
  488. background: linear-gradient(180deg, #f8fcff 0%, #ffffff 100%);
  489. // 自定义头部
  490. .custom-header {
  491. position: fixed;
  492. top: 0;
  493. left: 0;
  494. right: 0;
  495. background-color: #ffffff;
  496. border-bottom: 1rpx solid #e5e5e5;
  497. z-index: 100;
  498. .header-content {
  499. height: 88rpx;
  500. display: flex;
  501. align-items: center;
  502. justify-content: space-between;
  503. padding: 0 32rpx;
  504. .back-btn {
  505. width: 60rpx;
  506. height: 60rpx;
  507. display: flex;
  508. align-items: center;
  509. justify-content: center;
  510. .back-icon {
  511. font-size: 56rpx;
  512. color: #333333;
  513. font-weight: 300;
  514. }
  515. }
  516. .header-title {
  517. flex: 1;
  518. text-align: center;
  519. font-size: 32rpx;
  520. font-weight: 500;
  521. color: #000000;
  522. }
  523. .placeholder {
  524. width: 60rpx;
  525. }
  526. }
  527. }
  528. // 页面内容
  529. .page-body {
  530. flex: 1;
  531. margin-top: 88rpx;
  532. padding: 40rpx;
  533. // 加载状态
  534. .loading-state {
  535. display: flex;
  536. align-items: center;
  537. justify-content: center;
  538. padding: 120rpx 0;
  539. .loading-text {
  540. font-size: 28rpx;
  541. color: #999999;
  542. }
  543. }
  544. // 信息列表
  545. .info-list {
  546. margin-top: 100rpx;
  547. background-color: #ffffff;
  548. border-radius: 20rpx;
  549. overflow: hidden;
  550. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
  551. .info-item {
  552. display: flex;
  553. align-items: center;
  554. justify-content: space-between;
  555. padding: 36rpx 40rpx;
  556. border-bottom: 1rpx solid #f0f0f0;
  557. &:last-child {
  558. border-bottom: none;
  559. }
  560. &.avatar-item {
  561. .avatar-wrapper {
  562. display: flex;
  563. align-items: center;
  564. gap: 24rpx;
  565. .avatar-image {
  566. width: 100rpx;
  567. height: 100rpx;
  568. border-radius: 50rpx;
  569. border: 4rpx solid #6ec7f5;
  570. }
  571. }
  572. }
  573. .value-wrapper {
  574. display: flex;
  575. align-items: center;
  576. gap: 16rpx;
  577. }
  578. .edit-btn {
  579. padding: 10rpx 24rpx;
  580. background: linear-gradient(135deg, #1ec9c9 0%, #17b3b3 100%);
  581. border-radius: 20rpx;
  582. &:active {
  583. opacity: 0.8;
  584. }
  585. .edit-btn-text {
  586. font-size: 24rpx;
  587. color: #ffffff;
  588. font-weight: 500;
  589. white-space: nowrap;
  590. }
  591. }
  592. .item-label {
  593. font-size: 30rpx;
  594. color: #666666;
  595. font-weight: 500;
  596. }
  597. .gender-value {
  598. display: flex;
  599. align-items: center;
  600. }
  601. .item-value {
  602. font-size: 30rpx;
  603. color: #333333;
  604. font-weight: 500;
  605. // 字典listClass样式
  606. &.default {
  607. color: #909399;
  608. }
  609. &.primary {
  610. color: #6ec7f5;
  611. }
  612. &.success {
  613. color: #67c23a;
  614. }
  615. &.info {
  616. color: #909399;
  617. }
  618. &.warning {
  619. color: #e6a23c;
  620. }
  621. &.danger {
  622. color: #f56c6c;
  623. }
  624. }
  625. }
  626. }
  627. }
  628. // 弹窗样式
  629. .modal-overlay {
  630. position: fixed;
  631. top: 0;
  632. left: 0;
  633. right: 0;
  634. bottom: 0;
  635. background: rgba(0, 0, 0, 0.6);
  636. display: flex;
  637. align-items: center;
  638. justify-content: center;
  639. z-index: 1000;
  640. backdrop-filter: blur(4rpx);
  641. .modal-content {
  642. width: 620rpx;
  643. max-width: 90%;
  644. background: #ffffff;
  645. border-radius: 24rpx;
  646. overflow: hidden;
  647. box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.15);
  648. animation: modalSlideIn 0.3s ease-out;
  649. @keyframes modalSlideIn {
  650. from {
  651. opacity: 0;
  652. transform: translateY(-40rpx) scale(0.95);
  653. }
  654. to {
  655. opacity: 1;
  656. transform: translateY(0) scale(1);
  657. }
  658. }
  659. .modal-header {
  660. padding: 40rpx 32rpx 24rpx;
  661. display: flex;
  662. align-items: center;
  663. justify-content: space-between;
  664. background: linear-gradient(135deg, #f8fcff 0%, #ffffff 100%);
  665. .modal-title {
  666. font-size: 34rpx;
  667. font-weight: 600;
  668. color: #1a1a1a;
  669. letter-spacing: 1rpx;
  670. }
  671. .modal-close {
  672. width: 56rpx;
  673. height: 56rpx;
  674. display: flex;
  675. align-items: center;
  676. justify-content: center;
  677. border-radius: 50%;
  678. background: rgba(0, 0, 0, 0.04);
  679. transition: all 0.2s;
  680. &:active {
  681. background: rgba(0, 0, 0, 0.08);
  682. transform: scale(0.9);
  683. }
  684. .close-icon {
  685. font-size: 44rpx;
  686. color: #666666;
  687. line-height: 1;
  688. font-weight: 300;
  689. }
  690. }
  691. }
  692. .modal-body {
  693. padding: 32rpx;
  694. .upload-area {
  695. width: 100%;
  696. height: 420rpx;
  697. border: 3rpx dashed #d9d9d9;
  698. border-radius: 16rpx;
  699. display: flex;
  700. align-items: center;
  701. justify-content: center;
  702. overflow: hidden;
  703. margin-bottom: 32rpx;
  704. background: #fafafa;
  705. transition: all 0.3s;
  706. position: relative;
  707. &:active {
  708. border-color: #1ec9c9;
  709. background: #f0fffe;
  710. }
  711. .preview-image {
  712. width: 100%;
  713. height: 100%;
  714. object-fit: cover;
  715. }
  716. .upload-placeholder {
  717. display: flex;
  718. flex-direction: column;
  719. align-items: center;
  720. justify-content: center;
  721. gap: 16rpx;
  722. &::before {
  723. content: '+';
  724. font-size: 80rpx;
  725. color: #1ec9c9;
  726. font-weight: 300;
  727. line-height: 1;
  728. }
  729. .placeholder-text {
  730. font-size: 28rpx;
  731. color: #999999;
  732. }
  733. }
  734. }
  735. .modal-input {
  736. width: 100%;
  737. padding: 28rpx 24rpx;
  738. border: 2rpx solid #e8e8e8;
  739. border-radius: 16rpx;
  740. font-size: 30rpx;
  741. color: #333333;
  742. margin-bottom: 32rpx;
  743. box-sizing: border-box;
  744. background: #fafafa;
  745. transition: all 0.3s;
  746. line-height: 1.5;
  747. min-height: 88rpx;
  748. &:focus {
  749. border-color: #1ec9c9;
  750. background: #ffffff;
  751. box-shadow: 0 0 0 4rpx rgba(30, 201, 201, 0.1);
  752. }
  753. }
  754. .picker-value {
  755. width: 100%;
  756. padding: 28rpx 24rpx;
  757. border: 2rpx solid #e8e8e8;
  758. border-radius: 16rpx;
  759. display: flex;
  760. align-items: center;
  761. justify-content: space-between;
  762. margin-bottom: 32rpx;
  763. background: #fafafa;
  764. transition: all 0.2s;
  765. box-sizing: border-box;
  766. min-height: 88rpx;
  767. &:active {
  768. background: #f0f0f0;
  769. }
  770. .value-text {
  771. font-size: 30rpx;
  772. color: #333333;
  773. flex: 1;
  774. overflow: hidden;
  775. text-overflow: ellipsis;
  776. white-space: nowrap;
  777. }
  778. .arrow-icon {
  779. font-size: 24rpx;
  780. color: #999999;
  781. transition: transform 0.3s;
  782. margin-left: 16rpx;
  783. flex-shrink: 0;
  784. }
  785. }
  786. .modal-actions {
  787. display: flex;
  788. gap: 20rpx;
  789. margin-top: 8rpx;
  790. .action-btn {
  791. flex: 1;
  792. padding: 28rpx;
  793. border-radius: 16rpx;
  794. display: flex;
  795. align-items: center;
  796. justify-content: center;
  797. transition: all 0.2s;
  798. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08);
  799. &:active {
  800. transform: scale(0.98);
  801. }
  802. .btn-text {
  803. font-size: 30rpx;
  804. font-weight: 500;
  805. letter-spacing: 1rpx;
  806. }
  807. &.cancel-btn {
  808. background: #f5f5f5;
  809. box-shadow: none;
  810. &:active {
  811. background: #e8e8e8;
  812. }
  813. .btn-text {
  814. color: #666666;
  815. }
  816. }
  817. &.confirm-btn {
  818. background: linear-gradient(135deg, #1ec9c9 0%, #17b3b3 100%);
  819. box-shadow: 0 4rpx 16rpx rgba(30, 201, 201, 0.3);
  820. &:active {
  821. box-shadow: 0 2rpx 8rpx rgba(30, 201, 201, 0.3);
  822. }
  823. .btn-text {
  824. color: #ffffff;
  825. }
  826. }
  827. }
  828. }
  829. }
  830. }
  831. }
  832. }
  833. </style>