完成下载

This commit is contained in:
2023-06-14 22:02:50 +08:00
parent bfde74bb87
commit 3963fd8fad
11 changed files with 160 additions and 133 deletions

View File

@@ -28,24 +28,24 @@
</el-table-column>
<el-table-column label="url" prop="url" />
</el-table>
<el-dialog :fullscreen="true" v-model="dialogVisible" title="Tips" width="30%" >
<el-dialog :fullscreen="true" v-model="dialogVisible" title="Tips" width="30%">
<div style="width: 100%;height: 100%;overflow-y: auto;">
<div v-for="i in msg">{{ i }}</div>
</div>
</el-dialog>
</div>
</template>
<script setup>
import { ref } from 'vue';
import { ElLoading,ElMessage } from 'element-plus'
import { ElLoading, ElMessage } from 'element-plus'
import axios from 'axios';
const dialogVisible = ref(false)
const form = ref({
name: "https://v.qq.com/x/cover/mzc002007vp35qj.html",
start: 1,
save:"D:/dl"
save: localStorage.getItem("save")
})
const tableData = ref([])
const table = ref()
@@ -56,9 +56,9 @@ function getlist() {
// tableData.value = res
// load.close()
// })
axios.get("http://127.0.0.1:3050/getQqList",{
params: {url:form.value.name}
}).then((r)=>{
axios.get("http://127.0.0.1:3050/getQqList", {
params: { url: form.value.name }
}).then((r) => {
tableData.value = r.data
})
}
@@ -72,11 +72,33 @@ function setlist() {
const msg = ref([])
async function dow() {
dialogVisible.value = true
let list = table.value.getSelectionRows()
for(let i of list){
await axios.get("http://127.0.0.1:3050/startDown",{
params:i
if (list.length == 0) {
ElMessage({
showClose: true,
message: '请选择要下载的剧集',
type: 'error',
})
return
}
if (!form.value.save) {
ElMessage({
showClose: true,
message: '请填写下载位置',
type: 'error',
})
return
}
dialogVisible.value = true
localStorage.setItem("save",form.value.save)
for (let i of list) {
await axios.get("http://127.0.0.1:3050/startDown", {
params: {
...i,
save: form.value.save + "/" + i.title.split(" ")[0]
}
})
}
// dialogVisible.value = false
@@ -84,15 +106,17 @@ async function dow() {
showClose: true,
message: '添加完成',
type: 'success',
duration:0
})
}
const source = new EventSource(`http://127.0.0.1:3050/msg`);
source.onmessage = event => {
// 挂到载体上面
msg.value.unshift(event.data)
// 挂到载体上面
if (msg.value.length > 200) {
msg.value.splice(200)
}
msg.value.unshift(event.data)
}
function showmsg(){
function showmsg() {
dialogVisible.value = true
}
</script>