This commit is contained in:
tangtaoit 2024-08-12 19:52:16 +08:00
commit 19d3870200
9 changed files with 254 additions and 199 deletions

View File

@ -25,7 +25,7 @@
<img src="https://img.shields.io/badge/Semi UI-2.24.2-%236CB52D.svg?logo=SemiUI" alt="SemiUI">
</a> &nbsp;
<a href="https://turbo.build/repo" target="_blank" rel="noopener" style="display:inline-block;">
<img src="https://img.shields.io/badge/turbo-1.4.7-%236CB52D.svg?logo=Turbo&logoColor=FFF" alt="Turbo" />
<img src="https://img.shields.io/badge/turbo-2.0.9-%236CB52D.svg?logo=Turbo&logoColor=FFF" alt="Turbo" />
</a> &nbsp;
<a href="https://githubim.com/" target="_blank" rel="noopener" style="display:inline-block;">
<img src="https://img.shields.io/badge/WukongIm-1.2.10-%236CB52D.svg?logo=WukonIm" alt="Wukongim" />

View File

@ -1,11 +1,12 @@
import { Checkbox } from "@douyinfe/semi-ui/lib/es/checkbox";
import { Checkbox } from "@douyinfe/semi-ui";
import React, { Component } from "react";
import { getPinyin } from "../../Utils/pinYin";
import { toSimplized } from "../../Utils/t2s";
import "./index.css";
import { IconSearchStroked } from "@douyinfe/semi-icons";
import { animateScroll, scroller } from "react-scroll";
import "./index.css";
export class IndexTableItem {
id!: string;
name!: string;

View File

@ -1,6 +1,6 @@
import React, { Component } from "react";
import "./index.css"
import { Input } from "@douyinfe/semi-ui/lib/es/input";
import { Input } from "@douyinfe/semi-ui";
import { IconSearchStroked } from '@douyinfe/semi-icons';
export interface SearchProps {

View File

@ -3,12 +3,14 @@ import React from "react";
import { Component } from "react";
import Provider from "../../Service/Provider";
import WKApp from "../../App";
import "./index.css";
import { SubscribersVM } from "./vm";
import IndexTable, { IndexTableItem } from "../IndexTable";
import WKBase, { WKBaseContext } from "../WKBase";
import RouteContext, { RouteContextConfig } from "../../Service/Context";
import { SubscriberList } from "./list";
import { ChannelSettingRouteData } from "../../Components/ChannelSetting/context";
import "./index.css";
export interface SubscribersProps {
context: RouteContext<any>;
@ -44,6 +46,10 @@ export class Subscribers extends Component<SubscribersProps> {
render() {
const { context, onAdd, onRemove, channel } = this.props;
const data = context.routeData() as ChannelSettingRouteData;
const disableSelectList = data.subscribers.map((subscriber) => {
return subscriber.uid;
});
return (
<Provider
create={() => {
@ -80,6 +86,7 @@ export class Subscribers extends Component<SubscribersProps> {
{vm.showAdd()
? WKApp.endpoints.organizationalTool(
channel,
disableSelectList,
<div className="wk-subscribers-item">
<img
src={require("./assets/icon_add_more_gray.png")}

View File

@ -162,10 +162,15 @@ export class EndpointCommon {
);
}
organizationalTool(channel: Channel, render?: JSX.Element): JSX.Element {
organizationalTool(
channel: Channel,
disableSelectList?: string[],
render?: JSX.Element
): JSX.Element {
return EndpointManager.shared.invoke(EndpointCategory.organizational, {
channel: channel,
render: render,
channel,
disableSelectList,
render,
});
}
@ -184,9 +189,10 @@ export class EndpointCommon {
);
}
organizationalLayer(channel: Channel): void {
organizationalLayer(channel: Channel, disableSelectList?: string[]): void {
return EndpointManager.shared.invoke(EndpointCategory.organizationalLayer, {
channel: channel,
channel,
disableSelectList,
});
}

View File

@ -1,231 +1,232 @@
.wk-chat {
width: 100%;
height: 100%;
width: 100%;
height: 100%;
}
.wk-chat-content {
display: flex;
width: 100%;
height: 100%;
display: flex;
width: 100%;
height: 100%;
}
.wk-chat-content-left {
width: var(--wk-wdith-conversation-list);
height: 100%;
border-right: var(--wk-line);
width: var(--wk-wdith-conversation-list);
height: 100%;
border-right: var(--wk-line);
}
.wk-chat-search {
height: var(--wk-height-chat-search);
width: 100%;
padding: 0px 20px 0px 20px;
display: flex;
align-items: center;
justify-content: space-between;
height: var(--wk-height-chat-search);
width: 100%;
padding: 0px 20px 0px 20px;
display: flex;
align-items: center;
justify-content: space-between;
}
.wk-chat-search-add {
padding: 5px;
cursor: pointer;
color: black;
padding: 5px;
cursor: pointer;
color: black;
}
body[theme-mode=dark] .wk-chat-search-add {
color: white;
body[theme-mode="dark"] .wk-chat-search-add {
color: white;
}
.wk-chat-title {
width: 250px;
font-size: 24px;
font-weight: 500;
width: 250px;
font-size: 24px;
font-weight: 500;
}
body[theme-mode=dark] .wk-chat-title {
color: white;
body[theme-mode="dark"] .wk-chat-title {
color: white;
}
.wk-chat-conversation-list {
width: 100%;
height: calc(100% - var(--wk-height-chat-search));
width: 100%;
height: calc(100% - var(--wk-height-chat-search));
}
.wk-chat-content-right {
width: 100%;
height: 100%;
display: flex;
position: relative;
width: 100%;
height: 100%;
display: flex;
position: relative;
}
@media screen and (max-width: 640px) {
.wk-chat-content-right {
width: 100%;
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
transform: translate3d(0, 0, 0);
transition: transform var(--wk-layer-transition);
}
@media screen and (max-width: 640px) {
.wk-chat-content-right {
width: 100%;
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
transform: translate3d(0, 0, 0);
transition: transform var(--wk-layer-transition);
}
.wk-chat-content:not(.wk-conversation-open) .wk-chat-content-right {
transform: translate3d(100vw, 0, 0);
}
.wk-chat-content:not(.wk-conversation-open) .wk-chat-content-right {
transform: translate3d(100vw, 0, 0);
}
.wk-chat-content-left {
width: 100%;
}
.wk-chat-content-left {
width: 100%;
}
.wk-chat-conversation-header-back {
display: flex !important;
}
.wk-chat-conversation-header-back {
display: flex !important;
}
}
.wk-chat-content-chat {
width: 100%;
height: 100%;
transition: width 150ms ease-in-out 0s;
width: 100%;
height: 100%;
transition: width 150ms ease-in-out 0s;
}
.wk-chat-content-right.wk-chat-channelsetting-open .wk-chat-content-chat {
width: calc(100% - var(--wk-wdith-chat-channelsetting));
width: calc(100% - var(--wk-wdith-chat-channelsetting));
}
.wk-chat-conversation {
width: 100%;
height: calc(100% - var(--wk-height-chat-conversation-header));
width: 100%;
height: calc(100% - var(--wk-height-chat-conversation-header));
}
.wk-chat-empty {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
background-color: var(--wk-color-secondary);
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
background-color: var(--wk-color-secondary);
}
.wk-chat-empty img {
height: 340px;
transform: scale(1.14);
height: 340px;
transform: scale(1.14);
}
.wk-chat-conversation-header {
height: var(--wk-height-chat-conversation-header);
width: 100%;
background-color: white;
display: flex;
align-items: center;
box-shadow: 0 1px 1px rgba(114,114,114,0.168627);
z-index: 11;
padding: 0.5rem 0.8125rem 0.5rem 1.5rem;
position: relative;
cursor: pointer;
box-sizing: border-box;
height: var(--wk-height-chat-conversation-header);
width: 100%;
background-color: white;
display: flex;
align-items: center;
box-shadow: 0 1px 1px rgba(114, 114, 114, 0.168627);
z-index: 11;
padding: 0.5rem 0.8125rem 0.5rem 1.5rem;
position: relative;
cursor: pointer;
box-sizing: border-box;
}
body[theme-mode=dark] .wk-chat-conversation-header {
background-color: var(--wk-color-secondary);
body[theme-mode="dark"] .wk-chat-conversation-header {
background-color: var(--wk-color-secondary);
}
.wk-chat-conversation-header-left {
display: flex;
align-items: center;
display: flex;
align-items: center;
}
.wk-chat-conversation-header-back {
width: 40px;
height: 40px;
display: none;
position: relative;
justify-content: center;
align-items: center;
width: 40px;
height: 40px;
display: none;
position: relative;
justify-content: center;
align-items: center;
}
.wk-chat-conversation-header-back-icon {
position: absolute;
/* transform: rotate(-45deg); */
transform: rotate(180deg);
position: absolute;
/* transform: rotate(-45deg); */
transform: rotate(180deg);
}
.wk-chat-conversation-header-back-icon::before, .wk-chat-conversation-header-back-icon::after {
position: absolute;
left: 0;
top: 0;
content: "";
.wk-chat-conversation-header-back-icon::before,
.wk-chat-conversation-header-back-icon::after {
position: absolute;
left: 0;
top: 0;
content: "";
}
.wk-chat-conversation-header-back-icon::after {
transform: rotate(-45deg) scaleX(0.75) translate(0, 0.375rem);
transform: rotate(-45deg) scaleX(0.75) translate(0, 0.375rem);
}
.wk-chat-conversation-header-back-icon::before {
transform: rotate(45deg) scaleX(0.75) translate(0, -0.375rem);
transform: rotate(45deg) scaleX(0.75) translate(0, -0.375rem);
}
.wk-chat-conversation-header-back-icon, .wk-chat-conversation-header-back-icon::before, .wk-chat-conversation-header-back-icon::after {
width: 1.125rem;
height: 0.125rem;
border-radius: 0.125rem;
background-color: rgb(112,117,121);
transition: transform var(--wk-slide-transition);
.wk-chat-conversation-header-back-icon,
.wk-chat-conversation-header-back-icon::before,
.wk-chat-conversation-header-back-icon::after {
width: 1.125rem;
height: 0.125rem;
border-radius: 0.125rem;
background-color: rgb(112, 117, 121);
transition: transform var(--wk-slide-transition);
}
.wk-chat-conversation-header-channel {
display: flex;
display: flex;
}
.wk-chat-conversation-header-channel-avatar img {
width: 40px;
height: 40px;
border-radius: 40%;
width: 40px;
height: 40px;
border-radius: 40%;
}
.wk-chat-conversation-header-channel-info {
display: flex;
align-items: center;
display: flex;
align-items: center;
}
.wk-chat-conversation-header-channel-info-name {
margin-left: 10px;
font-size: 14px;
font-weight: 600;
margin-left: 10px;
font-size: 14px;
font-weight: 600;
}
body[theme-mode=dark] .wk-chat-conversation-header-channel-info-name {
color: white;
body[theme-mode="dark"] .wk-chat-conversation-header-channel-info-name {
color: white;
}
.wk-chat-conversation-header-content {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
}
.wk-chat-conversation-header-right {
display: flex;
align-items: center;
display: flex;
align-items: center;
}
.wk-chat-conversation-header-right div {
margin-right: 10px;
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
.wk-chat-conversation-header-right div {
margin-right: 10px;
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
}
.wk-chat-conversation-header-right div:last-child {
margin-right: 0px;
margin-right: 0px;
}
.wk-chat-conversation-header-setting {
display: flex;
align-items: center;
display: flex;
align-items: center;
}
.wk-chat-channelsetting {
@ -257,68 +258,73 @@ body[theme-mode=dark] .wk-chat-channelsetting {
}
.wk-chat-content-right.wk-chat-channelsetting-open .wk-chat-channelsetting {
margin-right: 0px;
margin-right: 0px;
}
.wk-chat-conversation-list-loading {
display: flex;
width: 100%;
justify-content: center;
align-items: center;
display: flex;
width: 100%;
justify-content: center;
align-items: center;
}
.wk-chatmenuspopover {
width: 100%;
height: 100%;
width: 100%;
height: 100%;
}
.wk-chatmenuspopover ul {
margin-bottom: 0px;
width: 100%;
height: 100%;
margin-bottom: 0px;
width: 100%;
height: 100%;
}
body[theme-mode=dark] .wk-chat-popover {
background-color: var(--wk-color-secondary);
color: white;
--color-popover-bg-default: red
body[theme-mode="dark"] .wk-chat-popover {
background-color: var(--wk-color-secondary);
color: white;
--color-popover-bg-default: red;
}
.wk-chatmenuspopover li {
display: flex;
align-items: center;
cursor: pointer;
padding: 10px;
display: flex;
align-items: center;
cursor: pointer;
padding: 10px;
}
.wk-chatmenuspopover li:first-child {
margin-top: 0px;
margin-top: 0px;
}
.wk-chatmenuspopover li img {
width: 20px;
height: 20px;
color: white;
width: 18px;
height: 18px;
color: white;
}
.wk-chatmenuspopover-title {
margin-left: 10px;
font-size: 14px;
margin-left: 10px;
font-size: 14px;
}
.wk-chatmenuspopover-avatar {
display: flex;
align-items: center;
}
.wk-chat-conversation-header-right-item {
position: relative;
position: relative;
}
.wk-conversation-header-mask {
background-color: rgb(0,0,0,0.0);
position: absolute;
width: 100%;
height: 100%;
top: 0px;
border-radius: 100%;
background-color: rgb(0, 0, 0, 0);
position: absolute;
width: 100%;
height: 100%;
top: 0px;
border-radius: 100%;
}
.wk-conversation-header-mask:hover {
background-color: rgb(0,0,0,0.1);
}
background-color: rgb(0, 0, 0, 0.1);
}

View File

@ -88,8 +88,6 @@ export default class BaseModule implements IModule {
return "base";
}
init(): void {
APIClient.shared.logoutCallback = () => {
WKApp.shared.logout();
};
@ -229,7 +227,9 @@ export default class BaseModule implements IModule {
cmdContent.param.from_name
);
} else if (cmdContent.cmd === "groupAvatarUpdate") {
WKApp.shared.changeChannelAvatarTag(new Channel(param.group_no, ChannelTypeGroup));
WKApp.shared.changeChannelAvatarTag(
new Channel(param.group_no, ChannelTypeGroup)
);
// 群头像更新
WKSDK.shared().channelManager.fetchChannelInfo(
new Channel(param.group_no, ChannelTypeGroup)
@ -343,8 +343,11 @@ export default class BaseModule implements IModule {
ConversationAction.update
);
}
} else if (cmdContent.cmd === "userAvatarUpdate") { // 用户头像更新
WKApp.shared.changeChannelAvatarTag(new Channel(param.uid, ChannelTypePerson));
} else if (cmdContent.cmd === "userAvatarUpdate") {
// 用户头像更新
WKApp.shared.changeChannelAvatarTag(
new Channel(param.uid, ChannelTypePerson)
);
WKApp.dataSource.notifyContactsChange();
}
});
@ -450,15 +453,16 @@ export default class BaseModule implements IModule {
return;
}
if (window.Notification && Notification.permission !== "denied") {
const options = {
body: description,
icon: WKApp.shared.avatarChannel(message.channel),
lang: "zh-CN",
tag: "tag",
renotify: true,
};
const notify = new Notification(
channelInfo ? channelInfo.orgData.displayName : "通知",
{
body: description,
icon: WKApp.shared.avatarChannel(message.channel),
lang: "zh-CN",
tag: "tag",
// renotify: true,
}
options
);
notify.onclick = () => {
@ -509,7 +513,7 @@ export default class BaseModule implements IModule {
icon={require("./assets/toolbars/func_screenshot.svg").default}
onClick={() => {
if ((window as any).__POWERED_ELECTRON__) {
(window as any).ipc.send('screenshots-start', {})
(window as any).ipc.send("screenshots-start", {});
} else {
window.open("https://www.snipaste.com");
}
@ -532,10 +536,11 @@ export default class BaseModule implements IModule {
const isDark = WKApp.config.themeMode === ThemeMode.dark;
return {
title: "发起群聊",
icon: require(`${isDark
? "./assets/popmenus_startchat_dark.png"
: "./assets/popmenus_startchat.png"
}`),
icon: require(`${
isDark
? "./assets/popmenus_startchat_dark.png"
: "./assets/popmenus_startchat.png"
}`),
onClick: () => {
const channel: any = {
channelID: localStorage.uid,

View File

@ -14,6 +14,8 @@ import {
import { BasicTreeNodeData } from "@douyinfe/semi-foundation/lib/cjs/tree/foundation";
import { WKApp, ThemeMode, WKViewQueueHeader } from "@tsdaodao/base";
import WKAvatar from "@tsdaodao/base/src/Components/WKAvatar";
import { ContactsStatus } from "@tsdaodao/base/src/Service/DataSource/DataSource";
import "./index.css";
interface IPorpsOrganizationalGroupNew {
@ -21,6 +23,7 @@ interface IPorpsOrganizationalGroupNew {
channelID: string;
channelType: number;
};
disableSelectList?: string[];
showAdd?: boolean;
render?: JSX.Element;
remove?: () => void;
@ -185,7 +188,8 @@ export class OrganizationalGroupNew extends Component<
}
OTree.push({
label: employeesNum > 0 ? `${item.name}(${employeesNum})` : `${item.name}`,
label:
employeesNum > 0 ? `${item.name}(${employeesNum})` : `${item.name}`,
value: item.dept_id,
key: item.short_no,
icon: (
@ -291,12 +295,14 @@ export class OrganizationalGroupNew extends Component<
getFriendData() {
const setFriendData: any[] = [];
WKApp.dataSource.contactsList.map((item) => {
setFriendData.push({
name: item.name,
uid: item.uid,
WKApp.dataSource.contactsList
.filter((c) => c.status !== ContactsStatus.Blacklist)
.map((item) => {
setFriendData.push({
name: item.remark || item.name,
uid: item.uid,
});
});
});
this.setState({
friendData: [...setFriendData],
friendSearchData: [...setFriendData],
@ -401,6 +407,18 @@ export class OrganizationalGroupNew extends Component<
}
}
isDisableItem(id: string) {
const { disableSelectList } = this.props;
if (disableSelectList && disableSelectList.length > 0) {
for (const disableSelect of disableSelectList) {
if (disableSelect === id) {
return true;
}
}
}
return false;
}
render(): ReactNode {
const isDark = WKApp.config.themeMode === ThemeMode.dark;
const {
@ -531,6 +549,7 @@ export class OrganizationalGroupNew extends Component<
<Checkbox
key={friend.uid}
value={friend.uid}
disabled={this.isDisableItem(friend.uid)}
className="friend-opt-item"
>
<WKAvatar

View File

@ -45,7 +45,7 @@ export default class ContactsModule implements IModule {
WKApp.endpoints.registerContactsHeader("friends.new", (param: any) => {
return (
<IconListItem
badge={ WKApp.shared.getFriendApplysUnreadCount() }
badge={WKApp.shared.getFriendApplysUnreadCount()}
title="新朋友"
icon={require("./assets/friend_new.png")}
backgroudColor={"var(--wk-color-secondary)"}
@ -111,8 +111,15 @@ export default class ContactsModule implements IModule {
"contacts.organizational.group.add",
(param) => {
const channel = param.channel as any;
const disableSelectList = param.disableSelectList as
| string[]
| undefined;
return (
<OrganizationalGroupNew channel={channel} render={param.render} />
<OrganizationalGroupNew
channel={channel}
disableSelectList={disableSelectList}
render={param.render}
/>
);
}
);
@ -121,6 +128,9 @@ export default class ContactsModule implements IModule {
"contacts.organizational.layer",
(param) => {
const channel = param.channel as any;
const disableSelectList = param.disableSelectList as
| string[]
| undefined;
const div = document.createElement("div");
const ref: any = React.createRef();
document.body.appendChild(div);
@ -135,6 +145,7 @@ export default class ContactsModule implements IModule {
<OrganizationalGroupNew
ref={ref}
channel={channel}
disableSelectList={disableSelectList}
remove={remove}
/>,
div
@ -144,4 +155,4 @@ export default class ContactsModule implements IModule {
}
);
}
}
}