cname.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <view :class="[AppTheme]" class="cname">
  3. <view class="content">
  4. <input type="text" placeholder="请输入您要更改的昵称" class="ipt" v-model="nicheng" />
  5. <button class="add-btn bg-linear-gradient" @click="goSave">提交</button>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. import mineApi from '@/api/mine/index.js';
  11. export default {
  12. data() {
  13. return {
  14. primary:this.$theme.primary,
  15. nicheng: '',
  16. sex: '',
  17. settingFile:getApp().globalData.siteinfo
  18. };
  19. },
  20. methods: {
  21. goSave: function() {
  22. let data = {
  23. nickname:encodeURI(this.nicheng),
  24. sex: 1
  25. };
  26. mineApi.myinfo(data).then(ret => {
  27. if (ret.status == 200) {
  28. this.$u.toast(ret.msg);
  29. uni.setStorageSync('nickname', this.nicheng);
  30. setTimeout(() => {
  31. uni.redirectTo({
  32. url: '/pagesD/pages/set/set?name' + this.nicheng
  33. });
  34. }, 1000);
  35. } else if (ret.status == 401) {
  36. this.$u.toast('登陆失效请重新登陆');
  37. setTimeout(function() {
  38. uni.redirectTo({
  39. url: '/pagesD/pages/set/set'
  40. });
  41. }, 2000);
  42. } else if (ret.status === 0) {
  43. this.$u.toast(ret.msg);
  44. }
  45. });
  46. }
  47. }
  48. };
  49. </script>
  50. <style lang="scss">
  51. page {
  52. width: 100%;
  53. height: 100%;
  54. background: #f1f1f1;
  55. }
  56. .set-btn {
  57. margin: 50rpx auto;
  58. width: 582rpx;
  59. height: 90rpx;
  60. border-radius: 45rpx;
  61. background-color: #0e7aff;
  62. font-size: 31rpx;
  63. color: white;
  64. font-weight: 600;
  65. display: flex;
  66. align-items: center;
  67. justify-content: center;
  68. }
  69. .cname {
  70. width: 100%;
  71. height: 100%;
  72. }
  73. .content {
  74. width: 100%;
  75. margin-top: 30rpx;
  76. height: 84rpx;
  77. background-color: #ffffff;
  78. }
  79. .content .ipt {
  80. padding-left: 20rpx;
  81. width: 100%;
  82. height: 100%;
  83. font-size: 28rpx;
  84. display: flex;
  85. align-items: center;
  86. font-family: PingFang SC;
  87. font-weight: 500;
  88. color: #666666;
  89. }
  90. .aui-bar-nav .aui-btn.aui-btn-outlined {
  91. border-width: 0;
  92. }
  93. .add-btn {
  94. display: flex;
  95. align-items: center;
  96. justify-content: center;
  97. width: 690upx;
  98. height: 80upx;
  99. margin: 60upx auto;
  100. font-size: $font-lg;
  101. color: #fff;
  102. border-radius: 10upx;
  103. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  104. }
  105. </style>