updateNickName.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <view class="container">
  3. <view class="wrapper">
  4. <view class="input-content">
  5. <view class="cu-form-group" style="border: 2upx solid whitesmoke;margin-bottom: 20px;border-radius: 30px">
  6. <text class="title">原昵称</text>
  7. <input type="text" :value="oldnickName" placeholder-class="input-empty" disabled="true" />
  8. </view>
  9. <view class="cu-form-group" style="border: 2upx solid whitesmoke;margin-bottom: 20px;border-radius: 30px">
  10. <text class="title">新昵称</text>
  11. <input type="nickname" v-model="nickName" placeholder="请设置新昵称" placeholder-class="input-empty" maxlength="20"
  12. minlength="6" />
  13. </view>
  14. </view>
  15. <button class="confirm-btn" @click="updatNickName">修改昵称</button>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. nickName: '',
  24. oldnickName: ''
  25. }
  26. },
  27. onLoad() {
  28. this.oldnickName = this.$queue.getData('userName');
  29. },
  30. methods: {
  31. updatNickName() {
  32. var patrn = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、 ]/im;
  33. if (patrn.test(this.nickName)) { // 如果包含特殊字符返回false
  34. this.$queue.showToast('包含特殊字符,请重新输入');
  35. return;
  36. }
  37. uni.showLoading({
  38. title: '提交中...'
  39. });
  40. let userId = this.$queue.getData('userId');
  41. let data = {
  42. userName:this.nickName
  43. }
  44. this.$Request.postT('/app/user/updateUserName',data).then(res => {
  45. uni.hideLoading();
  46. if (res.code === 0) {
  47. this.$queue.showToast("更新成功");
  48. setTimeout(() => {
  49. uni.navigateBack();
  50. }, 500);
  51. }
  52. });
  53. },
  54. },
  55. }
  56. </script>
  57. <style lang='scss'>
  58. page {
  59. background: #fff;
  60. }
  61. .send-msg {
  62. border-radius: 30px;
  63. color: white;
  64. height: 30px;
  65. font-size: 14px;
  66. line-height: 30px;
  67. background: #e10a07;
  68. }
  69. .container {
  70. padding-top: 32upx;
  71. position: relative;
  72. width: 100%;
  73. height: 100%;
  74. overflow: hidden;
  75. background: #fff;
  76. }
  77. .wrapper {
  78. position: relative;
  79. z-index: 90;
  80. background: #fff;
  81. padding-bottom: 20px;
  82. }
  83. .right-top-sign {
  84. position: absolute;
  85. top: 40px;
  86. right: -15px;
  87. z-index: 95;
  88. &:before,
  89. &:after {
  90. display: block;
  91. content: "";
  92. width: 20px;
  93. height: 40px;
  94. background: -moz-linear-gradient(left, #fa4dbe 0, #fbaa58 100%);
  95. background: -webkit-gradient(linear,
  96. left top,
  97. left right,
  98. color-stop(0, #fa4dbe),
  99. color-stop(100%, #fbaa58));
  100. background: -webkit-linear-gradient(left, #fa4dbe 0, #fbaa58 100%);
  101. background: -o-linear-gradient(left, #fa4dbe 0, #fbaa58 100%);
  102. background: -ms-linear-gradient(left, #fa4dbe 0, #fbaa58 100%);
  103. background: linear-gradient(to left, #fa4dbe 0, #fbaa58 100%);
  104. }
  105. &:before {
  106. transform: rotate(50deg);
  107. border-radius: 0 50px 0 0;
  108. }
  109. &:after {
  110. position: absolute;
  111. right: -198px;
  112. top: 0;
  113. transform: rotate(-50deg);
  114. border-radius: 50px 0 0 0;
  115. /* background: pink; */
  116. }
  117. }
  118. .left-bottom-sign {
  119. position: absolute;
  120. left: -270px;
  121. bottom: -320px;
  122. /*border: 100upx solid #d0d1fd;*/
  123. border-radius: 50%;
  124. padding: 90px;
  125. }
  126. .welcome {
  127. position: relative;
  128. left: 30px;
  129. top: -55px;
  130. font-size: 28px;
  131. color: #555;
  132. text-shadow: 1px 0px 1px rgba(0, 0, 0, .3);
  133. }
  134. .input-content {
  135. padding: 0 20px;
  136. }
  137. .confirm-btn {
  138. width: 300px;
  139. height: 42px;
  140. line-height: 42px;
  141. border-radius: 30px;
  142. margin-top: 40px;
  143. background: #FFAF5E;
  144. color: #fff;
  145. &:after {
  146. border-radius: 60px;
  147. }
  148. }
  149. .confirm-btn1 {
  150. width: 300px;
  151. height: 42px;
  152. line-height: 42px;
  153. border-radius: 30px;
  154. margin-top: 40px;
  155. background: whitesmoke;
  156. color: grey;
  157. &:after {
  158. border-radius: 60px;
  159. }
  160. }
  161. .forget-section {
  162. text-align: center;
  163. margin-top: 40px;
  164. }
  165. .register-section {
  166. position: fixed;
  167. left: 0;
  168. bottom: 30px;
  169. width: 100%;
  170. text-align: center;
  171. text {
  172. margin-left: 10px;
  173. }
  174. }
  175. </style>