create-child.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. // onShow 可能重复触发,且与按钮的 redirectTo 叠加时会并发发起跳转,
  17. // 让框架对已销毁的 webview 调用 routeDone,报
  18. // "routeDone with a webviewId N is not found"。统一走一次性守卫。
  19. this.redirectOnce()
  20. },
  21. methods: {
  22. redirectOnce() {
  23. if (this._redirected) return
  24. this._redirected = true
  25. uni.redirectTo({ url: '/pages/profile-extra/family-members' })
  26. },
  27. goToFamilyMembers() {
  28. this.redirectOnce()
  29. }
  30. }
  31. }
  32. </script>
  33. <style scoped lang="scss">
  34. .redirect-container {
  35. display: flex;
  36. justify-content: center;
  37. align-items: center;
  38. min-height: 100vh;
  39. background: $facade-fill-2;
  40. padding: 40rpx;
  41. }
  42. .redirect-card {
  43. background: $app-surface;
  44. border-radius: 24rpx;
  45. padding: 60rpx 40rpx;
  46. text-align: center;
  47. width: 100%;
  48. }
  49. .redirect-icon {
  50. font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
  51. display: block;
  52. margin-bottom: 24rpx;
  53. }
  54. .redirect-title {
  55. font-size: calc(32rpx * var(--font-scale, 1));
  56. font-weight: bold;
  57. color: $facade-text-strong;
  58. display: block;
  59. margin-bottom: 16rpx;
  60. }
  61. .redirect-desc {
  62. font-size: calc(28rpx * var(--font-scale, 1));
  63. color: $facade-text-body;
  64. display: block;
  65. margin-bottom: 40rpx;
  66. }
  67. .redirect-btn {
  68. background: $wechat-green;
  69. color: $app-surface;
  70. border-radius: 24rpx;
  71. font-size: calc(30rpx * var(--font-scale, 1));
  72. padding: 20rpx 60rpx;
  73. }
  74. </style>