增加记住授权码功能
This commit is contained in:
parent
2a87cd760e
commit
749237a02d
@ -50,10 +50,10 @@
|
||||
<template #prefix>
|
||||
请输入授权码:
|
||||
</template>
|
||||
<template #append>
|
||||
<el-button @click="validate" type="primary">验证</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
<el-checkbox v-model="isRemember" style="margin-left: 180px">是否记住授权码</el-checkbox>
|
||||
<el-button @click="validate" type="primary" @keydown.enter="validate" style="margin-left: 100px">验证</el-button>
|
||||
|
||||
</el-col>
|
||||
|
||||
</div>
|
||||
@ -61,7 +61,7 @@
|
||||
|
||||
<script>
|
||||
import store from "../store";
|
||||
import {computed, ref} from "vue";
|
||||
import {computed, ref, onMounted} from "vue";
|
||||
import {ElMessage} from "element-plus"
|
||||
export default {
|
||||
name: "DashBoard",
|
||||
@ -69,8 +69,13 @@ export default {
|
||||
const link = ref("")
|
||||
const AuthCode = ref("")
|
||||
const keyword = ref("")
|
||||
const isRemember = ref(false)
|
||||
let timer
|
||||
|
||||
const loadComplete = computed(() => {
|
||||
return store.getters.loadComplete
|
||||
})
|
||||
|
||||
function post(){
|
||||
if(link.value.trim() === ''){
|
||||
ElMessage("请输入链接后再提交")
|
||||
@ -99,6 +104,7 @@ export default {
|
||||
}
|
||||
else{
|
||||
store.dispatch("validate", AuthCode.value)
|
||||
localStorage.setItem("auth", AuthCode.value)
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,14 +123,16 @@ export default {
|
||||
timer = setTimeout(() => {
|
||||
store.dispatch("searchByKeyword", keyword.value)
|
||||
}, 500)
|
||||
|
||||
}
|
||||
|
||||
const loadComplete = computed(() => {
|
||||
return store.getters.loadComplete
|
||||
onMounted(() => {
|
||||
const auth = localStorage.getItem("auth")
|
||||
if(auth !== null){
|
||||
store.dispatch("validate", auth)
|
||||
}
|
||||
})
|
||||
|
||||
return {link, post, query, validate, loadComplete, AuthCode, searchByLink, keyword, searchByKeyword, store}
|
||||
return {post, query, validate, searchByLink, searchByKeyword, link, loadComplete, AuthCode, keyword, isRemember, store}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -140,7 +148,7 @@ export default {
|
||||
width: auto;
|
||||
background-color: ghostwhite;
|
||||
display: block;
|
||||
margin-left: 200px;
|
||||
margin-left: 180px;
|
||||
margin-top: 200px;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user