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

141 lines
2.7 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 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. 答题小程序
  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. export default {
  41. data() {
  42. return {
  43. userInfo: {
  44. headImage: '',
  45. nickName: '',
  46. }
  47. };
  48. },
  49. onShow() {},
  50. computed: {},
  51. methods: {
  52. onChooseAvatar(res) {
  53. let self = this
  54. self.$Oss.ossUpload(res.target.avatarUrl)
  55. .then(url => {
  56. self.userInfo.headImage = url
  57. })
  58. },
  59. submit() {
  60. let self = this
  61. uni.createSelectorQuery().in(this)
  62. .select("#nickName")
  63. .fields({
  64. properties: ["value"],
  65. })
  66. .exec((res) => {
  67. const nickName = res?.[0]?.value
  68. self.userInfo.nickName = nickName
  69. // 此处是因为没有做配置所以需要注掉
  70. uni.navigateTo({
  71. url: 'wxLogin'
  72. })
  73. // if (self.$utils.verificationAll(self.userInfo, {
  74. // headImage: '请选择头像',
  75. // nickName: '请填写昵称',
  76. // })) {
  77. // return
  78. // }
  79. self.$api('infoUpdateInfo', self.userInfo, res => {
  80. if (res.code == 200) {
  81. uni.switchTab({
  82. url: '/pages/index/index'
  83. })
  84. }
  85. })
  86. })
  87. },
  88. }
  89. }
  90. </script>
  91. <style lang="scss" scoped>
  92. .login {
  93. display: flex;
  94. flex-direction: column;
  95. justify-content: center;
  96. align-items: center;
  97. height: 80vh;
  98. .line {
  99. display: flex;
  100. justify-content: space-between;
  101. align-items: center;
  102. width: 80%;
  103. border-bottom: 1px solid #00000023;
  104. padding: 30rpx 0;
  105. margin: 0 auto;
  106. }
  107. .chooseAvatar {
  108. width: 100%;
  109. padding: 0;
  110. margin: 0;
  111. margin-top: 10vh;
  112. }
  113. .btn {
  114. // background: $uni-linear-gradient-btn-color;
  115. background: $uni-color;
  116. color: #fff;
  117. width: 80%;
  118. padding: 20rpx 0;
  119. text-align: center;
  120. border-radius: 115rpx;
  121. margin-top: 10vh;
  122. }
  123. uni-button:after {
  124. content: "";
  125. border: none !important;
  126. outline: none !important;
  127. }
  128. }
  129. </style>