新增删除功能

This commit is contained in:
lion 2022-07-22 12:13:09 +08:00
parent ed257498c2
commit 2a87cd760e
6 changed files with 44 additions and 18 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="app"> <div class="app">
<el-container> <el-container>
<el-aside width="500px"> <el-aside width="590px">
<Side/> <Side/>
</el-aside> </el-aside>
<el-main> <el-main>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -42,12 +42,10 @@
</el-col> </el-col>
<el-col :span="6"></el-col> <el-col :span="6"></el-col>
</el-row> </el-row>
</div> </div>
<div class="DashBoard" v-show="!loadComplete"> <div class="DashBoard" v-show="!loadComplete">
<el-col :span="20"> <el-col :span="15">
<el-input v-model="AuthCode" class="validate"> <el-input v-model="AuthCode" class="validate">
<template #prefix> <template #prefix>
请输入授权码 请输入授权码
@ -142,7 +140,7 @@ export default {
width: auto; width: auto;
background-color: ghostwhite; background-color: ghostwhite;
display: block; display: block;
margin-left: 400px; margin-left: 200px;
margin-top: 200px; margin-top: 200px;
} }
</style> </style>

View File

@ -12,17 +12,20 @@
文件大小:{{props.row.fileSize}} 文件大小:{{props.row.fileSize}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="Name" width="300"> <el-table-column label="名字" width="300">
<template #default="scoped"> <template #default="scoped">
{{scoped.row.name}} {{scoped.row.name}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="link" width="80"> <el-table-column label="操作" width="180">
<template #default="scoped"> <template #default="scoped">
<el-link :href="scoped.row.download" v-show="scoped.row.download">download</el-link> <span v-show="scoped.row.download">
<el-button @click="downloadGallery(scoped.row.download)">下载</el-button>
<el-button @click="deleteGallery(scoped.row.gid)">删除</el-button>
</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="status" width="60"> <el-table-column label="进度" width="60">
<template #default="scoped"> <template #default="scoped">
{{ scoped.row.progress }} {{ scoped.row.progress }}
</template> </template>
@ -61,6 +64,7 @@ export default {
let input = ref(null) let input = ref(null)
let data = computed(() => { let data = computed(() => {
console.log(store.getters.task)
if(store.getters.task) if(store.getters.task)
return store.getters.task return store.getters.task
else else
@ -72,6 +76,8 @@ export default {
}) })
let max = computed(() => { let max = computed(() => {
if(targetPage.value > store.getters.max)
store.commit("_changePage", store.getters.max)
return store.getters.max return store.getters.max
}) })
@ -118,7 +124,6 @@ export default {
} }
function reverse(){ function reverse(){
console.log("reverse")
isEditing.value = !isEditing.value isEditing.value = !isEditing.value
if(isEditing){ if(isEditing){
input.value.focus() input.value.focus()
@ -126,6 +131,14 @@ export default {
targetPage.value = page.value targetPage.value = page.value
} }
function downloadGallery(link){
window.open(link)
}
function deleteGallery(gid){
store.dispatch("deleteGallery", gid)
}
return {update, return {update,
data, data,
@ -142,6 +155,8 @@ export default {
toMin, toMin,
previous, previous,
next, next,
downloadGallery,
deleteGallery,
store store
} }
} }

View File

@ -1,8 +0,0 @@
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}

View File

@ -103,6 +103,17 @@ const actions = {
}, },
searchByKeyword(context, keyword){ searchByKeyword(context, keyword){
context.commit("_searchByKeyword", keyword) context.commit("_searchByKeyword", keyword)
},
deleteGallery(context, gid){
axios.delete(base_url, {params:{AuthCode:state.AuthCode, gid:gid}}).then((res) => {
if(res.data.result === "success"){
ElMessage("删除成功")
context.commit("_deleteGallery", gid)
}
else{
ElMessage(res.data.data)
}
})
} }
} }
@ -172,6 +183,16 @@ const mutations = {
if(state.searchTask.length === 0){ if(state.searchTask.length === 0){
ElMessage("未找到该关键字的本子") ElMessage("未找到该关键字的本子")
} }
},
_deleteGallery(state, gid){
state.totalTask.map((currentValue, index, arr) => {
return currentValue.gid === gid ? null: currentValue
})
if(state.searchTask.length !== 1){
state.searchTask.map(currentValue => {
return currentValue.gid === gid ? null : currentValue
})
}
} }
} }