userinfo.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view class="userinfo">
  3. <view class="user-head u-flex u-row-between">
  4. <text>头像</text>
  5. <image :src="userinfo.avatar" mode="aspectFill" @click="uploadimg"></image>
  6. </view>
  7. <view class="user-item" @click="tochangename">
  8. <view class="item-name">
  9. 昵称
  10. </view>
  11. <view class="item-input u-flex">
  12. <input type="text" placeholder="请输入昵称" :disabled="true" v-model="userinfo.name">
  13. </view>
  14. </view>
  15. <view class="user-item" @click="tochangename">
  16. <view class="item-name">
  17. 简介
  18. </view>
  19. <view class="item-input u-flex">
  20. <input type="text" placeholder="添加简介" :disabled="true" v-model="userinfo.name">
  21. </view>
  22. </view>
  23. <view style="height: 150rpx;"></view>
  24. <view class="safe-area-inset-bottom"></view>
  25. <view class="user-down">
  26. <view class="down-btn u-flex">
  27. <text @click="save">保存</text>
  28. </view>
  29. <view class="safe-area-inset-bottom"></view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. // import fuxing from "../common/fuxing.js"
  35. import {
  36. index
  37. } from "../units/inquire.js"
  38. export default {
  39. data() {
  40. return {
  41. userinfo: {},
  42. }
  43. },
  44. onLoad() {
  45. this.getuser()
  46. },
  47. methods: {
  48. save() {
  49. if (!this.userinfo.avatar) {
  50. this.$u.toast("请上传头像")
  51. return
  52. }
  53. if (!this.userinfo.name) {
  54. this.$u.toast("请输入昵称")
  55. return
  56. }
  57. if (!this.userinfo.sex) {
  58. this.$u.toast("请输入简介")
  59. return
  60. }
  61. uni.showLoading({
  62. mask: true,
  63. title: "请稍后"
  64. })
  65. // this.$u.post('/api/headhunter.user/profile', {
  66. // avatar: this.userinfo.avatar,
  67. // name: this.userinfo.name,
  68. // industry_first: this.userinfo.industry_first,
  69. // industry_id: this.userinfo.industry_id,
  70. // experience_id: this.userinfo.experience_id,
  71. // work_status: this.userinfo.work_status,
  72. // work_address: this.userinfo.work_address,
  73. // realname: this.userinfo.virtual_name,
  74. // }).then(res => {
  75. // if (res.code == 1) {
  76. // this.$u.toast("修改成功")
  77. // setTimeout(() => {
  78. // uni.navigateBack()
  79. // }, 800)
  80. // } else {
  81. // this.$u.toast(res.msg)
  82. // }
  83. // })
  84. },
  85. uploadimg() {
  86. uni.chooseImage({
  87. count: 1,
  88. success: (img) => {
  89. uni.showLoading({
  90. mask: true,
  91. title: "请稍后"
  92. })
  93. uni.uploadFile({
  94. url: this.$url + '/api/common/upload',
  95. filePath: img.tempFilePaths[0],
  96. name: 'file',
  97. success: (res) => {
  98. uni.hideLoading()
  99. if (JSON.parse(res.data).code == 1) {
  100. this.userinfo.avatar = JSON.parse(res.data).data.fullurl
  101. } else {
  102. this.$u.toast(JSON.parse(res.data).msg)
  103. }
  104. },
  105. fail: (e) => {
  106. console.log(e);
  107. }
  108. })
  109. }
  110. })
  111. },
  112. getuser() {
  113. index().then(res => {
  114. this.userinfo = res.data.group_info
  115. })
  116. },
  117. }
  118. }
  119. </script>
  120. <style lang="scss">
  121. .userinfo {
  122. padding: 0 32rpx;
  123. .user-down {
  124. position: fixed;
  125. bottom: 0;
  126. left: 0;
  127. z-index: 99;
  128. width: 750rpx;
  129. background-color: #fff;
  130. .down-btn {
  131. padding: 8rpx 32rpx;
  132. text {
  133. line-height: 88rpx;
  134. background: #0C66C2;
  135. border-radius: 12rpx;
  136. width: 100%;
  137. font-size: 32rpx;
  138. font-family: PingFangSC-Medium, PingFang SC;
  139. font-weight: 500;
  140. color: #FFFFFF;
  141. text-align: center;
  142. }
  143. }
  144. }
  145. .user-item {
  146. padding-top: 30rpx;
  147. border-bottom: 2rpx solid #F0F0F0;
  148. .item-input {
  149. height: 100rpx;
  150. input {
  151. height: 100rpx;
  152. flex: 1;
  153. }
  154. }
  155. .item-name {
  156. font-size: 26rpx;
  157. font-family: PingFangSC-Regular, PingFang SC;
  158. font-weight: 400;
  159. color: #888888;
  160. }
  161. }
  162. .user-head {
  163. padding: 32rpx 0;
  164. border-bottom: 2rpx solid #F0F0F0;
  165. text {
  166. font-size: 32rpx;
  167. font-family: PingFangSC-Regular, PingFang SC;
  168. font-weight: 400;
  169. color: #222222;
  170. }
  171. image {
  172. border-radius: 100%;
  173. width: 120rpx;
  174. height: 120rpx;
  175. }
  176. }
  177. }
  178. </style>