@hbisty/qj-common 5.0.4 → 5.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/.babelrc +12 -12
  2. package/.eslintrc.js +25 -25
  3. package/.idea/common.iml +11 -11
  4. package/.idea/modules.xml +7 -7
  5. package/.idea/vcs.xml +5 -5
  6. package/.postcssrc.js +9 -9
  7. package/.prettierrc.js +7 -7
  8. package/.project +37 -37
  9. package/README.md +2 -2
  10. package/gulpfile.js +20 -20
  11. package/package.json +18 -18
  12. package/src/api/apimanage.js +146 -146
  13. package/src/api/common/index.js +192 -192
  14. package/src/api/login.js +160 -160
  15. package/src/api/shopFbu.js +515 -515
  16. package/src/api/siteMsg.js +36 -0
  17. package/src/api/upload.js +8 -8
  18. package/src/components/Bounced/index.vue +145 -145
  19. package/src/components/Breadcrumb/index.vue +71 -71
  20. package/src/components/Checkbox/index.vue +53 -53
  21. package/src/components/Hamburger/index.vue +48 -48
  22. package/src/components/Logistics/logic.vue +186 -186
  23. package/src/components/ScrollBar/index.vue +60 -60
  24. package/src/components/SiteMsg/img/readed-icon.png +0 -0
  25. package/src/components/SiteMsg/img/unread-icon.png +0 -0
  26. package/src/components/SiteMsg/index.vue +773 -0
  27. package/src/components/SiteMsg//347/253/231/345/206/205/344/277/241/346/266/210/346/201/257-/346/216/245/345/217/243/346/226/207/346/241/243.txt +191 -0
  28. package/src/components/Sticky/index.vue +76 -76
  29. package/src/components/SvgIcon/index.vue +42 -42
  30. package/src/components/ThemePicker/index.vue +243 -243
  31. package/src/components/Tinymce/components/editorImage.vue +94 -94
  32. package/src/components/Tinymce/index.vue +166 -166
  33. package/src/components/Tinymce/plugins.js +7 -7
  34. package/src/components/Tinymce/toolbar.js +6 -6
  35. package/src/components/TreeTable/customEval.js +44 -44
  36. package/src/components/TreeTable/eval.js +29 -29
  37. package/src/components/TreeTable/index.vue +124 -124
  38. package/src/components/TreeTable/readme.md +89 -89
  39. package/src/components/TreeTableApi/customEval.js +49 -49
  40. package/src/components/TreeTableApi/eval.js +29 -29
  41. package/src/components/TreeTableApi/index.vue +124 -124
  42. package/src/components/TreeTableApi/readme.md +89 -89
  43. package/src/components/Upload/singleImage.vue +123 -123
  44. package/src/components/Upload/singleImage2.vue +118 -118
  45. package/src/components/Upload/singleImage3.vue +138 -138
  46. package/src/components/Upload/upload.vue +295 -295
  47. package/src/components/workOrderList/index.vue +158 -158
  48. package/src/dependencies.js +119 -119
  49. package/src/iconShop/demo.css +539 -539
  50. package/src/iconShop/demo_index.html +8445 -8445
  51. package/src/iconShop/iconfont.css +1451 -1451
  52. package/src/iconShop/iconfont.json +2522 -2522
  53. package/src/iconShop/iconfont.svg +1070 -1070
  54. package/src/iconfont/demo.css +539 -539
  55. package/src/iconfont/demo_index.html +5276 -5276
  56. package/src/iconfont/iconfont.css +905 -905
  57. package/src/iconfont/iconfont.json +1563 -1563
  58. package/src/iconfont/iconfont.svg +692 -692
  59. package/src/icons/index.js +9 -9
  60. package/src/lang/e.js +48 -48
  61. package/src/lang/en.js +48 -48
  62. package/src/lang/zh.js +48 -48
  63. package/src/main.js +62 -62
  64. package/src/permission.js +283 -283
  65. package/src/permissionForMall.backup.js +375 -375
  66. package/src/permissionForMall.js +375 -375
  67. package/src/preset.js +67 -67
  68. package/src/router/_import_common.js +1 -1
  69. package/src/router/_import_development.js +1 -1
  70. package/src/router/_import_production.js +1 -1
  71. package/src/store/getters.js +39 -39
  72. package/src/store/index.js +18 -18
  73. package/src/store/modules/app.js +34 -34
  74. package/src/store/modules/menu.js +82 -82
  75. package/src/store/modules/user.js +234 -234
  76. package/src/styles/element-ui.scss +1368 -1368
  77. package/src/styles/index.scss +166 -166
  78. package/src/styles/mixin.scss +27 -27
  79. package/src/styles/pc-ui.scss +1031 -1031
  80. package/src/styles/scrollBar.scss +21 -21
  81. package/src/styles/sidebar.scss +123 -123
  82. package/src/styles/transition.scss +32 -32
  83. package/src/styles/variables.scss +44 -44
  84. package/src/styles/wf-ui.scss +86 -86
  85. package/src/utils/auth.js +84 -57
  86. package/src/utils/dom.js +12 -12
  87. package/src/utils/getQueryString.js +5 -5
  88. package/src/utils/import.js +5 -5
  89. package/src/utils/index.js +355 -355
  90. package/src/utils/interceptor.js +34 -34
  91. package/src/utils/menu.js +116 -116
  92. package/src/utils/proapp.js +35 -35
  93. package/src/utils/query.js +26 -26
  94. package/src/utils/request.js +374 -374
  95. package/src/utils/routeMapping.js +39 -39
  96. package/src/utils/routeMapping.json +310 -310
  97. package/src/utils/utils.js +84 -84
  98. package/src/utils/validate.js +102 -102
  99. package/src/views/404.vue +72 -72
  100. package/src/views/Layout.vue +106 -106
  101. package/src/views/imgSwiper/index.vue +34 -34
  102. package/src/views/layout/Layout.vue +181 -181
  103. package/src/views/layout/components/AppMain.vue +20 -20
  104. package/src/views/layout/components/Footer.vue +22 -22
  105. package/src/views/layout/components/LeftNavbar.vue +318 -318
  106. package/src/views/layout/components/NavMenu.vue +15 -15
  107. package/src/views/layout/components/Navbar.vue +765 -695
  108. package/src/views/layout/components/Sidebar/SidebarItem.vue +116 -116
  109. package/src/views/layout/components/Sidebar/index.vue +216 -216
  110. package/src/views/layout/components/index.js +19 -19
  111. package/src/views/layout/theme/darkBlue/Layout.vue +140 -140
  112. package/src/views/layout/theme/darkBlue/components/AppMain.vue +38 -38
  113. package/src/views/layout/theme/darkBlue/components/Footer.vue +147 -147
  114. package/src/views/layout/theme/darkBlue/components/LeftNavbar(/345/261/225/347/244/272/345/205/250/351/203/250/350/217/234/345/215/225).vue +448 -448
  115. package/src/views/layout/theme/darkBlue/components/LeftNavbar.3.vue +191 -191
  116. package/src/views/layout/theme/darkBlue/components/LeftNavbar.vue +466 -466
  117. package/src/views/layout/theme/darkBlue/components/Navbar.vue +200 -200
  118. package/src/views/layout/theme/darkBlue/components/Sidebar/SidebarItem.vue +71 -71
  119. package/src/views/layout/theme/darkBlue/components/Sidebar/index.vue +49 -49
  120. package/src/views/layout/theme/darkBlue/components/index.js +15 -15
  121. package/src/views/layout-default/Layout.vue +134 -134
  122. package/src/views/layout-default/components/AppMain.vue +19 -19
  123. package/src/views/layout-default/components/Footer.vue +22 -22
  124. package/src/views/layout-default/components/LeftNavbar.vue +164 -164
  125. package/src/views/layout-default/components/Navbar.vue +295 -295
  126. package/src/views/layout-default/components/Sidebar/SidebarItem.vue +67 -67
  127. package/src/views/layout-default/components/Sidebar/index.vue +59 -59
  128. package/src/views/layout-default/components/index.js +4 -4
  129. package/src/views/layout-default/theme/darkBlue/Layout.vue +140 -140
  130. package/src/views/layout-default/theme/darkBlue/components/AppMain.vue +38 -38
  131. package/src/views/layout-default/theme/darkBlue/components/Footer.vue +147 -147
  132. package/src/views/layout-default/theme/darkBlue/components/LeftNavbar.vue +465 -465
  133. package/src/views/layout-default/theme/darkBlue/components/Navbar.vue +200 -200
  134. package/src/views/layout-default/theme/darkBlue/components/Sidebar/SidebarItem.vue +69 -69
  135. package/src/views/layout-default/theme/darkBlue/components/Sidebar/index.vue +49 -49
  136. package/src/views/layout-default/theme/darkBlue/components/index.js +15 -15
  137. package/src/views/pc/Internationalization.vue +80 -80
  138. package/src/views/pc/default/Layout.vue +442 -442
  139. package/src/views/pc/default/LayoutCard.vue +424 -424
  140. package/src/views/pc/default/assets/flex.scss +99 -99
  141. package/src/views/pc/default/footer-modules/DgFooter/index.vue +179 -179
  142. package/src/views/pc/default/footer-modules/DgFooter/indexSDX.vue +187 -187
  143. package/src/views/pc/default/footer-modules/footer.vue +171 -171
  144. package/src/views/pc/default/footer-modules/footerAns.vue +167 -167
  145. package/src/views/pc/default/footer-modules/footerBulk.vue +169 -169
  146. package/src/views/pc/default/footer-modules/footerDM.vue +254 -254
  147. package/src/views/pc/default/footer-modules/footerDefault.vue +267 -267
  148. package/src/views/pc/default/footer-modules/footerDefaultA.vue +270 -270
  149. package/src/views/pc/default/footer-modules/footerDefaultNew.vue +201 -201
  150. package/src/views/pc/default/footer-modules/footerHDB.vue +153 -153
  151. package/src/views/pc/default/footer-modules/footerHy.vue +63 -63
  152. package/src/views/pc/default/footer-modules/footerKYW.vue +163 -163
  153. package/src/views/pc/default/footer-modules/footerMh.vue +30 -30
  154. package/src/views/pc/default/footer-modules/footerNew.vue +116 -116
  155. package/src/views/pc/default/footer-modules/footer_yzj.vue +169 -169
  156. package/src/views/pc/default/footer-modules/footerayd.vue +85 -85
  157. package/src/views/pc/default/footer-modules/ymFooter.vue +154 -154
  158. package/src/views/pc/default/footer-modules/zgl.vue +250 -250
  159. package/src/views/pc/default/header-modules/DgHeader/Logo.vue +57 -57
  160. package/src/views/pc/default/header-modules/DgHeader/Search.vue +135 -135
  161. package/src/views/pc/default/header-modules/DgHeader/Settleup.vue +46 -46
  162. package/src/views/pc/default/header-modules/DgHeader/index.vue +38 -38
  163. package/src/views/pc/default/header-modules/active.vue +177 -177
  164. package/src/views/pc/default/header-modules/header.vue +97 -97
  165. package/src/views/pc/default/header-modules/headerA.vue +142 -142
  166. package/src/views/pc/default/header-modules/headerFLPT.vue +157 -157
  167. package/src/views/pc/default/header-modules/headerMh.vue +187 -187
  168. package/src/views/pc/default/header-modules/headerNew.vue +121 -121
  169. package/src/views/pc/default/header-modules/headerSDX.vue +304 -304
  170. package/src/views/pc/default/header-modules/headerStyle2.vue +173 -173
  171. package/src/views/pc/default/header-modules/headerStyle3.vue +190 -190
  172. package/src/views/pc/default/header-modules/headerStyle4.vue +163 -163
  173. package/src/views/pc/default/header-modules/headerStyleAns.vue +400 -400
  174. package/src/views/pc/default/header-modules/headerStyleBulk.vue +427 -427
  175. package/src/views/pc/default/header-modules/headerStyleDefalut.vue +209 -209
  176. package/src/views/pc/default/header-modules/headerStyleKYW.vue +435 -435
  177. package/src/views/pc/default/header-modules/headerStyle_yzj.vue +427 -427
  178. package/src/views/pc/default/header-modules/headerayd.vue +187 -187
  179. package/src/views/pc/default/header-modules/index.vue +466 -466
  180. package/src/views/pc/default/header-modules/ymHeader.vue +292 -292
  181. package/src/views/pc/default/header-modules/ysHeader.vue +248 -248
  182. package/src/views/pc/default/header-modules/zgl.vue +855 -855
  183. package/src/views/pc/default/leftMenu-modules/leftMenu-logo.vue +194 -194
  184. package/src/views/pc/default/leftMenu-modules/leftMenu-style2.vue +206 -206
  185. package/src/views/pc/default/leftMenu-modules/leftMenu-style3.vue +207 -207
  186. package/src/views/pc/default/leftMenu-modules/leftMenu-style4.vue +192 -192
  187. package/src/views/pc/default/leftMenu-modules/leftMenu.vue +183 -183
  188. package/src/views/pc/default/leftMenu-modules/leftMenuDefault.vue +212 -212
  189. package/src/views/pc/default/leftMenu-modules/leftMenuDefaultEn.vue +214 -214
  190. package/src/views/pc/default/leftMenu-modules/leftMenuDefaultFLPT.vue +220 -220
  191. package/src/views/pc/default/leftMenu-modules/leftMenuDefaultayd.vue +220 -220
  192. package/src/views/pc/default/nav-modules/nav.vue +52 -52
  193. package/src/views/pc/default/nav-modules/navAns.vue +60 -60
  194. package/src/views/pc/default/nav-modules/navBulk.vue +60 -60
  195. package/src/views/pc/default/top-modules/DgTopShortcut/index.vue +177 -177
  196. package/src/views/pc/default/top-modules/Toplg.vue +280 -280
  197. package/src/views/pc/default/top-modules/topA.vue +136 -136
  198. package/src/views/pc/default/top-modules/topAns.vue +261 -261
  199. package/src/views/pc/default/top-modules/topAns_yzj.vue +282 -282
  200. package/src/views/pc/default/top-modules/topBar.vue +304 -304
  201. package/src/views/pc/default/top-modules/topBulk.vue +280 -280
  202. package/src/views/pc/default/top-modules/topDefault.vue +244 -244
  203. package/src/views/pc/default/top-modules/topDefaultDM.vue +197 -197
  204. package/src/views/pc/default/top-modules/topDefaultNew.vue +271 -271
  205. package/src/views/pc/default/top-modules/topFLPT.vue +197 -197
  206. package/src/views/pc/default/top-modules/topHDB.vue +479 -479
  207. package/src/views/pc/default/top-modules/topKYW.vue +258 -258
  208. package/src/views/pc/default/top-modules/topMh.vue +174 -174
  209. package/src/views/pc/default/top-modules/topNew.vue +97 -97
  210. package/src/views/pc/default/top-modules/topSDX.vue +298 -298
  211. package/src/views/pc/default/top-modules/topSimple.vue +247 -247
  212. package/src/views/pc/default/top-modules/topSimpleHy.vue +256 -256
  213. package/src/views/pc/default/top-modules/topUcc.vue +264 -264
  214. package/src/views/pc/default/top-modules/topayd.vue +170 -170
  215. package/src/views/pc/default/top-modules/ymTop.vue +299 -299
  216. package/src/views/pc/default/top-modules/zgltop.vue +499 -499
  217. package/src/views/routerView.vue +9 -9
  218. package/src/views/templates/components/temp-select.vue +80 -80
  219. package/src/views/templates/components/temp-upload.vue +233 -233
  220. package/src/views/templates/readme.md +2 -2
  221. package/src/views/templates/templateInput.vue +421 -421
  222. package/src/views/templates/templateReadme.html +588 -588
  223. package/src/views/templates/templateReadme.md +619 -619
  224. package/src/views/templates/templateTable.vue +2244 -2244
  225. package/src/views/templates/templateTableData.vue +1883 -1883
  226. package/src/views/templates/templateUi/templateTableContent.vue +187 -187
  227. package/src/views/treeTemplate/index.vue +559 -559
  228. package/src/views/treeTemplate/treeTemplate.md +274 -274
  229. package/src/views/uploadDialog/index copy.vue +352 -352
  230. package/src/views/uploadDialog/index.vue +558 -558
  231. package/src/views/uploadDialog/indexOlay.vue +582 -582
  232. package/src/views/uploadDialog/indexPM.vue +578 -578
  233. package/src/views/uploadDialog/indexUpload.vue +543 -543
  234. package/src/views/uploadDialog/readme.md +45 -45
package/src/permission.js CHANGED
@@ -1,283 +1,283 @@
1
- // Main of Application
2
- import main from '#/main';
3
-
4
- // White List
5
- const whiteList = [`b2b.heidelbergchina.com`, `uatb2b.heidelbergchina.com`];
6
-
7
- // Executor
8
- main(({ menuActions }, { proApp, router, store, _import, _import_common, NProgress, PageNotFound, domCreate, interceptor, queryParams, getActiveMenu, generateRoutesFromMenu }) => {
9
- // Get Info of Pro App
10
- // const { proappEnvLayout, proappEnv, proappType, Layout } = proApp('commerce');
11
- // Set Mode
12
- const type = whiteList.includes(location.host) ? 'pc' : 'commerce';
13
-
14
- // Get Info of Pro App
15
- const { proappEnvLayout, proappEnv, proappType, Layout } = proApp(type);
16
-
17
- // Get Interceptor
18
- const { before, after } = interceptor(router, NProgress, proappEnvLayout, queryParams);
19
-
20
- // Interceptor of Route -- Before
21
- before((to, from, next) => {
22
- // Set Title of Document
23
- if (proappEnvLayout && proappEnvLayout.proappEnvName) {
24
- document.title = proappEnvLayout.proappEnvName;
25
- }
26
-
27
- // Localhost
28
- if (location.hostname === 'localhost') {
29
- return next();
30
- }
31
-
32
- // Dispatch GetAppInfo
33
- store.dispatch('GetAppInfo').then((res) => {
34
- // Get App Path
35
- const appPath = process.env.APP_PATH;
36
-
37
- // Preset Menu List
38
- const menuList = JSON.parse(window.sessionStorage.getItem('menuList') || null);
39
-
40
- // Is Load Routes
41
- if (store.getters.isLoadRoutes) {
42
- return next(), localStorage.setItem('_params', to.meta.params || '');
43
- }
44
-
45
- // Menu from Storage
46
- if (menuList && menuList.routerMap) {
47
- // Current Routes
48
- if (menuList.routerMap[appPath]) {
49
- return menuList.routerMap[appPath].forEach((el) => {
50
- handleRouter(el.children);
51
- });
52
- }
53
-
54
- // Is Index or Not
55
- return appPath === 'index' ? handleRouter() : Message.error(`您还没有配${appPath}模块的路由`);
56
- }
57
-
58
- // No Storage
59
- store.dispatch('GetAppRouter').then((menuList) => {
60
- // Current Routes
61
- if (menuList.routerMap && menuList.routerMap[appPath]) {
62
- return menuList.routerMap[appPath].forEach((el) => {
63
- handleRouter(el.children);
64
- });
65
- }
66
-
67
- // Is Index or Not
68
- return appPath === 'index' ? handleRouter() : Message.error(`您还没有配${appPath}模块的路由`);
69
- });
70
- });
71
-
72
- /**
73
- * Functions
74
- * ========== ========== ==========
75
- */
76
-
77
- function handleMenu() {
78
- // Set Menu List
79
- let menuList = window.sessionStorage.getItem('menuList') ? JSON.parse(window.sessionStorage.getItem('menuList')).menuList : null;
80
-
81
- // No Menu List
82
- if (!menuList) {
83
- return;
84
- }
85
-
86
- // Const Menu
87
- const menu = {};
88
-
89
- // Set Menu
90
- menuList && menuList.forEach((element) => (menu[element.proappModelCode] = element.children));
91
-
92
- // Set Code
93
- menuCode(menuList);
94
-
95
- // Set Menu into Storage
96
- window.sessionStorage.setItem('menu', JSON.stringify(menu));
97
- }
98
-
99
- function menuCode(data) {
100
- if (!data || !data.length) {
101
- return;
102
- }
103
-
104
- data.forEach((item) => {
105
- if (item.menuCode === 'P0000111') {
106
- return window.sessionStorage.setItem('menuAction', item.menuAction);
107
- }
108
-
109
- if (item.children && item.children.length > 0) {
110
- menuCode(item.children);
111
- }
112
- });
113
- }
114
-
115
- function handleRouter(data) {
116
- // First
117
- handleMenu();
118
-
119
- // No Data Stop
120
- if (!data) {
121
- next();
122
- return false;
123
- }
124
-
125
- if ('success' in data && !data.success) {
126
- return false;
127
- }
128
-
129
- // Set Menus for Add Routes
130
- const menus = [
131
- {
132
- path: '/404',
133
- redirect: '/404',
134
- component: Layout,
135
- children: [
136
- {
137
- path: '',
138
- hidden: true,
139
- component: PageNotFound,
140
- },
141
- ],
142
- },
143
- {
144
- path: '*',
145
- redirect: '/404',
146
- },
147
- ];
148
-
149
- // Data of Layout
150
- const dataLayout = [];
151
-
152
- // No Data Layout
153
- const noneLayout = [];
154
-
155
- // Check Action by Preset
156
- data.forEach((e) => (menuActions.includes(e.menuAction) ? noneLayout.push(e) : dataLayout.push(e)));
157
-
158
- // Check First for No Data
159
- noneLayout.forEach((item) => {
160
- // 只做一级
161
- menus.push({
162
- path: '/' + item.menuAction,
163
- component: _import(item.menuJspath),
164
- meta: {
165
- params: item.proappMenuQparam,
166
- menuCode: item.proappModelCode,
167
- },
168
- });
169
- });
170
-
171
- menus.push({
172
- component: window.parent === window ? Layout : _import('routerView'),
173
- meta: {
174
- params: dataLayout.proappMenuQparam,
175
- menuCode: dataLayout.proappModelCode,
176
- },
177
- path: '/',
178
- hidden: true,
179
- redirect: getActiveMenu(dataLayout),
180
- children: generateRoutesFromMenu(dataLayout),
181
- });
182
-
183
- if (proappEnvLayout && proappEnvLayout.proappEnvIndex) {
184
- // Set hash
185
- const hash = proappEnvLayout.proappEnvIndex.split('#')[1];
186
-
187
- //重定向首页
188
- menus.push({
189
- path: '',
190
- redirect: `/${hash}`,
191
- children: [
192
- {
193
- path: `/${hash}`, //运营端
194
- name: '首页',
195
- meta: {
196
- title: '首页',
197
- },
198
- component: `_import(${hash}/index)`,
199
- beforeEnter: (to, from, next) => {
200
- if (store.state.user.name) {
201
- return next();
202
- }
203
-
204
- getInfo().then(({ dataObj }) => {
205
- store.commit('SET_NAME', dataObj.userName), next();
206
- });
207
- },
208
- },
209
- ],
210
- });
211
- }
212
-
213
- store.commit('ADD_MENU', menus);
214
- store.commit('LOAD_ROUTES');
215
- router.options.routes = [...menus, ...router.options.routes];
216
- router.addRoutes([...menus]);
217
-
218
- next({
219
- path: to.path,
220
- query: queryParams(),
221
- });
222
- }
223
- });
224
-
225
- // Interceptor of Route -- After
226
- after((to, from, next) => {
227
- // No Layout
228
- if (!proappEnvLayout) {
229
- return;
230
- }
231
- let arr = document.getElementsByTagName('link') || [];
232
- let link, head;
233
- // Get Head
234
- if (Array.isArray(arr)) {
235
- head = document.getElementsByTagName('head')[0];
236
- // Extension Metas
237
- const keywords = domCreate('meta', {
238
- name: 'keywords',
239
- content: proappEnvLayout.proappEnvDes,
240
- });
241
-
242
- const description = domCreate('meta', {
243
- name: 'description',
244
- content: proappEnvLayout.proappEnvDes,
245
- });
246
-
247
- // Insert
248
- head.appendChild(keywords);
249
- head.appendChild(description);
250
- }
251
- if (Array.isArray(arr) && arr.length > 1) {
252
- // Extension Link of 1 ?
253
- link = document.getElementsByTagName('link')[1];
254
- // Set Href of Link
255
- link.href = '';
256
- link.href = proappEnvLayout.proappEnvIconUrl;
257
- }
258
- // // Extension Link of 1 ?
259
- // const link = document.getElementsByTagName('link')[1];
260
-
261
- // // Get Head
262
- // const head = document.getElementsByTagName('head')[0];
263
-
264
- // // Set Href of Link
265
- // link.href = '';
266
- // link.href = proappEnvLayout.proappEnvIconUrl;
267
-
268
- // // Extension Metas
269
- // const keywords = domCreate('meta', {
270
- // name: 'keywords',
271
- // content: proappEnvLayout.proappEnvDes,
272
- // });
273
-
274
- // const description = domCreate('meta', {
275
- // name: 'description',
276
- // content: proappEnvLayout.proappEnvDes,
277
- // });
278
-
279
- // // Insert
280
- // head.appendChild(keywords);
281
- // head.appendChild(description);
282
- });
283
- });
1
+ // Main of Application
2
+ import main from '#/main';
3
+
4
+ // White List
5
+ const whiteList = [`b2b.heidelbergchina.com`, `uatb2b.heidelbergchina.com`];
6
+
7
+ // Executor
8
+ main(({ menuActions }, { proApp, router, store, _import, _import_common, NProgress, PageNotFound, domCreate, interceptor, queryParams, getActiveMenu, generateRoutesFromMenu }) => {
9
+ // Get Info of Pro App
10
+ // const { proappEnvLayout, proappEnv, proappType, Layout } = proApp('commerce');
11
+ // Set Mode
12
+ const type = whiteList.includes(location.host) ? 'pc' : 'commerce';
13
+
14
+ // Get Info of Pro App
15
+ const { proappEnvLayout, proappEnv, proappType, Layout } = proApp(type);
16
+
17
+ // Get Interceptor
18
+ const { before, after } = interceptor(router, NProgress, proappEnvLayout, queryParams);
19
+
20
+ // Interceptor of Route -- Before
21
+ before((to, from, next) => {
22
+ // Set Title of Document
23
+ if (proappEnvLayout && proappEnvLayout.proappEnvName) {
24
+ document.title = proappEnvLayout.proappEnvName;
25
+ }
26
+
27
+ // Localhost
28
+ if (location.hostname === 'localhost') {
29
+ return next();
30
+ }
31
+
32
+ // Dispatch GetAppInfo
33
+ store.dispatch('GetAppInfo').then((res) => {
34
+ // Get App Path
35
+ const appPath = process.env.APP_PATH;
36
+
37
+ // Preset Menu List
38
+ const menuList = JSON.parse(window.sessionStorage.getItem('menuList') || null);
39
+
40
+ // Is Load Routes
41
+ if (store.getters.isLoadRoutes) {
42
+ return next(), localStorage.setItem('_params', to.meta.params || '');
43
+ }
44
+
45
+ // Menu from Storage
46
+ if (menuList && menuList.routerMap) {
47
+ // Current Routes
48
+ if (menuList.routerMap[appPath]) {
49
+ return menuList.routerMap[appPath].forEach((el) => {
50
+ handleRouter(el.children);
51
+ });
52
+ }
53
+
54
+ // Is Index or Not
55
+ return appPath === 'index' ? handleRouter() : Message.error(`您还没有配${appPath}模块的路由`);
56
+ }
57
+
58
+ // No Storage
59
+ store.dispatch('GetAppRouter').then((menuList) => {
60
+ // Current Routes
61
+ if (menuList.routerMap && menuList.routerMap[appPath]) {
62
+ return menuList.routerMap[appPath].forEach((el) => {
63
+ handleRouter(el.children);
64
+ });
65
+ }
66
+
67
+ // Is Index or Not
68
+ return appPath === 'index' ? handleRouter() : Message.error(`您还没有配${appPath}模块的路由`);
69
+ });
70
+ });
71
+
72
+ /**
73
+ * Functions
74
+ * ========== ========== ==========
75
+ */
76
+
77
+ function handleMenu() {
78
+ // Set Menu List
79
+ let menuList = window.sessionStorage.getItem('menuList') ? JSON.parse(window.sessionStorage.getItem('menuList')).menuList : null;
80
+
81
+ // No Menu List
82
+ if (!menuList) {
83
+ return;
84
+ }
85
+
86
+ // Const Menu
87
+ const menu = {};
88
+
89
+ // Set Menu
90
+ menuList && menuList.forEach((element) => (menu[element.proappModelCode] = element.children));
91
+
92
+ // Set Code
93
+ menuCode(menuList);
94
+
95
+ // Set Menu into Storage
96
+ window.sessionStorage.setItem('menu', JSON.stringify(menu));
97
+ }
98
+
99
+ function menuCode(data) {
100
+ if (!data || !data.length) {
101
+ return;
102
+ }
103
+
104
+ data.forEach((item) => {
105
+ if (item.menuCode === 'P0000111') {
106
+ return window.sessionStorage.setItem('menuAction', item.menuAction);
107
+ }
108
+
109
+ if (item.children && item.children.length > 0) {
110
+ menuCode(item.children);
111
+ }
112
+ });
113
+ }
114
+
115
+ function handleRouter(data) {
116
+ // First
117
+ handleMenu();
118
+
119
+ // No Data Stop
120
+ if (!data) {
121
+ next();
122
+ return false;
123
+ }
124
+
125
+ if ('success' in data && !data.success) {
126
+ return false;
127
+ }
128
+
129
+ // Set Menus for Add Routes
130
+ const menus = [
131
+ {
132
+ path: '/404',
133
+ redirect: '/404',
134
+ component: Layout,
135
+ children: [
136
+ {
137
+ path: '',
138
+ hidden: true,
139
+ component: PageNotFound,
140
+ },
141
+ ],
142
+ },
143
+ {
144
+ path: '*',
145
+ redirect: '/404',
146
+ },
147
+ ];
148
+
149
+ // Data of Layout
150
+ const dataLayout = [];
151
+
152
+ // No Data Layout
153
+ const noneLayout = [];
154
+
155
+ // Check Action by Preset
156
+ data.forEach((e) => (menuActions.includes(e.menuAction) ? noneLayout.push(e) : dataLayout.push(e)));
157
+
158
+ // Check First for No Data
159
+ noneLayout.forEach((item) => {
160
+ // 只做一级
161
+ menus.push({
162
+ path: '/' + item.menuAction,
163
+ component: _import(item.menuJspath),
164
+ meta: {
165
+ params: item.proappMenuQparam,
166
+ menuCode: item.proappModelCode,
167
+ },
168
+ });
169
+ });
170
+
171
+ menus.push({
172
+ component: window.parent === window ? Layout : _import('routerView'),
173
+ meta: {
174
+ params: dataLayout.proappMenuQparam,
175
+ menuCode: dataLayout.proappModelCode,
176
+ },
177
+ path: '/',
178
+ hidden: true,
179
+ redirect: getActiveMenu(dataLayout),
180
+ children: generateRoutesFromMenu(dataLayout),
181
+ });
182
+
183
+ if (proappEnvLayout && proappEnvLayout.proappEnvIndex) {
184
+ // Set hash
185
+ const hash = proappEnvLayout.proappEnvIndex.split('#')[1];
186
+
187
+ //重定向首页
188
+ menus.push({
189
+ path: '',
190
+ redirect: `/${hash}`,
191
+ children: [
192
+ {
193
+ path: `/${hash}`, //运营端
194
+ name: '首页',
195
+ meta: {
196
+ title: '首页',
197
+ },
198
+ component: `_import(${hash}/index)`,
199
+ beforeEnter: (to, from, next) => {
200
+ if (store.state.user.name) {
201
+ return next();
202
+ }
203
+
204
+ getInfo().then(({ dataObj }) => {
205
+ store.commit('SET_NAME', dataObj.userName), next();
206
+ });
207
+ },
208
+ },
209
+ ],
210
+ });
211
+ }
212
+
213
+ store.commit('ADD_MENU', menus);
214
+ store.commit('LOAD_ROUTES');
215
+ router.options.routes = [...menus, ...router.options.routes];
216
+ router.addRoutes([...menus]);
217
+
218
+ next({
219
+ path: to.path,
220
+ query: queryParams(),
221
+ });
222
+ }
223
+ });
224
+
225
+ // Interceptor of Route -- After
226
+ after((to, from, next) => {
227
+ // No Layout
228
+ if (!proappEnvLayout) {
229
+ return;
230
+ }
231
+ let arr = document.getElementsByTagName('link') || [];
232
+ let link, head;
233
+ // Get Head
234
+ if (Array.isArray(arr)) {
235
+ head = document.getElementsByTagName('head')[0];
236
+ // Extension Metas
237
+ const keywords = domCreate('meta', {
238
+ name: 'keywords',
239
+ content: proappEnvLayout.proappEnvDes,
240
+ });
241
+
242
+ const description = domCreate('meta', {
243
+ name: 'description',
244
+ content: proappEnvLayout.proappEnvDes,
245
+ });
246
+
247
+ // Insert
248
+ head.appendChild(keywords);
249
+ head.appendChild(description);
250
+ }
251
+ if (Array.isArray(arr) && arr.length > 1) {
252
+ // Extension Link of 1 ?
253
+ link = document.getElementsByTagName('link')[1];
254
+ // Set Href of Link
255
+ link.href = '';
256
+ link.href = proappEnvLayout.proappEnvIconUrl;
257
+ }
258
+ // // Extension Link of 1 ?
259
+ // const link = document.getElementsByTagName('link')[1];
260
+
261
+ // // Get Head
262
+ // const head = document.getElementsByTagName('head')[0];
263
+
264
+ // // Set Href of Link
265
+ // link.href = '';
266
+ // link.href = proappEnvLayout.proappEnvIconUrl;
267
+
268
+ // // Extension Metas
269
+ // const keywords = domCreate('meta', {
270
+ // name: 'keywords',
271
+ // content: proappEnvLayout.proappEnvDes,
272
+ // });
273
+
274
+ // const description = domCreate('meta', {
275
+ // name: 'description',
276
+ // content: proappEnvLayout.proappEnvDes,
277
+ // });
278
+
279
+ // // Insert
280
+ // head.appendChild(keywords);
281
+ // head.appendChild(description);
282
+ });
283
+ });