default.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <div class="icore-default">
  3. <div class="icore-default-title">
  4. <i class="el-icon-menu" style="font-size: 16px; color:#20a0ff; margin-right: 6px; position: relative; top: 1px;"></i>功能导航
  5. </div>
  6. <div class="icore-default-content">
  7. <ul class="icore-default-ul">
  8. <li class="icore-default-li"
  9. :class="'icore-default-li' + (index + 1)"
  10. @click="goto(item)" :key="index" v-for="(item, index) in setData">
  11. <div class="icore-default-li-c"></div>
  12. <div class="icore-default-li-t">
  13. <span class="icore-nav-icons icore-default-li-i icore-defaultault"
  14. :class="item.pTarget && item.pTarget.menuIcon ? item.pTarget.menuIcon : 'icore-default-li-i' + (item.pIndex + 1)"></span>
  15. <p>{{item.preTarget && item.preTarget.name ? item.preTarget.name : ''}}</p>
  16. </div>
  17. </li>
  18. </ul>
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. import { proPath } from '@/config/config.js';
  24. export default {
  25. props: ['menuData'],
  26. data () {
  27. return {
  28. setData: [],
  29. companyId: '' // 选择公司Id
  30. }
  31. },
  32. mounted: function () {
  33. let that = this;
  34. window.top.localStorage.setItem('activeMenu','default')
  35. this.companyId = window.top.localStorage.getItem('companyId');
  36. that.getTop10();
  37. },
  38. methods: {
  39. goto (item) {
  40. let that = this;
  41. that.axios.get('pass/v1/sysuserroles/checkUserAuthorize?userId='+ this.$store.state.userInfo.userId +'&menuId='+ item.menuId).then((res) => {
  42. if(res.data.code === '0'){
  43. if(res.data.data){
  44. that.$emit('gotoSetPage', item);
  45. }else {
  46. that.$message.error('无权限访问')
  47. }
  48. }else {
  49. that.$message.error(res.data.message)
  50. }
  51. }).catch((err) =>{
  52. window.top.localStorage.setItem('activeMenu',item.menuId)
  53. that.$emit('gotoSetPage', item);
  54. })
  55. },
  56. getTop10 () {
  57. let that = this;
  58. that.axios.get(proPath + 'v1/sysmenus/getTop10', {
  59. params: {
  60. userId: that.$store.state.userInfo.userId,
  61. companyId: that.companyId
  62. }
  63. }
  64. ).then(function (response) {
  65. if (response) {
  66. let data = response.data;
  67. var tempData = [];
  68. for (let i = 0; i < data.length; i++) {
  69. tempData.push(that.getLabelbyMenuId(data[i].menuId));
  70. }
  71. that.setData = tempData;
  72. }
  73. }).catch((err) => {
  74. console.log(err);
  75. });
  76. },
  77. getLabelbyMenuId (menuId) {
  78. let that = this;
  79. var returnObj = {};
  80. for (let i = 0; i < that.menuData.length; i++) {
  81. if (that.menuData[i].menuType !== '4' && that.menuData[i].menuType !== '1' ) {
  82. continue;
  83. }
  84. if (!that.menuData[i].children) {
  85. continue;
  86. }
  87. for (let j = 0; j < that.menuData[i].children.length; j++) {
  88. if (that.menuData[i].children[j].menuType !== '4' && that.menuData[i].children[j].menuType !== '1') {
  89. continue;
  90. }
  91. if (that.menuData[i].children[j].menuId === menuId) {
  92. returnObj = {
  93. 'pTarget': that.menuData[i],
  94. 'pIndex': i,
  95. 'pageBreadcrumb': [{menuId: 1, menuLabel: that.menuData[i].name}, {menuId: 2, menuLabel: that.menuData[i].children[j].name}],
  96. 'preTarget': that.menuData[i].children[j],
  97. 'menuId': that.menuData[i].children[j].menuId
  98. }
  99. break;
  100. } else if (that.menuData[i].children[j].children) {
  101. for (let k = 0; k < that.menuData[i].children[j].children.length; k++) {
  102. if (that.menuData[i].children[j].children[k].menuType !== '4' && that.menuData[i].children[j].children[k].menuType !== '1') {
  103. continue;
  104. }
  105. if (that.menuData[i].children[j].children[k].menuId === menuId) {
  106. returnObj = {
  107. 'pTarget': that.menuData[i],
  108. 'pIndex': i,
  109. 'pageBreadcrumb': [{menuId: 1, menuLabel: that.menuData[i].name},
  110. {menuId: 2, menuLabel: that.menuData[i].children[j].name},
  111. {menuId: 3, menuLabel: that.menuData[i].children[j].children[k].name}],
  112. 'preTarget': that.menuData[i].children[j].children[k],
  113. 'menuId': that.menuData[i].children[j].children[k].menuId
  114. }
  115. break;
  116. } else if (that.menuData[i].children[j].children[k].children) {
  117. for (let l = 0; l < that.menuData[i].children[j].children[k].children.length; l++) {
  118. if (that.menuData[i].children[j].children[k].children[l].menuType !== '4' && that.menuData[i].children[j].children[k].children[l].menuType !== '1') {
  119. continue;
  120. }
  121. if (that.menuData[i].children[j].children[k].children[l].menuId === menuId) {
  122. returnObj = {
  123. 'pTarget': that.menuData[i],
  124. 'pIndex': i,
  125. 'pageBreadcrumb': [{menuId: 1, menuLabel: that.menuData[i].name},
  126. {menuId: 2, menuLabel: that.menuData[i].children[j].name},
  127. {menuId: 3, menuLabel: that.menuData[i].children[j].children[k].name},
  128. {menuId: 4, menuLabel: that.menuData[i].children[j].children[k].children[l].name}],
  129. 'preTarget': that.menuData[i].children[j].children[k].children[l],
  130. 'menuId': that.menuData[i].children[j].children[k].children[l].menuId
  131. }
  132. break;
  133. }
  134. }
  135. }
  136. }
  137. }
  138. }
  139. }
  140. return returnObj;
  141. }
  142. }
  143. }
  144. </script>
  145. <style scoped>
  146. .icore-default { height: 100%; position: relative; }
  147. .icore-default-title {
  148. position: absolute; top: 0; left: 5%;
  149. width: 90%; height: 60px; line-height: 60px;
  150. border-bottom: 1px solid #ddd;
  151. font-size: 14px; color: #666;
  152. }
  153. .icore-default-content {
  154. position: relative;
  155. padding-top: 60px;
  156. min-width: 1200px; height: 100%;
  157. background: url(../assets/img/default-bg.png) center bottom no-repeat;
  158. }
  159. .icore-default-ul {
  160. position: absolute; top: 50%; left: 50%;
  161. margin-left: -560px; margin-top: -250px;
  162. width: 1100px; height: 440px;
  163. overflow: hidden;
  164. }
  165. .icore-default-li {
  166. cursor: pointer;
  167. position: relative; float: left;
  168. width: 200px; height: 200px;
  169. margin: 10px;
  170. -webkit-transition: transform .4s ease-out; transition: transform .4s ease-out;
  171. }
  172. .icore-default-li1 { background-color: #4fa9ee; animation: fadeInLeft .5s ease-out .7s both; }
  173. .icore-default-li2 { background-color: #45e3e6; animation: fadeInLeft .5s ease-out .6s both; }
  174. .icore-default-li3 { background-color: #4fa9ee; animation: fadeInLeft .5s ease-out .5s both; }
  175. .icore-default-li4 { background-color: #f2d830; animation: fadeInLeft .5s ease-out .4s both; }
  176. .icore-default-li5 { background-color: #4fa9ee; animation: fadeInLeft .5s ease-out .3s both; }
  177. .icore-default-li6 { background-color: #f26199; animation: fadeInRight .5s ease-out .3s both;}
  178. .icore-default-li7 { background-color: #4fa9ee; animation: fadeInRight .5s ease-out .5s both;}
  179. .icore-default-li8 { background-color: #4cd995; animation: fadeInRight .5s ease-out .7s both;}
  180. .icore-default-li9 { background-color: #4fa9ee; animation: fadeInRight .5s ease-out .9s both;}
  181. .icore-default-li10 { background-color: #f29e55; animation: fadeInRight .5s ease-out 1.1s both;}
  182. .icore-default-li-c {
  183. opacity: 0;
  184. position: absolute; top: 0; left: 0; z-index: 1;
  185. width: 100%; height: 100%;
  186. background-color: #000;
  187. -webkit-transition: opacity .4s ease-out; transition: opacity .4s ease-out;
  188. }
  189. .icore-default-li:hover { transform: scale(1.1, 1.1); }
  190. .icore-default-li:hover > .icore-default-li-c { opacity: .3; box-shadow: 0 0 5px #000; }
  191. .icore-default-li-t {
  192. position: absolute; top: 0; left: 0; z-index: 2;
  193. width: 100%; height: 100%;
  194. font-size: 14px; color: #fff; text-align: center;
  195. }
  196. .icore-default-li-i {
  197. margin-bottom: -40px;
  198. width: 180px; height: 180px;
  199. cursor: default;
  200. }
  201. .icore-default-li-i1 { background-position: -1080px 0px !important;cursor: pointer; }
  202. .icore-default-li-i2 { background-position: -900px 0px !important;cursor: pointer; }
  203. .icore-default-li-i3 { background-position: -1440px 0px !important;cursor: pointer; }
  204. .icore-default-li-i4 { background-position: -1260px 0px !important;cursor: pointer; }
  205. .icore-default-li-i5 { background-position: -720px 0px !important;cursor: pointer; }
  206. .icore-default-li-i6 { background-position: -180px 0px !important;cursor: pointer; }
  207. .icore-default-li-i7 { background-position: 0px 0px !important;cursor: pointer; }
  208. .icore-default-li-i8 { background-position: -540px 0px !important;cursor: pointer; }
  209. .icore-default-li-i9 { background-position: -360px 0px !important;cursor: pointer; }
  210. </style>