index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view class="settings-root">
  3. <erp-nav-bar title="个人资料设置" />
  4. <!-- 2. 资料列表 -->
  5. <view class="settings-list" :style="{ marginTop: '10px' }">
  6. <view class="item-row avatar-row" @click="doChooseImage">
  7. <text class="item-label">头像</text>
  8. <view class="item-right">
  9. <image class="avatar-img" :src="myInfo.avatarUrl" mode="aspectFill"></image>
  10. <text class="icon-more"></text>
  11. </view>
  12. </view>
  13. <view class="item-row" @click="doEditName">
  14. <text class="item-label">用户昵称</text>
  15. <view class="item-right">
  16. <text class="item-value">{{ myInfo.nickName }}</text>
  17. <text class="icon-more"></text>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="settings-list mt-30">
  22. <view class="item-row no-tap">
  23. <text class="item-label">手机号码</text>
  24. <view class="item-right">
  25. <text class="item-value readonly">{{ myInfo.phoneNum }}</text>
  26. </view>
  27. </view>
  28. <view class="item-row no-tap">
  29. <text class="item-label">授权客户</text>
  30. <view class="item-right">
  31. <text class="item-value readonly">{{ myInfo.orgName }}</text>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="footer-bar">
  36. <button class="btn-confirm" @click="saveProfile">确认保存</button>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import ErpNavBar from '@/components/erp-nav-bar.vue';
  42. export default {
  43. components: { ErpNavBar },
  44. data() {
  45. return {
  46. myInfo: {
  47. avatarUrl: 'https://img.icons8.com/clouds/200/manager.png',
  48. nickName: '张经理',
  49. phoneNum: '138-8888-8888',
  50. orgName: '广东粤铝材实业有限公司'
  51. }
  52. }
  53. },
  54. methods: {
  55. goBack() { uni.navigateBack(); },
  56. doChooseImage() {
  57. uni.chooseImage({
  58. count: 1,
  59. success: (res) => {
  60. this.myInfo.avatarUrl = res.tempFilePaths[0];
  61. uni.showToast({ title: '头像已选好', icon: 'none' });
  62. }
  63. });
  64. },
  65. doEditName() {
  66. uni.showModal({
  67. title: '设置昵称',
  68. content: this.myInfo.nickName,
  69. editable: true,
  70. confirmColor: '#C1001C', // 重点修复点:弹窗确认按钮强制采用主题红
  71. success: (res) => {
  72. if (res.confirm) {
  73. this.myInfo.nickName = res.content || '未命名';
  74. }
  75. }
  76. });
  77. },
  78. saveProfile() {
  79. uni.showLoading({ title: '保存中' });
  80. setTimeout(() => {
  81. uni.hideLoading();
  82. uni.showToast({ title: '保存成功' });
  83. setTimeout(() => { uni.navigateBack(); }, 1200);
  84. }, 600);
  85. }
  86. }
  87. }
  88. </script>
  89. <style scoped>
  90. .settings-root {
  91. width: 100vw;
  92. height: 100vh;
  93. background: #f8fafb;
  94. display: flex;
  95. flex-direction: column;
  96. }
  97. .settings-list {
  98. background: #fff;
  99. padding: 0 40rpx;
  100. }
  101. .mt-30 {
  102. margin-top: 30rpx;
  103. }
  104. .item-row {
  105. display: flex;
  106. justify-content: space-between;
  107. align-items: center;
  108. min-height: 110rpx;
  109. border-bottom: 2rpx solid #f9f9f9;
  110. }
  111. .item-row:last-child {
  112. border-bottom: none;
  113. }
  114. .avatar-row {
  115. height: 180rpx;
  116. }
  117. .item-label {
  118. font-size: 32rpx;
  119. color: #333;
  120. }
  121. .item-right {
  122. display: flex;
  123. align-items: center;
  124. }
  125. .avatar-img {
  126. width: 110rpx;
  127. height: 110rpx;
  128. border-radius: 50%;
  129. background: #eee;
  130. margin-right: 20rpx;
  131. }
  132. .item-value {
  133. font-size: 30rpx;
  134. color: #666;
  135. margin-right: 15rpx;
  136. }
  137. .item-value.readonly {
  138. color: #aaa;
  139. margin-right: 0;
  140. }
  141. .icon-more {
  142. width: 14rpx;
  143. height: 14rpx;
  144. border-top: 3rpx solid #ccc;
  145. border-right: 3rpx solid #ccc;
  146. transform: rotate(45deg);
  147. }
  148. .footer-bar {
  149. padding: 40rpx;
  150. margin-top: auto;
  151. padding-bottom: calc(40rpx + env(safe-area-inset-bottom));
  152. }
  153. .btn-confirm {
  154. width: 100%;
  155. height: 90rpx;
  156. background: #C1001C;
  157. color: #fff;
  158. border-radius: 45rpx;
  159. font-size: 32rpx;
  160. font-weight: bold;
  161. display: flex;
  162. align-items: center;
  163. justify-content: center;
  164. }
  165. </style>