YTRouter.ets 1.6 KB

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