小说小程序前端代码仓库(小程序)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

185 lines
4.1 KiB

  1. <template>
  2. <view class="modify-info-page">
  3. <navbar title="修改信息" />
  4. <BackArrow class="back-arrow-fix" @back="goBack" />
  5. <view class="header">
  6. <view class="avatar-upload">
  7. <uv-avatar :src="avatarUrl" size="88" shape="circle" @click="showUpload = true" class="avatar-main" />
  8. <view class="avatar-upload-btn" @click="showUpload = true">
  9. <uv-icon name="camera-fill" size="28" color="#fff" />
  10. </view>
  11. <uv-upload
  12. v-if="showUpload"
  13. :fileList="fileList"
  14. :maxCount="1"
  15. accept="image"
  16. :previewImage="false"
  17. :deletable="false"
  18. :showUploadList="false"
  19. @afterRead="onAvatarChange"
  20. @delete="onAvatarDelete"
  21. />
  22. </view>
  23. </view>
  24. <view class="card">
  25. <view class="card-title">个人信息</view>
  26. <view class="form-item">
  27. <view class="form-label"><text class="star">*</text> 昵称</view>
  28. <view class="form-value">{{ form.nickname }}</view>
  29. </view>
  30. <view class="divider"></view>
  31. <view class="form-item">
  32. <view class="form-label"><text class="star">*</text> 个性签名</view>
  33. <view class="form-value">{{ form.signature }}</view>
  34. </view>
  35. <view class="divider"></view>
  36. </view>
  37. <view class="card">
  38. <view class="card-title">手机号</view>
  39. <view class="form-item">
  40. <view class="form-label"><text class="star">*</text> 手机号</view>
  41. <view class="form-value">{{ form.phone }}</view>
  42. </view>
  43. <view class="divider"></view>
  44. </view>
  45. <view class="footer">
  46. <uv-button type="primary" text="确认" shape="circle" size="large" @click="onSubmit" customStyle="width:100%;height:44px;font-size:18px;background:#0a226b;" />
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import BackArrow from './components/BackArrow.vue'
  52. export default {
  53. components: { BackArrow },
  54. data() {
  55. return {
  56. avatarUrl: '',
  57. fileList: [],
  58. showUpload: false,
  59. form: {
  60. nickname: '战斗世界',
  61. signature: '世界这么美,小说好精彩~',
  62. phone: '19989674531'
  63. }
  64. }
  65. },
  66. methods: {
  67. goBack() {
  68. uni.navigateBack()
  69. },
  70. onAvatarChange(file) {
  71. this.avatarUrl = file.file.url
  72. this.fileList = [file.file]
  73. this.showUpload = false
  74. },
  75. onAvatarDelete() {
  76. this.avatarUrl = ''
  77. this.fileList = []
  78. },
  79. onSubmit() {
  80. uni.showToast({ title: '提交成功', icon: 'success' })
  81. }
  82. }
  83. }
  84. </script>
  85. <style scoped>
  86. .modify-info-page {
  87. min-height: 100vh;
  88. background: #f8f8f8;
  89. display: flex;
  90. flex-direction: column;
  91. }
  92. .back-arrow-fix {
  93. position: absolute;
  94. top: 60rpx;
  95. left: 32rpx;
  96. z-index: 1000;
  97. }
  98. .header {
  99. display: flex;
  100. flex-direction: column;
  101. align-items: center;
  102. margin-top: 120rpx;
  103. margin-bottom: 24rpx;
  104. position: relative;
  105. }
  106. .avatar-upload {
  107. display: flex;
  108. flex-direction: column;
  109. align-items: center;
  110. position: relative;
  111. width: 120rpx;
  112. height: 120rpx;
  113. }
  114. .avatar-main {
  115. box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.08);
  116. }
  117. .avatar-upload-btn {
  118. position: absolute;
  119. bottom: 0;
  120. right: 0;
  121. width: 48rpx;
  122. height: 48rpx;
  123. background: #0a226b;
  124. border-radius: 50%;
  125. display: flex;
  126. align-items: center;
  127. justify-content: center;
  128. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  129. border: 2rpx solid #fff;
  130. }
  131. .card {
  132. background: #fff;
  133. border-radius: 24rpx;
  134. margin: 0 24rpx 32rpx 24rpx;
  135. padding: 32rpx 28rpx 8rpx 28rpx;
  136. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.02);
  137. }
  138. .card-title {
  139. font-size: 28rpx;
  140. font-weight: bold;
  141. color: #222;
  142. margin-bottom: 18rpx;
  143. margin-top: 18rpx;
  144. }
  145. .form-item {
  146. margin-bottom: 8rpx;
  147. margin-top: 18rpx;
  148. }
  149. .form-label {
  150. font-size: 22rpx;
  151. color: #888;
  152. margin-bottom: 4rpx;
  153. display: flex;
  154. align-items: center;
  155. }
  156. .star {
  157. color: #f44;
  158. font-size: 22rpx;
  159. margin-right: 4rpx;
  160. margin-top: 18rpx;
  161. }
  162. .form-value {
  163. font-size: 26rpx;
  164. color: #222;
  165. font-weight: 500;
  166. margin-bottom: 2rpx;
  167. }
  168. .divider {
  169. height: 1px;
  170. background: #f0f0f0;
  171. margin: 8rpx 0 8rpx 0;
  172. }
  173. .footer {
  174. position: fixed;
  175. left: 0;
  176. right: 0;
  177. bottom: 90rpx;
  178. margin: 0 24rpx;
  179. }
  180. </style>