This commit is contained in:
lishiyun1227 2023-04-17 14:59:20 +08:00
parent 9deba4ae51
commit 4a4039bd7d
2 changed files with 2 additions and 63 deletions

View File

@ -105,41 +105,3 @@
user-select: text;
}
}
.dialog{
position: relative;
margin: 0 auto;
background-color: rgba(0,0,0,0.2);
color: var(--black);
.dialog-modal{
position: absolute;
left: 10%;
right: 10%;
width: 30%;
height: 300px;
top: 20%;
background-color: var(--white);
font-size: 12px;
color: var(--black);
border: var(--border-in-light);
box-shadow: var(--card-shadow);
padding: 10px 20px;
border-radius: 8px;
animation: slide-in-from-top ease 0.3s;
.title{
border-bottom: 1px solid #e6e5e5;
position: relative;
color: var(--black);
font-size: 14px;
}
.content-input{
padding: 20px;
margin-bottom: 30px;
}
button{
background-color: #009999;
padding: 9px 20px;
}
}
}

View File

@ -582,8 +582,6 @@ export function Chat(props: {
const context: RenderMessage[] = session.context.slice();
const accessStore = useAccessStore();
const [dialog, setDialog] = useState(false)
const [dialogValue, setDialogValue] = useState('')
if (
context.length === 0 &&
@ -591,19 +589,11 @@ export function Chat(props: {
) {
const copiedHello = Object.assign({}, BOT_HELLO);
if (!accessStore.isAuthorized()) {
// copiedHello.content = Locale.Error.Unauthorized;
setDialog(true)
copiedHello.content = Locale.Error.Unauthorized;
}
context.push(copiedHello);
}
const handleClick = () =>{
accessStore.updateCode(dialogValue);
setDialog(false)
// const copiedHello = Object.assign({}, BOT_HELLO);
// context.push(copiedHello);
}
// preview messages
const messages = context
.concat(session.messages as RenderMessage[])
@ -841,19 +831,6 @@ export function Chat(props: {
/>
</div>
</div>
{dialog ?
<div className="dialog">
<div className="dialog-modal">
<div className="title">ACCESS-CODE</div>
<div className="content-input">
<input value={dialogValue} type="text" placeholder='请输入ACCESS-CODE' onChange={(e) => {
accessStore.updateCode(e.currentTarget.value);
setDialogValue(e.currentTarget.value);
}} />
</div>
<button onClick={handleClick}></button>
</div>
</div> : ''}
</div>
);
}