酒店桌布为微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

132 lines
2.5 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <template>
  2. <view class="login">
  3. <view class="title">
  4. 布周到
  5. </view>
  6. <view class="title">
  7. 申请获取你的头像昵称
  8. </view>
  9. <button class="chooseAvatar" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
  10. <view class="line">
  11. <view class="">
  12. 头像
  13. </view>
  14. <view class="">
  15. <image :src="userInfo.headImage" v-if="userInfo.headImage" style="width: 60rpx;height: 60rpx;"
  16. mode=""></image>
  17. <image src="../static/auth/headImage.png" v-else style="width: 50rpx;height: 50rpx;" mode=""></image>
  18. </view>
  19. </view>
  20. </button>
  21. <view class="line">
  22. <view class="">
  23. 昵称
  24. </view>
  25. <view class="">
  26. <input type="nickname" placeholder="请输入昵称" style="text-align: right;" id="nickName"
  27. v-model="userInfo.nickName" />
  28. </view>
  29. </view>
  30. <view class="btn" @click="submit">
  31. 确认
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. userInfo: {
  40. headImage: '',
  41. nickName: '',
  42. }
  43. };
  44. },
  45. onShow() {},
  46. computed: {},
  47. methods: {
  48. onChooseAvatar(res) {
  49. let self = this
  50. self.$Oss.ossUpload(res.target.avatarUrl)
  51. .then(url => {
  52. self.userInfo.headImage = url
  53. })
  54. },
  55. submit() {
  56. let self = this
  57. uni.createSelectorQuery().in(this)
  58. .select("#nickName")
  59. .fields({
  60. properties: ["value"],
  61. })
  62. .exec((res) => {
  63. const nickName = res?.[0]?.value
  64. self.userInfo.nickName = nickName
  65. if (self.$utils.verificationAll(self.userInfo, {
  66. headImage: '请选择头像',
  67. nickName: '请填写昵称',
  68. })) {
  69. return
  70. }
  71. self.$api('updateInfo', self.userInfo, res => {
  72. if (res.code == 200) {
  73. uni.redirectTo({
  74. url:'/pages/index/index'
  75. })
  76. }
  77. })
  78. })
  79. },
  80. }
  81. }
  82. </script>
  83. <style lang="scss" scoped>
  84. .login {
  85. display: flex;
  86. flex-direction: column;
  87. justify-content: center;
  88. align-items: center;
  89. height: 80vh;
  90. .title {
  91. line-height: 45rpx;
  92. font-weight: 900;
  93. }
  94. .line {
  95. display: flex;
  96. justify-content: space-between;
  97. align-items: center;
  98. width: 80%;
  99. border-bottom: 1px solid #00000023;
  100. padding: 30rpx 0;
  101. margin: 0 auto;
  102. }
  103. .chooseAvatar {
  104. width: 100%;
  105. padding: 0;
  106. margin: 0;
  107. margin-top: 10vh;
  108. border: none;
  109. }
  110. .btn {
  111. // background: $uni-linear-gradient-btn-color;
  112. background: $uni-color;
  113. color: #fff;
  114. width: 80%;
  115. padding: 20rpx 0;
  116. text-align: center;
  117. border-radius: 15rpx;
  118. margin-top: 10vh;
  119. }
  120. }
  121. </style>