edit-name.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view class="container">
  3. <!-- 自定义头部 -->
  4. <view class="custom-header">
  5. <view class="header-left" @click="navBack">
  6. <image class="back-icon" src="/static/icons/chevron_right_dark.svg" style="transform: rotate(180deg);"></image>
  7. </view>
  8. <text class="header-title">修改真实姓名</text>
  9. <view class="header-right" @click="saveName">
  10. <text class="save-btn">保存</text>
  11. </view>
  12. </view>
  13. <view class="header-placeholder"></view>
  14. <view class="input-card">
  15. <input class="name-input" type="text" v-model="name" placeholder="请输入真实姓名" />
  16. <view class="clear-icon" v-if="name.length > 0" @click="clearName">
  17. <text class="clear-text">×</text>
  18. </view>
  19. </view>
  20. <text class="input-tip">请确保填写真实有效的信息,方便管理员审核。</text>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. name: '张*哥'
  28. }
  29. },
  30. onLoad(option) {
  31. if(option.name) {
  32. this.name = option.name;
  33. }
  34. },
  35. methods: {
  36. navBack() {
  37. uni.navigateBack({
  38. delta: 1
  39. });
  40. },
  41. clearName() {
  42. this.name = '';
  43. },
  44. saveName() {
  45. if(!this.name.trim()) {
  46. uni.showToast({ title: '姓名不能为空', icon: 'none' });
  47. return;
  48. }
  49. // 模拟保存并通知上一个页面更新
  50. uni.$emit('updateName', this.name);
  51. uni.navigateBack();
  52. }
  53. }
  54. }
  55. </script>
  56. <style>
  57. page {
  58. background-color: #F8F8F8;
  59. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  60. }
  61. .custom-header {
  62. position: fixed;
  63. top: 0;
  64. left: 0;
  65. width: 100%;
  66. height: 88rpx;
  67. padding-top: var(--status-bar-height);
  68. background-color: #fff;
  69. display: flex;
  70. align-items: center;
  71. justify-content: space-between;
  72. padding-left: 30rpx;
  73. padding-right: 30rpx;
  74. box-sizing: border-box;
  75. z-index: 100;
  76. }
  77. .header-placeholder {
  78. height: calc(88rpx + var(--status-bar-height));
  79. }
  80. .back-icon {
  81. width: 40rpx;
  82. height: 40rpx;
  83. }
  84. .header-title {
  85. font-size: 32rpx; /* 16pt based on design req */
  86. font-weight: bold;
  87. color: #333;
  88. }
  89. .header-right {
  90. /* width: 40rpx; removed fixed width to fit text */
  91. }
  92. .save-btn {
  93. font-size: 28rpx;
  94. color: #FF5722;
  95. font-weight: bold;
  96. }
  97. .container {
  98. padding: 30rpx;
  99. }
  100. .input-card {
  101. background-color: #fff;
  102. border-radius: 12rpx;
  103. padding: 20rpx 30rpx;
  104. display: flex;
  105. align-items: center;
  106. margin-bottom: 20rpx;
  107. }
  108. .name-input {
  109. flex: 1;
  110. font-size: 32rpx;
  111. color: #333;
  112. height: 60rpx;
  113. }
  114. .clear-icon {
  115. width: 36rpx;
  116. height: 36rpx;
  117. background-color: #CCCCCC;
  118. border-radius: 50%;
  119. display: flex;
  120. align-items: center;
  121. justify-content: center;
  122. }
  123. .clear-text {
  124. color: #fff;
  125. font-size: 28rpx;
  126. line-height: 28rpx;
  127. margin-top: -2rpx; /* Visual adjustment */
  128. }
  129. .input-tip {
  130. font-size: 24rpx;
  131. color: #999;
  132. }
  133. </style>