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

266 lines
5.1 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
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. <view v-else class="avatar" style="background-color: #C7C7C7; border-radius: 50%;">
  23. <uv-icon name="account-fill" color="#ffffff" size="70rpx"></uv-icon>
  24. </view>
  25. </button>
  26. </view>
  27. </view>
  28. <view class="form-item">
  29. <view class="label">
  30. 昵称
  31. </view>
  32. <view class="content">
  33. <input type="nickname" placeholder="请输入昵称" style="text-align: right;" id="nickName"
  34. placeholder-class="uni-placeholder"
  35. v-model="userInfoForm.nickName"
  36. />
  37. </view>
  38. </view>
  39. <view class="form-item">
  40. <view class="label">
  41. 手机号
  42. </view>
  43. <view class="content">
  44. <input v-if="userInfoForm.phone"
  45. placeholder-class="uni-placeholder"
  46. placeholder="请输入手机号"
  47. style="text-align: right;"
  48. disabled
  49. v-model="userInfoForm.phone"
  50. />
  51. <view v-else>
  52. <button
  53. :plain="true" :hairline="false"
  54. class="btn-phone"
  55. open-type="getPhoneNumber"
  56. @getphonenumber="getPhone"
  57. >
  58. 获取电话号码
  59. </button>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="btn" @click="submit">
  65. 确认
  66. </view>
  67. </view>
  68. </template>
  69. <script>
  70. export default {
  71. data() {
  72. return {
  73. userInfoForm: {
  74. headImage: '',
  75. nickName: '',
  76. }
  77. };
  78. },
  79. onShow() {},
  80. onLoad() {
  81. this.userInfoForm.nickName = this.userInfo.nickName || ''
  82. this.userInfoForm.headImage = this.userInfo.headImage || ''
  83. },
  84. computed: {},
  85. methods: {
  86. onChooseAvatar(res) {
  87. this.$Oss.ossUpload(res.target.avatarUrl)
  88. .then(url => {
  89. this.userInfoForm.headImage = url
  90. })
  91. },
  92. submit() {
  93. let self = this
  94. uni.createSelectorQuery().in(this)
  95. .select("#nickName")
  96. .fields({
  97. properties: ["value"],
  98. })
  99. .exec((res) => {
  100. const nickName = res?.[0]?.value
  101. self.userInfoForm.nickName = nickName
  102. if (self.$utils.verificationAll(self.userInfoForm, {
  103. headImage: '请选择头像',
  104. nickName: '请填写昵称',
  105. phone: '请填写手机号',
  106. })) {
  107. return
  108. }
  109. self.$api('updateInfo', {
  110. avatarUrl : self.userInfoForm.headImage,
  111. nickName : self.userInfoForm.nickName,
  112. }, res => {
  113. if (res.code == 200) {
  114. uni.reLaunch({
  115. url:'/pages/index/index'
  116. })
  117. }
  118. })
  119. })
  120. },
  121. }
  122. }
  123. </script>
  124. <style lang="scss" scoped>
  125. .login {
  126. display: flex;
  127. justify-content: flex-start;
  128. align-items: center;
  129. height: 100vh;
  130. flex-direction: column;
  131. position: relative;
  132. background: $uni-bg-color;
  133. .logo{
  134. margin-top: 334rpx;
  135. width: 320rpx;
  136. image{
  137. height: 150rpx;
  138. width: 320rpx;
  139. }
  140. .text{
  141. margin-top: 90rpx;
  142. font-size: 38rpx;
  143. font-family: PingFang SC, PingFang SC-Bold;
  144. font-weight: 700;
  145. text-align: center;
  146. color: #000000;
  147. }
  148. }
  149. .title {
  150. margin-top: 48rpx;
  151. font-size: 32rpx;
  152. font-family: PingFang SC, PingFang SC-Regular;
  153. font-weight: 400;
  154. color: #000000;
  155. }
  156. .form {
  157. margin-top: 45rpx;
  158. width: 100%;
  159. display: flex;
  160. flex-direction: column;
  161. align-items: center;
  162. .form-item {
  163. width: 85%;
  164. display: flex;
  165. align-items: baseline;
  166. padding: 11rpx 23rpx;
  167. position: relative;
  168. &::after {
  169. position: absolute;
  170. bottom: 0;
  171. left: 0;
  172. content: " ";
  173. width: 100%;
  174. height: 1rpx;
  175. border-top: 1px solid rgba(112, 112, 112, 0.35);
  176. transform: scaleY(.5);
  177. }
  178. .label {
  179. width: 90rpx;
  180. font-size: 30rpx;
  181. font-family: SimSun, SimSun-Regular;
  182. font-weight: 400;
  183. text-align: left;
  184. color: #000000;
  185. }
  186. .content {
  187. flex: 1;
  188. text-align: right;
  189. }
  190. }
  191. .form-item + .form-item {
  192. margin-top: 50rpx;
  193. }
  194. .btn-avatar {
  195. background: transparent;
  196. border: none;
  197. border-radius: none;
  198. box-shadow: none;
  199. padding: 0;
  200. margin: 0;
  201. font-size: 0;
  202. text-align: right;
  203. }
  204. .avatar {
  205. display: inline-block;
  206. width: 70rpx;
  207. height: 70rpx;
  208. margin-right: 63rpx;
  209. }
  210. .btn-phone {
  211. border: none;
  212. border-radius: 0;
  213. padding: 7rpx;
  214. margin: 0;
  215. text-align: right;
  216. color: #C7C7C7;
  217. font-size: 30rpx;
  218. line-height: 1;
  219. }
  220. }
  221. .btn {
  222. text-align: center;
  223. margin-top: 155rpx;
  224. width: 80%;
  225. height: 100rpx;
  226. border-radius: 50rpx;
  227. background-color: #B3997E;
  228. color: #fff;
  229. display: flex;
  230. justify-content: center;
  231. align-items: center;
  232. border-radius: 50rpx;
  233. border: none;
  234. }
  235. }
  236. </style>