index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <view class="container">
  3. <view v-if="!isLoggedIn" class="login-prompt">
  4. <view class="prompt-icon">👤</view>
  5. <text class="prompt-title">登录浠艾福</text>
  6. <text class="prompt-desc">登录后可查看个人资料</text>
  7. <button class="login-btn" @click="goLogin">登录 / 注册</button>
  8. </view>
  9. <template v-else>
  10. <PageBanner theme="wealth" tagline="个人中心" quote="" />
  11. <ProfileHeader @avatar-click="goToEditInfo" />
  12. <ProfileMenu :role="role" @invite-generate="onInviteGenerate" />
  13. </template>
  14. </view>
  15. </template>
  16. <script>
  17. import PageBanner from '../../components/PageBanner.vue'
  18. import ProfileHeader from './components/ProfileHeader.vue'
  19. import ProfileMenu from './components/ProfileMenu.vue'
  20. export default {
  21. components: {
  22. PageBanner,
  23. ProfileHeader,
  24. ProfileMenu
  25. },
  26. data() {
  27. return {
  28. shareData: null
  29. }
  30. },
  31. computed: {
  32. isLoggedIn() {
  33. return !!uni.getStorageSync('token')
  34. },
  35. role() {
  36. return uni.getStorageSync('currentRole') || uni.getStorageSync('role') || 'parent'
  37. }
  38. },
  39. onShareAppMessage() {
  40. if (this.shareData) {
  41. return {
  42. title: this.shareData.title,
  43. path: this.shareData.path,
  44. imageUrl: '/static/invite-card.png'
  45. }
  46. }
  47. },
  48. methods: {
  49. goLogin() {
  50. uni.navigateTo({
  51. url: '/pages/login/login'
  52. })
  53. },
  54. goToEditInfo() {
  55. uni.navigateTo({
  56. url: '/pages/user-edit/user-edit'
  57. })
  58. },
  59. onInviteGenerate(data) {
  60. this.shareData = data
  61. uni.showToast({
  62. title: '点击右上角转发给TA',
  63. icon: 'none'
  64. })
  65. }
  66. }
  67. }
  68. </script>
  69. <style scoped>
  70. .container {
  71. min-height: 100vh;
  72. background: #f5f7fa;
  73. padding-bottom: 120rpx;
  74. }
  75. .login-prompt {
  76. display: flex;
  77. flex-direction: column;
  78. align-items: center;
  79. justify-content: center;
  80. min-height: 80vh;
  81. padding: 60rpx;
  82. }
  83. .prompt-icon {
  84. font-size: 120rpx;
  85. margin-bottom: 30rpx;
  86. width: 160rpx;
  87. height: 160rpx;
  88. line-height: 160rpx;
  89. text-align: center;
  90. background: #f5f5f5;
  91. border-radius: 50%;
  92. }
  93. .prompt-title {
  94. font-size: 36rpx;
  95. font-weight: bold;
  96. color: #333;
  97. margin-bottom: 16rpx;
  98. }
  99. .prompt-desc {
  100. font-size: 26rpx;
  101. color: #999;
  102. text-align: center;
  103. margin-bottom: 40rpx;
  104. }
  105. .login-prompt .login-btn {
  106. width: 60%;
  107. height: 80rpx;
  108. line-height: 80rpx;
  109. background: linear-gradient(135deg, #5B9BD5, #3A7CC4);
  110. color: #fff;
  111. font-size: 30rpx;
  112. font-weight: bold;
  113. border-radius: 40rpx;
  114. text-align: center;
  115. border: none;
  116. }
  117. .login-prompt .login-btn::after {
  118. border: none;
  119. }
  120. </style>