login.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <view class="login-page" :style="{ '--font-scale': fontScale }">
  3. <!--
  4. 兜底整页登录壳:全部登录逻辑已迁移至全局组件 login-sheet(components/login-sheet.vue)。
  5. 历史整页登录的 URL 参数(?inviteCode=&inviteType=&refCode=&redirect=)在 onLoad 透传给浮层。
  6. standalone 模式语义:登录成功(无跳转需求)/ 暂不登录 → 回首页,保持旧整页登录行为。
  7. 触发场景:登出流程的 reLaunch 到本页、或宿主页面未挂载浮层时的 openLoginSheet() 回退。
  8. -->
  9. <login-sheet ref="loginSheet" :standalone="true" />
  10. </view>
  11. </template>
  12. <script>
  13. import fontScaleMixin from '@/mixins/font-scale.js'
  14. export default {
  15. mixins: [fontScaleMixin],
  16. data() {
  17. return {
  18. _sheetOptions: {}
  19. }
  20. },
  21. onLoad(options) {
  22. this._sheetOptions = {
  23. inviteCode: (options && options.inviteCode) || '',
  24. inviteType: (options && options.inviteType) || '',
  25. refCode: (options && options.refCode) || '',
  26. redirect: (options && options.redirect) || ''
  27. }
  28. },
  29. mounted() {
  30. // 页面渲染完成后自动弹出浮层(子组件先于父组件 mounted,$refs 可用)
  31. if (this.$refs.loginSheet) {
  32. this.$refs.loginSheet.open(this._sheetOptions)
  33. }
  34. },
  35. onUnload() {
  36. // 清理 tap 锁兜底定时器,避免登录成功跳转后定时器仍在已销毁组件上置值(组件自身也会清理)
  37. if (this.$refs && this.$refs.loginSheet && this.$refs.loginSheet._tapLockTimer) {
  38. clearTimeout(this.$refs.loginSheet._tapLockTimer)
  39. this.$refs.loginSheet._tapLockTimer = null
  40. }
  41. }
  42. }
  43. </script>
  44. <style scoped lang="scss">
  45. .login-page {
  46. min-height: 100vh;
  47. background: linear-gradient(180deg, $flat-bg 0%, #FFEEDB 100%);
  48. }
  49. </style>