@hbisty/qj-common 5.0.8 → 5.1.0

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.1.0",
4
4
  "description": "common files && template for qj-paas",
5
5
  "scripts": {
6
6
  "gulp": "gulp css"
@@ -128,7 +128,7 @@
128
128
  />
129
129
  </el-tooltip>
130
130
  </div>
131
- <div class="msg-content-text" v-html="renderContent(msg)"></div>
131
+ <div class="msg-content-text" v-html="renderContent(msg)" @click="handleLinkClick"></div>
132
132
  </div>
133
133
 
134
134
  <el-empty
@@ -213,16 +213,16 @@ 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
220
- // 商品Code:goodsCode
220
+ // 商品编号:goodsNo
221
221
  // 售后:refundCode
222
222
  if (msg.platform === 'mer') { //商家端
223
- if (expData.goodsCode) { //商品列表
224
- const merGoodsPage = "/paas/merchant-pc/index.html#/goodsList?goodsNo=" + expData.goodsCode;
225
- content = content.replace(expData.goodsCode, `<a href="${merGoodsPage}">${expData.goodsCode}</a>`)
223
+ if (expData.goodsNo) { //商品列表
224
+ const merGoodsPage = "/paas/merchant-pc/index.html#/goodsList?goodsNo=" + expData.goodsNo;
225
+ content = content.replace(expData.goodsNo, `<a href="${merGoodsPage}">${expData.goodsNo}</a>`)
226
226
  }
227
227
  if (expData.contractBillcode) { //订单号
228
228
  if (msg.mnslistBustypeExt === 'mer_service_after_sale_audit') { //退单列表
@@ -238,9 +238,9 @@ export default {
238
238
  content = content.replace(expData.businessDes1, `<a href="${merReceivablePage}">${expData.businessDes1}</a>`)
239
239
  }
240
240
  } else if (msg.platform === 'op') { //运营端
241
- if (expData.goodsCode) { //商品列表
242
- const opGoodsPage = "/paas/bbc-bus-pc/index.html#/auCommoditylist?goodsNo=" + expData.goodsCode;
243
- content = content.replace(expData.goodsCode, `<a href="${opGoodsPage}">${expData.goodsCode}</a>`)
241
+ if (expData.goodsNo) { //商品列表
242
+ const opGoodsPage = "/paas/bbc-bus-pc/index.html#/auCommoditylist?goodsNo=" + expData.goodsNo;
243
+ content = content.replace(expData.goodsNo, `<a href="${opGoodsPage}">${expData.goodsNo}</a>`)
244
244
  }
245
245
  } else if (msg.platform === 'buy') { //商城端
246
246
  if (expData.businessDes1) { //应付账单列表
@@ -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
  }
@@ -498,9 +498,14 @@ export default {
498
498
  this.markAllChecked = false
499
499
  }
500
500
  },
501
- jumpToProduct(code) {
502
- this.$emit('jump-to-product', code)
503
- this.$message.info(`跳转至商品中心 - 商品管理 - 待审核商品列表,商品编号:${code}`)
501
+ handleLinkClick(e) {
502
+ const link = e.target.closest('a')
503
+ if (!link) return
504
+ e.preventDefault()
505
+ const href = link.getAttribute('href')
506
+ window.location.href = href
507
+ window.location.reload()
508
+
504
509
  },
505
510
  closeDrawer() {
506
511
  this.drawerVisible = false
@@ -755,7 +760,7 @@ export default {
755
760
  color: #606266;
756
761
  line-height: 1.6;
757
762
 
758
- .highlight-link {
763
+ a {
759
764
  color: #409eff;
760
765
  cursor: pointer;
761
766
  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() {