userInformation.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <route lang="json5">
  2. {
  3. style: {
  4. navigationStyle: 'custom',
  5. },
  6. }
  7. </route>
  8. <!-- 个人信息 -->
  9. <template>
  10. <view class="container">
  11. <headerTitle :title="'个人信息'" />
  12. <view class="content">
  13. <!-- 头像 -->
  14. <view class="section" @click="pictureBtn">
  15. <view class="gender-container">
  16. <view class="label">头像</view>
  17. <view class="gender">点击可查看</view>
  18. </view>
  19. <View class="avatar">
  20. <image :src="userAvatar" class="avatar-image" />
  21. </View>
  22. <view>
  23. <image style="width: 48rpx; height: 48rpx" src="@/static/icon/chevron-right.svg" />
  24. </view>
  25. </view>
  26. <!-- 昵称 -->
  27. <view class="section" @click="nicknameBtn">
  28. <view class="section-left">
  29. <view class="label">昵称</view>
  30. <wd-input v-model="nicknameValue" placeholder="请输入昵称" />
  31. </view>
  32. </view>
  33. <!-- 性别 -->
  34. <ItemForm label="性别">
  35. <template #default>
  36. <pickerUser
  37. :columns="columns"
  38. v-model:value="genderValue"
  39. title="选择性别"
  40. @confirm="handleConfirm"
  41. />
  42. </template>
  43. </ItemForm>
  44. <!-- 生日 -->
  45. <ItemForm label="生日">
  46. <template #default>
  47. <wd-datetime-picker type="date" v-model="datetimeValue" @confirm="handleTimes" />
  48. </template>
  49. </ItemForm>
  50. </view>
  51. </view>
  52. </template>
  53. <script setup>
  54. import { ref } from 'vue'
  55. import headerTitle from './headerTitle.vue'
  56. import pickerUser from './pickerUser.vue'
  57. import ItemForm from './item-form.vue'
  58. import { formateDate } from '../../../utils/times'
  59. const columns = ref(['男', '女', '保密'])
  60. const genderValue = ref('男') // 性别
  61. const datetimeValue = ref('') // 生日
  62. const nicknameValue = ref('') // 昵称
  63. const handleConfirm = (value) => {
  64. console.log('选择的值:', value)
  65. }
  66. const userAvatar = ref(
  67. 'https://ai-public.mastergo.com/ai/img_res/6e500f9fbe00a9cbad23aa49c6a2830b.jpg',
  68. )
  69. const nickname = ref('小奥特曼的爸爸')
  70. // 点击头像
  71. const pictureBtn = () => {
  72. console.log('点击头像')
  73. }
  74. // 点击昵称
  75. const nicknameBtn = () => {
  76. console.log('点击昵称')
  77. }
  78. // 点击性别
  79. const genderBtn = () => {
  80. console.log('点击性别')
  81. }
  82. // 点击生日
  83. const handleTimes = ({ value }) => {
  84. formateDate(value)
  85. console.log(formateDate(value), 'formattedDateformattedDate')
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. .container {
  90. min-height: 100vh;
  91. background-color: #f2f2f2;
  92. }
  93. .content {
  94. background-color: #ffffff;
  95. }
  96. .section {
  97. display: flex;
  98. align-items: center;
  99. justify-content: space-between;
  100. padding: 32rpx;
  101. border-bottom: 2rpx solid #f1f5f9;
  102. }
  103. .section-left {
  104. width: 100%;
  105. height: 120rpx;
  106. }
  107. .label {
  108. color: #333;
  109. height: 60rpx;
  110. font-size: 32rpx;
  111. font-style: normal;
  112. font-weight: 400;
  113. line-height: 48rpx;
  114. }
  115. .avatar {
  116. width: 130rpx;
  117. height: 96rpx;
  118. margin-right: 32rpx;
  119. overflow: hidden;
  120. border-radius: 50%;
  121. image {
  122. width: 100%;
  123. height: 100%;
  124. object-fit: cover;
  125. }
  126. }
  127. .gender-container {
  128. width: 100%;
  129. }
  130. .nickname {
  131. display: flex;
  132. align-items: center;
  133. height: 60rpx;
  134. font-family: 'PingFang SC';
  135. font-size: 28rpx;
  136. font-style: normal;
  137. font-weight: 400;
  138. }
  139. .gender {
  140. padding: 10rpx 0px;
  141. font-size: 28rpx;
  142. color: #333;
  143. }
  144. ::v-deep .wd-picker__cell {
  145. padding: 12rpx 0px;
  146. }
  147. </style>