children.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <view class="redirect-container" :style="{ '--font-scale': fontScale }">
  3. <view class="redirect-card">
  4. <text class="redirect-icon">👪</text>
  5. <text class="redirect-title">已将儿童管理整合到家庭成员</text>
  6. <text class="redirect-desc">成员信息请在「家庭成员」中添加和管理</text>
  7. <button class="redirect-btn" @click="goToFamilyMembers">前往家庭成员</button>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. import fontScaleMixin from '@/mixins/font-scale.js'
  13. export default {
  14. mixins: [fontScaleMixin],
  15. onShow() {
  16. // 自动跳转到家庭成员页面。
  17. // onShow 可能重复触发,且与按钮的 redirectTo 叠加时会并发发起跳转,
  18. // 让框架对已销毁的 webview 调用 routeDone,报
  19. // "routeDone with a webviewId N is not found"。统一走一次性守卫。
  20. this.redirectOnce()
  21. },
  22. methods: {
  23. redirectOnce() {
  24. if (this._redirected) return
  25. this._redirected = true
  26. uni.redirectTo({ url: '/pages/profile-extra/family-members' })
  27. },
  28. goToFamilyMembers() {
  29. this.redirectOnce()
  30. }
  31. }
  32. }
  33. </script>
  34. <style scoped lang="scss">
  35. .redirect-container {
  36. display: flex;
  37. justify-content: center;
  38. align-items: center;
  39. min-height: 100vh;
  40. background: $facade-fill-2;
  41. padding: 40rpx;
  42. }
  43. .redirect-card {
  44. background: $app-surface;
  45. border-radius: 24rpx;
  46. padding: 60rpx 40rpx;
  47. text-align: center;
  48. width: 100%;
  49. }
  50. .redirect-icon {
  51. font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
  52. display: block;
  53. margin-bottom: 24rpx;
  54. }
  55. .redirect-title {
  56. font-size: calc(32rpx * var(--font-scale, 1));
  57. font-weight: bold;
  58. color: $facade-text-strong;
  59. display: block;
  60. margin-bottom: 16rpx;
  61. }
  62. .redirect-desc {
  63. font-size: calc(28rpx * var(--font-scale, 1));
  64. color: $facade-text-body;
  65. display: block;
  66. margin-bottom: 40rpx;
  67. }
  68. .redirect-btn {
  69. background: $wechat-green;
  70. color: $app-surface;
  71. border-radius: 24rpx;
  72. font-size: calc(30rpx * var(--font-scale, 1));
  73. padding: 20rpx 60rpx;
  74. }
  75. </style>