基本正常,未发现恶性bug
This commit is contained in:
@@ -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>
|
||||
@@ -0,0 +1,168 @@
|
||||
<template>
|
||||
<div class="side" style="width: 100%">
|
||||
<span>下载历史</span>
|
||||
<div v-show="loadComplete" class="load_complete" >
|
||||
<el-table :data="data">
|
||||
<el-table-column type="expand">
|
||||
<template #default="props">
|
||||
名字:{{ props.row.name}} <br>
|
||||
链接:<el-link :href="props.row.link">Link</el-link> <br>
|
||||
语言:{{props.row.language}} <br>
|
||||
页数:{{props.row.pages}} <br>
|
||||
文件大小:{{props.row.fileSize}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="Name" width="300">
|
||||
<template #default="scoped">
|
||||
{{scoped.row.name}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="link" width="80">
|
||||
<template #default="scoped">
|
||||
<el-link :href="scoped.row.download" v-show="scoped.row.download">download</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="status" width="60">
|
||||
<template #default="scoped">
|
||||
{{ scoped.row.progress }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-row class="pageChanger">
|
||||
<el-col>
|
||||
<el-button @click="toMin">{{min}}</el-button>
|
||||
<el-button @click="previous">-</el-button>
|
||||
<el-input v-model="targetPage"
|
||||
@change="changePage"
|
||||
v-show="isEditing"
|
||||
@blur="reverse()"
|
||||
class="page"
|
||||
ref="input"></el-input>
|
||||
<span @click="reverse" v-show="!isEditing" class="page">{{page}}</span>
|
||||
<el-button @click="next">+</el-button>
|
||||
<el-button @click="toMax">{{max}}</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<span v-show="!loadComplete" class="side">请输入授权码后再查看</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import store from "../store";
|
||||
import {computed, ref} from "vue";
|
||||
export default {
|
||||
name: "Side",
|
||||
setup(){
|
||||
|
||||
const targetPage = ref(1)
|
||||
const isEditing = ref(false)
|
||||
|
||||
let input = ref(null)
|
||||
|
||||
let data = computed(() => {
|
||||
if(store.getters.task)
|
||||
return store.getters.task
|
||||
else
|
||||
return null
|
||||
})
|
||||
|
||||
let min = computed(() => {
|
||||
return store.getters.min
|
||||
})
|
||||
|
||||
let max = computed(() => {
|
||||
return store.getters.max
|
||||
})
|
||||
|
||||
let page = computed(() => {
|
||||
targetPage.value = store.getters.page
|
||||
return store.getters.page
|
||||
})
|
||||
|
||||
function next() {
|
||||
if(targetPage.value < max.value) {
|
||||
targetPage.value++
|
||||
store.commit("_changePage", targetPage.value)
|
||||
}
|
||||
}
|
||||
|
||||
function previous() {
|
||||
if(targetPage.value > min.value) {
|
||||
targetPage.value--
|
||||
store.commit("_changePage", targetPage.value)
|
||||
}
|
||||
}
|
||||
|
||||
function toMax() {
|
||||
store.commit("_changePage", max.value)
|
||||
targetPage.value = max.value
|
||||
}
|
||||
|
||||
function toMin(){
|
||||
store.commit("_changePage", min.value)
|
||||
targetPage.value = min.value
|
||||
}
|
||||
|
||||
let loadComplete = computed(() => {
|
||||
return store.getters.loadComplete
|
||||
})
|
||||
|
||||
function update(){
|
||||
store.dispatch("update")
|
||||
}
|
||||
|
||||
function changePage(){
|
||||
if(targetPage.value >= min.value && targetPage.value <= max.value)
|
||||
store.commit("_changePage", targetPage.value)
|
||||
}
|
||||
|
||||
function reverse(){
|
||||
console.log("reverse")
|
||||
isEditing.value = !isEditing.value
|
||||
if(isEditing){
|
||||
input.value.focus()
|
||||
}
|
||||
targetPage.value = page.value
|
||||
}
|
||||
|
||||
|
||||
return {update,
|
||||
data,
|
||||
min,
|
||||
max,
|
||||
targetPage,
|
||||
loadComplete,
|
||||
page,
|
||||
isEditing,
|
||||
input,
|
||||
reverse,
|
||||
changePage,
|
||||
toMax,
|
||||
toMin,
|
||||
previous,
|
||||
next,
|
||||
store
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.side{
|
||||
text-align: center;
|
||||
height: 300px;
|
||||
}
|
||||
span{
|
||||
display: block;
|
||||
}
|
||||
.pageChanger{
|
||||
position: absolute;
|
||||
top:92vh;
|
||||
left: 150px;
|
||||
}
|
||||
.page{
|
||||
display: inline-block;
|
||||
width: 50px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user