n20-common-lib 2.2.18 → 2.2.20

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": "n20-common-lib",
3
- "version": "2.2.18",
3
+ "version": "2.2.20",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -66,7 +66,7 @@
66
66
  </el-dropdown-menu>
67
67
  </el-dropdown>
68
68
 
69
- <el-badge :hidden="noticeNum === 0" :value="noticeNum" class="m-l-m">
69
+ <el-badge :hidden="noticeNum + afficheNum === 0" :value="noticeNum + afficheNum">
70
70
  <span v-popover:noticePop class="news-btn el-icon-bell header-color"></span>
71
71
  </el-badge>
72
72
 
@@ -158,7 +158,7 @@
158
158
  </dialogWrap>
159
159
  <!-- 消息/通知 -->
160
160
  <el-popover ref="noticePop" trigger="click" width="400" @after-enter="$refs.noticeContent.show()">
161
- <noticePop ref="noticeContent" />
161
+ <noticePop ref="noticeContent" :notice-num="noticeNum" :affiche-num="afficheNum" />
162
162
  </el-popover>
163
163
  <el-dialog :visible.sync="scV" :title="'切换用户' | $lc" append-to-body width="600px">
164
164
  <switchUser :visible.sync="scV" :user-no="userNo" />
@@ -242,6 +242,7 @@ export default {
242
242
  themeList,
243
243
  themeVal: window.localStorage.getItem('pageTheme') || 'default',
244
244
  noticeNum: 0,
245
+ afficheNum: 0,
245
246
  rolesList: [],
246
247
  scV: false,
247
248
  underway: false
@@ -444,14 +445,14 @@ export default {
444
445
  getNNum() {
445
446
  clearTimeout(this.getNNumTimeOut)
446
447
  if (!document.hidden) {
447
- Promise.all([
448
- axios.get('/bems/wkb/messageCenter/getUnReadTotal/' + this.userNo, null, { loading: false, noMsg: true }),
449
- axios.get('/bems/1.0/notice/notReadCount', null, {
450
- loading: false,
451
- noMsg: true
448
+ axios
449
+ .get('/bems/wkb/messageCenter/getUnReadTotal/' + this.userNo, null, { loading: false, noMsg: true })
450
+ .then((res) => {
451
+ this.noticeNum = res.data.data || 0
452
452
  })
453
- ]).then(([res_1, res_2]) => {
454
- this.noticeNum = (res_1.data.data || 0) + (res_2.data || 0)
453
+
454
+ axios.get('/bems/1.0/notice/notReadCount', null, { loading: false, noMsg: true }).then((res) => {
455
+ this.afficheNum = res.data || 0
455
456
  })
456
457
 
457
458
  this.getNNumTimeOut = setTimeout(this.loopGetNNum, 1000 * 60 * 3)
@@ -75,7 +75,7 @@
75
75
  <span class="set-user-btn iconfont icon-kehuduanxiazai header-color m-l-lg" @click="dowApp"></span>
76
76
  </el-tooltip>
77
77
 
78
- <el-badge :hidden="noticeNum === 0" :value="noticeNum">
78
+ <el-badge :hidden="noticeNum + afficheNum === 0" :value="noticeNum + afficheNum">
79
79
  <span v-if="!noticeDrw" v-popover:noticePop class="news-btn iconfont icon-xiaoxi header-color"></span>
80
80
  <span v-else class="news-btn iconfont icon-xiaoxi header-color" @click="customOpt.noticeDrawer"></span>
81
81
  </el-badge>
@@ -220,7 +220,7 @@
220
220
  </dialogWrap>
221
221
  <!-- 消息/通知 -->
222
222
  <el-popover v-if="!noticeDrw" ref="noticePop" trigger="click" width="400" @after-enter="$refs.noticeContent.show()">
223
- <noticePop ref="noticeContent" />
223
+ <noticePop ref="noticeContent" :notice-num="noticeNum" :affiche-num="afficheNum" />
224
224
  </el-popover>
225
225
  <el-dialog :visible.sync="scV" :title="'切换用户' | $lc" append-to-body width="600px">
226
226
  <switchUser :visible.sync="scV" :user-no="userNo" />
@@ -304,6 +304,7 @@ export default {
304
304
  themeList,
305
305
  themeVal: window.localStorage.getItem('pageTheme') || 'default',
306
306
  noticeNum: 0,
307
+ afficheNum: 0,
307
308
  rolesList: [],
308
309
  scV: false,
309
310
  underway: false,
@@ -543,7 +544,7 @@ export default {
543
544
  let { base = '/' } = this.$router.options
544
545
  if (!/\/$/.test(base)) base += '/'
545
546
 
546
- window.location.href = window.location.origin + base
547
+ window.location.href = window.location.origin + base + 'dashboard/workplace'
547
548
  },
548
549
  toSystem() {
549
550
  window.localStorage.setItem('pageInType', 'toFront')
@@ -551,7 +552,7 @@ export default {
551
552
  let { base = '/' } = this.$router.options
552
553
  if (!/\/$/.test(base)) base += '/'
553
554
 
554
- window.location.href = window.location.origin + base
555
+ window.location.href = window.location.origin + base + 'dashboard/workplace'
555
556
  },
556
557
  getUserImg() {
557
558
  return this.$axios
@@ -602,14 +603,14 @@ export default {
602
603
  getNNum() {
603
604
  clearTimeout(this.getNNumTimeOut)
604
605
  if (!document.hidden) {
605
- Promise.all([
606
- axios.get('/bems/wkb/messageCenter/getUnReadTotal/' + this.userNo, null, { loading: false, noMsg: true }),
607
- axios.get('/bems/1.0/notice/notReadCount', null, {
608
- loading: false,
609
- noMsg: true
606
+ axios
607
+ .get('/bems/wkb/messageCenter/getUnReadTotal/' + this.userNo, null, { loading: false, noMsg: true })
608
+ .then((res) => {
609
+ this.noticeNum = res.data.data || 0
610
610
  })
611
- ]).then(([res_1, res_2]) => {
612
- this.noticeNum = (res_1.data.data || 0) + (res_2.data || 0)
611
+
612
+ axios.get('/bems/1.0/notice/notReadCount', null, { loading: false, noMsg: true }).then((res) => {
613
+ this.afficheNum = res.data || 0
613
614
  })
614
615
 
615
616
  this.getNNumTimeOut = setTimeout(this.loopGetNNum, 1000 * 60 * 3)
@@ -81,6 +81,10 @@ export default {
81
81
  return `【${msgT}】${item.title}`
82
82
  }
83
83
  },
84
+ props: {
85
+ noticeNum: { type: Number, default: 0 },
86
+ afficheNum: { type: Number, default: 0 }
87
+ },
84
88
  data() {
85
89
  return {
86
90
  showKey: 0,
@@ -88,8 +92,6 @@ export default {
88
92
  username: sessionStorage.getItem('userNo'),
89
93
  nLd: false,
90
94
  aLd: false,
91
- noticeNum: 0,
92
- afficheNum: 0,
93
95
  noticeList: [],
94
96
  noticeTotal: 0,
95
97
  afficheList: [],
@@ -171,7 +173,6 @@ export default {
171
173
  .put(`/bems/wkb/messageCenter/batchUpdate`, { ids: [item.id], type: '1' }, { loading: false, noMsg: true })
172
174
  .then(() => {
173
175
  item.readState = '1'
174
- this.noticeNum = this.noticeNum - 1
175
176
  window.postMessage('NstcUpdateNotice')
176
177
  })
177
178
  }
@@ -40,14 +40,17 @@ async function asyncGetRelaNos(appNo, rns) {
40
40
  oRelaNos = [...new Set(oRelaNos)]
41
41
  rnObj.relaNos = oRelaNos
42
42
 
43
+ let syncArr = window._keep_syncStorageAppNos
44
+ let isSync = appNo && syncArr && syncArr.includes(appNo)
45
+
43
46
  // sessionStorage.setItem('relaNos', JSON.stringify(ssRelaNos))
44
- setItem('relaNos', ssRelaNos)
47
+ setItem('relaNos', ssRelaNos, isSync)
45
48
  // sessionStorage.setItem('cltrelaNos', JSON.stringify(ssCltrelaNos))
46
- setItem('cltrelaNos', ssCltrelaNos)
49
+ setItem('cltrelaNos', ssCltrelaNos, isSync)
47
50
 
48
51
  let ssRelaNosG = getItem('relaNosGlobal')
49
52
  ssRelaNosG.push(...oRelaNos)
50
- setItem('relaNosGlobal', ssRelaNosG)
53
+ setItem('relaNosGlobal', ssRelaNosG, isSync)
51
54
  }
52
55
 
53
56
  export default asyncGetRelaNos
@@ -1,19 +1,24 @@
1
- export function setItem(key, obj) {
1
+ export function setItem(key, obj, sync) {
2
2
  window['_keep_' + key] = obj
3
- setTimeout(function () {
3
+ if (sync) {
4
4
  sessionStorage.setItem(key, JSON.stringify(obj))
5
- }, 100)
5
+ } else {
6
+ setTimeout(function () {
7
+ sessionStorage.setItem(key, JSON.stringify(obj))
8
+ }, 100)
9
+ }
6
10
  }
7
11
 
8
12
  export function getItem(key) {
9
13
  let obj = window['_keep_' + key]
10
14
  if (!obj) {
11
- if (key === 'relaNosGlobal') {
15
+ obj = JSON.parse(sessionStorage.getItem(key))
16
+
17
+ if (key === 'relaNosGlobal' && !obj) {
12
18
  let relaNos = getItem('relaNos') || []
13
19
  obj = relaNos.map((item) => item.relaNos).flat()
14
- } else {
15
- obj = JSON.parse(sessionStorage.getItem(key))
16
20
  }
21
+
17
22
  window['_keep_' + key] = obj
18
23
  }
19
24
  return obj