百富门答题小程序
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.

150 lines
2.8 KiB

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