爱简收旧衣按件回收前端代码仓库
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.

280 lines
5.7 KiB

3 months ago
2 weeks ago
3 months ago
2 weeks ago
3 months ago
2 weeks ago
3 months ago
2 weeks ago
3 months ago
2 months ago
3 months ago
2 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 weeks ago
3 months ago
2 weeks ago
3 months ago
2 weeks ago
3 months ago
2 weeks ago
3 months ago
2 weeks ago
3 months ago
2 weeks ago
3 months ago
2 weeks ago
3 months ago
2 weeks ago
3 months ago
2 weeks ago
3 months ago
2 weeks ago
3 months ago
  1. <template>
  2. <view class="login">
  3. <view class="header">
  4. <image :src='logoImage' mode="aspectFit" class="logo-img"></image>
  5. <view class="app-title">
  6. {{logoName}}
  7. </view>
  8. <view class="subtitle">
  9. 申请获取你的头像昵称
  10. </view>
  11. </view>
  12. <view class="form-container">
  13. <button class="avatar-section" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
  14. <view class="avatar-label">头像</view>
  15. <view class="avatar-container">
  16. <image :src="userInfo.avatarUrl" v-if="userInfo.avatarUrl" class="avatar-img" mode="aspectFill"></image>
  17. <view v-else class="avatar-placeholder">
  18. <image src="/static/暂未登录 请先登录.png" class="placeholder-img" mode="aspectFit"></image>
  19. <text class="placeholder-text">点击选择头像</text>
  20. </view>
  21. </view>
  22. </button>
  23. <view class="nickname-section">
  24. <view class="nickname-label">昵称</view>
  25. <view class="nickname-input-container">
  26. <input type="nickname" placeholder="请输入昵称" class="nickname-input" id="nickName"
  27. v-model="userInfo.nickName" />
  28. </view>
  29. </view>
  30. </view>
  31. <view class="submit-btn" @click="submit">
  32. 确认
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. userInfo: {
  41. avatarUrl: '',
  42. nickName: '',
  43. },
  44. configData: [],
  45. };
  46. },
  47. onShow() { },
  48. computed: {
  49. logoImage() {
  50. console.log(getApp().globalData.configData,'getApp().globalData.configData')
  51. const item = getApp().globalData.configData.find(i => i.keyName === 'logo_image')
  52. return item ? item.keyContent : ''
  53. },
  54. logoName() {
  55. const item = getApp().globalData.configData.find(i => i.keyName === 'logo_name')
  56. return item ? item.keyContent : ''
  57. }
  58. },
  59. methods: {
  60. onChooseAvatar(res) {
  61. let self = this
  62. self.$Oss.ossUpload(res.target.avatarUrl)
  63. .then(url => {
  64. console.log(url);
  65. self.userInfo.avatarUrl = url
  66. })
  67. },
  68. submit() {
  69. let self = this
  70. console.log(self.userInfo.avatarUrl, '111');
  71. uni.createSelectorQuery().in(this)
  72. .select("#nickName")
  73. .fields({
  74. properties: ["value"],
  75. })
  76. .exec((res) => {
  77. const nickName = res?.[0]?.value
  78. self.userInfo.nickName = nickName
  79. if (getApp().globalData.phone) {
  80. self.userInfo.phone = getApp().globalData.phone
  81. }
  82. if (self.$utils.verificationAll(self.userInfo, {
  83. avatarUrl: '请选择头像',
  84. nickName: '请填写昵称',
  85. })) {
  86. return
  87. }
  88. if (uni.getStorageSync('shareId')) {
  89. self.userInfo.shareId = uni.getStorageSync('shareId')
  90. }
  91. self.$api('updateInfo', self.userInfo, res => {
  92. console.log(res, self.userInfo);
  93. if (res.code == 200) {
  94. uni.switchTab({
  95. url: '/pages/component/home'
  96. })
  97. }
  98. })
  99. })
  100. },
  101. }
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. .login {
  106. min-height: 100vh;
  107. background: linear-gradient(180deg, #fff7e6 0%, #fff 40%);
  108. display: flex;
  109. flex-direction: column;
  110. align-items: center;
  111. padding: 0 48rpx;
  112. box-sizing: border-box;
  113. }
  114. .header {
  115. display: flex;
  116. flex-direction: column;
  117. align-items: center;
  118. margin-top: 120rpx;
  119. margin-bottom: 80rpx;
  120. .logo-img {
  121. width: 160rpx;
  122. height: 160rpx;
  123. border-radius: 32rpx;
  124. margin-bottom: 32rpx;
  125. box-shadow: 0 8rpx 24rpx rgba(255, 156, 0, 0.15);
  126. }
  127. .app-title {
  128. font-size: 48rpx;
  129. font-weight: bold;
  130. color: #222;
  131. margin-bottom: 16rpx;
  132. }
  133. .subtitle {
  134. font-size: 28rpx;
  135. color: #666;
  136. line-height: 1.4;
  137. }
  138. }
  139. .form-container {
  140. width: 100%;
  141. max-width: 600rpx;
  142. margin-bottom: 80rpx;
  143. }
  144. .avatar-section {
  145. width: 100%;
  146. background: #fff;
  147. border-radius: 24rpx;
  148. padding: 48rpx 36rpx;
  149. margin-bottom: 32rpx;
  150. border: none;
  151. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
  152. display: flex;
  153. flex-direction: column;
  154. align-items: center;
  155. gap: 32rpx;
  156. &::after {
  157. border: none;
  158. }
  159. .avatar-label {
  160. font-size: 32rpx;
  161. font-weight: 500;
  162. color: #333;
  163. }
  164. .avatar-container {
  165. position: relative;
  166. width: 200rpx;
  167. height: 200rpx;
  168. }
  169. .avatar-img {
  170. width: 100%;
  171. height: 100%;
  172. border-radius: 50%;
  173. border: 4rpx solid #fff;
  174. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1);
  175. }
  176. .avatar-placeholder {
  177. width: 100%;
  178. height: 100%;
  179. border-radius: 50%;
  180. border: 4rpx dashed #ddd;
  181. display: flex;
  182. flex-direction: column;
  183. align-items: center;
  184. justify-content: center;
  185. background: #f8f8f8;
  186. gap: 16rpx;
  187. .placeholder-img {
  188. width: 80rpx;
  189. height: 80rpx;
  190. opacity: 0.6;
  191. }
  192. .placeholder-text {
  193. font-size: 24rpx;
  194. color: #999;
  195. }
  196. }
  197. }
  198. .nickname-section {
  199. background: #fff;
  200. border-radius: 24rpx;
  201. padding: 48rpx 36rpx;
  202. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
  203. .nickname-label {
  204. font-size: 32rpx;
  205. font-weight: 500;
  206. color: #333;
  207. margin-bottom: 32rpx;
  208. text-align: center;
  209. }
  210. .nickname-input-container {
  211. position: relative;
  212. }
  213. .nickname-input {
  214. width: 100%;
  215. height: 88rpx;
  216. background: #f8f8f8;
  217. border-radius: 16rpx;
  218. padding: 0 24rpx;
  219. font-size: 32rpx;
  220. color: #333;
  221. border: 2rpx solid transparent;
  222. box-sizing: border-box;
  223. transition: all 0.3s;
  224. &:focus {
  225. border-color: #ffb400;
  226. background: #fff;
  227. outline: none;
  228. }
  229. &::placeholder {
  230. color: #bbb;
  231. font-size: 28rpx;
  232. }
  233. }
  234. }
  235. .submit-btn {
  236. width: 100%;
  237. max-width: 600rpx;
  238. height: 96rpx;
  239. background: linear-gradient(90deg, #ffd01e 0%, #ff8917 100%);
  240. color: #fff;
  241. font-size: 36rpx;
  242. font-weight: bold;
  243. text-align: center;
  244. line-height: 96rpx;
  245. border-radius: 48rpx;
  246. box-shadow: 0 8rpx 24rpx rgba(255, 156, 0, 0.3);
  247. transition: all 0.3s;
  248. &:active {
  249. transform: translateY(2rpx);
  250. box-shadow: 0 4rpx 12rpx rgba(255, 156, 0, 0.3);
  251. }
  252. }
  253. </style>