user.wxml 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <view class="user-page">
  2. <scroll-view class="user-scroll" scroll-y show-scrollbar="{{false}}">
  3. <view class="user-content">
  4. <profile-header
  5. nickname="{{nickname}}"
  6. avatar="{{avatar}}"
  7. logged-in="{{loggedIn}}"
  8. logging-in="{{loggingIn}}"
  9. bind:login="onRequestLogin"
  10. bind:editprofile="onEditProfile"
  11. />
  12. <button wx:if="{{loggedIn}}" class="user-edit-profile" hover-class="user-action--pressed" disabled="{{profileSaving}}" bindtap="onEditProfile">修改信息</button>
  13. <view class="user-actions">
  14. <view class="user-action user-action--favorites" hover-class="user-action--pressed" aria-role="button" aria-label="查看收藏" bindtap="onViewFavorites">
  15. <view class="user-action__icon">
  16. <svg-icon name="ph:heart" size="34px" color="#a83f2d" />
  17. </view>
  18. <view class="user-action__content">
  19. <text class="user-action__title">查看收藏</text>
  20. </view>
  21. <svg-icon name="ph:caret-right-bold" size="16px" color="#a69687" />
  22. </view>
  23. <view class="user-action user-action--about" hover-class="user-action--pressed" aria-role="button" aria-label="关于我们" bindtap="onAbout">
  24. <view class="user-action__icon">
  25. <svg-icon name="ph:info" size="31px" color="#493b31" />
  26. </view>
  27. <text class="user-action__title user-action__content">关于我们</text>
  28. <svg-icon name="ph:caret-right-bold" size="16px" color="#a69687" />
  29. </view>
  30. </view>
  31. <button wx:if="{{loggedIn}}" class="user-logout" hover-class="user-action--pressed" bindtap="onLogout">退出登录</button>
  32. </view>
  33. </scroll-view>
  34. <van-popup show="{{profileEditorOpen}}" z-index="{{10000}}" round close-on-click-overlay="{{!profileSaving}}" bind:close="onCloseProfile" custom-style="background: #fffaf7; width: 86%; max-width: 420px;">
  35. <form wx:if="{{profileEditorOpen}}" bindsubmit="onSaveProfile">
  36. <!-- 原生 form 的内部容器不参与外层 flex,布局交给 view。 -->
  37. <view class="profile-editor">
  38. <text class="profile-editor__title">{{profileFirstTime ? '完善资料' : '修改资料'}}</text>
  39. <button class="profile-editor__avatar" open-type="chooseAvatar" bindchooseavatar="onChooseAvatar" disabled="{{profileSaving}}" aria-label="选择头像">
  40. <image wx:if="{{draftAvatar && !draftAvatarFailed}}" class="profile-editor__image" src="{{draftAvatar}}" mode="aspectFill" binderror="onDraftAvatarError" />
  41. <svg-icon wx:else name="ph:user-fill" size="50px" color="#c6b7a6" />
  42. </button>
  43. <text class="profile-editor__avatar-label">头像</text>
  44. <view class="profile-editor__field">
  45. <text class="profile-editor__label">昵称</text>
  46. <input class="profile-editor__input" name="nickname" type="nickname" value="{{draftNickname}}" placeholder="请输入或选择微信昵称" maxlength="32" disabled="{{profileSaving}}" bindinput="onNicknameInput" bindblur="onNicknameInput" bindnicknamereview="onNicknameReview" />
  47. </view>
  48. <view class="profile-editor__actions">
  49. <button class="profile-editor__button profile-editor__button--cancel" disabled="{{profileSaving}}" bindtap="onCloseProfile">{{profileFirstTime ? '暂时跳过' : '取消'}}</button>
  50. <button class="profile-editor__button profile-editor__button--save" form-type="submit" loading="{{profileSaving}}" disabled="{{profileSaving}}">{{profileSaving ? '保存中' : '保存资料'}}</button>
  51. </view>
  52. </view>
  53. </form>
  54. </van-popup>
  55. <van-toast id="van-toast" />
  56. <van-dialog id="van-dialog" confirm-button-color="#a83f2d" />
  57. </view>