Home.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <template>
  2. <div class="home">
  3. <el-container class="container">
  4. <el-header class="header" style="height: 60px;">
  5. <div>
  6. <div class="logo">
  7. <!-- <img src="../assets/image/logo.jpg">-->
  8. <h3>全国收费公路通行费电子发票后台管理系统</h3>
  9. </div>
  10. <div class="message">
  11. <div class="theUser"><span class="el-icon-user-solid"></span>{{name}}</div>
  12. <!-- <div class="theUser"><span class="el-icon-s-custom" style="font-size: 18px;"></span></div> -->
  13. <div class="theUser" @click="Logout"><span class="el-icon-s-unfold"></span>退出登录</div>
  14. </div>
  15. </div>
  16. </el-header>
  17. <el-main class="main" style="">
  18. <div style="height:100%;">
  19. <div class="leftNav">
  20. <template>
  21. <template v-if="roleId == 1">
  22. <el-menu
  23. :default-active="$route.path"
  24. unique-opened
  25. router
  26. background-color="#22a2d4"
  27. active-text-color="#ffd04b"
  28. style="height: 100%">
  29. <el-menu-item index="/main" >
  30. <i class="el-icon-s-tools"></i>
  31. <span slot="title">首页</span>
  32. </el-menu-item>
  33. <el-submenu
  34. v-for="item in menus"
  35. :key="item.id"
  36. :index="item.id + ''">
  37. <template slot="title">
  38. <i class="el-icon-s-tools" style="font-size: 14px color: #fff;"></i>
  39. <span>{{ item.authName }}</span>
  40. </template>
  41. <el-menu-item
  42. v-for="item1 in item.children"
  43. :key="item1.id"
  44. :index="'/' + item1.path">
  45. <i class="el-icon-search" style="font-size: 14px color: #fff;"></i>
  46. {{ item1.authName }}
  47. </el-menu-item>
  48. </el-submenu>
  49. </el-menu>
  50. </template>
  51. <template v-if="roleId == 2">
  52. <el-menu
  53. :default-active="$route.path"
  54. unique-opened
  55. router
  56. background-color="#22a2d4"
  57. active-text-color="#ffd04b"
  58. style="height: 100%">
  59. <el-menu-item index="/main">
  60. <i class="el-icon-s-tools"></i>
  61. <span slot="title">首页</span>
  62. </el-menu-item>
  63. <el-menu-item index="/personal" >
  64. <i class="el-icon-s-tools"></i>
  65. <span slot="title">个人中心</span>
  66. </el-menu-item>
  67. <!-- <el-menu-item index="/consumption">
  68. <i class="el-icon-s-tools"></i>
  69. <span slot="title">消费统计</span>
  70. </el-menu-item> -->
  71. <el-submenu
  72. v-for="item in menu"
  73. :key="item.id"
  74. :index="item.id + ''">
  75. <template slot="title">
  76. <i class="el-icon-s-tools" style="font-size: 14px color: #fff;"></i>
  77. <span>{{ item.authName }}</span>
  78. </template>
  79. <el-menu-item
  80. v-for="item1 in item.children"
  81. :key="item1.id"
  82. :index="'/' + item1.path">
  83. <i class="el-icon-search" style="font-size: 14px color: #fff;"></i>
  84. {{ item1.authName }}
  85. </el-menu-item>
  86. </el-submenu>
  87. </el-menu>
  88. </template>
  89. <template v-if="roleId == 3">
  90. <el-menu
  91. :default-active="$route.path"
  92. unique-opened
  93. router
  94. background-color="#22a2d4"
  95. active-text-color="#ffd04b"
  96. style="height: 100%">
  97. <el-menu-item index="/main" >
  98. <i class="el-icon-s-tools"></i>
  99. <span slot="title">首页</span>
  100. </el-menu-item>
  101. <el-menu-item index="/personal" >
  102. <i class="el-icon-s-tools"></i>
  103. <span slot="title">个人中心</span>
  104. </el-menu-item>
  105. <el-submenu
  106. v-for="item in menuList"
  107. :key="item.id"
  108. :index="item.id + ''">
  109. <template slot="title">
  110. <i class="el-icon-s-tools" style="font-size: 14px color: #fff;"></i>
  111. <span>{{ item.authName }}</span>
  112. </template>
  113. <el-menu-item
  114. v-for="item1 in item.children"
  115. :key="item1.id"
  116. :index="'/' + item1.path">
  117. <i class="el-icon-search" style="font-size: 14px color: #fff;"></i>
  118. {{ item1.authName }}
  119. </el-menu-item>
  120. </el-submenu>
  121. </el-menu>
  122. </template>
  123. </template>
  124. </div>
  125. <div class="rightNav">
  126. <router-view></router-view>
  127. </div>
  128. </div>
  129. </el-main>
  130. </el-container>
  131. </div>
  132. </template>
  133. <script>
  134. export default {
  135. data() {
  136. return {
  137. menus: [
  138. {
  139. id:2,
  140. authName:"用户管理",
  141. children:[
  142. {
  143. id:1,
  144. path:"user",
  145. authName:"用户列表"
  146. },
  147. ]
  148. },
  149. {
  150. id: 3,
  151. authName:"客户管理",
  152. children:[
  153. {
  154. id:1,
  155. path:"customer",
  156. authName:"客户管理"
  157. },{
  158. id:2,
  159. path:"customerRecharge",
  160. authName:"充值记录"
  161. },{
  162. id:3,
  163. path:"custRecTime",
  164. authName:"备案预警查询"
  165. }
  166. ]
  167. },
  168. {
  169. id: 4,
  170. authName:"无车管理",
  171. children:[
  172. {
  173. id:8,
  174. path:"nocarRec",
  175. authName:"车辆备案"
  176. },{
  177. id:2,
  178. path:"billway",
  179. authName:"运单查询"
  180. },{
  181. id:3,
  182. path:"billwayException",
  183. authName:"异常运单"
  184. },{
  185. id:4,
  186. path:"nocarInvoice",
  187. authName:"发票查询"
  188. },{
  189. id:5,
  190. path:"hcInvoice",
  191. authName:"红冲发票查询"
  192. }
  193. ]
  194. },{
  195. id: 5,
  196. authName:"自有车管理",
  197. children:[
  198. {
  199. id:1,
  200. path:"selfcarRec",
  201. authName:"ETC备案"
  202. },{
  203. id:2,
  204. path:"selfCarTrade",
  205. authName:"交易查询"
  206. },{
  207. id:2,
  208. path:"selfCarTradeException",
  209. authName:"异常交易查询"
  210. },{
  211. id:3,
  212. path:"selfInvoice",
  213. authName:"发票查询"
  214. }
  215. ]
  216. },{
  217. id: 6,
  218. authName:"计费管理",
  219. children:[
  220. {
  221. id:1,
  222. path:"SelfCalculateInfo",
  223. authName:"自有车计费查询"
  224. },
  225. {
  226. id:2,
  227. path:"noCarCalculateInfo",
  228. authName:"无车计费查询"
  229. }
  230. ]
  231. },{
  232. id: 7,
  233. authName:"参数管理",
  234. children:[
  235. {
  236. id:1,
  237. path:"paramMagager",
  238. authName:"参数管理"
  239. }
  240. ]
  241. }
  242. ],
  243. roleId: '',
  244. userName: '',
  245. name: ''
  246. };
  247. },
  248. components: {
  249. },
  250. beforeCreate() {
  251. // 判断是否登录,token
  252. var token = sessionStorage.getItem('token');
  253. if (!token) {
  254. // 提示
  255. this.$message.warning('请先登录');
  256. // 没有token,跳转到登录页面
  257. this.$router.push('/login');
  258. }
  259. },
  260. created() {
  261. this.roleId = sessionStorage.getItem('roleId');
  262. this.name = sessionStorage.getItem('name');
  263. },
  264. mounted () {
  265. },
  266. methods: {
  267. // 退出登录
  268. Logout() {
  269. // 提示退出成功
  270. this.$message.success('退出成功');
  271. // 1 清除token
  272. sessionStorage.clear();
  273. // 2 跳转到登录页面
  274. this.$router.push('/login');
  275. },
  276. }
  277. };
  278. </script>
  279. <style>
  280. .home {
  281. height: 100%;
  282. width: 100%;
  283. font-size: 1px;
  284. }
  285. .home .container {
  286. height: 100%;
  287. background: -webkit-linear-gradient(top, #289dfa , #fff);
  288. background: -o-linear-gradient(bottom, #289dfa , #fff);
  289. background: -moz-linear-gradient(bottom, #289dfa, #fff);
  290. background: linear-gradient(to bottom, #289dfa , #fff);
  291. }
  292. .home .header {
  293. height: 130px;
  294. }
  295. .home .header > div {
  296. overflow: hidden;
  297. }
  298. .home .header .logo {
  299. float: left;
  300. margin-top: 15px;
  301. margin-left: 20px;
  302. }
  303. .home .header img {
  304. height: 40px;
  305. width: 40px;
  306. }
  307. .home .header h3 {
  308. display: inline-block;
  309. font-size: 30px;
  310. color: #fff;
  311. margin-left: 10px;
  312. }
  313. .home .header .message {
  314. float: right;
  315. margin-top: 20px;
  316. margin-right: 35px;
  317. background-color: #d3e7f9;
  318. overflow: hidden;
  319. }
  320. .home .header .message .theUser {
  321. float: left;
  322. height: 40px;
  323. line-height: 40px;
  324. width: 100px;
  325. font-size: 16px;
  326. text-align: center;
  327. cursor:pointer;
  328. }
  329. .home .main {
  330. margin: 5px;
  331. height:100%;
  332. overflow: hidden;
  333. background-color: #fff;
  334. }
  335. .home .el-menu {
  336. border: 0;
  337. }
  338. .home .el-submenu__title i{
  339. color: #fff;
  340. font-size: 16px;
  341. }
  342. .home .el-menu-item {
  343. color: #fff;
  344. font-size: 16px;
  345. }
  346. .home .el-menu-item i{
  347. color: #fff;
  348. font-size: 16px;
  349. }
  350. .home .el-menu span {
  351. font-size: 16px;
  352. }
  353. .home .main .leftNav {
  354. width: 18%;
  355. float: left;
  356. overflow-y: scroll;
  357. height: 100%;
  358. }
  359. .home .main .rightNav {
  360. margin-left: 2%;
  361. width: 80%;
  362. float: left;
  363. }
  364. .el-message {
  365. font-size: 35px !important;
  366. }
  367. .el-submenu__title {
  368. color: #fff !important;
  369. }
  370. </style>