12.10提交

This commit is contained in:
zoujiandong
2025-12-10 17:33:39 +08:00
parent 22104881f1
commit c86aa03f01
28 changed files with 3237 additions and 279 deletions
+30 -12
View File
@@ -39,7 +39,7 @@
</view>
<!-- 内容列表 -->
<scroll-view class="content-scroll" scroll-y>
<scroll-view class="content-scroll" scroll-y :scroll-top="scrollTop">
<view v-if="currentList.length === 0" class="empty-state">
<text>暂无数据</text>
</view>
@@ -144,7 +144,7 @@
<script setup>
import { ref, computed, onMounted, nextTick } from "vue";
import downloadStore from "@/store/downloadStoreVideo.js";
import { onLoad, onShow, onUnload } from "@dcloudio/uni-app";
import { onLoad, onShow,onUnload,onBackPress} from "@dcloudio/uni-app";
import playImg from "@/static/down_true.png";
import pauseImg from "@/static/down_false.png";
import navTo from "@/utils/navTo";
@@ -156,6 +156,7 @@ const selectedItems = ref([]);
// 响应式数据
const activeTab = ref("completed"); // completed: 已完成, downloading: 缓存中
const isEditMode = ref(false);
const scrollTop = ref(0);
const storageInfo = ref({
total: "461.31G",
available: "312.92G",
@@ -204,7 +205,12 @@ const clearAll=()=>{
const isItemSelected = (item) => {
return selectedItems.value.includes(item.id);
}
onBackPress(() => {
if(from.value){
plus.runtime.quit();
return true;
}
});
// 切换项的选中状态
const toggleSelectItem = (item) => {
const index = selectedItems.value.indexOf(item.id);
@@ -237,13 +243,11 @@ const currentList = computed(() => {
});
// 方法
const goBack = () => {
uni.navigateBack({
fail() {
uni.redirectTo({
url: "/pages/index/index",
});
},
});
if(from.value){
plus.runtime.quit();
}else{
uni.navigateBack()
};
};
const switchTab = (tab) => {
@@ -252,6 +256,14 @@ const switchTab = (tab) => {
// 切换标签时清空选择
selectedItems.value = [];
isAllSelect.value = false;
// 切换到缓存中时,滚动到顶部
if (tab === 'downloading') {
// 先设置为一个非0值,然后在下一个tick设置为0,确保滚动触发
scrollTop.value = 0.01;
nextTick(() => {
scrollTop.value = 0;
});
}
};
const toggleEdit = () => {
@@ -330,8 +342,14 @@ const formatSize = (size) => {
// 如果已经是格式化字符串
return size;
};
onLoad(() => {
const from = ref('');
onLoad((options) => {
if(options.from){
from.value = options.from;
}
if(options.type){
switchTab('downloading')
}
// 从store同步任务列表
syncTasksFromStore();
// 监听store变化