index.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. import {createRouter, createWebHistory} from "vue-router";
  2. import HomeIndex from "../views/HomeIndex.vue";
  3. import ApplyPermission from "../views/index/ApplyPermission.vue";
  4. import SplashScreen from "../views/index/SplashScreen.vue";
  5. import RiskTips from "../views/index/RiskTips.vue";
  6. import SearchIcon from "../views/index/SearchIcon.vue";
  7. import Notification from "../views/notification/Index.vue";
  8. import IndexUser from "../views/index/User.vue";
  9. import UserCenter from "../views/index/UserCenter.vue";
  10. import MarketDetails from "../views/market/details/Index.vue";
  11. import HistoryIndex from "../views/asset/history/Index.vue";
  12. import EntrustDetails from "../views/asset/history/EntrustDetails.vue";
  13. import PositionDetails from "../views/asset/history/PositionDetails.vue";
  14. import IcoIndex from "../views/index/ico/Index.vue";
  15. import LoanIndex from "../views/index/loan/Index.vue";
  16. import LoanRules from "../views/index/loan/Rules.vue";
  17. import UserLoanIndex from "../views/user/loan/Index.vue";
  18. import TradeLayout from '@/views/bitcoin/TradeLayout.vue'; // 新建的公共父组件
  19. import TradeFutures from '@/views/bitcoin/TradeFutures.vue'; // (合约)
  20. import TradeSeconds from '@/views/bitcoin/lever/TradeSeconds.vue'; // 秒合约(占位)
  21. import TradeOptions from '@/views/bitcoin/TradeOptions.vue'; // 期权(占位)
  22. import TradeMargin from '@/views/bitcoin/lever/TradeMargin.vue';
  23. import Calculator from '../views/bitcoin/Calculator.vue' // 新建的计算器页面
  24. import CommonFunctionsPopup from '@/views/bitcoin/CommonFunctionsPopup/CommonFunctionsPopup.vue' // 子组件路径
  25. import TradeSettings from '@/views/bitcoin/CommonFunctionsPopup/GeneralLevel2/TradeSettings.vue'// 新建
  26. import TradeRules from '@/views/bitcoin/CommonFunctionsPopup/GeneralLevel2/TradeRules.vue' // 新建
  27. const routes = [
  28. {
  29. path: "/",
  30. name: "home",
  31. component: HomeIndex,
  32. },
  33. {
  34. path: "/bitcoin",
  35. component: TradeLayout, // 而是布局组件
  36. // 当访问 /bitcoin 时,自动重定向到 /bitcoin/contract
  37. redirect: '/bitcoin/contract',
  38. children: [
  39. // 1. 核心交易子路由
  40. {
  41. path: 'contract',
  42. name: 'TradeContract',
  43. component: TradeFutures, // 核心交易逻辑
  44. meta: { title: '合约' }
  45. },
  46. {
  47. path: 'seconds',
  48. name: 'TradeSeconds',
  49. component: TradeSeconds,
  50. meta: { title: '秒合约' }
  51. },
  52. {
  53. path: 'options',
  54. name: 'TradeOptions',
  55. component: TradeOptions,
  56. meta: { title: '期权' }
  57. },
  58. {
  59. path: 'margin',
  60. name: 'TradeMargin',
  61. component: TradeMargin,
  62. meta: { title: '杠杆' }
  63. },
  64. { path: 'settings',
  65. name: 'TradeSettings',
  66. component: TradeSettings },
  67. { path: 'calculator',
  68. name: 'calculator',
  69. component: Calculator },
  70. ]
  71. },
  72. {
  73. path: "/applyPermission",
  74. name: "applyPermission",
  75. component: ApplyPermission,
  76. },
  77. {
  78. path: "/splashScreen",
  79. name: "splashScreen",
  80. component: SplashScreen,
  81. },
  82. {
  83. path: "/riskTips",
  84. name: "riskTips",
  85. component: RiskTips,
  86. },
  87. {
  88. path: "/searchIcon",
  89. name: "searchIcon",
  90. component: SearchIcon,
  91. },
  92. {
  93. path: "/notification",
  94. name: "notification",
  95. component: Notification,
  96. },
  97. {
  98. path: "/indexUser",
  99. name: "indexUser",
  100. component: IndexUser,
  101. },
  102. {
  103. path: "/userCenter",
  104. name: "userCenter",
  105. component: UserCenter,
  106. },
  107. {
  108. path: "/marketDetails",
  109. name: "marketDetails",
  110. component: MarketDetails,
  111. },
  112. {
  113. path: "/historyIndex",
  114. name: "historyIndex",
  115. component: HistoryIndex,
  116. },
  117. {
  118. path: "/entrustDetails",
  119. name: "entrustDetails",
  120. component: EntrustDetails,
  121. },
  122. {
  123. path: "/positionDetails",
  124. name: "positionDetails",
  125. component: PositionDetails,
  126. },
  127. {
  128. path: "/icoIndex",
  129. name: "icoIndex",
  130. component: IcoIndex,
  131. },
  132. {
  133. path: "/loanIndex",
  134. name: "loanIndex",
  135. component: LoanIndex,
  136. },
  137. {
  138. path: "/loanRules",
  139. name: "loanRules",
  140. component: LoanRules,
  141. },
  142. {
  143. path: "/userLoanIndex",
  144. name: "userLoanIndex",
  145. component: UserLoanIndex,
  146. },
  147. ];
  148. const router = createRouter({
  149. history: createWebHistory(process.env.BASE_URL),
  150. routes,
  151. });
  152. export default router;