This commit is contained in:
tangtaoit 2024-11-13 19:05:11 +08:00
commit 9de9346720
4 changed files with 3011 additions and 2990 deletions

View File

@ -7,7 +7,7 @@
"scripts": { "scripts": {
"start": "cross-env BROWSER=none REACT_APP_VERSION=$npm_package_version react-app-rewired start", "start": "cross-env BROWSER=none REACT_APP_VERSION=$npm_package_version react-app-rewired start",
"dev": "cross-env MODE=dev BROWSER=none REACT_APP_VERSION=$npm_package_version react-app-rewired start", "dev": "cross-env MODE=dev BROWSER=none REACT_APP_VERSION=$npm_package_version react-app-rewired start",
"dev-ele": "kill-port 3000 && concurrently -k -n=web,ele -c=green,blue \"wait-on tcp:3000 && yarn dev\" \"npm-run-all watch\"", "dev-ele": "concurrently -k -n=web,ele -c=green,blue \"yarn dev\" \"wait-on tcp:127.0.0.1:3000 &&npm-run-all watch\"",
"watch": "tsc-watch -p tsconfig.e.json --onSuccess \"npm-run-all start:electron\"", "watch": "tsc-watch -p tsconfig.e.json --onSuccess \"npm-run-all start:electron\"",
"start:electron": "cross-env NODE_ENV=development electron .", "start:electron": "cross-env NODE_ENV=development electron .",
"build": "cross-env REACT_APP_VERSION=$npm_package_version react-app-rewired build", "build": "cross-env REACT_APP_VERSION=$npm_package_version react-app-rewired build",

View File

@ -28,7 +28,7 @@
"eslint-config-custom": "*", "eslint-config-custom": "*",
"prettier": "^2.5.1", "prettier": "^2.5.1",
"rimraf": "^5.0.5", "rimraf": "^5.0.5",
"turbo": "2.0.9" "turbo": "2.2.1"
}, },
"packageManager": "yarn@1.22.19", "packageManager": "yarn@1.22.19",
"engines": { "engines": {

View File

@ -256,6 +256,12 @@ export default class WKApp extends ProviderListener {
WKApp.loginInfo.load(); // 加载登录信息 WKApp.loginInfo.load(); // 加载登录信息
const themeMode = StorageService.shared.getItem("theme-mode"); const themeMode = StorageService.shared.getItem("theme-mode");
const currentSystemThemeModeIsDark = window.matchMedia(
"(prefers-color-scheme: dark)"
).matches;
if (!themeMode && currentSystemThemeModeIsDark) {
WKApp.config.themeMode = ThemeMode.dark;
}
if (themeMode === "1") { if (themeMode === "1") {
WKApp.config.themeMode = ThemeMode.dark; WKApp.config.themeMode = ThemeMode.dark;
} }
@ -374,14 +380,16 @@ export default class WKApp extends ProviderListener {
return this.avatarChannel(c); return this.avatarChannel(c);
} }
avatarOrg(orgID: string){ avatarOrg(orgID: string) {
const baseURl = WKApp.apiClient.config.apiURL; const baseURl = WKApp.apiClient.config.apiURL;
return `${baseURl}organizations/${orgID}/logo`; return `${baseURl}organizations/${orgID}/logo`;
} }
// 我的用户头像发送改变 // 我的用户头像发送改变
myUserAvatarChange() { myUserAvatarChange() {
this.changeChannelAvatarTag(new Channel(WKApp.loginInfo.uid||"", ChannelTypePerson)); this.changeChannelAvatarTag(
new Channel(WKApp.loginInfo.uid || "", ChannelTypePerson)
);
} }
changeChannelAvatarTag(channel: Channel) { changeChannelAvatarTag(channel: Channel) {
@ -389,17 +397,17 @@ export default class WKApp extends ProviderListener {
if (channel) { if (channel) {
myAvatarTag = `channelAvatarTag:${channel.channelType}${channel.channelID}`; myAvatarTag = `channelAvatarTag:${channel.channelType}${channel.channelID}`;
} }
console.log('changeChannelAvatarTag0----->') console.log("changeChannelAvatarTag0----->");
const t = new Date().getTime(); const t = new Date().getTime();
WKApp.loginInfo.setStorageItem(myAvatarTag, `${t}`); WKApp.loginInfo.setStorageItem(myAvatarTag, `${t}`);
} }
getChannelAvatarTag(channel? :Channel) { getChannelAvatarTag(channel?: Channel) {
let myAvatarTag = "channelAvatarTag"; let myAvatarTag = "channelAvatarTag";
if (channel) { if (channel) {
myAvatarTag = `channelAvatarTag:${channel.channelType}${channel.channelID}`; myAvatarTag = `channelAvatarTag:${channel.channelType}${channel.channelID}`;
} }
const tag = WKApp.loginInfo.getStorageItem(myAvatarTag); const tag = WKApp.loginInfo.getStorageItem(myAvatarTag);
if(!tag) { if (!tag) {
return ""; return "";
} }
return tag; return tag;
@ -530,13 +538,16 @@ export default class WKApp extends ProviderListener {
return friendApplys; return friendApplys;
} }
public setFriendApplysUnreadCount(){ public setFriendApplysUnreadCount() {
if(WKApp.loginInfo.isLogined()){ if (WKApp.loginInfo.isLogined()) {
WKApp.apiClient.get(`/user/reddot/friendApply`).then(res=>{ WKApp.apiClient.get(`/user/reddot/friendApply`).then((res) => {
WKApp.mittBus.emit('friend-applys-unread-count', res.count) WKApp.mittBus.emit("friend-applys-unread-count", res.count);
WKApp.loginInfo.setStorageItem(`${WKApp.loginInfo.uid}-friend-applys-unread-count`, res.count); WKApp.loginInfo.setStorageItem(
`${WKApp.loginInfo.uid}-friend-applys-unread-count`,
res.count
);
WKApp.menus.refresh(); WKApp.menus.refresh();
}) });
} }
} }
@ -551,7 +562,9 @@ export default class WKApp extends ProviderListener {
// } // }
// } // }
if (WKApp.loginInfo.isLogined()) { if (WKApp.loginInfo.isLogined()) {
const num = WKApp.loginInfo.getStorageItem(`${WKApp.loginInfo.uid}-friend-applys-unread-count`) const num = WKApp.loginInfo.getStorageItem(
`${WKApp.loginInfo.uid}-friend-applys-unread-count`
);
unreadCount = Number(num); unreadCount = Number(num);
} }
return unreadCount; return unreadCount;
@ -577,7 +590,10 @@ export default class WKApp extends ProviderListener {
// WKApp.endpointManager.invokes(EndpointCategory.friendApplyDataChange); // WKApp.endpointManager.invokes(EndpointCategory.friendApplyDataChange);
// } // }
if (WKApp.loginInfo.isLogined()) { if (WKApp.loginInfo.isLogined()) {
WKApp.loginInfo.setStorageItem(`${WKApp.loginInfo.uid}-friend-applys-unread-count`, '0') WKApp.loginInfo.setStorageItem(
`${WKApp.loginInfo.uid}-friend-applys-unread-count`,
"0"
);
} }
await WKApp.apiClient.delete(`/user/reddot/friendApply`); await WKApp.apiClient.delete(`/user/reddot/friendApply`);
} }

5955
yarn.lock

File diff suppressed because it is too large Load Diff