@hbisty/qj-common 5.0.8 → 5.0.9

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hbisty/qj-common",
3
- "version": "5.0.8",
3
+ "version": "5.0.9",
4
4
  "description": "common files && template for qj-paas",
5
5
  "scripts": {
6
6
  "gulp": "gulp css"
@@ -213,7 +213,7 @@ export default {
213
213
  if (msg.content) {
214
214
  let content = msg.content;
215
215
  if (msg.mnslistExp && msg.mnslistExp.bizLinkData) {
216
- const expData = msg.mnslistExp.bizLinkData
216
+ const expData = JSON.parse(msg.mnslistExp.bizLinkData)
217
217
  // 平台类型消息跳转处理
218
218
  // 订单号:contractBillcode
219
219
  // 订单批次号:contractBbillcode
@@ -249,7 +249,7 @@ export default {
249
249
  }
250
250
  if (expData.contractBillcode) { //订单号
251
251
  if (msg.mnslistBustypeExt.includes('buy_service_after_sale')) { //售后列表
252
- const buyRefundPage = "/paas/bbc-cli-pc/index.html#/user?toPath=afterSalesSales&contractBillcode=" + expData.contractBillcode;
252
+ const buyRefundPage = "/paas/bbc-cli-pc/index.html#/user?toPath=afterSales&contractBillcode=" + expData.contractBillcode;
253
253
  content = content.replace(expData.contractBillcode, `<a href="${buyRefundPage}">${expData.contractBillcode}</a>`)
254
254
  } else { //订单列表
255
255
  const buyOrderPage = "/paas/bbc-cli-pc/index.html#/user?toPath=order&contractBillcode=" + expData.contractBillcode;
@@ -392,7 +392,7 @@ export default {
392
392
  content: row.mnslistContent || '',
393
393
  isRead: String(row.stateExt) === '1',
394
394
  raw: row,
395
- mnslistExp: row.mnslistExp,
395
+ mnslistExp: mnslistExp,
396
396
  platform: platform || '',
397
397
  mnslistBustypeExt: row.mnslistBustypeExt || ''
398
398
  }
@@ -755,7 +755,7 @@ export default {
755
755
  color: #606266;
756
756
  line-height: 1.6;
757
757
 
758
- .highlight-link {
758
+ a {
759
759
  color: #409eff;
760
760
  cursor: pointer;
761
761
  text-decoration: none;
@@ -34,6 +34,27 @@ export default {
34
34
  },
35
35
 
36
36
  methods: {
37
+ // 根据 $route.path(对应最深层的 menuAction)在 sessionStorage['menu'] 中反查所属一级菜单的 menuCode(key)
38
+ findMenuCodeBySession() {
39
+ try {
40
+ const raw = window.sessionStorage.getItem('menu');
41
+ if (!raw || raw === '{}') return null;
42
+ const menuData = JSON.parse(raw) || {};
43
+ const routePath = this.$route.path.replace('/', '');
44
+ if (!routePath) return null;
45
+ // 递归匹配节点自身及 children / routechildren 中的 menuAction
46
+ const hasMatch = (node) => {
47
+ if (!node) return false;
48
+ if (node.menuAction === routePath) return true;
49
+ return [].concat(node.children || [], node.routechildren || []).some(hasMatch);
50
+ };
51
+ const code = Object.keys(menuData).find((key) => (menuData[key] || []).some(hasMatch));
52
+ return code || null;
53
+ } catch (err) {
54
+ console.log('出错了' + err);
55
+ return null;
56
+ }
57
+ },
37
58
  getMenuList() {
38
59
  let menuList = window.sessionStorage.getItem('menuList') ? JSON.parse(window.sessionStorage.getItem('menuList')).menuList : null,
39
60
  code = window.sessionStorage.getItem('menuCode'),
@@ -132,6 +153,13 @@ export default {
132
153
  this.handleMenu(menuList.menuList);
133
154
  }
134
155
  }
156
+ // meta 和缓存都没有 menuCode 时,用当前路由在菜单树中反查一级菜单 key
157
+ if (!menuCode) {
158
+ menuCode = this.findMenuCodeBySession();
159
+ if (menuCode) {
160
+ window.sessionStorage.setItem('menuCode', menuCode);
161
+ }
162
+ }
135
163
  return window.sessionStorage.getItem('menu') ? JSON.parse(window.sessionStorage.getItem('menu'))[menuCode] : null;
136
164
  },
137
165
  isActive() {