YTRouter.ets 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import { IBestToast } from '@ibestservices/ibest-ui'
  2. import { DelPhotoParam } from '../models'
  3. import { DiaLogPageEnum, DiaLogParam, YTDiaLogModel } from '../models/YTDiaLogModel'
  4. class YTRouter extends NavPathStack {
  5. private static declare instance: YTRouter
  6. private constructor() {
  7. super()
  8. }
  9. static getInstance() {
  10. if (!YTRouter.instance) {
  11. YTRouter.instance = new YTRouter()
  12. }
  13. return YTRouter.instance
  14. }
  15. router2SettingPage() {
  16. yTRouter.pushPathByName('SettingPage', '')
  17. }
  18. router2SuggestionPage() {
  19. yTRouter.pushPathByName('SuggestionPage', '')
  20. }
  21. router2AgreementPage(param: '关于我们' | '隐私政策' | '用户协议') {
  22. yTRouter.pushPathByName('AgreementPage', param)
  23. }
  24. /**
  25. * 跳转至用户协议
  26. */
  27. router2userAgreement() {
  28. yTRouter.pushPathByName('UserAgreementPage', '')
  29. }
  30. /**
  31. * 跳转至隐私政策
  32. */
  33. router2Privacy() {
  34. yTRouter.pushPathByName('Privacy', '')
  35. }
  36. router2AboutUS() {
  37. yTRouter.pushPathByName('AboutUS', '')
  38. }
  39. getAgreementPageParam() {
  40. return yTRouter.getParamByName('AgreementPage').pop() as '关于我们' | '隐私政策' | '用户协议'
  41. }
  42. router2LoginPage(needToast: boolean = false) {
  43. if (yTRouter.getAllPathName().pop() === 'LoginPage') {
  44. return
  45. }
  46. if (needToast) {
  47. IBestToast.show("请先登录哦~")
  48. }
  49. yTRouter.pushPathByName('LoginPage', '')
  50. }
  51. router2DelPhotoPage(param: DelPhotoParam) {
  52. yTRouter.pushPathByName('DelPhotoPage', param)
  53. }
  54. getDelPhotoParam() {
  55. return yTRouter.getParamByName('DelPhotoPage').pop() as DelPhotoParam
  56. }
  57. //UpdatePasswordPage
  58. router2UpdatePasswordPage() {
  59. yTRouter.pushPathByName("UpdatePasswordPage", '')
  60. }
  61. routerBack() {
  62. yTRouter.pop()
  63. }
  64. /**
  65. * DiaLog 相关
  66. */
  67. router2DiaLog(param: DiaLogParam) {
  68. yTRouter.pushPathByName('YTNaviDiaLog', param)
  69. }
  70. }
  71. export const yTRouter = YTRouter.getInstance()