基本正常,未发现恶性bug

This commit is contained in:
lion
2022-07-20 20:02:41 +08:00
commit ed257498c2
8 changed files with 634 additions and 0 deletions
+148
View File
@@ -0,0 +1,148 @@
<template>
<div class="DashBoard" v-show="loadComplete">
<el-row>
<el-col :span="24"> </el-col>
</el-row>
<el-row>
<el-col :span="8"></el-col>
<el-col :span="8">
<el-input v-model="link" placeholder="输入链接"></el-input>
</el-col>
<el-col :span="8"></el-col>
</el-row>
<br>
<el-row>
<el-col :span="8"></el-col>
<el-col :span="12">
<el-button @click="post">提交下载</el-button>
<el-button @click="query">查询任务</el-button>
<el-button @click="searchByLink">查找任务</el-button>
</el-col>
<el-col :span="4"></el-col>
</el-row>
<br>
<hr>
<br>
<el-row>
<el-col :span="8"></el-col>
<el-col :span="8">
<el-input v-model="keyword" placeholder="输入关键字" @change="searchByKeyword">
<template #prefix>
输入关键字查找:
</template>
</el-input>
</el-col>
<el-col :span="8"></el-col>
</el-row>
<br>
<el-row>
<el-col :span="11"></el-col>
<el-col :span="7">
<el-button>确定</el-button>
</el-col>
<el-col :span="6"></el-col>
</el-row>
</div>
<div class="DashBoard" v-show="!loadComplete">
<el-col :span="20">
<el-input v-model="AuthCode" class="validate">
<template #prefix>
请输入授权码:
</template>
<template #append>
<el-button @click="validate" type="primary">验证</el-button>
</template>
</el-input>
</el-col>
</div>
</template>
<script>
import store from "../store";
import {computed, ref} from "vue";
import {ElMessage} from "element-plus"
export default {
name: "DashBoard",
setup(){
const link = ref("")
const AuthCode = ref("")
const keyword = ref("")
let timer
function post(){
if(link.value.trim() === ''){
ElMessage("请输入链接后再提交")
}
else {
let gid = link.value.split('/')[4]
if (!gid || !link.value.includes("hentai")) {
ElMessage("请检查链接输入是否正确")
}
else
store.dispatch("post", link.value)
}
}
function query(){
if(link.value.trim() === ''){
ElMessage("请输入链接后再查询")
}
else
store.dispatch("query", link.value)
}
function validate(){
if(AuthCode.value.trim() === ""){
ElMessage("请输入授权码后再验证")
}
else{
store.dispatch("validate", AuthCode.value)
}
}
function searchByLink() {
if(link.value.trim() === ""){
ElMessage("请输入链接后查找")
}
else {
store.dispatch("searchByLink", link.value)
}
}
function searchByKeyword(){
if(timer)
clearTimeout(timer)
timer = setTimeout(() => {
store.dispatch("searchByKeyword", keyword.value)
}, 500)
}
const loadComplete = computed(() => {
return store.getters.loadComplete
})
return {link, post, query, validate, loadComplete, AuthCode, searchByLink, keyword, searchByKeyword, store}
}
}
</script>
<style scoped>
.DashBoard{
width: auto;
height: 90vh;
background-color: ghostwhite;
}
.validate{
width: auto;
background-color: ghostwhite;
display: block;
margin-left: 400px;
margin-top: 200px;
}
</style>