editinfo.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <view class="main">
  3. <view class="cu-list menu">
  4. <view class="cu-item arrow" @click="isShowConfirm=true">
  5. <view class="content">
  6. <text class="text-grey">昵称</text>
  7. </view>
  8. <view class="action">
  9. <text class="text-grey text-sm">{{newName}}</text>
  10. </view>
  11. </view>
  12. <view class="cu-item arrow" @click="gotophone">
  13. <view class="content">
  14. <text class="text-grey">已绑定电话</text>
  15. </view>
  16. <view class="action">
  17. <text class="text-grey text-sm"></text>
  18. </view>
  19. </view>
  20. <view class="cu-item arrow" @click="">
  21. <view class="content">
  22. <text class="text-grey">切换账号</text>
  23. </view>
  24. <view class="action">
  25. </view>
  26. </view>
  27. <view class="cu-item arrow" @click="gotopwd">
  28. <view class="content">
  29. <text class="text-grey">支付密码</text>
  30. </view>
  31. <view class="action">
  32. </view>
  33. </view>
  34. </view>
  35. <block v-if="isShowConfirm">
  36. <view class='toast-box'>
  37. <view class='toastbg' @click.stop="isShowConfirm=false"></view>
  38. <view class='showToast'>
  39. <view class='toast-title'>
  40. <text>修改昵称</text>
  41. </view>
  42. <view class='toast-main'>
  43. <view class='toast-input'>
  44. <input type='text' placeholder='输入昵称' v-model="newName" data-name='stuEidtName'></input>
  45. </view>
  46. </view>
  47. <view class='toast-button'>
  48. <view class='button2'>
  49. <button type="default" @click.stop="editName">保存</button>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </block>
  55. </view>
  56. </template>
  57. <script>
  58. export default {
  59. onLoad(options) {
  60. this.newName = options.name
  61. },
  62. mounted() {
  63. },
  64. data() {
  65. return {
  66. isShowConfirm: false,
  67. newName: ""
  68. }
  69. },
  70. methods: {
  71. editName: async function() {
  72. let res = await this.$request.post("/api/v1/user/updateUser", {
  73. nickname: this.newName
  74. })
  75. if (res.status == 0) {
  76. this.isShowConfirm = false
  77. uni.showToast({
  78. title:"修改成功",
  79. icon:"none"
  80. })
  81. }
  82. },
  83. gotophone(){
  84. uni.navigateTo({
  85. url:"editphone"
  86. })
  87. },
  88. gotopwd(){
  89. uni.navigateTo({
  90. url:"paypassword"
  91. })
  92. }
  93. }
  94. };
  95. </script>
  96. <style scoped lang="scss">
  97. .main {}
  98. .button2 button {
  99. width: 100%;
  100. font-size: 26rpx;
  101. height: 70rpx;
  102. color: #606266;
  103. background-color: #FFFFFF;
  104. border-radius: 0;
  105. border-top: 2rpx solid rgba(0, 0, 0, .2);
  106. }
  107. .button2 button::after {
  108. border: none;
  109. }
  110. .toast-box {
  111. width: 100%;
  112. height: 100%;
  113. opacity: 1;
  114. position: fixed;
  115. top: 0px;
  116. left: 0px;
  117. }
  118. .toastbg {
  119. opacity: 0.2;
  120. background-color: black;
  121. position: absolute;
  122. width: 100%;
  123. min-height: 100vh;
  124. }
  125. .showToast {
  126. position: absolute;
  127. opacity: 1;
  128. width: 70%;
  129. margin-left: 15%;
  130. margin-top: 40%;
  131. }
  132. .toast-title {
  133. padding-left: 5%;
  134. background-color: #2196f3;
  135. color: white;
  136. padding-top: 2vh;
  137. padding-bottom: 2vh;
  138. border-top-right-radius: 16rpx;
  139. border-top-left-radius: 16rpx;
  140. }
  141. .toast-main {
  142. padding-top: 2vh;
  143. padding-bottom: 2vh;
  144. background-color: white;
  145. text-align: center;
  146. }
  147. .toast-input {
  148. margin-left: 5%;
  149. margin-right: 5%;
  150. border: 1px solid #ddd;
  151. padding-left: 2vh;
  152. padding-right: 2vh;
  153. padding-top: 1vh;
  154. padding-bottom: 1vh;
  155. }
  156. </style>