LoginRequiredState.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view class="empty-state">
  3. <view class="empty-icon">
  4. <text class="empty-icon-text">!</text>
  5. </view>
  6. <text class="empty-title">{{ title }}</text>
  7. <text class="empty-desc">{{ description }}</text>
  8. <button class="login-btn" hover-class="login-btn-hover" @tap="handleGoLogin">
  9. {{ buttonText }}
  10. </button>
  11. </view>
  12. </template>
  13. <script setup lang="ts">
  14. interface Props {
  15. title?: string
  16. description?: string
  17. buttonText?: string
  18. loginUrl?: string
  19. enableRedirect?: boolean
  20. }
  21. const props = withDefaults(defineProps<Props>(), {
  22. title: '暂无内容',
  23. description: '登录后可查看学术信息和产品相册',
  24. buttonText: '去登录',
  25. loginUrl: '/pages/login/index',
  26. enableRedirect: true,
  27. })
  28. const handleGoLogin = (): void => {
  29. uni.navigateTo({
  30. url: props.loginUrl,
  31. })
  32. }
  33. </script>
  34. <style scoped lang="scss">
  35. .empty-state {
  36. min-height: calc(100vh - 88rpx);
  37. box-sizing: border-box;
  38. padding: 180rpx 48rpx 0;
  39. display: flex;
  40. align-items: center;
  41. flex-direction: column;
  42. background: #fff;
  43. }
  44. .empty-icon {
  45. width: 128rpx;
  46. height: 128rpx;
  47. display: flex;
  48. align-items: center;
  49. justify-content: center;
  50. border-radius: 50%;
  51. background: #f2f8ff;
  52. }
  53. .empty-icon-text {
  54. font-size: 72rpx;
  55. font-weight: 700;
  56. color: #40a9ff;
  57. }
  58. .empty-title {
  59. margin-top: 36rpx;
  60. font-size: 32rpx;
  61. font-weight: 600;
  62. color: #333;
  63. }
  64. .empty-desc {
  65. margin-top: 16rpx;
  66. font-size: 26rpx;
  67. line-height: 38rpx;
  68. color: #999;
  69. text-align: center;
  70. }
  71. .login-btn {
  72. width: 320rpx;
  73. height: 80rpx;
  74. margin-top: 48rpx;
  75. display: flex;
  76. align-items: center;
  77. justify-content: center;
  78. border-radius: 999rpx;
  79. border: none;
  80. background: #40a9ff;
  81. color: #fff;
  82. font-size: 30rpx;
  83. line-height: 80rpx;
  84. }
  85. .login-btn::after {
  86. border: none;
  87. }
  88. .login-btn-hover {
  89. opacity: 0.85;
  90. }
  91. </style>