updateNickName.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. mask: true, // 是否显示透明蒙层,防止触摸穿透
  40. });
  41. let userId = this.$queue.getData('userId');
  42. let data = {
  43. userName:this.nickName
  44. }
  45. this.$Request.postT('/app/user/updateUserName',data).then(res => {
  46. uni.hideLoading();
  47. if (res.code === 0) {
  48. this.$queue.showToast("更新成功");
  49. setTimeout(() => {
  50. uni.navigateBack();
  51. }, 500);
  52. }
  53. });
  54. },
  55. },
  56. }
  57. </script>
  58. <style lang='scss'>
  59. page {
  60. background: #fff;
  61. }
  62. .send-msg {
  63. border-radius: 30px;
  64. color: white;
  65. height: 30px;
  66. font-size: 14px;
  67. line-height: 30px;
  68. background: #e10a07;
  69. }
  70. .container {
  71. padding-top: 32upx;
  72. position: relative;
  73. width: 100%;
  74. height: 100%;
  75. overflow: hidden;
  76. background: #fff;
  77. }
  78. .wrapper {
  79. position: relative;
  80. z-index: 90;
  81. background: #fff;
  82. padding-bottom: 20px;
  83. }
  84. .right-top-sign {
  85. position: absolute;
  86. top: 40px;
  87. right: -15px;
  88. z-index: 95;
  89. &:before,
  90. &:after {
  91. display: block;
  92. content: "";
  93. width: 20px;
  94. height: 40px;
  95. background: -moz-linear-gradient(left, #fa4dbe 0, #fbaa58 100%);
  96. background: -webkit-gradient(linear,
  97. left top,
  98. left right,
  99. color-stop(0, #fa4dbe),
  100. color-stop(100%, #fbaa58));
  101. background: -webkit-linear-gradient(left, #fa4dbe 0, #fbaa58 100%);
  102. background: -o-linear-gradient(left, #fa4dbe 0, #fbaa58 100%);
  103. background: -ms-linear-gradient(left, #fa4dbe 0, #fbaa58 100%);
  104. background: linear-gradient(to left, #fa4dbe 0, #fbaa58 100%);
  105. }
  106. &:before {
  107. transform: rotate(50deg);
  108. border-radius: 0 50px 0 0;
  109. }
  110. &:after {
  111. position: absolute;
  112. right: -198px;
  113. top: 0;
  114. transform: rotate(-50deg);
  115. border-radius: 50px 0 0 0;
  116. /* background: pink; */
  117. }
  118. }
  119. .left-bottom-sign {
  120. position: absolute;
  121. left: -270px;
  122. bottom: -320px;
  123. /*border: 100upx solid #d0d1fd;*/
  124. border-radius: 50%;
  125. padding: 90px;
  126. }
  127. .welcome {
  128. position: relative;
  129. left: 30px;
  130. top: -55px;
  131. font-size: 28px;
  132. color: #555;
  133. text-shadow: 1px 0px 1px rgba(0, 0, 0, .3);
  134. }
  135. .input-content {
  136. padding: 0 20px;
  137. }
  138. .confirm-btn {
  139. width: 300px;
  140. height: 42px;
  141. line-height: 42px;
  142. border-radius: 30px;
  143. margin-top: 40px;
  144. background: #FFAF5E;
  145. color: #fff;
  146. &:after {
  147. border-radius: 60px;
  148. }
  149. }
  150. .confirm-btn1 {
  151. width: 300px;
  152. height: 42px;
  153. line-height: 42px;
  154. border-radius: 30px;
  155. margin-top: 40px;
  156. background: whitesmoke;
  157. color: grey;
  158. &:after {
  159. border-radius: 60px;
  160. }
  161. }
  162. .forget-section {
  163. text-align: center;
  164. margin-top: 40px;
  165. }
  166. .register-section {
  167. position: fixed;
  168. left: 0;
  169. bottom: 30px;
  170. width: 100%;
  171. text-align: center;
  172. text {
  173. margin-left: 10px;
  174. }
  175. }
  176. </style>