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