移动端
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

permission.js 12 KiB

pirms 4 gadiem
pirms 3 gadiem
pirms 4 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 3 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 3 gadiem
pirms 2 gadiem
pirms 3 gadiem
pirms 4 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 2 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 2 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 3 gadiem
pirms 4 gadiem
pirms 3 gadiem
pirms 2 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 2 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 4 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. import router from './router'
  2. import store from './store'
  3. import NProgress from 'nprogress'
  4. import 'nprogress/nprogress.css'
  5. import { getToken } from '@/utils/auth'
  6. import Cookies from "js-cookie";
  7. NProgress.configure({ showSpinner: false })
  8. const whiteList = [
  9. '/index',
  10. '/login',
  11. '/auth-redirect',
  12. '/bind',
  13. '/register',
  14. '/news/index',
  15. '/news/newDetail',
  16. '/notice/index',
  17. '/supply/index',
  18. '/interaction/index',
  19. '/register/index',
  20. '/register/registerType',
  21. '/register/userRegister',
  22. '/register/companyRegister',
  23. '/biddingHall',
  24. '/authenticRight',
  25. '/authenticRight/login',
  26. '/project',
  27. '/policy',
  28. '/policyDetail',
  29. '/attestationDetail',
  30. '/noticeDetail',
  31. '/homestead/login',
  32. '/applicationForm',
  33. '/applicationList',
  34. '/certificateList',
  35. '/certificateSee',
  36. '/informationList',
  37. '/circulationList',
  38. '/circulationAdd',
  39. '/onlineHomeLogin',
  40. '/lawEnforcement',
  41. '/lawEnforcement/caseList',
  42. '/lawEnforcement/productsList',
  43. '/lawEnforcement/user',
  44. '/lawEnforcement/programme',
  45. '/lawEnforcement/programmeDetail',
  46. '/lawEnforcement/programmeModify',
  47. '/lawEnforcement/programmeApproval',
  48. '/lawEnforcement/complaint',
  49. '/lawEnforcement/reply',
  50. '/lawEnforcement/changePassword',
  51. '/lawEnforcement/feedback',
  52. '/lawEnforcement/feedbackForm',
  53. '/lawEnforcement/agreement',
  54. '/lawEnforcement/work',
  55. '/lawEnforcement/workDetail',
  56. '/lawEnforcement/caseDetail',
  57. '/lawEnforcement/login',
  58. '/lawEnforcement/indexComplaint',
  59. '/lawEnforcement/schemeDetail',
  60. '/lawEnforcement/waitingProcessing',
  61. '/lawEnforcement/complaintAdd',
  62. '/homesteadLogin',
  63. '/yinnongLogin',
  64. '/lawEnforcement/userRegister',
  65. '/lawEnforcement/companyRegister',
  66. '/sunVillage/login',
  67. //阳光村务公众号 -- 待删
  68. '/sunVillage/index',
  69. '/sunVillage/latestReport', //最新报道列表
  70. '/sunVillage/latestReport/details', //最新报道详情
  71. '/sunVillage/importantItems', //重大事项-列表
  72. '/sunVillage/importantItems/details', //重大事项-详情
  73. '/sunVillage/public', //三务公开
  74. '/sunVillage/public/details', //三务公开-详情
  75. '/sunVillage/financial', //惠民金融
  76. '/sunVillage/financial/details', //惠民金融-详情
  77. '/sunVillage/financial/products', //惠民金融 - 理财产品
  78. '/sunVillage/financial/loan', //惠民金融 - 理财产品
  79. '/sunVillage/injoint', //三资公开-财务公开
  80. '/sunVillage/injoint/details',//三资公开-财务公开-详情
  81. '/sunVillage/injoint/meansOf', //三资公开-清产核资
  82. '/sunVillage/injoint/meansOf_desc', //三资公开-清产核资-详情页
  83. '/sunVillage/injoint/assetsPublic', //三资公开-资产公开
  84. '/sunVillage/injoint/assetsPublic_desc', //三资公开-资产公开-详情
  85. '/sunVillage/injoint/publicResources', //三资公开-资源公开
  86. '/sunVillage/injoint/publicResources_desc', //三资公开-资源公开-详情
  87. '/sunVillage/consulting', //民生直通车
  88. '/sunVillage/consulting/inquiries', //民生直通车-咨询
  89. "/sunVillage/consulting/my_consulting", //民生直通车-我的咨询详情
  90. '/sunVillage/consulting/kanban', //民生直通车-民生看板
  91. '/sunVillage/consulting/kanban/focusList', //民生直通车-民生看板 -关注民生list
  92. '/sunVillage/consulting/kanban/focusDesc', //民生直通车-民生看板 -关注民生详情
  93. '/sunVillage/consulting/kanban/affairsList', //民生直通车-民生看板 - 民生办事list
  94. '/sunVillage/equity', //股权查询-股民信息
  95. '/sunVillage/equity_desc', // 股权查询-股民信息-详情
  96. '/sunVillage/shareBonus', //股权查询-股权分红
  97. '/sunVillage/shareBonus_num', //股权查询-股权分红-股数详情页
  98. '/sunVillage/shareBonus_amount', //股权查询-股权分红-分红详情页
  99. '/sunVillage/user/index', //个人中心
  100. '/sunVillage/user/mobile', //个人中心-修改手机号
  101. '/sunVillage/user/information', //个人中心-修改用户信息
  102. '/sunVillage/user/cooperative', //个人中心-修改所属合作社
  103. //阳光村务公众号 -- 待删
  104. //宅基地
  105. '/zjdLogin',
  106. '/onlineHome/workbench',
  107. //阳光村务--新
  108. '/sunVillage_info/login', //登录
  109. '/sunVillage_info/index', //首页
  110. '/sunVillage_info/list_tourists', //二页列表-游客
  111. '/sunVillage_info/fixedAssets', //固定资产
  112. '/sunVillage_info/information', //合同信息
  113. '/sunVillage_info/details', //详情页
  114. '/sunVillage_info/index_code', //农户首页
  115. '/sunVillage_info/list_finance', //财务公开
  116. '/sunVillage_info/list_issues', //零工公开
  117. '/sunVillage_info/list_photo', //一张图公开
  118. '/sunVillage_info/list_contract', //合同公开
  119. '/sunVillage_info/list_contract_detail', //合同公开详情页
  120. '/sunVillage_info/list_tourists_detail', //详情页
  121. '/sunVillage_info/list_issues_detail', //详情页
  122. '/sunVillage_info/list_finance_detail', //详情页
  123. '/sunVillage_info/list_photo_detail', //详情页
  124. '/sunVillage_info/list_finance_ranking', //详情页
  125. '/sunVillage_info/list_tourists_ranking', //详情页
  126. '/sunVillage_info/login_code', //详情页
  127. '/sunVillage_info/index_code_rights', //详情页
  128. '/sunVillage_info/list_vote', //详情页
  129. '/sunVillage_info/list_vote_detail', //详情页
  130. '/sunVillage_info/list_vote_form', //详情页
  131. '/sunVillage_info/homeApplication/applicationList', //列表页面
  132. '/sunVillage_info/proposerLite',
  133. '/sunVillage_info/paidExit/paidExitList', //列表页面
  134. '/sunVillage_info/paidExitAdd',
  135. '/sunVillage_info/paidExitModify',
  136. '/sunVillage_info/paidExitDetail',
  137. '/sunVillage_info/arbitrationList',
  138. '/sunVillage_info/arbitrationDetail',
  139. // 新型经营主体
  140. 'newBusinessEntity/newsBulletin', //新闻公告
  141. '/newBusinessEntity/index', //首页
  142. '/newBusinessEntity/login', //登录
  143. '/newBusinessEntity/register', //注册
  144. '/newBusinessEntity/conter', //底部组件
  145. '/newBusinessEntity/newsDetails', //新闻详情
  146. '/newBusinessEntity/listBody', //主体名录
  147. '/newBusinessEntity/map', //地图
  148. //农业大托管
  149. '/agriculturalTrusteeship/index',//首页
  150. '/agriculturalTrusteeship/login',//登录
  151. '/agriculturalTrusteeship/insuranceList',//保险列表
  152. '/agriculturalTrusteeship/insuranceProjectList',//保险产品列表
  153. '/agriculturalTrusteeship/insuranceProjectDetail',//保险产品详情
  154. '/agriculturalTrusteeship/societyList',//社会化列表
  155. '/agriculturalTrusteeship/societyProjectList',//社会化产品列表
  156. '/agriculturalTrusteeship/societyProjectDetail',//社会化产品详情
  157. '/agriculturalTrusteeship/shopList',//保险列表首页
  158. '/agriculturalTrusteeship/shopDetail',//保险列表详情
  159. '/agriculturalTrusteeship/shopEdit',//保险列表详情
  160. '/agriculturalTrusteeship/shopAdd',//保险列表首页
  161. '/agriculturalTrusteeship/serviceEdit',//保险列表首页
  162. '/agriculturalTrusteeship/socializationIndex',//社会化服务组织待处理
  163. '/agriculturalTrusteeship/socializationProject',//社会化服务组织产品
  164. '/agriculturalTrusteeship/socializationProjectDetail',//社会化服务组织产品详情
  165. '/agriculturalTrusteeship/socializationProjectEdit',//社会化服务组织产品修改
  166. '/agriculturalTrusteeship/socializationBill',//社会化服务组织订单
  167. '/agriculturalTrusteeship/socializationBillDetail',//社会化服务组织订单详情
  168. '/agriculturalTrusteeship/socializationBillOrder',//社会化服务组织订单详情
  169. '/agriculturalTrusteeship/socializationUser',//社会化服务组织个人中心
  170. '/agriculturalTrusteeship/socializationUserEdit',//社会化服务组织个人信息
  171. '/agriculturalTrusteeship/socializationRelease',//社会化服务组织发布产品
  172. '/agriculturalTrusteeship/socializationDraft',//社会化服务组织草稿箱
  173. '/agriculturalTrusteeship/socializationDraftEdit',//社会化服务组织草稿箱修改
  174. //'/agriculturalTrusteeship/buyerIndex',//买家选购
  175. //'/agriculturalTrusteeship/buyerWaitBill',//买家选购-等待处理
  176. // '/agriculturalTrusteeship/buyerAllBill',//买家选购-所有订单
  177. // '/agriculturalTrusteeship/placeOrder',//买家选购-下单页
  178. // '/agriculturalTrusteeship/billDetail',//买家选购-订单详情
  179. // '/agriculturalTrusteeship/billDetail2',//买家选购-订单详情
  180. // '/agriculturalTrusteeship/billDetail3',//买家选购-订单详情
  181. // '/agriculturalTrusteeship/billDetail4',//买家选购-订单详情
  182. // '/agriculturalTrusteeship/evaluate',//买家选购-服务评价
  183. ]
  184. router.beforeEach((to, from, next) => {
  185. NProgress.start()
  186. if (getToken()) {
  187. /* has token*/
  188. if (to.path === '/login') {
  189. next({ path: '/' })
  190. NProgress.done()
  191. } else {
  192. if (store.getters.roles.length === 0) {
  193. next()
  194. // 判断当前用户是否已拉取完user_info信息
  195. store.dispatch('GetInfo').then(res => {
  196. // 拉取user_info
  197. const roles = res.roles
  198. // store.dispatch('GenerateRoutes', { roles }).then(accessRoutes => {
  199. // // 根据roles权限生成可访问的路由表
  200. // router.addRoutes(accessRoutes) // 动态添加可访问路由表
  201. // next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
  202. // })
  203. next()
  204. }).catch(err => {
  205. store.dispatch('LogOut').then(() => {
  206. try {
  207. let loginUrl = Cookies.get("_Login_url");
  208. if (loginUrl && loginUrl.indexOf("onlineHomeLogin") !== -1) {
  209. next({ path: '/onlineHomeLogin' })
  210. return;
  211. }
  212. } catch (e) { console.log(e); }
  213. // Message.error(err)
  214. if ('/authenticRight/index'.indexOf(to.path) !== -1) {
  215. next({ path: '/authenticRight/login' })
  216. } else if ('/homestead/index'.indexOf(to.path) !== -1) {
  217. next({ path: '/homestead/login' })
  218. } else if (to.path.indexOf('/onlineHome') !== -1) {
  219. //next(`/onlineHomeLogin`)
  220. next(`/zjdLogin`)
  221. } else if (to.path.indexOf('/yinnong') !== -1) {
  222. next(`/yinnongLogin`)
  223. } else if (window.location.href.indexOf('/sunVillage_info/') != -1) {
  224. window.location.href = '/sunVillage_info/login';
  225. } else if (to.path.indexOf('/homesteadSurvey') !== -1) {
  226. next(`/homesteadLogin`)
  227. } else if (to.path.indexOf('/lawEnforcement') !== -1) {
  228. next(`//lawEnforcement/login`)
  229. } else if (to.path.indexOf('/sunVillage') !== -1) {
  230. next(`/sunVillage/login`)
  231. } else if (to.path.indexOf('/homestead/') !== -1) {
  232. next(`/homestead/login`)
  233. } else {
  234. next(`/yinnongLogin`)
  235. //next({ path: '/' })
  236. }
  237. })
  238. })
  239. } else {
  240. next()
  241. }
  242. }
  243. } else {
  244. // 没有token
  245. console.info(to);
  246. if (whiteList.indexOf(to.path) !== -1) {
  247. // 在免登录白名单,直接进入
  248. console.log(to.path)
  249. next()
  250. } else {
  251. try {
  252. let loginUrl = Cookies.get("_Login_url");
  253. if (loginUrl && loginUrl.indexOf("onlineHomeLogin") !== -1) {
  254. next({ path: `/onlineHomeLogin?redirect=${to.fullPath}` })
  255. return;
  256. }
  257. } catch (e) { console.log(e); }
  258. if ('/authenticRight/index'.indexOf(to.path) !== -1) {
  259. next(`/authenticRight/login?redirect=${to.fullPath}`)
  260. } else if ('/homestead/index'.indexOf(to.path) !== -1) {
  261. next(`/homestead/login?redirect=${to.fullPath}`)
  262. } else if (to.path.indexOf('/onlineHome') !== -1) {
  263. next(`/onlineHomeLogin`)
  264. } else if (to.path.indexOf('/yinnong') !== -1) {
  265. next(`/yinnongLogin`)
  266. } else if (window.location.href.indexOf('/sunVillage_info/') != -1) {
  267. window.location.href = '/sunVillage_info/login';
  268. } else if (to.path.indexOf('/homesteadSurvey') !== -1) {
  269. next(`/homesteadLogin`)
  270. } else if (to.path.indexOf('/lawEnforcement') !== -1) {
  271. next(`/lawEnforcement/login?redirect=${to.fullPath}`)
  272. } else if (to.path.indexOf('/sunVillage') !== -1) {
  273. next(`/sunVillage/login`)
  274. } else {
  275. next(`/login?redirect=${to.fullPath}`)
  276. }
  277. // // 否则全部重定向到登录页
  278. //next('/index');
  279. NProgress.done()
  280. }
  281. }
  282. })
  283. router.afterEach(() => {
  284. NProgress.done()
  285. })