FEAT => 本次更新项目为:更新 index.html 和 manifest.json 中的資源引用,新增 token2 支持於請求模組,並調整 ChatWindow 組件的樣式以改善顯示效果。

This commit is contained in:
超级老白兔
2025-08-16 11:24:07 +08:00
parent c7e90fc917
commit 85f4ca9744
6 changed files with 57 additions and 24 deletions

View File

@@ -33,7 +33,7 @@
"name": "vendor"
},
"index.html": {
"file": "assets/index-BRxvrekd.js",
"file": "assets/index-Bos-kh2O.js",
"name": "index",
"src": "index.html",
"isEntry": true,
@@ -44,7 +44,7 @@
"_charts-D0fT04H8.js"
],
"css": [
"assets/index-qTkOjY3P.css"
"assets/index-4EWIsBVv.css"
]
}
}

View File

@@ -11,13 +11,13 @@
</style>
<!-- 引入 uni-app web-view SDK必须 -->
<script type="text/javascript" src="/websdk.js"></script>
<script type="module" crossorigin src="/assets/index-BRxvrekd.js"></script>
<script type="module" crossorigin src="/assets/index-Bos-kh2O.js"></script>
<link rel="modulepreload" crossorigin href="/assets/vendor-2vc8h_ct.js">
<link rel="modulepreload" crossorigin href="/assets/ui-qLeQLv1F.js">
<link rel="modulepreload" crossorigin href="/assets/utils-6WF66_dS.js">
<link rel="modulepreload" crossorigin href="/assets/charts-D0fT04H8.js">
<link rel="stylesheet" crossorigin href="/assets/ui-D0C0OGrH.css">
<link rel="stylesheet" crossorigin href="/assets/index-qTkOjY3P.css">
<link rel="stylesheet" crossorigin href="/assets/index-4EWIsBVv.css">
</head>
<body>
<div id="root"></div>

View File

@@ -6,7 +6,7 @@ import axios, {
} from "axios";
import { Toast } from "antd-mobile";
import { useUserStore } from "@/store/module/user";
const { token } = useUserStore.getState();
const { token, token2 } = useUserStore.getState();
const DEFAULT_DEBOUNCE_GAP = 1000;
const debounceMap = new Map<string, number>();
@@ -19,7 +19,13 @@ const instance: AxiosInstance = axios.create({
});
instance.interceptors.request.use((config: any) => {
if (token) {
// 从配置中获取是否使用token2
const useToken2 = config.useToken2;
if (useToken2 && token2) {
config.headers = config.headers || {};
config.headers["Authorization"] = `Bearer ${token2}`;
} else if (token) {
config.headers = config.headers || {};
config.headers["Authorization"] = `Bearer ${token}`;
}
@@ -56,6 +62,7 @@ export function request(
method: Method = "GET",
config?: AxiosRequestConfig,
debounceGap?: number,
isToken2?: boolean,
): Promise<any> {
const gap =
typeof debounceGap === "number" ? debounceGap : DEFAULT_DEBOUNCE_GAP;
@@ -72,7 +79,10 @@ export function request(
url,
method,
...config,
};
} as any;
// 添加自定义属性
(axiosConfig as any).useToken2 = isToken2;
// 如果是FormData不设置Content-Type让浏览器自动设置
if (data instanceof FormData) {

View File

@@ -21,32 +21,47 @@
height: 64px;
min-height: 64px;
flex-shrink: 0;
gap: 16px; // 确保信息区域和按钮区域有足够间距
.chatInfo {
.chatHeaderInfo {
display: flex;
align-items: center;
gap: 12px;
flex: 1;
min-width: 0; // 防止flex子元素溢出
.chatDetails {
.chatName {
.chatHeaderDetails {
flex: 1;
display: flex;
align-items: center;
.chatHeaderName {
font-size: 16px;
font-weight: 600;
color: #262626;
display: flex;
align-items: center;
gap: 8px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-right: 30px;
.onlineStatus {
.chatHeaderOnlineStatus {
font-size: 12px;
color: #52c41a;
font-weight: normal;
flex-shrink: 0; // 防止在线状态被压缩
}
}
.chatStatus {
.chatHeaderType {
font-size: 12px;
color: #8c8c8c;
margin-top: 2px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
@@ -447,9 +462,9 @@
height: 56px;
min-height: 56px;
.chatInfo {
.chatDetails {
.chatName {
.chatHeaderInfo {
.chatHeaderDetails {
.chatHeaderName {
font-size: 14px;
}
}

View File

@@ -263,22 +263,24 @@ const ChatWindow: React.FC<ChatWindowProps> = ({
<Layout className={styles.chatMain}>
{/* 聊天头部 */}
<Header className={styles.chatHeader}>
<div className={styles.chatInfo}>
<div className={styles.chatHeaderInfo}>
<Avatar
size={40}
src={chat.avatar}
icon={chat.type === "group" ? <TeamOutlined /> : <UserOutlined />}
/>
<div className={styles.chatDetails}>
<div className={styles.chatName}>
<div
className={styles.chatHeaderDetails}
style={{
display: "flex",
}}
>
<div className={styles.chatHeaderName}>
{chat.name}
{chat.online && (
<span className={styles.onlineStatus}>线</span>
<span className={styles.chatHeaderOnlineStatus}>线</span>
)}
</div>
<div className={styles.chatStatus}>
{chat.type === "group" ? "群聊" : "私聊"}
</div>
</div>
</div>
<Space>

View File

@@ -22,9 +22,11 @@ export interface User {
interface UserState {
user: User | null;
token: string | null;
token2: string | null;
isLoggedIn: boolean;
setUser: (user: User) => void;
setToken: (token: string) => void;
setToken2: (token2: string) => void;
clearUser: () => void;
login: (token: string, userInfo: User, deviceTotal: number) => void;
logout: () => void;
@@ -34,10 +36,12 @@ export const useUserStore = createPersistStore<UserState>(
set => ({
user: null,
token: null,
token2: null,
isLoggedIn: false,
setUser: user => set({ user, isLoggedIn: true }),
setToken: token => set({ token }),
clearUser: () => set({ user: null, token: null, isLoggedIn: false }),
setToken2: token2 => set({ token2 }),
clearUser: () => set({ user: null, token: null, token2: null, isLoggedIn: false }),
login: (token, userInfo, deviceTotal) => {
// 只将token存储到localStorage
localStorage.setItem("token", token);
@@ -75,7 +79,8 @@ export const useUserStore = createPersistStore<UserState>(
logout: () => {
// 清除localStorage中的token
localStorage.removeItem("token");
set({ user: null, token: null, isLoggedIn: false });
localStorage.removeItem("token2");
set({ user: null, token: null, token2: null, isLoggedIn: false });
},
}),
{
@@ -83,6 +88,7 @@ export const useUserStore = createPersistStore<UserState>(
partialize: state => ({
user: state.user,
token: state.token,
token2: state.token2,
isLoggedIn: state.isLoggedIn,
}),
onRehydrateStorage: () => state => {