推拿小程序前端代码仓库
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.

221 lines
4.2 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
  1. <template>
  2. <view class="login">
  3. <view class="logo">
  4. <!-- 后续改回接口获取 -->
  5. <image src="../static/auth/logo.png" mode=""></image>
  6. <view class="text">
  7. {{ configList.logo_name }}
  8. </view>
  9. </view>
  10. <view class="title">
  11. 申请获取你的头像昵称
  12. </view>
  13. <view class="form">
  14. <view class="form-item">
  15. <view class="label">
  16. 头像
  17. </view>
  18. <view class="content">
  19. <button class="btn-avatar" :plain="true" :hairline="false" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
  20. <image :src="userInfoForm.headImage" v-if="userInfoForm.headImage" class="avatar"
  21. mode=""></image>
  22. <image src="../static/auth/headImage.png" v-else class="avatar" mode=""></image>
  23. </button>
  24. </view>
  25. </view>
  26. <view class="form-item">
  27. <view class="label">
  28. 昵称
  29. </view>
  30. <view class="content">
  31. <input type="nickname" placeholder="请输入昵称" style="text-align: right;" id="nickName"
  32. v-model="userInfoForm.nickName" />
  33. </view>
  34. </view>
  35. </view>
  36. <view class="btn" @click="submit">
  37. 确认
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. userInfoForm: {
  46. headImage: '',
  47. nickName: '',
  48. }
  49. };
  50. },
  51. onShow() {},
  52. onLoad() {
  53. this.userInfoForm.nickName = this.userInfo.nickName || ''
  54. this.userInfoForm.headImage = this.userInfo.headImage || ''
  55. },
  56. computed: {},
  57. methods: {
  58. onChooseAvatar(res) {
  59. this.$Oss.ossUpload(res.target.avatarUrl)
  60. .then(url => {
  61. this.userInfoForm.headImage = url
  62. })
  63. },
  64. submit() {
  65. let self = this
  66. uni.createSelectorQuery().in(this)
  67. .select("#nickName")
  68. .fields({
  69. properties: ["value"],
  70. })
  71. .exec((res) => {
  72. const nickName = res?.[0]?.value
  73. self.userInfoForm.nickName = nickName
  74. if (self.$utils.verificationAll(self.userInfoForm, {
  75. headImage: '请选择头像',
  76. nickName: '请填写昵称',
  77. })) {
  78. return
  79. }
  80. self.$api('updateInfo', {
  81. avatarUrl : self.userInfoForm.headImage,
  82. nickName : self.userInfoForm.nickName,
  83. }, res => {
  84. if (res.code == 200) {
  85. uni.reLaunch({
  86. url:'/pages/index/index'
  87. })
  88. }
  89. })
  90. })
  91. },
  92. }
  93. }
  94. </script>
  95. <style lang="scss" scoped>
  96. .login {
  97. display: flex;
  98. justify-content: flex-start;
  99. align-items: center;
  100. height: 100vh;
  101. flex-direction: column;
  102. position: relative;
  103. background: $uni-bg-color;
  104. .logo{
  105. margin-top: 334rpx;
  106. width: 320rpx;
  107. image{
  108. height: 150rpx;
  109. width: 320rpx;
  110. }
  111. .text{
  112. margin-top: 90rpx;
  113. font-size: 38rpx;
  114. font-family: PingFang SC, PingFang SC-Bold;
  115. font-weight: 700;
  116. text-align: center;
  117. color: #000000;
  118. }
  119. }
  120. .title {
  121. margin-top: 48rpx;
  122. font-size: 32rpx;
  123. font-family: PingFang SC, PingFang SC-Regular;
  124. font-weight: 400;
  125. color: #000000;
  126. }
  127. .form {
  128. margin-top: 45rpx;
  129. width: 100%;
  130. display: flex;
  131. flex-direction: column;
  132. align-items: center;
  133. .form-item {
  134. width: 85%;
  135. display: flex;
  136. align-items: baseline;
  137. padding: 11rpx 23rpx;
  138. position: relative;
  139. &::after {
  140. position: absolute;
  141. bottom: 0;
  142. left: 0;
  143. content: " ";
  144. width: 100%;
  145. height: 1rpx;
  146. border-top: 1px solid rgba(112, 112, 112, 0.35);
  147. transform: scaleY(.5);
  148. }
  149. .label {
  150. width: 60rpx;
  151. font-size: 30rpx;
  152. font-family: SimSun, SimSun-Regular;
  153. font-weight: 400;
  154. text-align: left;
  155. color: #000000;
  156. }
  157. .content {
  158. flex: 1;
  159. text-align: right;
  160. }
  161. }
  162. .form-item + .form-item {
  163. margin-top: 50rpx;
  164. }
  165. .btn-avatar {
  166. background: transparent;
  167. border: none;
  168. border-radius: none;
  169. box-shadow: none;
  170. padding: 0;
  171. margin: 0;
  172. font-size: 0;
  173. text-align: right;
  174. }
  175. .avatar {
  176. width: 70rpx;
  177. height: 70rpx;
  178. margin-right: 63rpx;
  179. }
  180. }
  181. .btn {
  182. text-align: center;
  183. margin-top: 155rpx;
  184. width: 80%;
  185. height: 100rpx;
  186. border-radius: 50rpx;
  187. background-color: #B3997E;
  188. color: #fff;
  189. display: flex;
  190. justify-content: center;
  191. align-items: center;
  192. border-radius: 50rpx;
  193. border: none;
  194. }
  195. }
  196. </style>