bi-element-ui 1.6.13-beta.3 → 1.6.13
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/lib/bi-element-ui-externals.common.js +1 -1
- package/lib/bi-element-ui-externals.common.js.gz +0 -0
- package/lib/bi-element-ui-externals.css +1 -1
- package/lib/bi-element-ui-externals.css.gz +0 -0
- package/lib/bi-element-ui-externals.umd.min.js +1 -1
- package/lib/bi-element-ui-externals.umd.min.js.gz +0 -0
- package/lib/bi-element-ui.common.js +1 -1
- package/lib/bi-element-ui.common.js.gz +0 -0
- package/lib/bi-element-ui.css +1 -1
- package/lib/bi-element-ui.css.gz +0 -0
- package/lib/bi-element-ui.esm.js +1 -1
- package/lib/bi-element-ui.esm.js.gz +0 -0
- package/lib/bi-element-ui.umd.min.js +1 -1
- package/lib/bi-element-ui.umd.min.js.gz +0 -0
- package/package.json +1 -1
- package/packages/NoticeCenter/noticeDialogApi.js +37 -0
- package/packages/NoticeCenter/src/index.vue +24 -1
- package/packages/index.js +3 -1
|
Binary file
|
package/package.json
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** 宿主挂载的 BiNoticeCenter 实例,供 openNoticeDialog 调用 */
|
|
2
|
+
let noticeDialogHost = null
|
|
3
|
+
|
|
4
|
+
export function registerNoticeDialogHost(vm) {
|
|
5
|
+
noticeDialogHost = vm
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function unregisterNoticeDialogHost(vm) {
|
|
9
|
+
if (noticeDialogHost === vm) {
|
|
10
|
+
noticeDialogHost = null
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 宿主项目调用:打开与 BiNoticeCenter 一致的系统通知弹窗。
|
|
16
|
+
* 点「知道了」仅关闭弹窗,不请求 noticeRead。
|
|
17
|
+
* 须已挂载 BiNoticeCenter(例如 BiNavbarTool 内 noticeCenter 为 true)。
|
|
18
|
+
*
|
|
19
|
+
* @param {{ title: string, user_name?: string, send_time?: string, content: string }} payload
|
|
20
|
+
* @returns {boolean} 是否成功(false 表示尚未有 NoticeCenter 完成注册)
|
|
21
|
+
*/
|
|
22
|
+
export function openNoticeDialog(payload) {
|
|
23
|
+
if (!payload || typeof payload !== 'object') {
|
|
24
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
25
|
+
console.warn('[bi-element-ui] openNoticeDialog: payload 应为对象')
|
|
26
|
+
}
|
|
27
|
+
return false
|
|
28
|
+
}
|
|
29
|
+
if (!noticeDialogHost || typeof noticeDialogHost.openExternalNoticeDialog !== 'function') {
|
|
30
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
31
|
+
console.warn('[bi-element-ui] openNoticeDialog: 请先挂载 BiNoticeCenter(如使用 BiNavbarTool 且开启通知中心)')
|
|
32
|
+
}
|
|
33
|
+
return false
|
|
34
|
+
}
|
|
35
|
+
noticeDialogHost.openExternalNoticeDialog(payload)
|
|
36
|
+
return true
|
|
37
|
+
}
|
|
@@ -160,6 +160,7 @@
|
|
|
160
160
|
// import WebSocketClass from '../../WebSocket'
|
|
161
161
|
import { diffTime } from '../../utils/time/index'
|
|
162
162
|
import request from '../../utils/request/index.js'
|
|
163
|
+
import { registerNoticeDialogHost, unregisterNoticeDialogHost } from '../noticeDialogApi'
|
|
163
164
|
export default {
|
|
164
165
|
name: 'BiNoticeCenter',
|
|
165
166
|
props: {
|
|
@@ -197,7 +198,9 @@ export default {
|
|
|
197
198
|
noticeListLoading: false,
|
|
198
199
|
noMore: false,
|
|
199
200
|
detailData: {},
|
|
200
|
-
noticeList: []
|
|
201
|
+
noticeList: [],
|
|
202
|
+
/** true:知道了仅关弹窗,不调 noticeRead(openNoticeDialog 打开) */
|
|
203
|
+
dialogCloseSkipsNoticeRead: false
|
|
201
204
|
}
|
|
202
205
|
},
|
|
203
206
|
inject: ['theme'],
|
|
@@ -214,6 +217,10 @@ export default {
|
|
|
214
217
|
this.last_id = ''
|
|
215
218
|
this.last_send_time = ''
|
|
216
219
|
this.initUnreadNum()
|
|
220
|
+
registerNoticeDialogHost(this)
|
|
221
|
+
},
|
|
222
|
+
beforeDestroy() {
|
|
223
|
+
unregisterNoticeDialogHost(this)
|
|
217
224
|
},
|
|
218
225
|
methods: {
|
|
219
226
|
handleClose() {},
|
|
@@ -231,6 +238,7 @@ export default {
|
|
|
231
238
|
this.badgeNum = unread_num
|
|
232
239
|
},
|
|
233
240
|
popupNotice(data, onlyread = false) {
|
|
241
|
+
this.dialogCloseSkipsNoticeRead = false
|
|
234
242
|
console.log('🚀 ~ data:', data)
|
|
235
243
|
console.log('🚀 ~ data:', data.id)
|
|
236
244
|
this.openNotice.title = data.title
|
|
@@ -242,8 +250,23 @@ export default {
|
|
|
242
250
|
this.dialogVisible = true
|
|
243
251
|
onlyread !== true && this.noticePoped(this.openNotice.id)
|
|
244
252
|
},
|
|
253
|
+
/** 供宿主 openNoticeDialog 使用:不调 noticePoped,关闭时不调 noticeRead */
|
|
254
|
+
openExternalNoticeDialog({ title, user_name, send_time, content }) {
|
|
255
|
+
this.dialogCloseSkipsNoticeRead = true
|
|
256
|
+
this.openNotice.title = title || ''
|
|
257
|
+
this.openNotice.user_name = user_name
|
|
258
|
+
this.openNotice.send_time = send_time || ''
|
|
259
|
+
this.openNotice.id = ''
|
|
260
|
+
this.openNotice.extra_id = undefined
|
|
261
|
+
this.openNotice.content = content || ''
|
|
262
|
+
this.dialogVisible = true
|
|
263
|
+
},
|
|
245
264
|
async noticeClose(id) {
|
|
246
265
|
this.dialogVisible = false
|
|
266
|
+
if (this.dialogCloseSkipsNoticeRead) {
|
|
267
|
+
this.dialogCloseSkipsNoticeRead = false
|
|
268
|
+
return
|
|
269
|
+
}
|
|
247
270
|
this.noticeRead(id)
|
|
248
271
|
},
|
|
249
272
|
async noticeRead(id) {
|
package/packages/index.js
CHANGED
|
@@ -37,6 +37,7 @@ import BiTableSticky from './TableSticky/index'
|
|
|
37
37
|
// import elTableSticky from '@cell-x/el-table-sticky'
|
|
38
38
|
import { doubleCheckVerification } from './Verification/index.js'
|
|
39
39
|
import ResponseInterceptor from './ResponseInterceptor'
|
|
40
|
+
import { openNoticeDialog } from './NoticeCenter/noticeDialogApi'
|
|
40
41
|
// import BiVerification from './Verification/index.js'
|
|
41
42
|
|
|
42
43
|
// 组件列表
|
|
@@ -220,9 +221,10 @@ export default {
|
|
|
220
221
|
getComponentsKeys: getComponentsKeys,
|
|
221
222
|
doubleCheckVerification: doubleCheckVerification,
|
|
222
223
|
handleResponse: ResponseInterceptor.handleResponse.bind(ResponseInterceptor),
|
|
224
|
+
openNoticeDialog,
|
|
223
225
|
version: pkg.version
|
|
224
226
|
}
|
|
225
227
|
|
|
226
228
|
// 命名导出
|
|
227
|
-
export { doubleCheckVerification, getComponentsKeys }
|
|
229
|
+
export { doubleCheckVerification, getComponentsKeys, openNoticeDialog }
|
|
228
230
|
export const handleResponse = ResponseInterceptor.handleResponse.bind(ResponseInterceptor)
|