@maketribe/ms-app 3.2.51 → 3.2.52
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/dist/cjs/layouts/components/header/index.js +1 -2
- package/dist/cjs/layouts/components/header/index.js.map +1 -1
- package/dist/esm/layouts/components/header/index.js +1 -2
- package/dist/esm/layouts/components/header/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/cjs/layouts/components/header/message.js +0 -94
- package/dist/cjs/layouts/components/header/message.js.map +0 -1
- package/dist/cjs/layouts/components/header/notify.js +0 -26
- package/dist/cjs/layouts/components/header/notify.js.map +0 -1
- package/dist/cjs/layouts/components/message-list/index.vue.js +0 -242
- package/dist/cjs/layouts/components/message-list/index.vue.js.map +0 -1
- package/dist/cjs/layouts/components/message-list/index.vue2.js +0 -4
- package/dist/cjs/layouts/components/message-list/index.vue2.js.map +0 -1
- package/dist/esm/layouts/components/header/message.js +0 -77
- package/dist/esm/layouts/components/header/message.js.map +0 -1
- package/dist/esm/layouts/components/header/notify.js +0 -26
- package/dist/esm/layouts/components/header/notify.js.map +0 -1
- package/dist/esm/layouts/components/message-list/index.vue.js +0 -243
- package/dist/esm/layouts/components/message-list/index.vue.js.map +0 -1
- package/dist/esm/layouts/components/message-list/index.vue2.js +0 -5
- package/dist/esm/layouts/components/message-list/index.vue2.js.map +0 -1
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const vue = require("vue");
|
|
4
4
|
const tools = require("./tools.js");
|
|
5
|
-
const message = require("./message.js");
|
|
6
5
|
require("@maketribe/dm");
|
|
7
6
|
require("element-plus");
|
|
8
7
|
require("@maketribe/utils");
|
|
@@ -26,7 +25,7 @@ const MKHeader = /* @__PURE__ */ vue.defineComponent({
|
|
|
26
25
|
"src": msAppClient == null ? void 0 : msAppClient.logo
|
|
27
26
|
}, null), projectName]), vue.createVNode("div", {
|
|
28
27
|
"class": "mk-header__tools"
|
|
29
|
-
}, [vue.createVNode(
|
|
28
|
+
}, [vue.createVNode(tools.MKHeaderTools, null, null)])]);
|
|
30
29
|
};
|
|
31
30
|
}
|
|
32
31
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/layouts/components/header/index.tsx"],"sourcesContent":["import { defineComponent, h, Ref, ref, unref } from \"vue\";\r\nimport { MKHeaderTools } from \"./tools\";\r\nimport { MKMessage } from \"./message\";\r\nimport { MSAppClient, MenuNode } from \"../../../core\";\r\n\r\nexport const MKHeader = defineComponent({\r\n\tname: \"MKHeader\",\r\n\tsetup() {\r\n\t\tconst msAppClient = MSAppClient.instance!;\r\n\r\n\t\tconst projectName = <div class=\"mk-header__projectName\">{msAppClient?.projectName}</div>;\r\n\r\n\r\n\t\treturn () => {\r\n\t\t\treturn (\r\n\t\t\t\t<div class=\"mk-header\">\r\n\t\t\t\t\t<div class=\"mk-header__main\">\r\n\t\t\t\t\t\t<img class=\"mk-header__logo\" src={msAppClient?.logo}></img>\r\n\t\t\t\t\t\t{projectName}\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"mk-header__tools\">\r\n\t\t\t\t\t\t<MKMessage
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/layouts/components/header/index.tsx"],"sourcesContent":["import { defineComponent, h, Ref, ref, unref } from \"vue\";\r\nimport { MKHeaderTools } from \"./tools\";\r\nimport { MKMessage } from \"./message\";\r\nimport { MSAppClient, MenuNode } from \"../../../core\";\r\n\r\nexport const MKHeader = defineComponent({\r\n\tname: \"MKHeader\",\r\n\tsetup() {\r\n\t\tconst msAppClient = MSAppClient.instance!;\r\n\r\n\t\tconst projectName = <div class=\"mk-header__projectName\">{msAppClient?.projectName}</div>;\r\n\r\n\r\n\t\treturn () => {\r\n\t\t\treturn (\r\n\t\t\t\t<div class=\"mk-header\">\r\n\t\t\t\t\t<div class=\"mk-header__main\">\r\n\t\t\t\t\t\t<img class=\"mk-header__logo\" src={msAppClient?.logo}></img>\r\n\t\t\t\t\t\t{projectName}\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"mk-header__tools\">\r\n\t\t\t\t\t\t{/* <MKMessage /> */}\r\n\t\t\t\t\t\t<MKHeaderTools />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t\r\n\t\t\t\t</div>\r\n\t\t\t);\r\n\t\t};\r\n\t},\r\n});\r\n"],"names":["MKHeader","defineComponent","name","setup","msAppClient","MSAppClient","instance","projectName","_createVNode","logo","MKHeaderTools"],"mappings":";;;;;;;;;;AAKaA,MAAAA,WAAWC,oBAAAA,gBAAgB;AAAA,EACvCC,MAAM;AAAA,EACNC,QAAQ;AACP,UAAMC,cAAcC,YAAW,YAACC;AAEhC,UAAMC,cAAWC,IAAA,YAAA,OAAA;AAAA,MAAA,SAAA;AAAA,OAAwCJ,CAAAA,2CAAaG,WAAW,CAAO;AAGxF,WAAO,MAAM;AACZ,aAAAC,IAAAA,YAAA,OAAA;AAAA,QAAA,SAAA;AAAA,MAAA,GAAA,CAAAA,IAAA,YAAA,OAAA;AAAA,QAAA,SAAA;AAAA,MAAA,GAAA,CAAAA,IAAA,YAAA,OAAA;AAAA,QAAA,SAAA;AAAA,QAAA,OAGqCJ,2CAAaK;AAAAA,MAC9CF,GAAAA,IAAAA,GAAAA,WAAW,IAAAC,IAAAA,YAAA,OAAA;AAAA,QAAA,SAAA;AAAA,SAAAA,CAAAA,IAAA,YAAAE,qBAAA,MAAA,IAAA,CAAA,CAAA,CAAA,CAAA;AAAA;EAUjB;AACD,CAAC;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { defineComponent, createVNode } from "vue";
|
|
2
2
|
import { MKHeaderTools } from "./tools.js";
|
|
3
|
-
import { MKMessage } from "./message.js";
|
|
4
3
|
import "@maketribe/dm";
|
|
5
4
|
import "element-plus";
|
|
6
5
|
import "@maketribe/utils";
|
|
@@ -24,7 +23,7 @@ const MKHeader = /* @__PURE__ */ defineComponent({
|
|
|
24
23
|
"src": msAppClient == null ? void 0 : msAppClient.logo
|
|
25
24
|
}, null), projectName]), createVNode("div", {
|
|
26
25
|
"class": "mk-header__tools"
|
|
27
|
-
}, [createVNode(
|
|
26
|
+
}, [createVNode(MKHeaderTools, null, null)])]);
|
|
28
27
|
};
|
|
29
28
|
}
|
|
30
29
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/layouts/components/header/index.tsx"],"sourcesContent":["import { defineComponent, h, Ref, ref, unref } from \"vue\";\r\nimport { MKHeaderTools } from \"./tools\";\r\nimport { MKMessage } from \"./message\";\r\nimport { MSAppClient, MenuNode } from \"../../../core\";\r\n\r\nexport const MKHeader = defineComponent({\r\n\tname: \"MKHeader\",\r\n\tsetup() {\r\n\t\tconst msAppClient = MSAppClient.instance!;\r\n\r\n\t\tconst projectName = <div class=\"mk-header__projectName\">{msAppClient?.projectName}</div>;\r\n\r\n\r\n\t\treturn () => {\r\n\t\t\treturn (\r\n\t\t\t\t<div class=\"mk-header\">\r\n\t\t\t\t\t<div class=\"mk-header__main\">\r\n\t\t\t\t\t\t<img class=\"mk-header__logo\" src={msAppClient?.logo}></img>\r\n\t\t\t\t\t\t{projectName}\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"mk-header__tools\">\r\n\t\t\t\t\t\t<MKMessage
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/layouts/components/header/index.tsx"],"sourcesContent":["import { defineComponent, h, Ref, ref, unref } from \"vue\";\r\nimport { MKHeaderTools } from \"./tools\";\r\nimport { MKMessage } from \"./message\";\r\nimport { MSAppClient, MenuNode } from \"../../../core\";\r\n\r\nexport const MKHeader = defineComponent({\r\n\tname: \"MKHeader\",\r\n\tsetup() {\r\n\t\tconst msAppClient = MSAppClient.instance!;\r\n\r\n\t\tconst projectName = <div class=\"mk-header__projectName\">{msAppClient?.projectName}</div>;\r\n\r\n\r\n\t\treturn () => {\r\n\t\t\treturn (\r\n\t\t\t\t<div class=\"mk-header\">\r\n\t\t\t\t\t<div class=\"mk-header__main\">\r\n\t\t\t\t\t\t<img class=\"mk-header__logo\" src={msAppClient?.logo}></img>\r\n\t\t\t\t\t\t{projectName}\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"mk-header__tools\">\r\n\t\t\t\t\t\t{/* <MKMessage /> */}\r\n\t\t\t\t\t\t<MKHeaderTools />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t\r\n\t\t\t\t</div>\r\n\t\t\t);\r\n\t\t};\r\n\t},\r\n});\r\n"],"names":["MKHeader","defineComponent","name","setup","msAppClient","MSAppClient","instance","projectName","_createVNode","logo","MKHeaderTools"],"mappings":";;;;;;;;AAKaA,MAAAA,WAAWC,gCAAgB;AAAA,EACvCC,MAAM;AAAA,EACNC,QAAQ;AACP,UAAMC,cAAcC,YAAYC;AAEhC,UAAMC,cAAWC,YAAA,OAAA;AAAA,MAAA,SAAA;AAAA,OAAwCJ,CAAAA,2CAAaG,WAAW,CAAO;AAGxF,WAAO,MAAM;AACZ,aAAAC,YAAA,OAAA;AAAA,QAAA,SAAA;AAAA,MAAA,GAAA,CAAAA,YAAA,OAAA;AAAA,QAAA,SAAA;AAAA,MAAA,GAAA,CAAAA,YAAA,OAAA;AAAA,QAAA,SAAA;AAAA,QAAA,OAGqCJ,2CAAaK;AAAAA,MAC9CF,GAAAA,IAAAA,GAAAA,WAAW,IAAAC,YAAA,OAAA;AAAA,QAAA,SAAA;AAAA,SAAAA,CAAAA,YAAAE,eAAA,MAAA,IAAA,CAAA,CAAA,CAAA,CAAA;AAAA;EAUjB;AACD,CAAC;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maketribe/ms-app",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.52",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"vue-cropper": "^1.1.4",
|
|
54
54
|
"vue-router": "^4.2.4",
|
|
55
55
|
"@maketribe/dm": "^3.2.12",
|
|
56
|
-
"@maketribe/locale": "^3.2.0",
|
|
57
56
|
"@maketribe/request": "^3.2.5",
|
|
58
|
-
"@maketribe/utils": "^3.2.1"
|
|
57
|
+
"@maketribe/utils": "^3.2.1",
|
|
58
|
+
"@maketribe/locale": "^3.2.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/sortablejs": "^1.15.8"
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const vue = require("vue");
|
|
4
|
-
const elementPlus = require("element-plus");
|
|
5
|
-
const index = require("../../../components/basic/svg-icon/index.js");
|
|
6
|
-
const index_vue_vue_type_script_setup_true_lang = require("../message-list/index.vue.js");
|
|
7
|
-
const SignalR = require("@microsoft/signalr");
|
|
8
|
-
const notify = require("./notify.js");
|
|
9
|
-
require("@maketribe/dm");
|
|
10
|
-
require("@maketribe/utils");
|
|
11
|
-
require("../../../core/DataModelDefines.js");
|
|
12
|
-
const MSAppClient = require("../../../core/MSAppClient.js");
|
|
13
|
-
require("@maketribe/request");
|
|
14
|
-
function _interopNamespaceDefault(e) {
|
|
15
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
16
|
-
if (e) {
|
|
17
|
-
for (const k in e) {
|
|
18
|
-
if (k !== "default") {
|
|
19
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: () => e[k]
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
n.default = e;
|
|
28
|
-
return Object.freeze(n);
|
|
29
|
-
}
|
|
30
|
-
const SignalR__namespace = /* @__PURE__ */ _interopNamespaceDefault(SignalR);
|
|
31
|
-
const MKMessage = /* @__PURE__ */ vue.defineComponent({
|
|
32
|
-
name: "MKMessage",
|
|
33
|
-
setup() {
|
|
34
|
-
const showMessageList = vue.ref(false);
|
|
35
|
-
const num = vue.ref(0);
|
|
36
|
-
console.log(localStorage.getItem("access-token"));
|
|
37
|
-
const connection = new SignalR__namespace.HubConnectionBuilder().withUrl("/api/ms/hubs/notification", {
|
|
38
|
-
accessTokenFactory: () => localStorage.getItem("access-token")
|
|
39
|
-
}).withAutomaticReconnect({
|
|
40
|
-
nextRetryDelayInMilliseconds: function(val) {
|
|
41
|
-
let arr = [1e3, 5e3, 1e4, 3e4];
|
|
42
|
-
if (val.previousRetryCount <= 3) {
|
|
43
|
-
return arr[val.previousRetryCount];
|
|
44
|
-
} else {
|
|
45
|
-
return arr[3];
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}).build();
|
|
49
|
-
connection.on('Notification"', (infos) => {
|
|
50
|
-
console.log(infos);
|
|
51
|
-
notify.notifyHandle(infos);
|
|
52
|
-
getUnreadMessageNum();
|
|
53
|
-
});
|
|
54
|
-
window.connection = connection;
|
|
55
|
-
const start = async () => {
|
|
56
|
-
try {
|
|
57
|
-
await connection.start();
|
|
58
|
-
console.log("SignalR Connected.");
|
|
59
|
-
} catch (err) {
|
|
60
|
-
console.log(err);
|
|
61
|
-
setTimeout(start, 5e3);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
connection.onclose(async () => {
|
|
65
|
-
await start();
|
|
66
|
-
});
|
|
67
|
-
const getUnreadMessageNum = async () => {
|
|
68
|
-
const httpRequest = MSAppClient.MSAppClient.instance.httpRequest;
|
|
69
|
-
const result = await httpRequest.get("/ms/dv/message/unread/count");
|
|
70
|
-
if (result.data.code == 200) {
|
|
71
|
-
num.value = result.data.data;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
vue.onMounted(() => {
|
|
75
|
-
getUnreadMessageNum();
|
|
76
|
-
});
|
|
77
|
-
return () => {
|
|
78
|
-
return vue.createVNode("div", null, [vue.createVNode(elementPlus.ElBadge, {
|
|
79
|
-
"value": num.value
|
|
80
|
-
}, {
|
|
81
|
-
default: () => [vue.createVNode(index.MKSvgIcon, {
|
|
82
|
-
"iconClass": "Message",
|
|
83
|
-
"class": "mk-header__tools-message",
|
|
84
|
-
"onClick": () => showMessageList.value = true
|
|
85
|
-
}, null)]
|
|
86
|
-
}), vue.createVNode(index_vue_vue_type_script_setup_true_lang, {
|
|
87
|
-
"showMessageList": vue.unref(showMessageList),
|
|
88
|
-
"onUpdate:showMessageList": (v) => showMessageList.value = v
|
|
89
|
-
}, null)]);
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
exports.MKMessage = MKMessage;
|
|
94
|
-
//# sourceMappingURL=message.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sources":["../../../../../src/layouts/components/header/message.tsx"],"sourcesContent":["import { ElBadge, ElButton, ElNotification } from \"element-plus\";\r\nimport { MKSvgIcon } from \"../../../components/basic/svg-icon\";\r\nimport { defineComponent, h, isVNode, onMounted, ref, Ref, unref } from \"vue\";\r\nimport MessageList from \"../message-list/index.vue\"\r\nimport * as SignalR from \"@microsoft/signalr\"\r\nimport { notifyHandle, NotifyType } from \"./notify\";\r\nimport { MSAppClient } from \"../../../core\"\r\n\r\n\r\n\r\nexport const MKMessage = defineComponent({\r\n name: \"MKMessage\",\r\n setup() {\r\n\r\n const showMessageList: Ref<boolean> | undefined = ref(false)\r\n const num: Ref<number> = ref(0)\r\n console.log(localStorage.getItem(\"access-token\"));\r\n //signalR连接\r\n const connection = new SignalR.HubConnectionBuilder()\r\n .withUrl(\"/api/ms/hubs/notification\", { accessTokenFactory: () => localStorage.getItem(\"access-token\") as string })\r\n //自动连接\r\n .withAutomaticReconnect({\r\n nextRetryDelayInMilliseconds: function (val) {\r\n // _this.$TF.closeLoading()\r\n let arr = [1000, 5000, 10000, 30000]\r\n if (val.previousRetryCount <= 3) {\r\n return arr[val.previousRetryCount]\r\n } else {\r\n return arr[3]\r\n }\r\n }\r\n })\r\n .build();\r\n //接收消息\r\n connection.on('Notification\"', (infos) => {\r\n console.log(infos);\r\n notifyHandle(infos);\r\n getUnreadMessageNum();\r\n });\r\n (window as any).connection = connection\r\n const start = async () => {\r\n try {\r\n await connection.start();\r\n console.log(\"SignalR Connected.\");\r\n } catch (err) {\r\n console.log(err);\r\n setTimeout(start, 5000);\r\n }\r\n };\r\n\r\n connection.onclose(async () => {\r\n await start();\r\n });\r\n\r\n //Start the connection.启动\r\n // start();\r\n\r\n const getUnreadMessageNum = async () => {\r\n const httpRequest = MSAppClient.instance!.httpRequest\r\n const result = await httpRequest.get(\"/ms/dv/message/unread/count\")\r\n if (result.data.code == 200) {\r\n num.value = result.data.data\r\n }\r\n\r\n }\r\n onMounted(() => {\r\n getUnreadMessageNum();\r\n })\r\n return () => {\r\n return (<div>\r\n <ElBadge value={num.value}>\r\n <MKSvgIcon iconClass=\"Message\" class=\"mk-header__tools-message\" onClick={() => (showMessageList.value = true)} />\r\n </ElBadge>\r\n <MessageList showMessageList={unref(showMessageList)} onUpdate:showMessageList={(v) => (showMessageList.value = v)}>\r\n\r\n </MessageList>\r\n </div>)\r\n }\r\n }\r\n})"],"names":["MKMessage","defineComponent","name","setup","showMessageList","ref","num","console","log","localStorage","getItem","connection","SignalR","HubConnectionBuilder","withUrl","accessTokenFactory","withAutomaticReconnect","nextRetryDelayInMilliseconds","val","arr","previousRetryCount","build","on","infos","notifyHandle","getUnreadMessageNum","window","start","err","setTimeout","onclose","httpRequest","MSAppClient","instance","result","get","data","code","value","onMounted","_createVNode","ElBadge","default","MKSvgIcon","onClick","MessageList","unref","v"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUaA,MAAAA,YAAYC,oBAAAA,gBAAgB;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AACT,aAAAe,IAAA,YAAA,OAAA,MAAA,CAAAA,IAAAA,YAAAC,YAAAA,SAAA;AAAA,QAAA,SACoBnC,IAAIgC;AAAAA,MAAK,GAAA;AAAA,QAAAI,SAAAA,MAAAF,CAAAA,IAAA,YAAAG,iBAAA;AAAA,UAAA,aAAA;AAAA,UAAA,SAAA;AAAA,UAAA,WACoDC,MAAOxC,gBAAgBkC,QAAQ;AAAA,QAAK,GAAA,IAAA,CAAA;AAAA,OAAAE,GAAAA,IAAA,YAAAK,2CAAA;AAAA,QAAA,mBAEnFC,IAAK,MAAC1C,eAAe;AAAA,QAAC,4BAA6B2C,OAAO3C,gBAAgBkC,QAAQS;AAAAA,MAAE,GAAA,IAAA,CAAA,CAAA;AAAA;EAK9H;AACJ,CAAC;;"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const vue = require("vue");
|
|
4
|
-
const elementPlus = require("element-plus");
|
|
5
|
-
const notifyHandle = (infos) => {
|
|
6
|
-
const message = vue.isVNode(infos.message) ? infos.message : vue.createVNode("div", {
|
|
7
|
-
"innerHTML": infos.message
|
|
8
|
-
}, [vue.createTextVNode(" ")]);
|
|
9
|
-
const action = vue.isVNode(infos.action) ? infos.action : vue.h(elementPlus.ElButton, {
|
|
10
|
-
onClick: () => {
|
|
11
|
-
notify.close();
|
|
12
|
-
},
|
|
13
|
-
link: true,
|
|
14
|
-
type: "primary"
|
|
15
|
-
}, {
|
|
16
|
-
default: () => "关闭"
|
|
17
|
-
});
|
|
18
|
-
const notify = elementPlus.ElNotification({
|
|
19
|
-
type: infos.type,
|
|
20
|
-
title: infos.title,
|
|
21
|
-
showClose: false,
|
|
22
|
-
message: vue.createVNode("div", null, [message, action])
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
exports.notifyHandle = notifyHandle;
|
|
26
|
-
//# sourceMappingURL=notify.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notify.js","sources":["../../../../../src/layouts/components/header/notify.tsx"],"sourcesContent":["import { ElButton, ElNotification, NotificationParamsTyped } from \"element-plus\";\r\nimport { h, isVNode, VNode, VNodeTypes } from \"vue\";\r\n\r\nexport enum NotifyType {\r\n success = \"success\",\r\n info = \"info\",\r\n warning = \"warning\",\r\n error = \"error\",\r\n}\r\n\r\nexport const notifyHandle = (infos: { type?: NotifyType, title: string, message: string, action?: VNode | String }) => {\r\n\r\n const message = isVNode(infos.message) ? infos.message : <div v-html={infos.message}> </div >\r\n const action = isVNode(infos.action) ? infos.action : h(ElButton, { onClick: () => { notify.close() }, link: true, type: \"primary\" }, { default: () => \"关闭\" })\r\n\r\n const notify = ElNotification({\r\n type: infos.type,\r\n title: infos.title,\r\n showClose: false,\r\n message:\r\n <div>\r\n {message}\r\n {action}\r\n </div>,\r\n });\r\n}"],"names":["notifyHandle","infos","message","isVNode","_createVNode","_createTextVNode","action","h","ElButton","onClick","notify","close","link","type","default","ElNotification","title","showClose"],"mappings":";;;;AAUaA,MAAAA,eAAgBC,WAA0F;AAEnH,QAAMC,UAAUC,IAAO,QAACF,MAAMC,OAAO,IAAID,MAAMC,UAAOE,IAAA,YAAA,OAAA;AAAA,IAAA,aAAgBH,MAAMC;AAAAA,EAAO,GAAA,CAAAG,IAAA,gBAAU,GAAA,CAAA,CAAA;AAC7F,QAAMC,SAASH,IAAO,QAACF,MAAMK,MAAM,IAAIL,MAAMK,SAASC,IAAC,EAACC,sBAAU;AAAA,IAAEC,SAASA,MAAM;AAAEC,aAAOC,MAAK;AAAA,IAAI;AAAA,IAAEC,MAAM;AAAA,IAAMC,MAAM;AAAA,EAAU,GAAG;AAAA,IAAEC,SAASA,MAAM;AAAA,EAAK,CAAC;AAE7J,QAAMJ,SAASK,YAAAA,eAAe;AAAA,IAC1BF,MAAMZ,MAAMY;AAAAA,IACZG,OAAOf,MAAMe;AAAAA,IACbC,WAAW;AAAA,IACXf,SAAOE,IAAA,YAEEF,OAAAA,MAAAA,CAAAA,SACAI,MAAM,CAAA;AAAA,EAEnB,CAAC;AACL;;"}
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const vue = require("vue");
|
|
3
|
-
const dm = require("@maketribe/dm");
|
|
4
|
-
const request = require("@maketribe/request");
|
|
5
|
-
const elementPlus = require("element-plus");
|
|
6
|
-
require("@maketribe/utils");
|
|
7
|
-
require("../../../core/DataModelDefines.js");
|
|
8
|
-
const MSAppClient = require("../../../core/MSAppClient.js");
|
|
9
|
-
const _hoisted_1 = { class: "mk-message__header" };
|
|
10
|
-
const _hoisted_2 = ["onClick"];
|
|
11
|
-
const _hoisted_3 = { class: "mk-message__body-item-header" };
|
|
12
|
-
const _hoisted_4 = { class: "mk-message__body-item-content" };
|
|
13
|
-
const _hoisted_5 = { class: "mk-message__body-item-footer" };
|
|
14
|
-
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
15
|
-
__name: "index",
|
|
16
|
-
props: {
|
|
17
|
-
showMessageList: {
|
|
18
|
-
type: Boolean,
|
|
19
|
-
default: false
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
emits: ["update:showMessageList"],
|
|
23
|
-
setup(__props, { emit: __emit }) {
|
|
24
|
-
var _a;
|
|
25
|
-
const httpRequest = (_a = MSAppClient.MSAppClient.instance) == null ? void 0 : _a.httpRequest;
|
|
26
|
-
const props = __props;
|
|
27
|
-
const buttonName = vue.ref("all");
|
|
28
|
-
const selectValue = vue.ref("");
|
|
29
|
-
const loading = vue.ref(false);
|
|
30
|
-
const pageNum = vue.ref(1);
|
|
31
|
-
const messageList = vue.ref([{
|
|
32
|
-
id: 1,
|
|
33
|
-
title: "系统消息",
|
|
34
|
-
content: "恭喜您!成功获得微信同款研发管理工具免费资格!恭喜您!成功获得微信同款研发管理工具免费资格!",
|
|
35
|
-
type: 1,
|
|
36
|
-
isRead: true,
|
|
37
|
-
createdAt: "2024-08-14 13:44:26"
|
|
38
|
-
}, {
|
|
39
|
-
id: 2,
|
|
40
|
-
title: "上级消息",
|
|
41
|
-
content: "未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读",
|
|
42
|
-
type: 2,
|
|
43
|
-
isRead: false,
|
|
44
|
-
createdAt: "2024-08-14 13:44:26"
|
|
45
|
-
}]);
|
|
46
|
-
const load = async (scroll) => {
|
|
47
|
-
const dom = document.querySelector(".mk-message__body").children[0];
|
|
48
|
-
if (dom.scrollHeight - dom.offsetHeight - scroll.scrollTop < 300) {
|
|
49
|
-
const result = await messageQuery.listWithResponse({
|
|
50
|
-
pc: 10,
|
|
51
|
-
pn: pageNum.value
|
|
52
|
-
});
|
|
53
|
-
pageNum.value++;
|
|
54
|
-
messageList.value.concat(result.data.data);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const messageType = vue.ref([
|
|
58
|
-
{
|
|
59
|
-
type: 1,
|
|
60
|
-
name: "类型1",
|
|
61
|
-
actions: (row) => {
|
|
62
|
-
console.log(row, "类型1");
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
type: 2,
|
|
67
|
-
name: "类型2",
|
|
68
|
-
actions: (row) => {
|
|
69
|
-
console.log(row, "类型2");
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
]);
|
|
73
|
-
const messageDv = request.DvOpt.createInstance({
|
|
74
|
-
name: "message",
|
|
75
|
-
moduleName: "ms"
|
|
76
|
-
});
|
|
77
|
-
const buttonGroup = new request.Group();
|
|
78
|
-
const selectGroup = new request.Group();
|
|
79
|
-
const messageQuery = messageDv.query().addGroup((group) => {
|
|
80
|
-
group.group.addGroup(buttonGroup).addGroup(selectGroup);
|
|
81
|
-
}).addOrderItem("createdAt", request.OrderType.DESC);
|
|
82
|
-
const refreshList = async (pc = 10) => {
|
|
83
|
-
return await messageQuery.list({
|
|
84
|
-
pc,
|
|
85
|
-
pn: 1
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
const emit = __emit;
|
|
89
|
-
const showMessageList = vue.computed({
|
|
90
|
-
get() {
|
|
91
|
-
return vue.unref(props.showMessageList);
|
|
92
|
-
},
|
|
93
|
-
set(value) {
|
|
94
|
-
emit("update:showMessageList", value);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
const readAllHandle = async () => {
|
|
98
|
-
const isConfirm = await dm.Dialoger.confirm({
|
|
99
|
-
title: "提示",
|
|
100
|
-
message: "确定将所有消息全部标记为已读吗?",
|
|
101
|
-
type: "warning"
|
|
102
|
-
});
|
|
103
|
-
if (!isConfirm) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
try {
|
|
107
|
-
loading.value = true;
|
|
108
|
-
const result = await (httpRequest == null ? void 0 : httpRequest.post("/message/readAll"));
|
|
109
|
-
if ((result == null ? void 0 : result.data.code) !== 200) {
|
|
110
|
-
dm.Messager.error({ message: (result == null ? void 0 : result.data.msg) || "操作失败" });
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
messageList.value = await refreshList();
|
|
114
|
-
} catch (e) {
|
|
115
|
-
console.error(e);
|
|
116
|
-
} finally {
|
|
117
|
-
loading.value = false;
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
const selectHandle = async () => {
|
|
121
|
-
selectGroup.clear();
|
|
122
|
-
if (selectValue.value) {
|
|
123
|
-
buttonGroup.addCondition("type", "=", selectValue.value);
|
|
124
|
-
}
|
|
125
|
-
messageList.value = await refreshList();
|
|
126
|
-
};
|
|
127
|
-
vue.watch(buttonName, async () => {
|
|
128
|
-
buttonGroup.clear();
|
|
129
|
-
if (buttonName.value != "all") {
|
|
130
|
-
buttonGroup.addCondition("isRead", "=", 1);
|
|
131
|
-
}
|
|
132
|
-
messageList.value = await refreshList();
|
|
133
|
-
});
|
|
134
|
-
return (_ctx, _cache) => {
|
|
135
|
-
const _component_ElOption = vue.resolveComponent("ElOption");
|
|
136
|
-
return showMessageList.value ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElDrawer), {
|
|
137
|
-
key: 0,
|
|
138
|
-
class: "mk-message",
|
|
139
|
-
title: "通知消息",
|
|
140
|
-
modelValue: showMessageList.value,
|
|
141
|
-
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => showMessageList.value = $event)
|
|
142
|
-
}, {
|
|
143
|
-
default: vue.withCtx(() => [
|
|
144
|
-
vue.createElementVNode("div", _hoisted_1, [
|
|
145
|
-
vue.createVNode(vue.unref(elementPlus.ElButtonGroup), { class: "mk-message__header-buttonGroup" }, {
|
|
146
|
-
default: vue.withCtx(() => [
|
|
147
|
-
vue.createVNode(vue.unref(elementPlus.ElButton), {
|
|
148
|
-
size: "small",
|
|
149
|
-
class: vue.normalizeClass([buttonName.value == "all" ? "active" : "", "mk-message__header-buttonGroup-button"]),
|
|
150
|
-
onClick: _cache[0] || (_cache[0] = () => {
|
|
151
|
-
buttonName.value = "all";
|
|
152
|
-
})
|
|
153
|
-
}, {
|
|
154
|
-
default: vue.withCtx(() => [
|
|
155
|
-
vue.createTextVNode(" 全部 ")
|
|
156
|
-
]),
|
|
157
|
-
_: 1
|
|
158
|
-
}, 8, ["class"]),
|
|
159
|
-
vue.createVNode(vue.unref(elementPlus.ElButton), {
|
|
160
|
-
size: "small",
|
|
161
|
-
class: vue.normalizeClass([buttonName.value == "unRead" ? "active" : "", "mk-message__header-buttonGroup-button"]),
|
|
162
|
-
onClick: _cache[1] || (_cache[1] = () => {
|
|
163
|
-
buttonName.value = "unRead";
|
|
164
|
-
})
|
|
165
|
-
}, {
|
|
166
|
-
default: vue.withCtx(() => [
|
|
167
|
-
vue.createTextVNode("未读")
|
|
168
|
-
]),
|
|
169
|
-
_: 1
|
|
170
|
-
}, 8, ["class"])
|
|
171
|
-
]),
|
|
172
|
-
_: 1
|
|
173
|
-
}),
|
|
174
|
-
vue.createVNode(vue.unref(elementPlus.ElSelect), {
|
|
175
|
-
placeholder: "请选择类型",
|
|
176
|
-
size: "small",
|
|
177
|
-
modelValue: selectValue.value,
|
|
178
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => selectValue.value = $event),
|
|
179
|
-
onChange: selectHandle,
|
|
180
|
-
clearable: ""
|
|
181
|
-
}, {
|
|
182
|
-
default: vue.withCtx(() => [
|
|
183
|
-
vue.createVNode(_component_ElOption, {
|
|
184
|
-
value: "1",
|
|
185
|
-
label: "测试"
|
|
186
|
-
})
|
|
187
|
-
]),
|
|
188
|
-
_: 1
|
|
189
|
-
}, 8, ["modelValue"]),
|
|
190
|
-
vue.createVNode(vue.unref(elementPlus.ElButton), {
|
|
191
|
-
link: "",
|
|
192
|
-
type: "primary",
|
|
193
|
-
size: "small",
|
|
194
|
-
onClick: readAllHandle
|
|
195
|
-
}, {
|
|
196
|
-
default: vue.withCtx(() => [
|
|
197
|
-
vue.createTextVNode("全部已读")
|
|
198
|
-
]),
|
|
199
|
-
_: 1
|
|
200
|
-
})
|
|
201
|
-
]),
|
|
202
|
-
vue.createVNode(vue.unref(elementPlus.ElScrollbar), {
|
|
203
|
-
class: "mk-message__body",
|
|
204
|
-
onScroll: load
|
|
205
|
-
}, {
|
|
206
|
-
default: vue.withCtx(() => [
|
|
207
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(messageList.value, (item) => {
|
|
208
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
209
|
-
class: vue.normalizeClass(["mk-message__body-item", { "is-read": item.isRead }]),
|
|
210
|
-
key: item.id,
|
|
211
|
-
onClick: ($event) => {
|
|
212
|
-
var _a2;
|
|
213
|
-
return (_a2 = messageType.value.find((a) => a.type == item.type)) == null ? void 0 : _a2.actions(item);
|
|
214
|
-
}
|
|
215
|
-
}, [
|
|
216
|
-
vue.createElementVNode("div", _hoisted_3, vue.toDisplayString(item.title), 1),
|
|
217
|
-
vue.createElementVNode("div", _hoisted_4, vue.toDisplayString(item.content), 1),
|
|
218
|
-
vue.createElementVNode("div", _hoisted_5, [
|
|
219
|
-
vue.createVNode(vue.unref(elementPlus.ElTag), null, {
|
|
220
|
-
default: vue.withCtx(() => {
|
|
221
|
-
var _a2;
|
|
222
|
-
return [
|
|
223
|
-
vue.createTextVNode(vue.toDisplayString((_a2 = messageType.value.find((a) => a.type == item.type)) == null ? void 0 : _a2.name), 1)
|
|
224
|
-
];
|
|
225
|
-
}),
|
|
226
|
-
_: 2
|
|
227
|
-
}, 1024),
|
|
228
|
-
vue.createTextVNode(" " + vue.toDisplayString(item.createdAt), 1)
|
|
229
|
-
])
|
|
230
|
-
], 10, _hoisted_2);
|
|
231
|
-
}), 128))
|
|
232
|
-
]),
|
|
233
|
-
_: 1
|
|
234
|
-
})
|
|
235
|
-
]),
|
|
236
|
-
_: 1
|
|
237
|
-
}, 8, ["modelValue"])) : vue.createCommentVNode("", true);
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
module.exports = _sfc_main;
|
|
242
|
-
//# sourceMappingURL=index.vue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.vue.js","sources":["../../../../../src/layouts/components/message-list/index.vue"],"sourcesContent":["<template>\r\n <ElDrawer class=\"mk-message\" title=\"通知消息\" v-model=\"showMessageList as any\" v-if=\"showMessageList\">\r\n <div class=\"mk-message__header\">\r\n <ElButtonGroup class=\"mk-message__header-buttonGroup\">\r\n <ElButton size=\"small\"\r\n :class=\"[buttonName == 'all' ? 'active' : '', 'mk-message__header-buttonGroup-button']\"\r\n @click=\"() => { buttonName = 'all' }\">\r\n 全部\r\n </ElButton>\r\n <ElButton size=\"small\"\r\n :class=\"[buttonName == 'unRead' ? 'active' : '', 'mk-message__header-buttonGroup-button']\"\r\n @click=\"() => { buttonName = 'unRead' }\">未读</ElButton>\r\n </ElButtonGroup>\r\n <ElSelect placeholder=\"请选择类型\" size=\"small\" v-model=\"selectValue\" @change=\"selectHandle\" clearable>\r\n <ElOption value=\"1\" label=\"测试\"></ElOption>\r\n </ElSelect>\r\n <ElButton link type=\"primary\" size=\"small\" @click=\"readAllHandle\">全部已读</ElButton>\r\n </div>\r\n <ElScrollbar class=\"mk-message__body\" @scroll=\"load\">\r\n <div v-for=\"item in messageList\" class=\"mk-message__body-item\" :class=\"{ 'is-read': item.isRead }\"\r\n :key=\"item.id\" @click=\"messageType.find((a) => a.type == item.type)?.actions(item)\">\r\n <div class=\"mk-message__body-item-header\">\r\n {{ item.title }}\r\n </div>\r\n <div class=\"mk-message__body-item-content\">\r\n {{ item.content }}\r\n </div>\r\n <div class=\"mk-message__body-item-footer\">\r\n <ElTag>{{ messageType.find((a) => a.type == item.type)?.name }}</ElTag>\r\n {{ item.createdAt }}\r\n </div>\r\n </div>\r\n </ElScrollbar>\r\n </ElDrawer>\r\n</template>\r\n<script setup lang=\"ts\">\r\nimport { Dialoger, Messager } from \"@maketribe/dm\";\r\nimport { DvOpt, Group, OrderType } from \"@maketribe/request\";\r\nimport { ElButtonGroup, ElDrawer, ElButton, ElSelect, ElScrollbar, ElTag } from \"element-plus\";\r\nimport { MSAppClient } from \"../../../core\";\r\nimport { ref, unref, computed, Ref, watch } from \"vue\";\r\n\r\nconst httpRequest = MSAppClient.instance?.httpRequest;\r\nconst props = defineProps({\r\n showMessageList: {\r\n type: Boolean,\r\n default: false,\r\n }\r\n});\r\n\r\ninterface Message {\r\n id: number;\r\n title: string;\r\n content?: string;\r\n type: number;\r\n isRead: boolean;\r\n createdAt: string;\r\n}\r\n\r\nconst buttonName = ref('all');\r\nconst selectValue = ref('');\r\nconst loading = ref(false);\r\nconst pageNum = ref(1);\r\nconst messageList: Ref<Message[]> = ref([{\r\n id: 1,\r\n title: \"系统消息\",\r\n content: \"恭喜您!成功获得微信同款研发管理工具免费资格!恭喜您!成功获得微信同款研发管理工具免费资格!\",\r\n type: 1,\r\n isRead: true,\r\n createdAt: \"2024-08-14 13:44:26\"\r\n}, {\r\n id: 2,\r\n title: \"上级消息\",\r\n content: \"未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读\",\r\n type: 2,\r\n isRead: false,\r\n createdAt: \"2024-08-14 13:44:26\"\r\n}])\r\n\r\nconst load = async (scroll: { scrollTop: number }) => {\r\n const dom = document.querySelector(\".mk-message__body\")!.children[0] as HTMLElement;\r\n if (dom.scrollHeight - dom.offsetHeight - scroll.scrollTop < 300) {\r\n\r\n const result = await messageQuery.listWithResponse({\r\n pc: 10,\r\n pn: pageNum.value\r\n })\r\n pageNum.value++\r\n messageList.value.concat(result.data.data)\r\n }\r\n}\r\n\r\nconst messageType = ref([\r\n {\r\n type: 1,\r\n name: \"类型1\",\r\n actions: (row: any) => {\r\n console.log(row, \"类型1\");\r\n }\r\n },\r\n {\r\n type: 2,\r\n name: \"类型2\",\r\n actions: (row: any) => {\r\n console.log(row, \"类型2\");\r\n }\r\n }\r\n])\r\n\r\nconst messageDv = DvOpt.createInstance({\r\n name: \"message\",\r\n moduleName: \"ms\"\r\n})\r\nconst buttonGroup = new Group();\r\nconst selectGroup = new Group();\r\nconst messageQuery = messageDv.query()\r\n .addGroup((group) => { group.group.addGroup(buttonGroup).addGroup(selectGroup); })\r\n .addOrderItem(\"createdAt\", OrderType.DESC)\r\nconst refreshList = async (pc: number = 10) => {\r\n return await messageQuery.list({\r\n pc: pc,\r\n pn: 1\r\n }) as Message[];\r\n}\r\n\r\n\r\n\r\nconst emit = defineEmits([\"update:showMessageList\"]);\r\n\r\nconst showMessageList: Ref<Boolean> = computed({\r\n get() {\r\n return unref(props.showMessageList);\r\n },\r\n set(value: Boolean) {\r\n emit(\"update:showMessageList\", value);\r\n }\r\n});\r\n\r\n//将未读全部变成已读\r\nconst readAllHandle = async () => {\r\n const isConfirm = await Dialoger.confirm({\r\n title: \"提示\",\r\n message: \"确定将所有消息全部标记为已读吗?\",\r\n type: \"warning\"\r\n });\r\n\r\n if (!isConfirm) {\r\n return;\r\n }\r\n\r\n try {\r\n loading.value = true;\r\n const result = await httpRequest?.post(\"/message/readAll\");\r\n if (result?.data.code !== 200) {\r\n Messager.error({ message: result?.data.msg || \"操作失败\" });\r\n return;\r\n }\r\n messageList.value = await refreshList()\r\n } catch (e) {\r\n console.error(e);\r\n } finally {\r\n loading.value = false;\r\n }\r\n}\r\n\r\n//筛选选中的消息类型\r\nconst selectHandle = async () => {\r\n selectGroup.clear();\r\n if (selectValue.value) {\r\n buttonGroup.addCondition(\"type\", \"=\", selectValue.value)\r\n }\r\n messageList.value = await refreshList()\r\n}\r\n\r\n//根据当前选择的是全部还是未读\r\nwatch(buttonName, async () => {\r\n buttonGroup.clear();\r\n if (buttonName.value != 'all') {\r\n buttonGroup.addCondition(\"isRead\", \"=\", 1)\r\n }\r\n messageList.value = await refreshList()\r\n})\r\n\r\n</script>\r\n<style lang='scss'></style>"],"names":["MSAppClient","ref","DvOpt","Group","OrderType","computed","unref","Dialoger","Messager","watch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0CM,UAAA,eAAcA,iBAAAA,YAAY,aAAZA,mBAAsB;AAC1C,UAAM,QAAQ;AAgBR,UAAA,aAAaC,QAAI,KAAK;AACtB,UAAA,cAAcA,QAAI,EAAE;AACpB,UAAA,UAAUA,QAAI,KAAK;AACnB,UAAA,UAAUA,QAAI,CAAC;AACf,UAAA,cAA8BA,IAAAA,IAAI,CAAC;AAAA,MACrC,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,SAAS;AAAA,MACT,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,WAAW;AAAA,IAAA,GACZ;AAAA,MACC,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,SAAS;AAAA,MACT,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,WAAW;AAAA,IACd,CAAA,CAAC;AAEI,UAAA,OAAO,OAAO,WAAkC;AAClD,YAAM,MAAM,SAAS,cAAc,mBAAmB,EAAG,SAAS,CAAC;AACnE,UAAI,IAAI,eAAe,IAAI,eAAe,OAAO,YA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AA,QACT,MAAM;AAAA,MAAA,CACT;AAED,UAAI,CAAC,WAAW;AACZ;AAAA,MACJ;AAEI,UAAA;AACA,gBAAQ,QAAQ;AAChB,cAAM,SAAS,OAAM,2CAAa,KAAK;AACnC,aAAA,iCAAQ,KAAK,UAAS,KAAK;AAC3BC,sBAAS,MAAM,EAAE,UAAS,iCAAQ,KAAK,QAAO,QAAQ;AACtD;AAAA,QACJ;AACY,oBAAA,QAAQ,MAAM;eACrB,GAAG;AACR,gBAAQ,MAAM,CAAC;AAAA,MAAA,UACjB;AACE,gBAAQ,QAAQ;AAAA,MACpB;AAAA,IAAA;AAIJ,UAAM,eAAe,YAAY;AAC7B,kBAAY,MAAM;AAClB,UAAI,YAAY,OAAO;AACnB,oBAAY,aAAa,QAAQ,KAAK,YAAY,KAAK;AAAA,MAC3D;AACY,kBAAA,QAAQ,MAAM;IAAY;AAI1CC,QAAA,MAAM,YAAY,YAAY;AAC1B,kBAAY,MAAM;AACd,UAAA,WAAW,SAAS,OAAO;AACf,oBAAA,aAAa,UAAU,KAAK,CAAC;AAAA,MAC7C;AACY,kBAAA,QAAQ,MAAM;IAAY,CACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.vue2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { defineComponent, ref, onMounted, createVNode, unref } from "vue";
|
|
2
|
-
import { ElBadge } from "element-plus";
|
|
3
|
-
import { MKSvgIcon } from "../../../components/basic/svg-icon/index.js";
|
|
4
|
-
import _sfc_main from "../message-list/index.vue.js";
|
|
5
|
-
import * as SignalR from "@microsoft/signalr";
|
|
6
|
-
import { notifyHandle } from "./notify.js";
|
|
7
|
-
import "@maketribe/dm";
|
|
8
|
-
import "@maketribe/utils";
|
|
9
|
-
import "../../../core/DataModelDefines.js";
|
|
10
|
-
import { MSAppClient } from "../../../core/MSAppClient.js";
|
|
11
|
-
import "@maketribe/request";
|
|
12
|
-
const MKMessage = /* @__PURE__ */ defineComponent({
|
|
13
|
-
name: "MKMessage",
|
|
14
|
-
setup() {
|
|
15
|
-
const showMessageList = ref(false);
|
|
16
|
-
const num = ref(0);
|
|
17
|
-
console.log(localStorage.getItem("access-token"));
|
|
18
|
-
const connection = new SignalR.HubConnectionBuilder().withUrl("/api/ms/hubs/notification", {
|
|
19
|
-
accessTokenFactory: () => localStorage.getItem("access-token")
|
|
20
|
-
}).withAutomaticReconnect({
|
|
21
|
-
nextRetryDelayInMilliseconds: function(val) {
|
|
22
|
-
let arr = [1e3, 5e3, 1e4, 3e4];
|
|
23
|
-
if (val.previousRetryCount <= 3) {
|
|
24
|
-
return arr[val.previousRetryCount];
|
|
25
|
-
} else {
|
|
26
|
-
return arr[3];
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}).build();
|
|
30
|
-
connection.on('Notification"', (infos) => {
|
|
31
|
-
console.log(infos);
|
|
32
|
-
notifyHandle(infos);
|
|
33
|
-
getUnreadMessageNum();
|
|
34
|
-
});
|
|
35
|
-
window.connection = connection;
|
|
36
|
-
const start = async () => {
|
|
37
|
-
try {
|
|
38
|
-
await connection.start();
|
|
39
|
-
console.log("SignalR Connected.");
|
|
40
|
-
} catch (err) {
|
|
41
|
-
console.log(err);
|
|
42
|
-
setTimeout(start, 5e3);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
connection.onclose(async () => {
|
|
46
|
-
await start();
|
|
47
|
-
});
|
|
48
|
-
const getUnreadMessageNum = async () => {
|
|
49
|
-
const httpRequest = MSAppClient.instance.httpRequest;
|
|
50
|
-
const result = await httpRequest.get("/ms/dv/message/unread/count");
|
|
51
|
-
if (result.data.code == 200) {
|
|
52
|
-
num.value = result.data.data;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
onMounted(() => {
|
|
56
|
-
getUnreadMessageNum();
|
|
57
|
-
});
|
|
58
|
-
return () => {
|
|
59
|
-
return createVNode("div", null, [createVNode(ElBadge, {
|
|
60
|
-
"value": num.value
|
|
61
|
-
}, {
|
|
62
|
-
default: () => [createVNode(MKSvgIcon, {
|
|
63
|
-
"iconClass": "Message",
|
|
64
|
-
"class": "mk-header__tools-message",
|
|
65
|
-
"onClick": () => showMessageList.value = true
|
|
66
|
-
}, null)]
|
|
67
|
-
}), createVNode(_sfc_main, {
|
|
68
|
-
"showMessageList": unref(showMessageList),
|
|
69
|
-
"onUpdate:showMessageList": (v) => showMessageList.value = v
|
|
70
|
-
}, null)]);
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
export {
|
|
75
|
-
MKMessage
|
|
76
|
-
};
|
|
77
|
-
//# sourceMappingURL=message.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sources":["../../../../../src/layouts/components/header/message.tsx"],"sourcesContent":["import { ElBadge, ElButton, ElNotification } from \"element-plus\";\r\nimport { MKSvgIcon } from \"../../../components/basic/svg-icon\";\r\nimport { defineComponent, h, isVNode, onMounted, ref, Ref, unref } from \"vue\";\r\nimport MessageList from \"../message-list/index.vue\"\r\nimport * as SignalR from \"@microsoft/signalr\"\r\nimport { notifyHandle, NotifyType } from \"./notify\";\r\nimport { MSAppClient } from \"../../../core\"\r\n\r\n\r\n\r\nexport const MKMessage = defineComponent({\r\n name: \"MKMessage\",\r\n setup() {\r\n\r\n const showMessageList: Ref<boolean> | undefined = ref(false)\r\n const num: Ref<number> = ref(0)\r\n console.log(localStorage.getItem(\"access-token\"));\r\n //signalR连接\r\n const connection = new SignalR.HubConnectionBuilder()\r\n .withUrl(\"/api/ms/hubs/notification\", { accessTokenFactory: () => localStorage.getItem(\"access-token\") as string })\r\n //自动连接\r\n .withAutomaticReconnect({\r\n nextRetryDelayInMilliseconds: function (val) {\r\n // _this.$TF.closeLoading()\r\n let arr = [1000, 5000, 10000, 30000]\r\n if (val.previousRetryCount <= 3) {\r\n return arr[val.previousRetryCount]\r\n } else {\r\n return arr[3]\r\n }\r\n }\r\n })\r\n .build();\r\n //接收消息\r\n connection.on('Notification\"', (infos) => {\r\n console.log(infos);\r\n notifyHandle(infos);\r\n getUnreadMessageNum();\r\n });\r\n (window as any).connection = connection\r\n const start = async () => {\r\n try {\r\n await connection.start();\r\n console.log(\"SignalR Connected.\");\r\n } catch (err) {\r\n console.log(err);\r\n setTimeout(start, 5000);\r\n }\r\n };\r\n\r\n connection.onclose(async () => {\r\n await start();\r\n });\r\n\r\n //Start the connection.启动\r\n // start();\r\n\r\n const getUnreadMessageNum = async () => {\r\n const httpRequest = MSAppClient.instance!.httpRequest\r\n const result = await httpRequest.get(\"/ms/dv/message/unread/count\")\r\n if (result.data.code == 200) {\r\n num.value = result.data.data\r\n }\r\n\r\n }\r\n onMounted(() => {\r\n getUnreadMessageNum();\r\n })\r\n return () => {\r\n return (<div>\r\n <ElBadge value={num.value}>\r\n <MKSvgIcon iconClass=\"Message\" class=\"mk-header__tools-message\" onClick={() => (showMessageList.value = true)} />\r\n </ElBadge>\r\n <MessageList showMessageList={unref(showMessageList)} onUpdate:showMessageList={(v) => (showMessageList.value = v)}>\r\n\r\n </MessageList>\r\n </div>)\r\n }\r\n }\r\n})"],"names":["MKMessage","defineComponent","name","setup","showMessageList","ref","num","console","log","localStorage","getItem","connection","SignalR","HubConnectionBuilder","withUrl","accessTokenFactory","withAutomaticReconnect","nextRetryDelayInMilliseconds","val","arr","previousRetryCount","build","on","infos","notifyHandle","getUnreadMessageNum","window","start","err","setTimeout","onclose","httpRequest","MSAppClient","instance","result","get","data","code","value","onMounted","_createVNode","ElBadge","default","MKSvgIcon","onClick","MessageList","unref","v"],"mappings":";;;;;;;;;;;AAUaA,MAAAA,YAAYC,gCAAgB;AAAA,EACrCC,MAAM;AAAA,EACNC,QAAQ;A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AA,SACoBnC,IAAIgC;AAAAA,MAAK,GAAA;AAAA,QAAAI,SAAAA,MAAAF,CAAAA,YAAAG,WAAA;AAAA,UAAA,aAAA;AAAA,UAAA,SAAA;AAAA,UAAA,WACoDC,MAAOxC,gBAAgBkC,QAAQ;AAAA,QAAK,GAAA,IAAA,CAAA;AAAA,OAAAE,GAAAA,YAAAK,WAAA;AAAA,QAAA,mBAEnFC,MAAM1C,eAAe;AAAA,QAAC,4BAA6B2C,OAAO3C,gBAAgBkC,QAAQS;AAAAA,MAAE,GAAA,IAAA,CAAA,CAAA;AAAA;EAK9H;AACJ,CAAC;"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { isVNode, createVNode, createTextVNode, h } from "vue";
|
|
2
|
-
import { ElButton, ElNotification } from "element-plus";
|
|
3
|
-
const notifyHandle = (infos) => {
|
|
4
|
-
const message = isVNode(infos.message) ? infos.message : createVNode("div", {
|
|
5
|
-
"innerHTML": infos.message
|
|
6
|
-
}, [createTextVNode(" ")]);
|
|
7
|
-
const action = isVNode(infos.action) ? infos.action : h(ElButton, {
|
|
8
|
-
onClick: () => {
|
|
9
|
-
notify.close();
|
|
10
|
-
},
|
|
11
|
-
link: true,
|
|
12
|
-
type: "primary"
|
|
13
|
-
}, {
|
|
14
|
-
default: () => "关闭"
|
|
15
|
-
});
|
|
16
|
-
const notify = ElNotification({
|
|
17
|
-
type: infos.type,
|
|
18
|
-
title: infos.title,
|
|
19
|
-
showClose: false,
|
|
20
|
-
message: createVNode("div", null, [message, action])
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
export {
|
|
24
|
-
notifyHandle
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=notify.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notify.js","sources":["../../../../../src/layouts/components/header/notify.tsx"],"sourcesContent":["import { ElButton, ElNotification, NotificationParamsTyped } from \"element-plus\";\r\nimport { h, isVNode, VNode, VNodeTypes } from \"vue\";\r\n\r\nexport enum NotifyType {\r\n success = \"success\",\r\n info = \"info\",\r\n warning = \"warning\",\r\n error = \"error\",\r\n}\r\n\r\nexport const notifyHandle = (infos: { type?: NotifyType, title: string, message: string, action?: VNode | String }) => {\r\n\r\n const message = isVNode(infos.message) ? infos.message : <div v-html={infos.message}> </div >\r\n const action = isVNode(infos.action) ? infos.action : h(ElButton, { onClick: () => { notify.close() }, link: true, type: \"primary\" }, { default: () => \"关闭\" })\r\n\r\n const notify = ElNotification({\r\n type: infos.type,\r\n title: infos.title,\r\n showClose: false,\r\n message:\r\n <div>\r\n {message}\r\n {action}\r\n </div>,\r\n });\r\n}"],"names":["notifyHandle","infos","message","isVNode","_createVNode","_createTextVNode","action","h","ElButton","onClick","notify","close","link","type","default","ElNotification","title","showClose"],"mappings":";;AAUaA,MAAAA,eAAgBC,WAA0F;AAEnH,QAAMC,UAAUC,QAAQF,MAAMC,OAAO,IAAID,MAAMC,UAAOE,YAAA,OAAA;AAAA,IAAA,aAAgBH,MAAMC;AAAAA,EAAO,GAAA,CAAAG,gBAAU,GAAA,CAAA,CAAA;AAC7F,QAAMC,SAASH,QAAQF,MAAMK,MAAM,IAAIL,MAAMK,SAASC,EAAEC,UAAU;AAAA,IAAEC,SAASA,MAAM;AAAEC,aAAOC,MAAK;AAAA,IAAI;AAAA,IAAEC,MAAM;AAAA,IAAMC,MAAM;AAAA,EAAU,GAAG;AAAA,IAAEC,SAASA,MAAM;AAAA,EAAK,CAAC;AAE7J,QAAMJ,SAASK,eAAe;AAAA,IAC1BF,MAAMZ,MAAMY;AAAAA,IACZG,OAAOf,MAAMe;AAAAA,IACbC,WAAW;AAAA,IACXf,SAAOE,YAEEF,OAAAA,MAAAA,CAAAA,SACAI,MAAM,CAAA;AAAA,EAEnB,CAAC;AACL;"}
|
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, unref, watch, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, createVNode, normalizeClass, createTextVNode, createElementBlock, Fragment, renderList, toDisplayString, createCommentVNode } from "vue";
|
|
2
|
-
import { Dialoger, Messager } from "@maketribe/dm";
|
|
3
|
-
import { DvOpt, Group, OrderType } from "@maketribe/request";
|
|
4
|
-
import { ElDrawer, ElButtonGroup, ElButton, ElSelect, ElScrollbar, ElTag } from "element-plus";
|
|
5
|
-
import "@maketribe/utils";
|
|
6
|
-
import "../../../core/DataModelDefines.js";
|
|
7
|
-
import { MSAppClient } from "../../../core/MSAppClient.js";
|
|
8
|
-
const _hoisted_1 = { class: "mk-message__header" };
|
|
9
|
-
const _hoisted_2 = ["onClick"];
|
|
10
|
-
const _hoisted_3 = { class: "mk-message__body-item-header" };
|
|
11
|
-
const _hoisted_4 = { class: "mk-message__body-item-content" };
|
|
12
|
-
const _hoisted_5 = { class: "mk-message__body-item-footer" };
|
|
13
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
14
|
-
__name: "index",
|
|
15
|
-
props: {
|
|
16
|
-
showMessageList: {
|
|
17
|
-
type: Boolean,
|
|
18
|
-
default: false
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
emits: ["update:showMessageList"],
|
|
22
|
-
setup(__props, { emit: __emit }) {
|
|
23
|
-
var _a;
|
|
24
|
-
const httpRequest = (_a = MSAppClient.instance) == null ? void 0 : _a.httpRequest;
|
|
25
|
-
const props = __props;
|
|
26
|
-
const buttonName = ref("all");
|
|
27
|
-
const selectValue = ref("");
|
|
28
|
-
const loading = ref(false);
|
|
29
|
-
const pageNum = ref(1);
|
|
30
|
-
const messageList = ref([{
|
|
31
|
-
id: 1,
|
|
32
|
-
title: "系统消息",
|
|
33
|
-
content: "恭喜您!成功获得微信同款研发管理工具免费资格!恭喜您!成功获得微信同款研发管理工具免费资格!",
|
|
34
|
-
type: 1,
|
|
35
|
-
isRead: true,
|
|
36
|
-
createdAt: "2024-08-14 13:44:26"
|
|
37
|
-
}, {
|
|
38
|
-
id: 2,
|
|
39
|
-
title: "上级消息",
|
|
40
|
-
content: "未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读",
|
|
41
|
-
type: 2,
|
|
42
|
-
isRead: false,
|
|
43
|
-
createdAt: "2024-08-14 13:44:26"
|
|
44
|
-
}]);
|
|
45
|
-
const load = async (scroll) => {
|
|
46
|
-
const dom = document.querySelector(".mk-message__body").children[0];
|
|
47
|
-
if (dom.scrollHeight - dom.offsetHeight - scroll.scrollTop < 300) {
|
|
48
|
-
const result = await messageQuery.listWithResponse({
|
|
49
|
-
pc: 10,
|
|
50
|
-
pn: pageNum.value
|
|
51
|
-
});
|
|
52
|
-
pageNum.value++;
|
|
53
|
-
messageList.value.concat(result.data.data);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
const messageType = ref([
|
|
57
|
-
{
|
|
58
|
-
type: 1,
|
|
59
|
-
name: "类型1",
|
|
60
|
-
actions: (row) => {
|
|
61
|
-
console.log(row, "类型1");
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
type: 2,
|
|
66
|
-
name: "类型2",
|
|
67
|
-
actions: (row) => {
|
|
68
|
-
console.log(row, "类型2");
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
]);
|
|
72
|
-
const messageDv = DvOpt.createInstance({
|
|
73
|
-
name: "message",
|
|
74
|
-
moduleName: "ms"
|
|
75
|
-
});
|
|
76
|
-
const buttonGroup = new Group();
|
|
77
|
-
const selectGroup = new Group();
|
|
78
|
-
const messageQuery = messageDv.query().addGroup((group) => {
|
|
79
|
-
group.group.addGroup(buttonGroup).addGroup(selectGroup);
|
|
80
|
-
}).addOrderItem("createdAt", OrderType.DESC);
|
|
81
|
-
const refreshList = async (pc = 10) => {
|
|
82
|
-
return await messageQuery.list({
|
|
83
|
-
pc,
|
|
84
|
-
pn: 1
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
const emit = __emit;
|
|
88
|
-
const showMessageList = computed({
|
|
89
|
-
get() {
|
|
90
|
-
return unref(props.showMessageList);
|
|
91
|
-
},
|
|
92
|
-
set(value) {
|
|
93
|
-
emit("update:showMessageList", value);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
const readAllHandle = async () => {
|
|
97
|
-
const isConfirm = await Dialoger.confirm({
|
|
98
|
-
title: "提示",
|
|
99
|
-
message: "确定将所有消息全部标记为已读吗?",
|
|
100
|
-
type: "warning"
|
|
101
|
-
});
|
|
102
|
-
if (!isConfirm) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
try {
|
|
106
|
-
loading.value = true;
|
|
107
|
-
const result = await (httpRequest == null ? void 0 : httpRequest.post("/message/readAll"));
|
|
108
|
-
if ((result == null ? void 0 : result.data.code) !== 200) {
|
|
109
|
-
Messager.error({ message: (result == null ? void 0 : result.data.msg) || "操作失败" });
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
messageList.value = await refreshList();
|
|
113
|
-
} catch (e) {
|
|
114
|
-
console.error(e);
|
|
115
|
-
} finally {
|
|
116
|
-
loading.value = false;
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
const selectHandle = async () => {
|
|
120
|
-
selectGroup.clear();
|
|
121
|
-
if (selectValue.value) {
|
|
122
|
-
buttonGroup.addCondition("type", "=", selectValue.value);
|
|
123
|
-
}
|
|
124
|
-
messageList.value = await refreshList();
|
|
125
|
-
};
|
|
126
|
-
watch(buttonName, async () => {
|
|
127
|
-
buttonGroup.clear();
|
|
128
|
-
if (buttonName.value != "all") {
|
|
129
|
-
buttonGroup.addCondition("isRead", "=", 1);
|
|
130
|
-
}
|
|
131
|
-
messageList.value = await refreshList();
|
|
132
|
-
});
|
|
133
|
-
return (_ctx, _cache) => {
|
|
134
|
-
const _component_ElOption = resolveComponent("ElOption");
|
|
135
|
-
return showMessageList.value ? (openBlock(), createBlock(unref(ElDrawer), {
|
|
136
|
-
key: 0,
|
|
137
|
-
class: "mk-message",
|
|
138
|
-
title: "通知消息",
|
|
139
|
-
modelValue: showMessageList.value,
|
|
140
|
-
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => showMessageList.value = $event)
|
|
141
|
-
}, {
|
|
142
|
-
default: withCtx(() => [
|
|
143
|
-
createElementVNode("div", _hoisted_1, [
|
|
144
|
-
createVNode(unref(ElButtonGroup), { class: "mk-message__header-buttonGroup" }, {
|
|
145
|
-
default: withCtx(() => [
|
|
146
|
-
createVNode(unref(ElButton), {
|
|
147
|
-
size: "small",
|
|
148
|
-
class: normalizeClass([buttonName.value == "all" ? "active" : "", "mk-message__header-buttonGroup-button"]),
|
|
149
|
-
onClick: _cache[0] || (_cache[0] = () => {
|
|
150
|
-
buttonName.value = "all";
|
|
151
|
-
})
|
|
152
|
-
}, {
|
|
153
|
-
default: withCtx(() => [
|
|
154
|
-
createTextVNode(" 全部 ")
|
|
155
|
-
]),
|
|
156
|
-
_: 1
|
|
157
|
-
}, 8, ["class"]),
|
|
158
|
-
createVNode(unref(ElButton), {
|
|
159
|
-
size: "small",
|
|
160
|
-
class: normalizeClass([buttonName.value == "unRead" ? "active" : "", "mk-message__header-buttonGroup-button"]),
|
|
161
|
-
onClick: _cache[1] || (_cache[1] = () => {
|
|
162
|
-
buttonName.value = "unRead";
|
|
163
|
-
})
|
|
164
|
-
}, {
|
|
165
|
-
default: withCtx(() => [
|
|
166
|
-
createTextVNode("未读")
|
|
167
|
-
]),
|
|
168
|
-
_: 1
|
|
169
|
-
}, 8, ["class"])
|
|
170
|
-
]),
|
|
171
|
-
_: 1
|
|
172
|
-
}),
|
|
173
|
-
createVNode(unref(ElSelect), {
|
|
174
|
-
placeholder: "请选择类型",
|
|
175
|
-
size: "small",
|
|
176
|
-
modelValue: selectValue.value,
|
|
177
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => selectValue.value = $event),
|
|
178
|
-
onChange: selectHandle,
|
|
179
|
-
clearable: ""
|
|
180
|
-
}, {
|
|
181
|
-
default: withCtx(() => [
|
|
182
|
-
createVNode(_component_ElOption, {
|
|
183
|
-
value: "1",
|
|
184
|
-
label: "测试"
|
|
185
|
-
})
|
|
186
|
-
]),
|
|
187
|
-
_: 1
|
|
188
|
-
}, 8, ["modelValue"]),
|
|
189
|
-
createVNode(unref(ElButton), {
|
|
190
|
-
link: "",
|
|
191
|
-
type: "primary",
|
|
192
|
-
size: "small",
|
|
193
|
-
onClick: readAllHandle
|
|
194
|
-
}, {
|
|
195
|
-
default: withCtx(() => [
|
|
196
|
-
createTextVNode("全部已读")
|
|
197
|
-
]),
|
|
198
|
-
_: 1
|
|
199
|
-
})
|
|
200
|
-
]),
|
|
201
|
-
createVNode(unref(ElScrollbar), {
|
|
202
|
-
class: "mk-message__body",
|
|
203
|
-
onScroll: load
|
|
204
|
-
}, {
|
|
205
|
-
default: withCtx(() => [
|
|
206
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(messageList.value, (item) => {
|
|
207
|
-
return openBlock(), createElementBlock("div", {
|
|
208
|
-
class: normalizeClass(["mk-message__body-item", { "is-read": item.isRead }]),
|
|
209
|
-
key: item.id,
|
|
210
|
-
onClick: ($event) => {
|
|
211
|
-
var _a2;
|
|
212
|
-
return (_a2 = messageType.value.find((a) => a.type == item.type)) == null ? void 0 : _a2.actions(item);
|
|
213
|
-
}
|
|
214
|
-
}, [
|
|
215
|
-
createElementVNode("div", _hoisted_3, toDisplayString(item.title), 1),
|
|
216
|
-
createElementVNode("div", _hoisted_4, toDisplayString(item.content), 1),
|
|
217
|
-
createElementVNode("div", _hoisted_5, [
|
|
218
|
-
createVNode(unref(ElTag), null, {
|
|
219
|
-
default: withCtx(() => {
|
|
220
|
-
var _a2;
|
|
221
|
-
return [
|
|
222
|
-
createTextVNode(toDisplayString((_a2 = messageType.value.find((a) => a.type == item.type)) == null ? void 0 : _a2.name), 1)
|
|
223
|
-
];
|
|
224
|
-
}),
|
|
225
|
-
_: 2
|
|
226
|
-
}, 1024),
|
|
227
|
-
createTextVNode(" " + toDisplayString(item.createdAt), 1)
|
|
228
|
-
])
|
|
229
|
-
], 10, _hoisted_2);
|
|
230
|
-
}), 128))
|
|
231
|
-
]),
|
|
232
|
-
_: 1
|
|
233
|
-
})
|
|
234
|
-
]),
|
|
235
|
-
_: 1
|
|
236
|
-
}, 8, ["modelValue"])) : createCommentVNode("", true);
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
export {
|
|
241
|
-
_sfc_main as default
|
|
242
|
-
};
|
|
243
|
-
//# sourceMappingURL=index.vue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.vue.js","sources":["../../../../../src/layouts/components/message-list/index.vue"],"sourcesContent":["<template>\r\n <ElDrawer class=\"mk-message\" title=\"通知消息\" v-model=\"showMessageList as any\" v-if=\"showMessageList\">\r\n <div class=\"mk-message__header\">\r\n <ElButtonGroup class=\"mk-message__header-buttonGroup\">\r\n <ElButton size=\"small\"\r\n :class=\"[buttonName == 'all' ? 'active' : '', 'mk-message__header-buttonGroup-button']\"\r\n @click=\"() => { buttonName = 'all' }\">\r\n 全部\r\n </ElButton>\r\n <ElButton size=\"small\"\r\n :class=\"[buttonName == 'unRead' ? 'active' : '', 'mk-message__header-buttonGroup-button']\"\r\n @click=\"() => { buttonName = 'unRead' }\">未读</ElButton>\r\n </ElButtonGroup>\r\n <ElSelect placeholder=\"请选择类型\" size=\"small\" v-model=\"selectValue\" @change=\"selectHandle\" clearable>\r\n <ElOption value=\"1\" label=\"测试\"></ElOption>\r\n </ElSelect>\r\n <ElButton link type=\"primary\" size=\"small\" @click=\"readAllHandle\">全部已读</ElButton>\r\n </div>\r\n <ElScrollbar class=\"mk-message__body\" @scroll=\"load\">\r\n <div v-for=\"item in messageList\" class=\"mk-message__body-item\" :class=\"{ 'is-read': item.isRead }\"\r\n :key=\"item.id\" @click=\"messageType.find((a) => a.type == item.type)?.actions(item)\">\r\n <div class=\"mk-message__body-item-header\">\r\n {{ item.title }}\r\n </div>\r\n <div class=\"mk-message__body-item-content\">\r\n {{ item.content }}\r\n </div>\r\n <div class=\"mk-message__body-item-footer\">\r\n <ElTag>{{ messageType.find((a) => a.type == item.type)?.name }}</ElTag>\r\n {{ item.createdAt }}\r\n </div>\r\n </div>\r\n </ElScrollbar>\r\n </ElDrawer>\r\n</template>\r\n<script setup lang=\"ts\">\r\nimport { Dialoger, Messager } from \"@maketribe/dm\";\r\nimport { DvOpt, Group, OrderType } from \"@maketribe/request\";\r\nimport { ElButtonGroup, ElDrawer, ElButton, ElSelect, ElScrollbar, ElTag } from \"element-plus\";\r\nimport { MSAppClient } from \"../../../core\";\r\nimport { ref, unref, computed, Ref, watch } from \"vue\";\r\n\r\nconst httpRequest = MSAppClient.instance?.httpRequest;\r\nconst props = defineProps({\r\n showMessageList: {\r\n type: Boolean,\r\n default: false,\r\n }\r\n});\r\n\r\ninterface Message {\r\n id: number;\r\n title: string;\r\n content?: string;\r\n type: number;\r\n isRead: boolean;\r\n createdAt: string;\r\n}\r\n\r\nconst buttonName = ref('all');\r\nconst selectValue = ref('');\r\nconst loading = ref(false);\r\nconst pageNum = ref(1);\r\nconst messageList: Ref<Message[]> = ref([{\r\n id: 1,\r\n title: \"系统消息\",\r\n content: \"恭喜您!成功获得微信同款研发管理工具免费资格!恭喜您!成功获得微信同款研发管理工具免费资格!\",\r\n type: 1,\r\n isRead: true,\r\n createdAt: \"2024-08-14 13:44:26\"\r\n}, {\r\n id: 2,\r\n title: \"上级消息\",\r\n content: \"未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读未读\",\r\n type: 2,\r\n isRead: false,\r\n createdAt: \"2024-08-14 13:44:26\"\r\n}])\r\n\r\nconst load = async (scroll: { scrollTop: number }) => {\r\n const dom = document.querySelector(\".mk-message__body\")!.children[0] as HTMLElement;\r\n if (dom.scrollHeight - dom.offsetHeight - scroll.scrollTop < 300) {\r\n\r\n const result = await messageQuery.listWithResponse({\r\n pc: 10,\r\n pn: pageNum.value\r\n })\r\n pageNum.value++\r\n messageList.value.concat(result.data.data)\r\n }\r\n}\r\n\r\nconst messageType = ref([\r\n {\r\n type: 1,\r\n name: \"类型1\",\r\n actions: (row: any) => {\r\n console.log(row, \"类型1\");\r\n }\r\n },\r\n {\r\n type: 2,\r\n name: \"类型2\",\r\n actions: (row: any) => {\r\n console.log(row, \"类型2\");\r\n }\r\n }\r\n])\r\n\r\nconst messageDv = DvOpt.createInstance({\r\n name: \"message\",\r\n moduleName: \"ms\"\r\n})\r\nconst buttonGroup = new Group();\r\nconst selectGroup = new Group();\r\nconst messageQuery = messageDv.query()\r\n .addGroup((group) => { group.group.addGroup(buttonGroup).addGroup(selectGroup); })\r\n .addOrderItem(\"createdAt\", OrderType.DESC)\r\nconst refreshList = async (pc: number = 10) => {\r\n return await messageQuery.list({\r\n pc: pc,\r\n pn: 1\r\n }) as Message[];\r\n}\r\n\r\n\r\n\r\nconst emit = defineEmits([\"update:showMessageList\"]);\r\n\r\nconst showMessageList: Ref<Boolean> = computed({\r\n get() {\r\n return unref(props.showMessageList);\r\n },\r\n set(value: Boolean) {\r\n emit(\"update:showMessageList\", value);\r\n }\r\n});\r\n\r\n//将未读全部变成已读\r\nconst readAllHandle = async () => {\r\n const isConfirm = await Dialoger.confirm({\r\n title: \"提示\",\r\n message: \"确定将所有消息全部标记为已读吗?\",\r\n type: \"warning\"\r\n });\r\n\r\n if (!isConfirm) {\r\n return;\r\n }\r\n\r\n try {\r\n loading.value = true;\r\n const result = await httpRequest?.post(\"/message/readAll\");\r\n if (result?.data.code !== 200) {\r\n Messager.error({ message: result?.data.msg || \"操作失败\" });\r\n return;\r\n }\r\n messageList.value = await refreshList()\r\n } catch (e) {\r\n console.error(e);\r\n } finally {\r\n loading.value = false;\r\n }\r\n}\r\n\r\n//筛选选中的消息类型\r\nconst selectHandle = async () => {\r\n selectGroup.clear();\r\n if (selectValue.value) {\r\n buttonGroup.addCondition(\"type\", \"=\", selectValue.value)\r\n }\r\n messageList.value = await refreshList()\r\n}\r\n\r\n//根据当前选择的是全部还是未读\r\nwatch(buttonName, async () => {\r\n buttonGroup.clear();\r\n if (buttonName.value != 'all') {\r\n buttonGroup.addCondition(\"isRead\", \"=\", 1)\r\n }\r\n messageList.value = await refreshList()\r\n})\r\n\r\n</script>\r\n<style lang='scss'></style>"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0CM,UAAA,eAAc,iBAAY,aAAZ,mBAAsB;AAC1C,UAAM,QAAQ;AAgBR,UAAA,aAAa,IAAI,KAAK;AACtB,UAAA,cAAc,IAAI,EAAE;AACpB,UAAA,UAAU,IAAI,KAAK;AACnB,UAAA,UAAU,IAAI,CAAC;AACf,UAAA,cAA8B,IAAI,CAAC;AAAA,MACrC,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,SAAS;AAAA,MACT,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,WAAW;AAAA,IAAA,GACZ;AAAA,MACC,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,SAAS;AAAA,MACT,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,WAAW;AAAA,IACd,CAAA,CAAC;AAEI,UAAA,OAAO,OAAO,WAAkC;AAClD,YAAM,MAAM,SAAS,cAAc,mBAAmB,EAAG,SAAS,CAAC;AACnE,UAAI,IAAI,eAAe,IAAI,eAAe,OAAO,YAAY,KAAK;AAExD,cAAA,SAAS,MAAM,aAAa,iBAAiB;AAAA,UAC/C,IAAI;AAAA,UACJ,IAAI,QAAQ;AAAA,QAAA,CACf;AACO,gBAAA;AACR,oBAAY,MAAM,OAAO,OAAO,KAAK,IAAI;AAAA,MAC7C;AAAA,IAAA;AAGJ,UAAM,cAAc,IAAI;AAAA,MACpB;AAAA,QACI,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS,CAAC,QAAa;AACX,kBAAA,IAAI,KAAK,KAAK;AAAA,QAC1B;AAAA,MACJ;AAAA,MACA;AAAA,QACI,MAAM;AAAA,QACN,MAAM;AAA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