@cmstops/pro-compo 0.1.2 → 0.1.3
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/index.css +115 -1
- package/dist/index.min.css +1 -1
- package/es/appCenter/component.js +1 -1
- package/es/appCenter/script/routeMap.d.ts +1 -1
- package/es/appCenter/style/index.css +1 -1
- package/es/appCenter/style/index.less +1 -1
- package/es/index.css +115 -1
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/es/index.less +2 -0
- package/es/messageBox/component.d.ts +0 -0
- package/es/messageBox/component.js +145 -0
- package/es/messageBox/index.d.ts +2 -0
- package/es/messageBox/index.js +7 -0
- package/es/messageBox/list.d.ts +0 -0
- package/es/messageBox/list.js +116 -0
- package/es/messageBox/script/api.d.ts +6 -0
- package/es/messageBox/script/api.js +16 -0
- package/es/messageBox/style/css.js +1 -0
- package/es/messageBox/style/index.css +64 -0
- package/es/messageBox/style/index.d.ts +1 -0
- package/es/messageBox/style/index.js +1 -0
- package/es/messageBox/style/index.less +71 -0
- package/es/userAvater/component.d.ts +0 -0
- package/es/userAvater/component.js +167 -0
- package/es/userAvater/index.d.ts +2 -0
- package/es/userAvater/index.js +7 -0
- package/es/userAvater/script/api.d.ts +8 -0
- package/es/userAvater/script/api.js +32 -0
- package/es/userAvater/style/css.js +1 -0
- package/es/userAvater/style/index.css +50 -0
- package/es/userAvater/style/index.d.ts +1 -0
- package/es/userAvater/style/index.js +1 -0
- package/es/userAvater/style/index.less +54 -0
- package/es/utils/request.js +3 -2
- package/lib/appCenter/component.js +1 -1
- package/lib/appCenter/style/index.css +1 -1
- package/lib/appCenter/style/index.less +1 -1
- package/lib/index.css +115 -1
- package/lib/index.js +4 -0
- package/lib/index.less +2 -0
- package/lib/messageBox/component.js +146 -0
- package/lib/messageBox/index.js +8 -0
- package/lib/messageBox/list.js +117 -0
- package/lib/messageBox/script/api.js +19 -0
- package/lib/messageBox/style/css.js +2 -0
- package/lib/messageBox/style/index.css +64 -0
- package/lib/messageBox/style/index.js +2 -0
- package/lib/messageBox/style/index.less +71 -0
- package/lib/userAvater/component.js +168 -0
- package/lib/userAvater/index.js +8 -0
- package/lib/userAvater/script/api.js +37 -0
- package/lib/userAvater/style/css.js +2 -0
- package/lib/userAvater/style/index.css +50 -0
- package/lib/userAvater/style/index.js +2 -0
- package/lib/userAvater/style/index.less +54 -0
- package/lib/utils/request.js +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var vue = require("vue");
|
|
3
|
+
var webVue = require("@arco-design/web-vue");
|
|
4
|
+
var list = require("./list.js");
|
|
5
|
+
var api = require("./script/api.js");
|
|
6
|
+
const _hoisted_1 = { class: "message-boxs-container" };
|
|
7
|
+
const _hoisted_2 = {
|
|
8
|
+
key: 1,
|
|
9
|
+
class: "reference-btn"
|
|
10
|
+
};
|
|
11
|
+
const _hoisted_3 = { class: "message-boxs-popover" };
|
|
12
|
+
const _sfc_main = vue.defineComponent({
|
|
13
|
+
...{ name: "messageBox" },
|
|
14
|
+
__name: "component",
|
|
15
|
+
props: {
|
|
16
|
+
BASE_API: {}
|
|
17
|
+
},
|
|
18
|
+
setup(__props) {
|
|
19
|
+
const props = __props;
|
|
20
|
+
const BASE_API = props.BASE_API || "https://site.cmstop.xyz";
|
|
21
|
+
const slotTest = !!vue.useSlots().reference;
|
|
22
|
+
const readMessagesCount = vue.ref(0);
|
|
23
|
+
const unreadMessagesCount = vue.ref(0);
|
|
24
|
+
const isLoadingMore = vue.ref(false);
|
|
25
|
+
const unreadMessages = vue.ref([]);
|
|
26
|
+
const readMessages = vue.ref([]);
|
|
27
|
+
const isNoMore = vue.ref(false);
|
|
28
|
+
const page = vue.ref({ limit: 20, offset: 0 });
|
|
29
|
+
const handlePopupVisibleChange = (visible) => {
|
|
30
|
+
if (!visible) {
|
|
31
|
+
setAllMsgToRead();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const setAllMsgToRead = async () => {
|
|
35
|
+
try {
|
|
36
|
+
const res = await api.setAllMsgRead(BASE_API);
|
|
37
|
+
if (res.code === 0) {
|
|
38
|
+
setData();
|
|
39
|
+
}
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.log(error);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const setData = async () => {
|
|
45
|
+
isLoadingMore.value = true;
|
|
46
|
+
const res = await api.getNoticeList(BASE_API, {}).catch(() => {
|
|
47
|
+
isLoadingMore.value = false;
|
|
48
|
+
});
|
|
49
|
+
if ((res == null ? void 0 : res.code) === 0 && (res == null ? void 0 : res.message)) {
|
|
50
|
+
const data = res.message;
|
|
51
|
+
if (data.notice_state) {
|
|
52
|
+
unreadMessages.value = data.notice_state[0] && data.notice_state[0].notices || [];
|
|
53
|
+
readMessages.value = data.notice_state[1] && data.notice_state[1].notices || [];
|
|
54
|
+
}
|
|
55
|
+
readMessagesCount.value = data.readed || 0;
|
|
56
|
+
unreadMessagesCount.value = data.unread || 0;
|
|
57
|
+
isLoadingMore.value = false;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const loadMore = async () => {
|
|
61
|
+
if (unreadMessages.value.length !== 0)
|
|
62
|
+
return;
|
|
63
|
+
isLoadingMore.value = true;
|
|
64
|
+
try {
|
|
65
|
+
page.value.offset = readMessages.value.length;
|
|
66
|
+
const res = await api.getNoticeList(BASE_API, {
|
|
67
|
+
state: 1,
|
|
68
|
+
...page.value
|
|
69
|
+
}).catch(() => {
|
|
70
|
+
isLoadingMore.value = false;
|
|
71
|
+
});
|
|
72
|
+
if (res.code === 0 && res.message) {
|
|
73
|
+
const { notice_state } = res.message;
|
|
74
|
+
notice_state[1].notices.length < page.value.limit && (isNoMore.value = true);
|
|
75
|
+
readMessages.value = readMessages.value.concat(
|
|
76
|
+
notice_state[1] && notice_state[1].notices || []
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
isLoadingMore.value = false;
|
|
80
|
+
} catch (error) {
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
vue.onMounted(() => {
|
|
84
|
+
setData();
|
|
85
|
+
});
|
|
86
|
+
return (_ctx, _cache) => {
|
|
87
|
+
const _directive_loading = vue.resolveDirective("loading");
|
|
88
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
89
|
+
vue.createVNode(vue.unref(webVue.Popover), {
|
|
90
|
+
trigger: "hover",
|
|
91
|
+
position: "bottom",
|
|
92
|
+
"arrow-style": { display: "none" },
|
|
93
|
+
"content-style": { padding: 0, minWidth: "400px" },
|
|
94
|
+
"popup-visible-change": handlePopupVisibleChange
|
|
95
|
+
}, {
|
|
96
|
+
content: vue.withCtx(() => [
|
|
97
|
+
vue.createElementVNode("div", _hoisted_3, [
|
|
98
|
+
vue.createVNode(vue.unref(webVue.Tabs), null, {
|
|
99
|
+
default: vue.withCtx(() => [
|
|
100
|
+
vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(webVue.TabPane), { key: "1" }, {
|
|
101
|
+
title: vue.withCtx(() => [
|
|
102
|
+
vue.createTextVNode("\u6D88\u606F")
|
|
103
|
+
]),
|
|
104
|
+
default: vue.withCtx(() => [
|
|
105
|
+
unreadMessages.value.length === 0 ? (vue.openBlock(), vue.createBlock(list, {
|
|
106
|
+
key: 0,
|
|
107
|
+
list: readMessages.value,
|
|
108
|
+
"onUpdate:list": _cache[0] || (_cache[0] = ($event) => readMessages.value = $event),
|
|
109
|
+
"list-type": "unread",
|
|
110
|
+
"is-loading-more": isLoadingMore.value,
|
|
111
|
+
"is-no-more": isNoMore.value,
|
|
112
|
+
onLoadMoreMsg: loadMore
|
|
113
|
+
}, null, 8, ["list", "is-loading-more", "is-no-more"])) : (vue.openBlock(), vue.createBlock(list, {
|
|
114
|
+
key: 1,
|
|
115
|
+
list: unreadMessages.value,
|
|
116
|
+
"onUpdate:list": _cache[1] || (_cache[1] = ($event) => unreadMessages.value = $event),
|
|
117
|
+
"list-type": "unread",
|
|
118
|
+
"is-loading-more": isLoadingMore.value,
|
|
119
|
+
"is-no-more": isNoMore.value,
|
|
120
|
+
onLoadMoreMsg: loadMore
|
|
121
|
+
}, null, 8, ["list", "is-loading-more", "is-no-more"]))
|
|
122
|
+
]),
|
|
123
|
+
_: 1
|
|
124
|
+
})), [
|
|
125
|
+
[_directive_loading, isLoadingMore.value]
|
|
126
|
+
])
|
|
127
|
+
]),
|
|
128
|
+
_: 1
|
|
129
|
+
})
|
|
130
|
+
])
|
|
131
|
+
]),
|
|
132
|
+
default: vue.withCtx(() => [
|
|
133
|
+
vue.createVNode(vue.unref(webVue.Badge), { count: unreadMessagesCount.value }, {
|
|
134
|
+
default: vue.withCtx(() => [
|
|
135
|
+
slotTest ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : (vue.openBlock(), vue.createElementBlock("button", _hoisted_2, "\u6D88\u606F\u5217\u8868"))
|
|
136
|
+
]),
|
|
137
|
+
_: 3
|
|
138
|
+
}, 8, ["count"])
|
|
139
|
+
]),
|
|
140
|
+
_: 3
|
|
141
|
+
})
|
|
142
|
+
]);
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
module.exports = _sfc_main;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var vue = require("vue");
|
|
3
|
+
var webVue = require("@arco-design/web-vue");
|
|
4
|
+
var icon = require("@arco-design/web-vue/es/icon");
|
|
5
|
+
const _hoisted_1 = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "empty-list"
|
|
8
|
+
};
|
|
9
|
+
const _hoisted_2 = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "message-list"
|
|
12
|
+
};
|
|
13
|
+
const _hoisted_3 = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "message-body"
|
|
16
|
+
};
|
|
17
|
+
const _hoisted_4 = { class: "media-message-content" };
|
|
18
|
+
const _hoisted_5 = { class: "message-content" };
|
|
19
|
+
const _hoisted_6 = { class: "title" };
|
|
20
|
+
const _hoisted_7 = { key: 0 };
|
|
21
|
+
const _hoisted_8 = { class: "time" };
|
|
22
|
+
const _hoisted_9 = ["onClick"];
|
|
23
|
+
const _hoisted_10 = { class: "message-media-title" };
|
|
24
|
+
const _hoisted_11 = { class: "message-media-title-hover" };
|
|
25
|
+
const _hoisted_12 = { class: "action" };
|
|
26
|
+
const _sfc_main = vue.defineComponent({
|
|
27
|
+
__name: "list",
|
|
28
|
+
props: {
|
|
29
|
+
listType: {},
|
|
30
|
+
list: {},
|
|
31
|
+
isLoadingMore: { type: Boolean },
|
|
32
|
+
isNorMore: { type: Boolean }
|
|
33
|
+
},
|
|
34
|
+
emits: ["loadMoreMsg"],
|
|
35
|
+
setup(__props, { emit: emits }) {
|
|
36
|
+
const props = __props;
|
|
37
|
+
const isEmptyList = vue.computed(() => {
|
|
38
|
+
if (props.list.length === 0) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
});
|
|
43
|
+
const listData = vue.computed(() => {
|
|
44
|
+
return props.list;
|
|
45
|
+
});
|
|
46
|
+
const approvalStateMapText = vue.ref({
|
|
47
|
+
approval_msg: { label: "\u63D0\u4EA4\u4E86\u4E00\u9879\u5185\u5BB9\uFF0C\u5F85\u60A8\u5BA1\u6838", show_user_alias: true },
|
|
48
|
+
approval_cc_msg: { label: "\u63D0\u4EA4\u4E86\u4E00\u9879\u5185\u5BB9\uFF0C\u6284\u9001\u7ED9\u60A8" },
|
|
49
|
+
approval_pass: { label: "\u60A8\u63D0\u4EA4\u4E86\u4E00\u9879\u5185\u5BB9\u5DF2\u5BA1\u6838\u901A\u8FC7" },
|
|
50
|
+
approval_fail: { label: "\u60A8\u63D0\u4EA4\u4E86\u4E00\u9879\u5185\u5BB9\u5BA1\u6838\u88AB\u9A73\u56DE" },
|
|
51
|
+
approval_retrial: { label: "\u60A8\u63D0\u4EA4\u4E86\u4E00\u9879\u5185\u5BB9\u5BA1\u6838\u88AB\u9A73\u56DE\u91CD\u5BA1" }
|
|
52
|
+
});
|
|
53
|
+
const openApprovalDetail = (msg) => {
|
|
54
|
+
console.log(msg);
|
|
55
|
+
};
|
|
56
|
+
const handleScroll = (event) => {
|
|
57
|
+
event && event.stopPropagation();
|
|
58
|
+
if (event.target) {
|
|
59
|
+
const { scrollTop, scrollHeight, clientHeight } = event.target;
|
|
60
|
+
if (scrollTop + clientHeight >= scrollHeight) {
|
|
61
|
+
if (props.isLoadingMore === false && !props.isNorMore) {
|
|
62
|
+
emits("loadMoreMsg", props.listType);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
return (_ctx, _cache) => {
|
|
68
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
69
|
+
isEmptyList.value === true ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
70
|
+
vue.createVNode(vue.unref(webVue.Empty))
|
|
71
|
+
])) : vue.createCommentVNode("v-if", true),
|
|
72
|
+
vue.createVNode(vue.unref(webVue.Scrollbar), {
|
|
73
|
+
class: "msg-scroll-bar",
|
|
74
|
+
onScroll: handleScroll
|
|
75
|
+
}, {
|
|
76
|
+
default: vue.withCtx(() => [
|
|
77
|
+
listData.value.length > 0 ? (vue.openBlock(), vue.createElementBlock("ul", _hoisted_2, [
|
|
78
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(listData.value, (item) => {
|
|
79
|
+
return vue.openBlock(), vue.createElementBlock("li", {
|
|
80
|
+
key: "list_" + item.msg.nid,
|
|
81
|
+
class: "message-item"
|
|
82
|
+
}, [
|
|
83
|
+
vue.createCommentVNode(" \u901A\u77E5\u5185\u5BB9 "),
|
|
84
|
+
item.msg ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, [
|
|
85
|
+
vue.createElementVNode("div", _hoisted_4, [
|
|
86
|
+
vue.createElementVNode("div", _hoisted_5, [
|
|
87
|
+
vue.createElementVNode("span", _hoisted_6, [
|
|
88
|
+
approvalStateMapText.value[item.msg.t].show_user_alias ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_7, vue.toDisplayString(item.msg.alias), 1)) : vue.createCommentVNode("v-if", true),
|
|
89
|
+
vue.createTextVNode(" " + vue.toDisplayString(approvalStateMapText.value[item.msg.t].label), 1)
|
|
90
|
+
]),
|
|
91
|
+
vue.createElementVNode("span", _hoisted_8, vue.toDisplayString(item.msg.time), 1)
|
|
92
|
+
]),
|
|
93
|
+
vue.createElementVNode("div", {
|
|
94
|
+
class: "message-info",
|
|
95
|
+
onClick: vue.withModifiers(($event) => openApprovalDetail(item.msg), ["stop"])
|
|
96
|
+
}, [
|
|
97
|
+
vue.createElementVNode("div", _hoisted_10, [
|
|
98
|
+
vue.createCommentVNode(' <FileTypeIcons\n class="icon"\n :file-type="item.msg.catalog"\n :doc-type="item.msg.series"\n ></FileTypeIcons> '),
|
|
99
|
+
vue.createElementVNode("span", _hoisted_11, vue.toDisplayString(item.msg.title), 1)
|
|
100
|
+
]),
|
|
101
|
+
vue.createElementVNode("div", _hoisted_12, [
|
|
102
|
+
vue.createVNode(vue.unref(icon.IconRight))
|
|
103
|
+
])
|
|
104
|
+
], 8, _hoisted_9)
|
|
105
|
+
])
|
|
106
|
+
])) : vue.createCommentVNode("v-if", true)
|
|
107
|
+
]);
|
|
108
|
+
}), 128))
|
|
109
|
+
])) : vue.createCommentVNode("v-if", true)
|
|
110
|
+
]),
|
|
111
|
+
_: 1
|
|
112
|
+
})
|
|
113
|
+
], 64);
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
module.exports = _sfc_main;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
var request = require("../../utils/request.js");
|
|
4
|
+
function getNoticeList(BASE_API, params) {
|
|
5
|
+
return request(BASE_API, {
|
|
6
|
+
url: "/poplar/v2/notice",
|
|
7
|
+
method: "post",
|
|
8
|
+
data: params
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function setAllMsgRead(BASE_API, params) {
|
|
12
|
+
return request(BASE_API, {
|
|
13
|
+
url: "/poplar/v2/notice/readed",
|
|
14
|
+
method: "post",
|
|
15
|
+
data: params
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
exports.getNoticeList = getNoticeList;
|
|
19
|
+
exports.setAllMsgRead = setAllMsgRead;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.reference-btn {
|
|
2
|
+
border: none;
|
|
3
|
+
padding: 12px 16px;
|
|
4
|
+
border-radius: 4px;
|
|
5
|
+
color: #5f5f5f;
|
|
6
|
+
}
|
|
7
|
+
.message-boxs-popover {
|
|
8
|
+
width: 435px;
|
|
9
|
+
position: relative;
|
|
10
|
+
}
|
|
11
|
+
.message-boxs-popover .arco-tabs-content {
|
|
12
|
+
padding-top: 0;
|
|
13
|
+
}
|
|
14
|
+
.message-boxs-popover .msg-scroll-bar {
|
|
15
|
+
height: 80vh;
|
|
16
|
+
overflow-y: auto;
|
|
17
|
+
display: block;
|
|
18
|
+
}
|
|
19
|
+
.message-boxs-popover .message-list {
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
list-style: none;
|
|
23
|
+
}
|
|
24
|
+
.message-boxs-popover .message-item {
|
|
25
|
+
padding: 16px;
|
|
26
|
+
padding-bottom: 0px;
|
|
27
|
+
}
|
|
28
|
+
.message-boxs-popover .message-item:last-child .message-body {
|
|
29
|
+
border-bottom: none;
|
|
30
|
+
}
|
|
31
|
+
.message-boxs-popover .message-item .message-body {
|
|
32
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
|
33
|
+
padding-bottom: 16px;
|
|
34
|
+
}
|
|
35
|
+
.message-boxs-popover .message-item .message-body .media-message-content {
|
|
36
|
+
width: 100%;
|
|
37
|
+
}
|
|
38
|
+
.message-boxs-popover .message-item .message-body .media-message-content .message-content {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: space-between;
|
|
42
|
+
font-size: 12px;
|
|
43
|
+
color: #4e5969;
|
|
44
|
+
margin-bottom: 18px;
|
|
45
|
+
}
|
|
46
|
+
.message-boxs-popover .message-item .message-body .media-message-content .message-info {
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: space-between;
|
|
50
|
+
color: #1d2129;
|
|
51
|
+
font-size: 14px;
|
|
52
|
+
line-height: 14px;
|
|
53
|
+
}
|
|
54
|
+
.message-boxs-popover .message-item .message-body .media-message-content .message-info .message-media-title {
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
text-overflow: ellipsis;
|
|
57
|
+
white-space: nowrap;
|
|
58
|
+
}
|
|
59
|
+
.message-boxs-popover .message-item .message-body .media-message-content .message-info .message-media-title .icon {
|
|
60
|
+
margin-right: 4px;
|
|
61
|
+
}
|
|
62
|
+
.message-boxs-popover .message-item .message-body .media-message-content .message-info .message-media-title:hover {
|
|
63
|
+
text-decoration: underline;
|
|
64
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
.reference-btn {
|
|
2
|
+
border: none;
|
|
3
|
+
padding: 12px 16px;
|
|
4
|
+
border-radius: 4px;
|
|
5
|
+
color: #5f5f5f;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.message-boxs-popover {
|
|
9
|
+
width: 435px;
|
|
10
|
+
position: relative;
|
|
11
|
+
// padding: 10px;
|
|
12
|
+
|
|
13
|
+
.arco-tabs-content {
|
|
14
|
+
padding-top: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.msg-scroll-bar {
|
|
18
|
+
height: 80vh;
|
|
19
|
+
overflow-y: auto;
|
|
20
|
+
display: block;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.message-list {
|
|
24
|
+
margin: 0;
|
|
25
|
+
padding: 0;
|
|
26
|
+
list-style: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.message-item {
|
|
30
|
+
padding: 16px;
|
|
31
|
+
padding-bottom: 0px;
|
|
32
|
+
&:last-child .message-body {
|
|
33
|
+
border-bottom: none;
|
|
34
|
+
}
|
|
35
|
+
.message-body {
|
|
36
|
+
border-bottom: 1px solid rgba(0,0,0,.05);
|
|
37
|
+
padding-bottom: 16px;
|
|
38
|
+
|
|
39
|
+
.media-message-content {
|
|
40
|
+
width: 100%;
|
|
41
|
+
.message-content {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: space-between;
|
|
45
|
+
font-size: 12px;
|
|
46
|
+
color: #4e5969;
|
|
47
|
+
margin-bottom: 18px;
|
|
48
|
+
}
|
|
49
|
+
.message-info {
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: space-between;
|
|
53
|
+
color: #1d2129;
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
line-height: 14px;
|
|
56
|
+
.message-media-title {
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
text-overflow: ellipsis;
|
|
59
|
+
white-space: nowrap;
|
|
60
|
+
.icon {
|
|
61
|
+
margin-right: 4px;
|
|
62
|
+
}
|
|
63
|
+
&:hover {
|
|
64
|
+
text-decoration: underline;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var vue = require("vue");
|
|
3
|
+
var webVue = require("@arco-design/web-vue");
|
|
4
|
+
var icon = require("@arco-design/web-vue/es/icon");
|
|
5
|
+
var api = require("./script/api.js");
|
|
6
|
+
const _hoisted_1 = { class: "user-avater-container" };
|
|
7
|
+
const _hoisted_2 = ["src"];
|
|
8
|
+
const _hoisted_3 = { key: 1 };
|
|
9
|
+
const _hoisted_4 = { class: "user-avater-content-info" };
|
|
10
|
+
const _hoisted_5 = { class: "avatar" };
|
|
11
|
+
const _hoisted_6 = ["src"];
|
|
12
|
+
const _hoisted_7 = { class: "nick-name" };
|
|
13
|
+
const _hoisted_8 = { class: "user-name" };
|
|
14
|
+
const _hoisted_9 = { class: "user-email" };
|
|
15
|
+
const _hoisted_10 = {
|
|
16
|
+
key: 0,
|
|
17
|
+
class: "org-alias"
|
|
18
|
+
};
|
|
19
|
+
const _hoisted_11 = { class: "b_info_bottom" };
|
|
20
|
+
const _sfc_main = vue.defineComponent({
|
|
21
|
+
...{ name: "userAvater" },
|
|
22
|
+
__name: "component",
|
|
23
|
+
props: {
|
|
24
|
+
BASE_API: {},
|
|
25
|
+
BASE_ACCOUNT_HOST: {},
|
|
26
|
+
userStore: {}
|
|
27
|
+
},
|
|
28
|
+
setup(__props) {
|
|
29
|
+
const props = __props;
|
|
30
|
+
const BASE_API = props.BASE_API || "https://site.cmstop.xyz";
|
|
31
|
+
const BASE_ACCOUNT_HOST = props.BASE_ACCOUNT_HOST || "https://account.cmstop.xyz";
|
|
32
|
+
const slotTest = !!vue.useSlots().reference;
|
|
33
|
+
const userInfo = vue.ref(null);
|
|
34
|
+
const loadUserInfo = async () => {
|
|
35
|
+
const res = await api.getUserInfo(BASE_API);
|
|
36
|
+
if (res.code === 0 && res.message) {
|
|
37
|
+
const userInfo2 = res.message;
|
|
38
|
+
getUserDomainsByDetail(userInfo2);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const getUserDomainsByDetail = async (_userInfo) => {
|
|
42
|
+
const res = await api.getUserDetails(BASE_API, {
|
|
43
|
+
id: _userInfo.id,
|
|
44
|
+
domainid: _userInfo.domain_id
|
|
45
|
+
});
|
|
46
|
+
if (res.code === 0 && res.message) {
|
|
47
|
+
_userInfo.domains = res.message.domains;
|
|
48
|
+
for (const k in _userInfo.domains) {
|
|
49
|
+
if (_userInfo.domains[k].id === _userInfo.domain_id) {
|
|
50
|
+
_userInfo.currentDomain = _userInfo.domains[k].alias;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
userInfo.value = _userInfo;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const loginOut = async () => {
|
|
57
|
+
await api.accountLogout(BASE_ACCOUNT_HOST);
|
|
58
|
+
window.location.href = BASE_ACCOUNT_HOST;
|
|
59
|
+
};
|
|
60
|
+
const profile = () => {
|
|
61
|
+
window.open(`${BASE_API}/foowz/#/account`, "_blank");
|
|
62
|
+
};
|
|
63
|
+
const domainClick = async (item) => {
|
|
64
|
+
const res = await api.domainSelect(BASE_API, item.id);
|
|
65
|
+
if (res.code === 0 && res.message) {
|
|
66
|
+
window.location.href = res.message;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
vue.onMounted(() => {
|
|
70
|
+
if (props.userStore) {
|
|
71
|
+
userInfo.value = props.userStore;
|
|
72
|
+
getUserDomainsByDetail(userInfo.value);
|
|
73
|
+
} else {
|
|
74
|
+
loadUserInfo();
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
return (_ctx, _cache) => {
|
|
78
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
79
|
+
userInfo.value ? (vue.openBlock(), vue.createBlock(vue.unref(webVue.Popover), {
|
|
80
|
+
key: 0,
|
|
81
|
+
trigger: "hover",
|
|
82
|
+
position: "bottom",
|
|
83
|
+
"arrow-style": { display: "none" },
|
|
84
|
+
"content-style": { padding: 0 }
|
|
85
|
+
}, {
|
|
86
|
+
content: vue.withCtx(() => {
|
|
87
|
+
var _a;
|
|
88
|
+
return [
|
|
89
|
+
vue.createElementVNode("div", _hoisted_4, [
|
|
90
|
+
vue.createElementVNode("div", _hoisted_5, [
|
|
91
|
+
vue.createVNode(vue.unref(webVue.Avatar), {
|
|
92
|
+
"trigger-type": "mask",
|
|
93
|
+
onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => profile(), ["stop"]))
|
|
94
|
+
}, {
|
|
95
|
+
"trigger-icon": vue.withCtx(() => [
|
|
96
|
+
vue.createVNode(vue.unref(icon.IconEdit))
|
|
97
|
+
]),
|
|
98
|
+
default: vue.withCtx(() => [
|
|
99
|
+
vue.createElementVNode("img", {
|
|
100
|
+
alt: "avatar",
|
|
101
|
+
src: userInfo.value.avatar
|
|
102
|
+
}, null, 8, _hoisted_6)
|
|
103
|
+
]),
|
|
104
|
+
_: 1
|
|
105
|
+
})
|
|
106
|
+
]),
|
|
107
|
+
vue.createElementVNode("div", _hoisted_7, vue.toDisplayString(userInfo.value.alias || "\u6682\u65E0"), 1),
|
|
108
|
+
vue.createElementVNode("div", _hoisted_8, vue.toDisplayString(userInfo.value.name), 1),
|
|
109
|
+
vue.createElementVNode("div", _hoisted_9, vue.toDisplayString(userInfo.value.mail || "\u6682\u65E0\u90AE\u7BB1"), 1),
|
|
110
|
+
((_a = userInfo.value.domains) == null ? void 0 : _a.length) === 1 && userInfo.value.currentDomain ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, vue.toDisplayString(userInfo.value.currentDomain), 1)) : vue.createCommentVNode("v-if", true),
|
|
111
|
+
vue.createVNode(vue.unref(webVue.Dropdown), null, {
|
|
112
|
+
content: vue.withCtx(() => [
|
|
113
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(userInfo.value.domains, (item, index) => {
|
|
114
|
+
return vue.openBlock(), vue.createBlock(vue.unref(webVue.Doption), {
|
|
115
|
+
key: index,
|
|
116
|
+
onClick: vue.withModifiers(($event) => domainClick(item), ["stop"])
|
|
117
|
+
}, {
|
|
118
|
+
default: vue.withCtx(() => [
|
|
119
|
+
vue.createTextVNode(vue.toDisplayString(item.alias), 1)
|
|
120
|
+
]),
|
|
121
|
+
_: 2
|
|
122
|
+
}, 1032, ["onClick"]);
|
|
123
|
+
}), 128))
|
|
124
|
+
]),
|
|
125
|
+
default: vue.withCtx(() => [
|
|
126
|
+
vue.createVNode(vue.unref(webVue.Button), { long: "" }, {
|
|
127
|
+
default: vue.withCtx(() => [
|
|
128
|
+
vue.createTextVNode(vue.toDisplayString(userInfo.value.currentDomain), 1)
|
|
129
|
+
]),
|
|
130
|
+
_: 1
|
|
131
|
+
})
|
|
132
|
+
]),
|
|
133
|
+
_: 1
|
|
134
|
+
}),
|
|
135
|
+
vue.createElementVNode("div", _hoisted_11, [
|
|
136
|
+
vue.createVNode(vue.unref(webVue.Button), {
|
|
137
|
+
long: "",
|
|
138
|
+
type: "text",
|
|
139
|
+
onClick: _cache[1] || (_cache[1] = ($event) => loginOut())
|
|
140
|
+
}, {
|
|
141
|
+
default: vue.withCtx(() => [
|
|
142
|
+
vue.createTextVNode("\u9000\u51FA")
|
|
143
|
+
]),
|
|
144
|
+
_: 1
|
|
145
|
+
})
|
|
146
|
+
])
|
|
147
|
+
])
|
|
148
|
+
];
|
|
149
|
+
}),
|
|
150
|
+
default: vue.withCtx(() => [
|
|
151
|
+
slotTest ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : (vue.openBlock(), vue.createBlock(vue.unref(webVue.Avatar), { key: 1 }, {
|
|
152
|
+
default: vue.withCtx(() => [
|
|
153
|
+
userInfo.value.avatar ? (vue.openBlock(), vue.createElementBlock("img", {
|
|
154
|
+
key: 0,
|
|
155
|
+
alt: "avatar",
|
|
156
|
+
src: userInfo.value.avatar
|
|
157
|
+
}, null, 8, _hoisted_2)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_3, vue.toDisplayString(userInfo.value.name), 1))
|
|
158
|
+
]),
|
|
159
|
+
_: 1
|
|
160
|
+
}))
|
|
161
|
+
]),
|
|
162
|
+
_: 3
|
|
163
|
+
})) : vue.createCommentVNode("v-if", true)
|
|
164
|
+
]);
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
module.exports = _sfc_main;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
var request = require("../../utils/request.js");
|
|
4
|
+
function getUserInfo(BASE_API, params) {
|
|
5
|
+
return request(BASE_API, {
|
|
6
|
+
url: "/poplar/v2/account/info",
|
|
7
|
+
method: "get",
|
|
8
|
+
params
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function getUserDetails(BASE_API, params) {
|
|
12
|
+
return request(BASE_API, {
|
|
13
|
+
url: `/poplar/v2/account/detail`,
|
|
14
|
+
method: "get",
|
|
15
|
+
params
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function domainSelect(BASE_API, did) {
|
|
19
|
+
return request(BASE_API, {
|
|
20
|
+
url: "/sandy/v1/account/domain/select",
|
|
21
|
+
method: "post",
|
|
22
|
+
data: {
|
|
23
|
+
domain_id: did
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function accountLogout(BASE_API, params) {
|
|
28
|
+
return request(BASE_API, {
|
|
29
|
+
url: "/sandy/v1/account/logout",
|
|
30
|
+
method: "post",
|
|
31
|
+
params
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
exports.accountLogout = accountLogout;
|
|
35
|
+
exports.domainSelect = domainSelect;
|
|
36
|
+
exports.getUserDetails = getUserDetails;
|
|
37
|
+
exports.getUserInfo = getUserInfo;
|