personal.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view class="content">
  3. <form @submit="save">
  4. <view class="hg24px">
  5. </view>
  6. <view class="list ft28 box-pack-between bgf flex-y-center border-b">
  7. <text>注册手机号</text>
  8. <view class="ft30">
  9. {{my_uerInfo.tel}}
  10. </view>
  11. </view>
  12. <view class="hg24px">
  13. </view>
  14. <view @click="uploadFile" class="list ft28 box-pack-between bgf flex-y-center border-b">
  15. <text>我的头像</text>
  16. <image class="header" :src="my_uerInfo.logo?URL+''+my_uerInfo.logo:'../../static/images/my/header-title.png'" mode=""></image>
  17. </view>
  18. <view class="list ft28 box-pack-between bgf flex-y-center border-b">
  19. <text>我的名称</text>
  20. <input type="text" name='nick_name' :value="my_uerInfo.nick_name" placeholder-class="placeholder-class"
  21. placeholder="请输入名称" class="tr" />
  22. </view>
  23. <view class="hg100px">
  24. </view>
  25. <button class="login-btn flex-center" form-type="submit">保存</button>
  26. </form>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. my_uerInfo: {},
  34. URL: getApp().globalData.URL,
  35. islogo: false,
  36. }
  37. },
  38. onLoad(e) {
  39. uni.getStorage({
  40. key: 'my_uerInfo',
  41. success: (res) => {
  42. console.log(res, "res")
  43. this.my_uerInfo = res.data;
  44. },
  45. fail(res) {}
  46. });
  47. },
  48. onShareAppMessage(e) {
  49. },
  50. methods: {
  51. save(e) {
  52. this.request({
  53. url: "user/save_edit",
  54. data: {
  55. token: uni.getStorageSync("token"),
  56. face: this.my_uerInfo.logo,
  57. nick_name: e.detail.value.nick_name,
  58. },
  59. }).then(res => {
  60. console.log(res, "res")
  61. if (res.code === '200') {
  62. uni.showToast({
  63. title: "保存成功",
  64. icon: 'none'
  65. })
  66. setTimeout(()=>{
  67. uni.navigateBack({
  68. delta:1
  69. })
  70. },2e3)
  71. }
  72. }).catch((res)=>{
  73. uni.showToast({
  74. title: res.message,
  75. icon: 'none'
  76. })
  77. });
  78. },
  79. uploadFile(e) {
  80. uni.chooseImage({
  81. success: (res) => {
  82. res.tempFilePaths.forEach((v, i) => {
  83. this.Upload({
  84. url: "Spread/upload_img",
  85. data: {
  86. url: v,
  87. type: 0,
  88. token: uni.getStorageSync("token"),
  89. }
  90. }).then(res => {
  91. console.log(res, "res")
  92. this.my_uerInfo.logo = res.file;
  93. }).catch({
  94. });
  95. })
  96. }
  97. });
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="scss">
  103. .list {
  104. width: 100%;
  105. height: 100rpx;
  106. padding: 0 20rpx;
  107. }
  108. .list input {
  109. text-align: right;
  110. }
  111. .header {
  112. width: 70rpx;
  113. height: 70rpx;
  114. border-radius: 500px;
  115. }
  116. .login-btn {
  117. width: 630rpx;
  118. height: 90rpx;
  119. background: linear-gradient(132deg, rgb(64, 158, 255) 0%, rgb(64, 158, 255) 100%);
  120. box-shadow: 0px 2rpx 12rpx rgb(64, 158, 255);
  121. opacity: 1;
  122. border-radius: 45rpx;
  123. margin: 0 auto;
  124. color: #FFFFFF;
  125. font-size: 30rpx;
  126. font-family: Source Han Sans CN;
  127. font-weight: 500;
  128. opacity: 1;
  129. }
  130. .hg100px{
  131. height: 100px;
  132. }
  133. </style>