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

fix ui style

parent cd9f490e
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
"ahooks": "^3.7.6", "ahooks": "^3.7.6",
"antd": "^4.20.0", "antd": "^4.20.0",
"classnames": "^2.3.0", "classnames": "^2.3.0",
"idb": "^7.1.1",
"lodash": "^4.17.0", "lodash": "^4.17.0",
"moment": "^2.29.0", "moment": "^2.29.0",
"omit.js": "^2.0.2", "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 @@ ...@@ -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 { Grid } from 'antd';
import styles from './productionCard.less'; import styles from './productionCard.less';
import classnames from 'classnames'; import classnames from 'classnames';
const { useBreakpoint } = Grid;
interface ProductionCardProps { interface ProductionCardProps {
index: number; index: number;
title?: string; title?: string;
...@@ -11,13 +11,15 @@ interface ProductionCardProps { ...@@ -11,13 +11,15 @@ interface ProductionCardProps {
const ProductionCard = (props: ProductionCardProps) => { const ProductionCard = (props: ProductionCardProps) => {
const { title, content, onChange } = props; const { title, content, onChange } = props;
const screens = useBreakpoint();
const isMobile = screens.xs;
const handleClick = () => { const handleClick = () => {
onChange && onChange(content); onChange && onChange(content);
}; };
return ( return (
<div className={classnames(styles.CardWrapper)}> <div className={classnames(`${styles.CardWrapper} ${isMobile && styles.CardWrapperMobile}`)}>
<div className={styles.title}>{title}</div> <div className={styles.title}>{title}</div>
<div className={styles.CardContent}> <div className={styles.CardContent}>
<div className={styles.content}>{content}</div> <div className={styles.content}>{content}</div>
......
...@@ -100,6 +100,12 @@ const Chat: React.FC = () => { ...@@ -100,6 +100,12 @@ const Chat: React.FC = () => {
} }
} }
function newChat() {
messageHistory.current.splice(0, messageHistory.current.length || 0);
isMobile && setShowSider(false);
setFirstChat(false);
}
useEffect(() => { useEffect(() => {
if (access?.token) { if (access?.token) {
getChatGLMToken(); getChatGLMToken();
...@@ -162,8 +168,8 @@ const Chat: React.FC = () => { ...@@ -162,8 +168,8 @@ const Chat: React.FC = () => {
> >
<div className={styles.siderChatContent}> <div className={styles.siderChatContent}>
<div style={{ padding: '30px 20px 0 20px' }}> <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> </Button>
</div> </div>
</div> </div>
...@@ -214,7 +220,15 @@ const Chat: React.FC = () => { ...@@ -214,7 +220,15 @@ const Chat: React.FC = () => {
{!isMobile && ( {!isMobile && (
<div className={styles.header} hidden={firstChat}> <div className={styles.header} hidden={firstChat}>
<Row> <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 level={2} style={{ marginBottom: 8, fontSize: 32 }}>
长沙振升集团 长沙振升集团
</Title> </Title>
......
...@@ -141,7 +141,7 @@ const PromptWord = () => { ...@@ -141,7 +141,7 @@ const PromptWord = () => {
actionRef.current?.reload(); actionRef.current?.reload();
} catch (error) { } catch (error) {
setAllLoading({ ...allLoading, editModalLoading: false }); setAllLoading({ ...allLoading, editModalLoading: false });
message.error('编辑提示用语失败,请重试!'); message.error('编辑提示用语失败,请重试');
} }
}; };
...@@ -156,7 +156,7 @@ const PromptWord = () => { ...@@ -156,7 +156,7 @@ const PromptWord = () => {
actionRef.current?.reload(); actionRef.current?.reload();
} catch (error) { } catch (error) {
setAllLoading({ ...allLoading, createModalLoading: false }); setAllLoading({ ...allLoading, createModalLoading: false });
message.error('新增提示用语失败,请重试!'); message.error('新增提示用语失败,请重试');
} }
}; };
...@@ -171,7 +171,7 @@ const PromptWord = () => { ...@@ -171,7 +171,7 @@ const PromptWord = () => {
actionRef.current?.reload(); actionRef.current?.reload();
} catch (error) { } catch (error) {
setAllLoading({ ...allLoading, deleteModalLoading: false }); setAllLoading({ ...allLoading, deleteModalLoading: false });
message.error('删除提示用语失败,请重试!'); message.error('删除提示用语失败,请重试');
} }
}; };
...@@ -217,7 +217,7 @@ const PromptWord = () => { ...@@ -217,7 +217,7 @@ const PromptWord = () => {
}; };
} catch (error) { } catch (error) {
setAllLoading({ ...allLoading, listLoading: false }); setAllLoading({ ...allLoading, listLoading: false });
message.error('请求列表失败,请重试!'); message.error('请求列表失败,请重试');
return { return {
data: [], data: [],
total: 0, total: 0,
......
...@@ -229,7 +229,8 @@ const UserManage = () => { ...@@ -229,7 +229,8 @@ const UserManage = () => {
}; };
const validatePassword = (_, value: any) => { 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)) { if (regex.test(value)) {
return Promise.resolve(); return Promise.resolve();
} }
......
import { extend } from 'umi-request'; import { extend } from 'umi-request';
import { history } from 'umi'; import { history } from 'umi';
import { message } from 'antd';
interface ILoginParams { interface ILoginParams {
name: string; name: string;
...@@ -22,9 +21,9 @@ request.interceptors.request.use((url, options) => { ...@@ -22,9 +21,9 @@ request.interceptors.request.use((url, options) => {
}); });
request.interceptors.response.use(async (response): Promise<any> => { request.interceptors.response.use(async (response): Promise<any> => {
console.log('response', response);
if (response.status === 401) { if (response.status === 401) {
localStorage.removeItem('user'); localStorage.removeItem('user');
localStorage.removeItem('expires');
history.push('/chat'); history.push('/chat');
} else if (response.status === 200) { } else if (response.status === 200) {
return response; return response;
...@@ -94,36 +93,36 @@ export const getUserMessage = (params?: any): Promise<string> => { ...@@ -94,36 +93,36 @@ export const getUserMessage = (params?: any): Promise<string> => {
export const createPromptWords = (params: any): Promise<any> => { export const createPromptWords = (params: any): Promise<any> => {
return request('https://glm-mangement-api.baibaomen.com/PromptWords/create', { return request('https://glm-mangement-api.baibaomen.com/PromptWords/create', {
method: 'POST', method: 'POST',
data: params data: params,
}) });
} };
export const updatePromptWords = (params: any): Promise<any> => { export const updatePromptWords = (params: any): Promise<any> => {
return request('https://glm-mangement-api.baibaomen.com/PromptWords/update', { return request('https://glm-mangement-api.baibaomen.com/PromptWords/update', {
method: 'POST', method: 'POST',
data: params data: params,
}) });
} };
export const deletePromptWords = (params: any): Promise<any> => { export const deletePromptWords = (params: any): Promise<any> => {
return request('https://glm-mangement-api.baibaomen.com/PromptWords/delete', { return request('https://glm-mangement-api.baibaomen.com/PromptWords/delete', {
method: 'POST', method: 'POST',
data: params data: params,
}) });
} };
export const pagePromptWords = (params: any): Promise<any> => { export const pagePromptWords = (params: any): Promise<any> => {
return request('https://glm-mangement-api.baibaomen.com/PromptWords/page', { return request('https://glm-mangement-api.baibaomen.com/PromptWords/page', {
method: 'POST', method: 'POST',
data: params data: params,
}) });
} };
export const typePromptWords = (): Promise<any> => { export const typePromptWords = (): Promise<any> => {
return request('https://glm-mangement-api.baibaomen.com/PromptWords/type', { return request('https://glm-mangement-api.baibaomen.com/PromptWords/type', {
method: 'POST', method: 'POST',
}) });
} };
export const postDeleteUser = (params?: any): Promise<string> => { export const postDeleteUser = (params?: any): Promise<string> => {
return request('https://glm-mangement-api.baibaomen.com/User/delete', { 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