index.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. import Vue from "vue";
  2. import VueRouter from "vue-router";
  3. const originalPush = VueRouter.prototype.push
  4. VueRouter.prototype.push = function push(location) {
  5. return originalPush.call(this, location).catch(err => err);
  6. }
  7. Vue.use(VueRouter);
  8. const routes = [
  9. {
  10. path: "/",
  11. name: "login",
  12. meta:{
  13. keepAlive:true
  14. },
  15. component: ()=>import("../views/login/login.vue")
  16. },
  17. {
  18. path: "/test",
  19. name: "test",
  20. component: ()=>import("../views/test/test.vue")
  21. },
  22. {
  23. path: "/loginByPhone",
  24. name: "loginByPhone",
  25. meta:{
  26. keepAlive:false
  27. },
  28. component: ()=>import("../views/login/loginByPhone.vue")
  29. },
  30. {
  31. path: "/loginByCode",
  32. name: "loginByCode",
  33. meta:{
  34. keepAlive:false
  35. },
  36. component: ()=>import("../views/login/loginByCode.vue")
  37. },
  38. {
  39. path: "/sex",
  40. name: "sex",
  41. meta:{
  42. keepAlive:true
  43. },
  44. component: ()=>import("../views/info/sex.vue")
  45. },
  46. {
  47. path: "/figure",
  48. name: "figure",
  49. meta:{
  50. keepAlive:true
  51. },
  52. component: ()=>import("../views/info/figure.vue")
  53. },
  54. {
  55. path: "/datum",
  56. name: "datum",
  57. meta:{
  58. keepAlive:true
  59. },
  60. component: ()=>import("../views/info/datum.vue")
  61. },
  62. {
  63. path: "/city",
  64. name: "city",
  65. meta:{
  66. keepAlive:true
  67. },
  68. component: ()=>import("../views/info/city.vue")
  69. },
  70. {
  71. path: "/wechat",
  72. name: "wechat",
  73. meta:{
  74. keepAlive:true
  75. },
  76. component: ()=>import("../views/info/wechat.vue")
  77. },
  78. {
  79. path: "/labels",
  80. name: "labels",
  81. meta:{
  82. keepAlive:false
  83. },
  84. component: ()=>import("../views/info/labels.vue")
  85. },
  86. {
  87. path: "/user",
  88. name: "user",
  89. meta:{
  90. keepAlive:true
  91. },
  92. component: ()=>import("../views/friends/user.vue")
  93. },
  94. {
  95. path: "/main",
  96. name: "main",
  97. meta:{
  98. keepAlive:true
  99. },
  100. component: ()=>import("../views/main/main.vue"),
  101. redirect: '/friends',
  102. children:[
  103. {
  104. path: "/friends",
  105. name: "friends",
  106. meta:{
  107. keepAlive:true
  108. },
  109. component:()=>import("../views/friends/friends.vue"),
  110. },
  111. {
  112. path: "/messages",
  113. name: "messages",
  114. meta:{
  115. keepAlive:false
  116. },
  117. component:()=>import("../views/messages/messages.vue"),
  118. },
  119. {
  120. path: "/mine",
  121. name: "mine",
  122. meta:{
  123. keepAlive:false
  124. },
  125. component:()=>import("../views/mine/mine.vue"),
  126. },
  127. ]
  128. },
  129. {
  130. path: "/chatting",
  131. name: "chatting",
  132. meta:{
  133. keepAlive:false
  134. },
  135. component: ()=>import("../views/chatting/chatting.vue")
  136. },
  137. {
  138. path: "/editCenter",
  139. name: "editCenter",
  140. meta:{
  141. keepAlive:true
  142. },
  143. component: ()=>import("../views/info/editCenter.vue")
  144. },
  145. {
  146. path: "/guest",
  147. name: "guest",
  148. meta:{
  149. keepAlive:false
  150. },
  151. component: ()=>import("../views/mine/guest.vue")
  152. },
  153. {
  154. path: "/search",
  155. name: "search",
  156. meta:{
  157. keepAlive:true
  158. },
  159. component: ()=>import("../views/search/search.vue")
  160. },
  161. {
  162. path: "/album",
  163. name: "album",
  164. meta:{
  165. keepAlive:true
  166. },
  167. component: ()=>import("../views/mine/album.vue")
  168. },
  169. {
  170. path: "/faceVideo",
  171. name: "faceVideo",
  172. meta:{
  173. keepAlive:true
  174. },
  175. component: ()=>import("../views/faceVideo/faceVideo.vue")
  176. },
  177. {
  178. path: "/chooseImage",
  179. name: "chooseImage",
  180. meta:{
  181. keepAlive:true
  182. },
  183. component: ()=>import("../views/mine/chooseImage.vue")
  184. },
  185. {
  186. path: "/authReady",
  187. name: "authReady",
  188. meta:{
  189. keepAlive:true
  190. },
  191. component: ()=>import("../views/mine/authReady.vue")
  192. },
  193. {
  194. path: "/setting",
  195. name: "setting",
  196. meta:{
  197. keepAlive:true
  198. },
  199. component: ()=>import("../views/setting/setting.vue")
  200. },
  201. {
  202. path: "/vip",
  203. name: "vip",
  204. meta:{
  205. keepAlive:true
  206. },
  207. component: ()=>import("../views/vip/vip.vue")
  208. },
  209. {
  210. path: "/walletHome",
  211. name: "walletHome",
  212. component: () => import("../views/wallet/walletHome/index"),
  213. },
  214. {
  215. path: "/ydDetail",
  216. name: "ydDetail",
  217. component: () => import("../views/wallet/ydDetail/index"),
  218. },
  219. {
  220. path: "/walletWithdraw",
  221. name: "walletWithdraw",
  222. component: () => import("../views/wallet/walletWithdraw/index"),
  223. },
  224. {
  225. path: "/boundAli",
  226. name: "boundAli",
  227. component: () => import("../views/wallet/boundAli/index"),
  228. },
  229. {
  230. path: "/incomeDetail",
  231. name: "incomeDetail",
  232. component: () => import("../views/wallet/incomeDetail/index"),
  233. },
  234. {
  235. path: "/exchange",
  236. name: "exchange",
  237. component: () => import("../views/wallet/exchange/index"),
  238. },
  239. {
  240. path: "/exchangeSuccess",
  241. name: "exchangeSuccess",
  242. component: () => import("../views/wallet/exchangeSuccess/index"),
  243. },
  244. {
  245. path: "/withdrawResult",
  246. name: "withdrawResult",
  247. component: () => import("../views/wallet/withdrawResult/index"),
  248. },
  249. ];
  250. const router = new VueRouter({
  251. mode: "history",
  252. base: process.env.BASE_URL,
  253. routes,
  254. });
  255. // router.beforeEach((to,from,next)=>{
  256. // console.log(to,from)
  257. // if(to.name==='test'){
  258. // next();
  259. // }
  260. // if(!localStorage.getItem('user')){
  261. // if(to.name==='login'||(from.name==='login'&&to.name==='loginByPhone')||(from.name==='loginByPhone'&&to.name==='loginByCode')){
  262. // next();
  263. // }
  264. // else {
  265. // next({path:'/'});
  266. // }
  267. // }
  268. // else{
  269. // next();
  270. // }
  271. // });
  272. export default router;