文章锁本地化语言

This commit is contained in:
tangly1024
2022-03-25 14:55:43 +08:00
parent 35e5f95197
commit 0c28745f1d
8 changed files with 45 additions and 26 deletions

View File

@@ -1,3 +1,4 @@
import { useGlobal } from '@/lib/global'
/**
* 加密文章校验组件
@@ -8,6 +9,8 @@
*/
export const ArticleLock = props => {
const { password, validPassword } = props
const { locale } = useGlobal()
const submitPassword = () => {
const p = document.getElementById('password')
if (p && p.value && p.value === password) {
@@ -16,18 +19,18 @@ export const ArticleLock = props => {
const tips = document.getElementById('tips')
if (tips) {
tips.innerHTML = ''
tips.innerHTML = '<div class=\'text-red-500 animate__shakeX animate__animated\'>密码输入错误</div>'
tips.innerHTML = `<div class='text-red-500 animate__shakeX animate__animated'>${locale.COMMON.PASSWORD_ERROR}</div>`
}
}
}
return <div className='w-full flex justify-center items-center h-96 font-sans'>
<div className='text-center space-y-3'>
<div className='font-bold'>文章已加锁请输入访问密码:</div>
<div className='font-bold'>{locale.COMMON.ARTICLE_LOCK_TIPS}</div>
<div className='flex'>
<input id="password" type='password' className='w-full text-sm pl-5 rounded-l transition focus:shadow-lgfont-light leading-10 text-black bg-white dark:bg-gray-500'></input>
<div onClick={submitPassword} className="px-3 whitespace-nowrap cursor-pointer items-center justify-center py-2 rounded-r duration-300 bg-gray-300" >
<i className={'duration-200 cursor-pointer fas fa-key'} >&nbsp;提交</i>
<i className={'duration-200 cursor-pointer fas fa-key'} >&nbsp;{locale.COMMON.SUBMIT}</i>
</div>
</div>
<div id='tips'>