index.vue 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <el-scrollbar wrapClass="scrollbar-wrapper">
  3. <!-- <div class="sideColumn">
  4. <hamburger
  5. class="hamburger-container"
  6. :toggleClick="toggleSideBar"
  7. :isActive="sidebar.opened"
  8. ></hamburger>
  9. </div>-->
  10. <!-- <el-menu
  11. mode="vertical"
  12. :unique-opened="uniqueOpened"
  13. :show-timeout="200"
  14. :default-active="$route.path"
  15. :collapse="isCollapse"
  16. background-color="#304156"
  17. text-color="#bfcbd9"
  18. active-text-color="#409EFF"
  19. >-->
  20. <div class="logo">
  21. <img src="../../../../assets/logo/logo1.png" alt />
  22. </div>
  23. <el-menu
  24. mode="vertical"
  25. :unique-opened="uniqueOpened"
  26. :show-timeout="200"
  27. :default-active="$route.path"
  28. background-color="#304156"
  29. text-color="#bfcbd9"
  30. active-text-color="#409EFF"
  31. >
  32. <sidebar-item
  33. v-for="(route, index) in permission_routers"
  34. :key="route.name"
  35. :item="route"
  36. :base-path="route.path"
  37. :index="index"
  38. @a="b"
  39. ></sidebar-item>
  40. <!-- <el-menu-item v-if="this.$store.getters.xt_user.cdm_role_exist" index="100">
  41. <a :href="CDMWebsit()">
  42. <i class="icon iconfont icon-manbing-xuanzhong" style="margin-right:4px"></i>
  43. <span
  44. slot="title"
  45. >慢病管理</span>
  46. </a>
  47. </el-menu-item>
  48. <el-menu-item v-if="this.$store.getters.xt_user.scrm_role_exist" index="101">
  49. <a :href="SCRMWebsit()">
  50. <i class="icon iconfont icon-pengyou" style="margin-right:4px"></i>
  51. <span
  52. slot="title"
  53. >SCRM</span>
  54. </a>
  55. </el-menu-item>
  56. <el-menu-item v-if="this.$store.getters.xt_user.mall_role_exist" index="102">
  57. <a :href="MircoMallWebsit()">
  58. <i class="icon iconfont icon-service_fill" style="margin-right:4px"></i>
  59. <span
  60. slot="title"
  61. >分销商城</span>
  62. </a>
  63. </el-menu-item> -->
  64. </el-menu>
  65. </el-scrollbar>
  66. <!-- <div class="mianLeft">
  67. <div class="logo">
  68. <img src="/static/img/logo.8dbb9fd.png" alt="" />
  69. </div>
  70. <div class="navBox">
  71. <div
  72. class="navOne"
  73. :class="activeClass == index ? 'active' : ''"
  74. v-for="(item, index) in permission_routers"
  75. :key="item.name"
  76. v-if="!item.hidden && item.children"
  77. >
  78. <div v-if="item.meta" @click="onClick(index)" class="one">
  79. <router-link :to="item.children[0].path">
  80. <svg-icon
  81. v-if="item.meta && item.meta.icon"
  82. :icon-class="item.meta.icon"
  83. ></svg-icon>
  84. <p v-if="item.meta && item.meta.title">
  85. {{ generateTitle(item.meta.title) }}
  86. </p>
  87. </router-link>
  88. </div>
  89. <div v-else @click="onClick(index)">
  90. <router-link :to="item.children[0].path" class="one">
  91. <svg-icon :icon-class="item.children[0].meta.icon"></svg-icon>
  92. <p>
  93. {{ generateTitle(item.children[0].meta.title) }}
  94. </p>
  95. </router-link>
  96. </div>
  97. </div>
  98. </div>
  99. </div>-->
  100. </template>
  101. <script>
  102. import { mapGetters } from "vuex";
  103. import SidebarItem from "./SidebarItem";
  104. import Hamburger from "@/components/Hamburger";
  105. import { generateTitle } from "@/utils/i18n";
  106. export default {
  107. components: { SidebarItem, Hamburger },
  108. computed: {
  109. ...mapGetters(["permission_routers", "sidebar"]),
  110. isCollapse() {
  111. return !this.sidebar.opened;
  112. }
  113. },
  114. data() {
  115. return {
  116. uniqueOpened: true,
  117. activeClass: 0,
  118. index: 0
  119. };
  120. },
  121. methods: {
  122. toggleSideBar() {
  123. this.$store.dispatch("toggleSideBar");
  124. },
  125. generateTitle,
  126. resolvePath(...paths) {
  127. return path.resolve(this.basePath, ...paths);
  128. },
  129. b(index, num) {
  130. // this.index = index;
  131. // this.activeClass = index;
  132. this.$emit("callBackIndex", index, num);
  133. },
  134. CDMWebsit() {
  135. return process.env.CDM_HOST;
  136. },
  137. SCRMWebsit() {
  138. return process.env.SRCM_HOST;
  139. },
  140. MircoMallWebsit() {
  141. return process.env.MIRCO_MALL_HOST;
  142. },
  143. },
  144. created() {
  145. // console.log(1111111121121111111, this.permission_routers);
  146. // this.permission_routers.map(item => {
  147. // console.log(item.children);
  148. // });
  149. }
  150. };
  151. </script>
  152. <style rel="stylesheet/scss" lang="scss" scoped>
  153. .mianLeft {
  154. width: 150px;
  155. height: 100%;
  156. overflow-y: auto;
  157. background: #304155;
  158. .navBox {
  159. display: flex;
  160. flex-wrap: wrap;
  161. .navOne {
  162. width: 50%;
  163. height: 75px;
  164. display: flex;
  165. align-items: center;
  166. justify-content: space-around;
  167. color: #fff;
  168. .one {
  169. display: flex;
  170. align-items: center;
  171. flex-direction: column;
  172. p {
  173. margin-top: 10px;
  174. font-size: 14px;
  175. }
  176. }
  177. }
  178. .active {
  179. background: #409eff;
  180. }
  181. }
  182. }
  183. .logo {
  184. width: 100px;
  185. height: 32px;
  186. margin: 20px auto;
  187. img {
  188. width: 100%;
  189. height: 100%;
  190. display: block;
  191. }
  192. }
  193. .sideColumn {
  194. background-color: rgb(48, 65, 86);
  195. .head {
  196. text-align: center;
  197. padding: 20px 0 0 0;
  198. .tx {
  199. .img {
  200. width: 45px;
  201. height: 45px;
  202. border-radius: 50%;
  203. -o-object-fit: cover;
  204. object-fit: cover;
  205. -o-object-position: center;
  206. object-position: center;
  207. }
  208. }
  209. .title {
  210. font-size: 14px;
  211. color: #bfcbd9;
  212. padding: 10px 10px 15px 10px;
  213. line-height: 22px;
  214. }
  215. }
  216. .headShrink {
  217. .tx {
  218. .img {
  219. width: 30px;
  220. height: 30px;
  221. }
  222. }
  223. .title {
  224. display: none;
  225. }
  226. }
  227. }
  228. </style>
  229. <style lang="scss">
  230. .scrollbar-wrapper {
  231. background-color: #1F2D3D;
  232. .el-menu{
  233. background-color: #1F2D3D !important;
  234. }
  235. .el-menu-item{
  236. height: 32px !important;
  237. line-height: 32px !important;
  238. background-color: #1F2D3D !important;
  239. color: #fff !important;
  240. i{
  241. color: #fff;
  242. }
  243. }
  244. }
  245. </style>
  246. <style lang="scss">
  247. </style>