Commit c49c0059 authored by 文旺-丰林-DEV's avatar 文旺-丰林-DEV

fix ui style

parent cd9f490e
......@@ -53,6 +53,7 @@
"ahooks": "^3.7.6",
"antd": "^4.20.0",
"classnames": "^2.3.0",
"idb": "^7.1.1",
"lodash": "^4.17.0",
"moment": "^2.29.0",
"omit.js": "^2.0.2",
......
import { openDB } from 'idb';
const dbPromise = openDB('chats', 1, {
upgrade(db) {
db.createObjectStore('titles', { keyPath: 'titles' });
db.createObjectStore('history', { keyPath: 'history' });
},
});
export default dbPromise;
......@@ -51,3 +51,17 @@
}
}
}
.CardWrapperMobile {
&:hover .CardContent {
background-color: #f8f9fb;
&:hover .content {
color: #0a7a73;
}
&:hover .button {
color: #0a7a73;
background-color: #f8f9fb;
border: solid 1px #0a7a73;
}
}
}
import { Grid } from 'antd';
import styles from './productionCard.less';
import classnames from 'classnames';
const { useBreakpoint } = Grid;
interface ProductionCardProps {
index: number;
title?: string;
......@@ -11,13 +11,15 @@ interface ProductionCardProps {
const ProductionCard = (props: ProductionCardProps) => {
const { title, content, onChange } = props;
const screens = useBreakpoint();
const isMobile = screens.xs;
const handleClick = () => {
onChange && onChange(content);
};
return (
<div className={classnames(styles.CardWrapper)}>
<div className={classnames(`${styles.CardWrapper} ${isMobile && styles.CardWrapperMobile}`)}>
<div className={styles.title}>{title}</div>
<div className={styles.CardContent}>
<div className={styles.content}>{content}</div>
......
......@@ -100,6 +100,12 @@ const Chat: React.FC = () => {
}
}
function newChat() {
messageHistory.current.splice(0, messageHistory.current.length || 0);
isMobile && setShowSider(false);
setFirstChat(false);
}
useEffect(() => {
if (access?.token) {
getChatGLMToken();
......@@ -162,8 +168,8 @@ const Chat: React.FC = () => {
>
<div className={styles.siderChatContent}>
<div style={{ padding: '30px 20px 0 20px' }}>
<Button size="large" block type="primary" icon={<PlusOutlined />}>
对话
<Button size="large" block type="primary" icon={<PlusOutlined />} onClick={newChat}>
对话
</Button>
</div>
</div>
......@@ -214,7 +220,15 @@ const Chat: React.FC = () => {
{!isMobile && (
<div className={styles.header} hidden={firstChat}>
<Row>
<Col span={24}>
<Col
span={24}
style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}
>
<img
style={{ marginRight: 12, height: 40, marginBottom: 6 }}
src="https://baibaomen.oss-cn-hangzhou.aliyuncs.com/zhensheng/Logo.png"
alt="logo"
/>
<Title level={2} style={{ marginBottom: 8, fontSize: 32 }}>
长沙振升集团
</Title>
......
......@@ -141,7 +141,7 @@ const PromptWord = () => {
actionRef.current?.reload();
} catch (error) {
setAllLoading({ ...allLoading, editModalLoading: false });
message.error('编辑提示用语失败,请重试!');
message.error('编辑提示用语失败,请重试');
}
};
......@@ -156,7 +156,7 @@ const PromptWord = () => {
actionRef.current?.reload();
} catch (error) {
setAllLoading({ ...allLoading, createModalLoading: false });
message.error('新增提示用语失败,请重试!');
message.error('新增提示用语失败,请重试');
}
};
......@@ -171,7 +171,7 @@ const PromptWord = () => {
actionRef.current?.reload();
} catch (error) {
setAllLoading({ ...allLoading, deleteModalLoading: false });
message.error('删除提示用语失败,请重试!');
message.error('删除提示用语失败,请重试');
}
};
......@@ -217,7 +217,7 @@ const PromptWord = () => {
};
} catch (error) {
setAllLoading({ ...allLoading, listLoading: false });
message.error('请求列表失败,请重试!');
message.error('请求列表失败,请重试');
return {
data: [],
total: 0,
......
......@@ -229,7 +229,8 @@ const UserManage = () => {
};
const validatePassword = (_, value: any) => {
const regex = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d]{8,16}$/;
const regex =
/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d!@#$%^&*()_+}{":?><,./;'\[\]\\=-]{8,16}$/;
if (regex.test(value)) {
return Promise.resolve();
}
......
import { extend } from 'umi-request';
import { history } from 'umi';
import { message } from 'antd';
interface ILoginParams {
name: string;
......@@ -22,9 +21,9 @@ request.interceptors.request.use((url, options) => {
});
request.interceptors.response.use(async (response): Promise<any> => {
console.log('response', response);
if (response.status === 401) {
localStorage.removeItem('user');
localStorage.removeItem('expires');
history.push('/chat');
} else if (response.status === 200) {
return response;
......@@ -94,36 +93,36 @@ export const getUserMessage = (params?: any): Promise<string> => {
export const createPromptWords = (params: any): Promise<any> => {
return request('https://glm-mangement-api.baibaomen.com/PromptWords/create', {
method: 'POST',
data: params
})
}
data: params,
});
};
export const updatePromptWords = (params: any): Promise<any> => {
return request('https://glm-mangement-api.baibaomen.com/PromptWords/update', {
method: 'POST',
data: params
})
}
data: params,
});
};
export const deletePromptWords = (params: any): Promise<any> => {
return request('https://glm-mangement-api.baibaomen.com/PromptWords/delete', {
method: 'POST',
data: params
})
}
data: params,
});
};
export const pagePromptWords = (params: any): Promise<any> => {
return request('https://glm-mangement-api.baibaomen.com/PromptWords/page', {
method: 'POST',
data: params
})
}
data: params,
});
};
export const typePromptWords = (): Promise<any> => {
return request('https://glm-mangement-api.baibaomen.com/PromptWords/type', {
method: 'POST',
})
}
});
};
export const postDeleteUser = (params?: any): Promise<string> => {
return request('https://glm-mangement-api.baibaomen.com/User/delete', {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment