YTRouter.ets 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import { DelPhotoParam } from '../models'
  2. export class YTRouter extends NavPathStack {
  3. private static declare instance: YTRouter
  4. private constructor() {
  5. super()
  6. }
  7. static getInstance() {
  8. if (!YTRouter.instance) {
  9. YTRouter.instance = new YTRouter()
  10. }
  11. return YTRouter.instance
  12. }
  13. router2SettingPage() {
  14. yTRouter.pushPathByName('SettingPage', '')
  15. }
  16. router2SuggestionPage() {
  17. yTRouter.pushPathByName('SuggestionPage', '')
  18. }
  19. router2AgreementPage(param: '关于我们' | '隐私政策' | '用户协议') {
  20. yTRouter.pushPathByName('AgreementPage', param)
  21. }
  22. /**
  23. * 跳转至用户协议
  24. */
  25. router2userAgreement() {
  26. yTRouter.pushPathByName('UserAgreementPage', '')
  27. }
  28. /**
  29. * 跳转至隐私政策
  30. */
  31. router2Privacy() {
  32. yTRouter.pushPathByName('Privacy', '')
  33. }
  34. router2AboutUS() {
  35. yTRouter.pushPathByName('AboutUS', '')
  36. }
  37. getAgreementPageParam() {
  38. return yTRouter.getParamByName('AgreementPage').pop() as '关于我们' | '隐私政策' | '用户协议'
  39. }
  40. router2LoginPage() {
  41. yTRouter.pushPathByName('LoginPage', '')
  42. }
  43. router2DelPhotoPage(param: DelPhotoParam) {
  44. yTRouter.pushPathByName('DelPhotoPage', param)
  45. }
  46. getDelPhotoParam() {
  47. return yTRouter.getParamByName('DelPhotoPage').pop() as DelPhotoParam
  48. }
  49. routerBack() {
  50. yTRouter.pop()
  51. }
  52. }
  53. export const yTRouter = YTRouter.getInstance()