login.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <view class="login-page">
  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. export default {
  14. data() {
  15. return {
  16. _sheetOptions: {}
  17. }
  18. },
  19. onLoad(options) {
  20. this._sheetOptions = {
  21. inviteCode: (options && options.inviteCode) || '',
  22. inviteType: (options && options.inviteType) || '',
  23. refCode: (options && options.refCode) || '',
  24. redirect: (options && options.redirect) || ''
  25. }
  26. },
  27. mounted() {
  28. // 页面渲染完成后自动弹出浮层(子组件先于父组件 mounted,$refs 可用)
  29. if (this.$refs.loginSheet) {
  30. this.$refs.loginSheet.open(this._sheetOptions)
  31. }
  32. },
  33. onUnload() {
  34. // 清理 tap 锁兜底定时器,避免登录成功跳转后定时器仍在已销毁组件上置值(组件自身也会清理)
  35. if (this.$refs && this.$refs.loginSheet && this.$refs.loginSheet._tapLockTimer) {
  36. clearTimeout(this.$refs.loginSheet._tapLockTimer)
  37. this.$refs.loginSheet._tapLockTimer = null
  38. }
  39. }
  40. }
  41. </script>
  42. <style scoped>
  43. .login-page {
  44. min-height: 100vh;
  45. background: linear-gradient(180deg, #FFF9F0 0%, #FFEEDB 100%);
  46. }
  47. </style>