edit-profile.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <view class="edit-profile" :class="{ 'dark-mode': isDarkTheme }">
  3. <!-- 顶部导航栏 -->
  4. <view class="header">
  5. <view class="back-btn" @click="goBack">
  6. <text class="back-icon">←</text>
  7. </view>
  8. <text class="header-title">编辑资料</text>
  9. <view class="placeholder"></view>
  10. </view>
  11. <scroll-view scroll-y class="content">
  12. <view class="card">
  13. <!-- 头像区域 -->
  14. <view class="avatar-section">
  15. <view class="avatar-circle">
  16. <image v-if="form.avatar" :src="form.avatar" class="avatar-img" mode="aspectFill" />
  17. <view v-else class="avatar-placeholder">👩</view>
  18. <view class="camera-btn" @click="changeAvatar">
  19. <text class="camera-icon">📷</text>
  20. </view>
  21. </view>
  22. <text class="change-avatar-text" @click="changeAvatar">更换头像</text>
  23. </view>
  24. <!-- 表单项 -->
  25. <view class="form-group">
  26. <text class="label">姓名</text>
  27. <input class="input" v-model="form.name" placeholder="请输入姓名" />
  28. </view>
  29. <view class="form-group">
  30. <text class="label">性别</text>
  31. <picker mode="selector" :range="genderOptions" :value="genderIndex" @change="onGenderChange">
  32. <view class="input picker-value">{{ form.gender || '请选择性别' }}</view>
  33. </picker>
  34. </view>
  35. <view class="form-group">
  36. <text class="label">手机号</text>
  37. <input class="input" v-model="form.phone" placeholder="请输入手机号" type="number" maxlength="11" />
  38. </view>
  39. <view class="form-group">
  40. <text class="label">红娘等级</text>
  41. <view class="input readonly">
  42. <text class="level-icon">🏅</text>
  43. <text class="level-text">{{ form.level || '金牌红娘' }}</text>
  44. </view>
  45. </view>
  46. <view class="form-group">
  47. <text class="label">个人简介</text>
  48. <textarea class="textarea" v-model="form.bio" placeholder="请输入个人简介..." />
  49. </view>
  50. <view class="save-btn" @click="handleSave">保存</view>
  51. </view>
  52. </scroll-view>
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. name: 'matchmaker-edit-profile',
  58. data() {
  59. return {
  60. isDarkTheme: false,
  61. genderOptions: ['女', '男'],
  62. genderIndex: 0,
  63. form: {
  64. avatar: '',
  65. name: '高红娘',
  66. gender: '女',
  67. phone: '',
  68. level: '金牌红娘',
  69. bio: '我是一名专业的红娘,拥有丰富的婚恋服务经验,已成功帮助1200对单身男女找到幸福。'
  70. }
  71. }
  72. },
  73. onShow() {
  74. const stored = uni.getStorageSync('matchmakerDarkMode')
  75. if (stored === true || stored === false) {
  76. this.isDarkTheme = stored
  77. }
  78. },
  79. methods: {
  80. goBack() {
  81. uni.navigateBack()
  82. },
  83. changeAvatar() {
  84. uni.showToast({ title: '更换头像开发中', icon: 'none' })
  85. },
  86. onGenderChange(e) {
  87. const index = Number(e.detail.value)
  88. this.genderIndex = index
  89. this.form.gender = this.genderOptions[index]
  90. },
  91. handleSave() {
  92. uni.showToast({ title: '已保存', icon: 'success' })
  93. // 这里可以接入实际保存接口
  94. }
  95. }
  96. }
  97. </script>
  98. <style lang="scss" scoped>
  99. .edit-profile {
  100. min-height: 100vh;
  101. background: #F5F5F5;
  102. display: flex;
  103. flex-direction: column;
  104. }
  105. .header {
  106. display: flex;
  107. align-items: center;
  108. justify-content: space-between;
  109. padding: 25rpx 30rpx;
  110. padding-top: calc(25rpx + env(safe-area-inset-top));
  111. background: #E9D7F5;
  112. .back-btn {
  113. width: 60rpx;
  114. height: 60rpx;
  115. display: flex;
  116. align-items: center;
  117. justify-content: center;
  118. .back-icon {
  119. font-size: 40rpx;
  120. color: #333;
  121. font-weight: bold;
  122. }
  123. }
  124. .header-title {
  125. font-size: 36rpx;
  126. font-weight: bold;
  127. color: #333;
  128. }
  129. .placeholder {
  130. width: 60rpx;
  131. }
  132. }
  133. .content {
  134. flex: 1;
  135. padding: 20rpx 20rpx 40rpx;
  136. }
  137. .card {
  138. background: #FFFFFF;
  139. border-radius: 24rpx;
  140. padding: 30rpx 24rpx 40rpx;
  141. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
  142. }
  143. .avatar-section {
  144. display: flex;
  145. flex-direction: column;
  146. align-items: center;
  147. margin-bottom: 30rpx;
  148. .avatar-circle {
  149. width: 150rpx;
  150. height: 150rpx;
  151. border-radius: 50%;
  152. border: 4rpx solid #E1D5FA;
  153. display: flex;
  154. align-items: center;
  155. justify-content: center;
  156. position: relative;
  157. .avatar-img,
  158. .avatar-placeholder {
  159. width: 130rpx;
  160. height: 130rpx;
  161. border-radius: 50%;
  162. background: #F5F5F5;
  163. display: flex;
  164. align-items: center;
  165. justify-content: center;
  166. font-size: 64rpx;
  167. }
  168. .camera-btn {
  169. position: absolute;
  170. right: 0;
  171. bottom: 10rpx;
  172. width: 48rpx;
  173. height: 48rpx;
  174. border-radius: 50%;
  175. background: #9C27B0;
  176. display: flex;
  177. align-items: center;
  178. justify-content: center;
  179. box-shadow: 0 4rpx 12rpx rgba(156, 39, 176, 0.4);
  180. .camera-icon {
  181. font-size: 26rpx;
  182. color: #FFF;
  183. }
  184. }
  185. }
  186. .change-avatar-text {
  187. margin-top: 16rpx;
  188. font-size: 26rpx;
  189. color: #9C27B0;
  190. }
  191. }
  192. .form-group {
  193. margin-top: 20rpx;
  194. .label {
  195. display: block;
  196. font-size: 26rpx;
  197. color: #666;
  198. margin-bottom: 10rpx;
  199. }
  200. .input {
  201. width: 100%;
  202. padding: 18rpx 20rpx;
  203. border-radius: 16rpx;
  204. background: #F7F7F9;
  205. font-size: 28rpx;
  206. color: #333;
  207. box-sizing: border-box;
  208. }
  209. .picker-value {
  210. line-height: 1.4;
  211. }
  212. .readonly {
  213. display: flex;
  214. align-items: center;
  215. gap: 8rpx;
  216. .level-icon { font-size: 30rpx; }
  217. .level-text { font-size: 28rpx; color: #333; }
  218. }
  219. .textarea {
  220. width: 100%;
  221. min-height: 160rpx;
  222. padding: 18rpx 20rpx;
  223. border-radius: 16rpx;
  224. background: #F7F7F9;
  225. font-size: 28rpx;
  226. color: #333;
  227. box-sizing: border-box;
  228. }
  229. }
  230. .save-btn {
  231. margin-top: 30rpx;
  232. width: 100%;
  233. padding: 22rpx 0;
  234. text-align: center;
  235. border-radius: 26rpx;
  236. background: linear-gradient(135deg, #F48FB1 0%, #EC407A 100%);
  237. color: #FFFFFF;
  238. font-size: 30rpx;
  239. font-weight: bold;
  240. }
  241. /* 深色模式适配 */
  242. .edit-profile.dark-mode {
  243. background: #121212;
  244. color: #f5f5f5;
  245. .header {
  246. background: #1f1f1f;
  247. .back-icon,
  248. .header-title {
  249. color: #f5f5f5;
  250. }
  251. }
  252. .content {
  253. background: #121212;
  254. }
  255. .card {
  256. background: #1e1e1e;
  257. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.6);
  258. }
  259. .form-group {
  260. .label { color: #b0b0b0; }
  261. .input,
  262. .textarea,
  263. .readonly {
  264. background: #242424;
  265. color: #f5f5f5;
  266. }
  267. }
  268. .change-avatar-text { color: #c792ea; }
  269. }
  270. </style>