11.28提交
This commit is contained in:
@@ -102,7 +102,7 @@
|
||||
<view class="video-progress-bar-inner" :style="{ width: item.progress + '%' }"></view>
|
||||
</view> -->
|
||||
<!-- <text>{{ item.progress + '%' }}</text> -->
|
||||
<text>{{ formatSize(item.downloadSize) }} / {{ formatSize(item.totalSize) }}</text>
|
||||
<view class="size-box">{{ formatSize(item.downloadSize) }}/{{ formatSize(item.totalSize) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -596,13 +596,24 @@ onMounted(() => {
|
||||
page{
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.size-box{
|
||||
display: flex;
|
||||
white-space: nowrap;
|
||||
justify-content: flex-end;
|
||||
|
||||
white-space: nowrap;
|
||||
font-size: 24rpx;
|
||||
color:#8b2316
|
||||
}
|
||||
.box{
|
||||
display: flex;
|
||||
flex:1;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
justify-content: flex-end;
|
||||
margin-left: 30rpx;
|
||||
text{
|
||||
width: 40rpx;
|
||||
display: flex;
|
||||
white-space: nowrap;
|
||||
font-size: 24rpx;
|
||||
color:#8b2316
|
||||
}
|
||||
@@ -804,8 +815,8 @@ page{
|
||||
}
|
||||
.video-status{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 20rpx;
|
||||
|
||||
|
||||
justify-content: space-between;
|
||||
.status-icon{
|
||||
display: flex;
|
||||
|
||||
+172
-76
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="zhinan-list-page">
|
||||
<!-- 头部导航栏 -->
|
||||
<uni-nav-bar
|
||||
<!-- <uni-nav-bar
|
||||
left-icon="left"
|
||||
:title="title"
|
||||
@clickLeft="goBack"
|
||||
@@ -12,7 +12,8 @@
|
||||
backgroundColor="#eeeeee"
|
||||
>
|
||||
|
||||
</uni-nav-bar>
|
||||
</uni-nav-bar> -->
|
||||
<navBar :title="title" />
|
||||
|
||||
<!-- 使用scroll-view实现列表 -->
|
||||
<scroll-view
|
||||
@@ -39,20 +40,16 @@
|
||||
<view class="item-date">{{ formatDate(item.releaseTime) }}</view>
|
||||
<!-- 操作按钮 -->
|
||||
<view class="item-action">
|
||||
<view
|
||||
class="download-btn"
|
||||
@click.stop="viewGuideline(item)"
|
||||
>
|
||||
<up-icon name="download" color="#8D2316" size="28"></up-icon>
|
||||
</view>
|
||||
<!-- <view
|
||||
v-else
|
||||
class="view-btn"
|
||||
@click.stop="viewGuideline(item)"
|
||||
>
|
||||
查看
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="download-btn" @click.stop="downLoad(item)" v-if="!downLoadtaskList.includes(item.uuid)">
|
||||
<!-- <up-icon name="download" color="#8D2316" size="28" ></up-icon> -->
|
||||
<uni-icons type="arrow-down" size="26" color="#8D2316"></uni-icons>
|
||||
</view>
|
||||
<view
|
||||
v-else
|
||||
class="view-btn"
|
||||
@click.stop="viewGuideline(item)"
|
||||
>查看</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -83,12 +80,13 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted} from 'vue'
|
||||
import { ref, onMounted,computed,nextTick} from 'vue'
|
||||
import api from '@/api/api.js'
|
||||
import { onShow,onLoad } from "@dcloudio/uni-app";
|
||||
import docUrl from "@/utils/docUrl.js"
|
||||
import navTo from "@/utils/navTo.js"
|
||||
import hotImg from "@/static/hot_booklist.png"
|
||||
import navBar from "@/components/navBar/navBar.vue"
|
||||
// 响应式数据
|
||||
const guidelinesList = ref([])
|
||||
const isLoading = ref(false)
|
||||
@@ -107,6 +105,13 @@ const from=ref('');
|
||||
const name=ref('');
|
||||
const showInnerSort=ref(false);
|
||||
const innerSortTitle=ref('上传时间');
|
||||
import downloadStore from "@/store/downloadStoreFile.js";
|
||||
const downloadTasks=ref([]);
|
||||
const downLoadtaskList=computed(()=>{
|
||||
console.log('downLoadtaskList');
|
||||
console.log(downloadTasks.value.map((item)=>item.id));
|
||||
return downloadTasks.value.map((item)=>item.id);
|
||||
});
|
||||
const chooseInnerSort=(index)=>{
|
||||
sort.value=index;
|
||||
if(index==1){
|
||||
@@ -144,6 +149,14 @@ const toggleInnerSort=()=>{
|
||||
showInnerSort.value=!showInnerSort.value;
|
||||
}
|
||||
onShow(() => {
|
||||
syncTasksFromStore();
|
||||
// 监听store变化
|
||||
downloadStore.addListener((tasks) => {
|
||||
downloadTasks.value = tasks;
|
||||
|
||||
});
|
||||
// 恢复正在下载的任务
|
||||
resumeDownloadingTasks();
|
||||
// 页面显示时,如果列表为空则加载数据
|
||||
if (guidelinesList.value.length === 0) {
|
||||
if(from.value){
|
||||
@@ -359,66 +372,39 @@ const downloadGuideline = (item) => {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const downLoad = (item) => {
|
||||
if(!item.path){
|
||||
uni.showToast({
|
||||
title: "暂无下载链接",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
addDownloadTask({
|
||||
url: docUrl + item.path,
|
||||
title: item.title,
|
||||
id: item.uuid,
|
||||
});
|
||||
};
|
||||
// 查看指南(支持常用文档直链:pdf/doc/docx/xls/xlsx/ppt/pptx/txt)
|
||||
const viewGuideline = (item) => {
|
||||
const url = docUrl+item.path
|
||||
if (url) {
|
||||
const isPDF = /\.(pdf)(\?|$)/i.test(url)
|
||||
const isOffice = /\.(docx?|xlsx?|pptx?)(\?|$)/i.test(url)
|
||||
const isText = /\.(txt)(\?|$)/i.test(url)
|
||||
|
||||
// H5 端
|
||||
// #ifdef H5
|
||||
if (isPDF) {
|
||||
try { window.open(url, '_blank') } catch (e) {
|
||||
uni.navigateTo({ url: `/pages_app/webview/webview?url=${encodeURIComponent(url)}` })
|
||||
}
|
||||
return
|
||||
}
|
||||
if (isOffice) {
|
||||
const officeUrl = `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(url)}`
|
||||
try { window.open(officeUrl, '_blank') } catch (e) {
|
||||
uni.navigateTo({ url: `/pages_app/webview/webview?url=${encodeURIComponent(officeUrl)}` })
|
||||
}
|
||||
return
|
||||
}
|
||||
if (isText) {
|
||||
uni.navigateTo({ url: `/pages_app/webview/webview?url=${encodeURIComponent(url)}` })
|
||||
return
|
||||
}
|
||||
// 其他格式统一用 webview 打开
|
||||
uni.navigateTo({ url: `/pages_app/webview/webview?url=${encodeURIComponent(url)}` })
|
||||
return
|
||||
// #endif
|
||||
|
||||
// 非 H5 端:下载后尝试用 openDocument,失败回退 webview
|
||||
// #ifndef H5
|
||||
uni.showToast({ title: '正在打开...', icon: 'none' })
|
||||
uni.downloadFile({
|
||||
url,
|
||||
success: (res) => {
|
||||
if (res.statusCode === 200 && res.tempFilePath) {
|
||||
uni.openDocument({
|
||||
filePath: res.tempFilePath,
|
||||
showMenu: true,
|
||||
success: () => {},
|
||||
fail: () => {
|
||||
uni.navigateTo({ url: `/pages_app/webview/webview?url=${encodeURIComponent(url)}` })
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({ url: `/pages_app/webview/webview?url=${encodeURIComponent(url)}` })
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.navigateTo({ url: `/pages_app/webview/webview?url=${encodeURIComponent(url)}` })
|
||||
}
|
||||
})
|
||||
return
|
||||
// #endif
|
||||
}
|
||||
// 无直链,回退到详情页
|
||||
const viewGuideline = (cell) => {
|
||||
console.log(cell);
|
||||
if (!cell.path) {
|
||||
uni.showToast({
|
||||
title: "暂无下载链接",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
downloadTasks.value.forEach(item => {
|
||||
if(item.id == cell.uuid) {
|
||||
uni.openDocument({
|
||||
filePath: item.localPath,
|
||||
success: () => console.log('打开成功'),
|
||||
fail: (err) => console.error('打开失败', err)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -463,6 +449,116 @@ const formatDate = (dateString) => {
|
||||
return dateString
|
||||
}
|
||||
}
|
||||
// 添加下载任务
|
||||
const addDownloadTask = (item) => {
|
||||
// 使用store添加任务
|
||||
const taskIndex = downloadStore.addTask(item);
|
||||
// 同步任务列表
|
||||
syncTasksFromStore();
|
||||
// 开始下载
|
||||
startDownload(taskIndex);
|
||||
};
|
||||
|
||||
// 开始下载
|
||||
const startDownload = (index) => {
|
||||
const taskItem = downloadStore.getTask(index);
|
||||
if (!taskItem) return;
|
||||
if(taskItem.status == "loading"){
|
||||
uni.showToast({
|
||||
title: "正在下载",
|
||||
icon: "none",
|
||||
});
|
||||
return false;
|
||||
};
|
||||
downloadStore.updateTask(index, {
|
||||
status: "loading"
|
||||
});
|
||||
|
||||
const task = uni.downloadFile({
|
||||
url: taskItem.url,
|
||||
success: (res1) => {
|
||||
//console.log("res1:"+JSON.stringify(res1));
|
||||
if (res1.statusCode === 200) {
|
||||
downloadStore.updateTask(index, {
|
||||
status: "completed",
|
||||
filePath: res1.tempFilePath,
|
||||
});
|
||||
|
||||
uni.showToast({
|
||||
title: "下载成功",
|
||||
icon: "none",
|
||||
});
|
||||
|
||||
|
||||
uni.saveFile({
|
||||
tempFilePath: res1.tempFilePath,
|
||||
success: function (res2) {
|
||||
console.log("res2:"+JSON.stringify(res2));
|
||||
uni.getSavedFileInfo({
|
||||
filePath: res2.savedFilePath,
|
||||
success: function (res) {
|
||||
console.log("res:"+JSON.stringify(res));
|
||||
console.log("size:"+res.size);
|
||||
downloadStore.updateTask(index, {
|
||||
status: "completed",
|
||||
localPath: res2.savedFilePath,
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
} else {
|
||||
downloadStore.updateTask(index, {
|
||||
status: "failed",
|
||||
});
|
||||
uni.showToast({
|
||||
title: "下载失败",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
downloadStore.updateTask(index, {
|
||||
status: "failed",
|
||||
});
|
||||
uni.showToast({
|
||||
title: "下载失败: " + (err.errMsg || "未知错误"),
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
// 监听下载进度
|
||||
task.onProgressUpdate((update) => {
|
||||
const currentTask = downloadStore.getTask(index);
|
||||
if (currentTask && currentTask.status === "downloading") {
|
||||
downloadStore.updateTask(index, {
|
||||
progress: update.progress
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 保存task对象到store(用于暂停/继续)
|
||||
downloadStore.updateTask(index, {
|
||||
task: task,
|
||||
});
|
||||
};
|
||||
|
||||
const syncTasksFromStore = () => {
|
||||
downloadTasks.value = downloadStore.getTasks();
|
||||
};
|
||||
// 恢复正在下载的任务
|
||||
const resumeDownloadingTasks = () => {
|
||||
// 使用 nextTick 确保在页面渲染后再恢复下载任务
|
||||
nextTick(() => {
|
||||
downloadStore.resumeDownloadingTasks((index) => {
|
||||
// 重新开始下载(uni.downloadFile不支持断点续传,所以从0开始)
|
||||
console.log("恢复下载任务:", downloadStore.getTask(index)?.url);
|
||||
startDownload(index);
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<navBar title="肝胆回放" />
|
||||
<navBar :title="from == 'video' ? '肝胆视频' : '肝胆回放'" />
|
||||
<view class="page">
|
||||
<!-- 筛选标签栏 -->
|
||||
<view class="filter-bar">
|
||||
@@ -99,8 +99,8 @@
|
||||
:data-item-id="item.id"
|
||||
>
|
||||
<template #error>
|
||||
<image :src="lazyImg" class="poster-image" mode="aspectFill"></image>
|
||||
</template>
|
||||
<image :src="lazyImg" class="poster-image" mode="aspectFill"></image>
|
||||
</template>
|
||||
</up-image>
|
||||
<view class="play-btn">
|
||||
<up-image
|
||||
@@ -221,7 +221,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, nextTick, computed } from "vue";
|
||||
import { onShow, onHide } from "@dcloudio/uni-app";
|
||||
import { onShow, onHide,onLoad } from "@dcloudio/uni-app";
|
||||
import CustomTabbar from "@/components/tabBar/tabBar.vue";
|
||||
import api from "@/api/api.js";
|
||||
import select from "@/static/triangle_normal.png";
|
||||
@@ -234,6 +234,12 @@ import navTo from "@/utils/navTo";
|
||||
import navBar from "@/components/navBar/navBar.vue";
|
||||
import empty from "@/components/empty/empty.vue";
|
||||
import lazyImg from "@/static/default_news_iv.png";
|
||||
const from=ref('');
|
||||
onLoad((options)=>{
|
||||
if(options.from){
|
||||
from.value=options.from;
|
||||
}
|
||||
});
|
||||
// 弹窗状态
|
||||
const isTimePopupShow = ref(false);
|
||||
const isLocationPopupShow = ref(false);
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
@clickLeft="goBack" :title="name" color="#8B2316" :border="false" backgroundColor="#eeeeee">
|
||||
<template #right>
|
||||
|
||||
<!-- <view class="nav-right" @click="goSelect">
|
||||
<view class="nav-right" @click="goSelect">
|
||||
精选
|
||||
</view> -->
|
||||
</view>
|
||||
</template>
|
||||
</uni-nav-bar>
|
||||
</view>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
:refresher-triggered="refreshing"
|
||||
@refresherrefresh="onRefresh"
|
||||
@scrolltolower="onLoadMore"
|
||||
lower-threshold="1000"
|
||||
lower-threshold="300"
|
||||
>
|
||||
<view class="meeting-list">
|
||||
<view
|
||||
@@ -101,9 +101,7 @@
|
||||
};
|
||||
const loadVideoData = async (isRefresh = false) => {
|
||||
if (loading.value && !isRefresh) return;
|
||||
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
const response = await api.videoByTypeNew({
|
||||
page: currentPage.value,
|
||||
@@ -128,7 +126,7 @@
|
||||
if (videoData && videoData.list) {
|
||||
const { list, totalPage,pageNumber } = videoData;
|
||||
console.log('视频列表数据:', list);
|
||||
|
||||
loading.value=false;
|
||||
if (isRefresh) {
|
||||
meetingList.value = list || [];
|
||||
currentPage.value = 1;
|
||||
@@ -138,6 +136,10 @@
|
||||
|
||||
hasMoreData.value = totalPage>pageNumber;
|
||||
loadMoreStatus.value = hasMoreData.value ? 'more' : 'noMore';
|
||||
if(hasMoreData.value ){
|
||||
|
||||
onLoadMore();
|
||||
}
|
||||
} else {
|
||||
throw new Error(response?.message || '获取数据失败');
|
||||
}
|
||||
@@ -162,6 +164,8 @@
|
||||
// 上拉加载更多
|
||||
const onLoadMore = () => {
|
||||
console.log('onLoadMore');
|
||||
console.log('hasMoreData',hasMoreData.value);
|
||||
console.log('loading',loading.value);
|
||||
if (!hasMoreData.value || loading.value) return;
|
||||
|
||||
loadMoreStatus.value = 'loading';
|
||||
|
||||
+93
-11
@@ -1,5 +1,31 @@
|
||||
<template>
|
||||
<navBar title="肝胆视频" />
|
||||
<view class="navbox">
|
||||
<view class="status_bar"></view>
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
title="肝胆视频"
|
||||
@clickLeft="goBack"
|
||||
color="#8B2316"
|
||||
:border="false"
|
||||
backgroundColor="#eeeeee"
|
||||
>
|
||||
<template #right>
|
||||
<view class="nav-actions" >
|
||||
<view class="collect-img" @click="goSearch">
|
||||
<image class="img-icon" :src="searchImg" mode="aspectFill" />
|
||||
</view>
|
||||
<view class="collect-img" @click="goMeet">
|
||||
<image
|
||||
class="img-icon"
|
||||
:src="meetImg"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</uni-nav-bar>
|
||||
</view>
|
||||
|
||||
<view class="video-page">
|
||||
<!-- Header -->
|
||||
|
||||
@@ -31,11 +57,23 @@
|
||||
@click="playBannerVideo(banner)"
|
||||
>
|
||||
<view class="banner-item">
|
||||
<image
|
||||
<up-image
|
||||
class="banner-image"
|
||||
:src="docUrl+banner.imgpath"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
:loadingIcon="lazyVideoImg"
|
||||
:errorIcon="lazyVideoImg"
|
||||
:lazy-load="true"
|
||||
width="100%"
|
||||
height="400rpx"
|
||||
>
|
||||
<template #error>
|
||||
<image :src="lazyVideoImg" class="banner-image" mode="aspectFill"></image>
|
||||
</template>
|
||||
<template #loading>
|
||||
<image :src="lazyVideoImg" class="banner-image" mode="aspectFill"></image>
|
||||
</template>
|
||||
</up-image>
|
||||
|
||||
</view>
|
||||
</swiper-item>
|
||||
@@ -97,7 +135,25 @@
|
||||
@click="playVideo(video)"
|
||||
>
|
||||
<view class="video-thumbnail">
|
||||
<image :src="docUrl + video.imgpath" mode="aspectFill"></image>
|
||||
<up-image
|
||||
:src="docUrl + video.imgpath"
|
||||
class="poster-image"
|
||||
mode="aspectFill"
|
||||
:loadingIcon="lazyImg"
|
||||
:errorIcon="lazyImg"
|
||||
:lazy-load="true"
|
||||
width="100%"
|
||||
height="220rpx"
|
||||
|
||||
>
|
||||
<template #error>
|
||||
<image :src="lazyImg" class="poster-image" mode="aspectFill"></image>
|
||||
</template>
|
||||
<template #loading>
|
||||
<image :src="lazyImg" class="poster-image" mode="aspectFill"></image>
|
||||
</template>
|
||||
</up-image>
|
||||
|
||||
</view>
|
||||
<view class="video-info">
|
||||
<view class="video-title">{{video.title || video.name}}</view>
|
||||
@@ -219,6 +275,10 @@
|
||||
import videoImg from "@/static/patient_video.png"
|
||||
import docUrl from '@/utils/docUrl';
|
||||
import navTo from '@/utils/navTo';
|
||||
import searchImg from "@/static/search.png"
|
||||
import lazyImg from "@/static/default_video.png"
|
||||
import lazyVideoImg from "@/static/videoPlaceholder.png";
|
||||
import meetImg from "@/static/sfewm.png"
|
||||
import formatNumber from '@/utils/formatNumber.js';
|
||||
import navBar from '@/components/navBar/navBar.vue';
|
||||
const isAllActive=ref(false)
|
||||
@@ -244,6 +304,18 @@
|
||||
const showFilter = ref(false);
|
||||
const yearList=ref([]);
|
||||
const selectYearContent=reactive({})
|
||||
const goSearch=()=>{
|
||||
uni.sendNativeEvent('goHomeSearch', {
|
||||
msg: 'goHomeSearch'
|
||||
},ret => {
|
||||
console.log(ret);
|
||||
})
|
||||
}
|
||||
const goMeet=()=>{
|
||||
uni.navigateTo({
|
||||
url: '/pages_app/liveReplay/liveReplay?from=video'
|
||||
});
|
||||
}
|
||||
// 筛选弹窗相关数据
|
||||
const filterTags = ref([
|
||||
{ name: '指南解读', selected: false },
|
||||
@@ -554,11 +626,11 @@
|
||||
|
||||
|
||||
// 搜索
|
||||
const goSearch = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages_app/search/search'
|
||||
});
|
||||
};
|
||||
// const goSearch = () => {
|
||||
// uni.navigateTo({
|
||||
// url: '/pages_app/search/search'
|
||||
// });
|
||||
// };
|
||||
|
||||
// 跳转到患教视频列表
|
||||
const goPatientVideo = () => {
|
||||
@@ -777,6 +849,16 @@
|
||||
$border-radius-small: 6px;
|
||||
$padding: 15px;
|
||||
$padding-small: 10px;
|
||||
.img-icon{
|
||||
width: 42rpx;
|
||||
height: 42rpx;
|
||||
}
|
||||
.nav-actions{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 20rpx;
|
||||
}
|
||||
.video-page {
|
||||
background-color: #f5f5f5;
|
||||
height: 100vh;
|
||||
@@ -1138,7 +1220,7 @@
|
||||
.popup-content {
|
||||
width: 100%;
|
||||
margin-top: calc(var(--status-bar-height) + 44px + 400rpx + 117rpx);
|
||||
height: 80vh;
|
||||
height: calc(100vh - var(--status-bar-height) - 44px - 400rpx - 117rpx);
|
||||
background-color: #fff;
|
||||
|
||||
overflow: scroll;
|
||||
@@ -1167,7 +1249,7 @@
|
||||
|
||||
.popup-body {
|
||||
display: flex;
|
||||
height: 600rpx;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.category-sidebar {
|
||||
|
||||
@@ -41,16 +41,17 @@
|
||||
:src="videoSrc"
|
||||
:videoHeight="220"
|
||||
:seekTime="0"
|
||||
@fullscreenchange="onFullscreenChange"
|
||||
/>
|
||||
<!-- 标签切换 -->
|
||||
<cover-view class="tabs" v-if="from != 'download'">
|
||||
<cover-view class="tabs" v-if="from != 'download'" :style="{ opacity: isFullScreen ? 0: 1 }">
|
||||
<cover-view
|
||||
class="tab"
|
||||
:class="{ active: activeTab === 'info' }"
|
||||
@click="switchTab('info')"
|
||||
>
|
||||
视频简介
|
||||
<view-cover class="tab-line" v-if="activeTab === 'info'"></view-cover>
|
||||
<cover-view class="tab-line" v-if="activeTab === 'info'"></cover-view>
|
||||
</cover-view>
|
||||
<cover-view
|
||||
class="tab"
|
||||
@@ -58,7 +59,7 @@
|
||||
@click="switchTab('comment')"
|
||||
>
|
||||
评论
|
||||
<view-cover class="tab-line" v-if="activeTab === 'comment'"></view-cover>
|
||||
<cover-view class="tab-line" v-if="activeTab === 'comment'"></cover-view>
|
||||
</cover-view>
|
||||
</cover-view>
|
||||
<view class="video-detail-page" v-if="from != 'download'">
|
||||
@@ -132,7 +133,8 @@
|
||||
<text v-if="!isVideoDownloadRecord && welfareNum > 0">(剩余免费下载{{ welfareNum }}次数)</text>
|
||||
</text
|
||||
>
|
||||
<text class="download-text" v-else-if="downLoadStatus === 'loading'">视频缓存中</text>
|
||||
|
||||
<text class="download-text" v-else-if="downLoadStatus === 'loading' || downLoadStatus === 'failed'">视频缓存中</text>
|
||||
<text class="download-text" v-else-if="downLoadStatus === 'completed'">查看缓存</text>
|
||||
</view>
|
||||
<view v-if="activeTab !== 'info' && from != 'download'" class="bottom-comment">
|
||||
@@ -226,6 +228,7 @@ const hasDownload = ref(false);
|
||||
const downLoadStatus = ref('start');
|
||||
let downList = uni.getStorageSync("downLoadVideo") || [];
|
||||
const downLoadList = ref(downList);
|
||||
const isFullScreen = ref(false);
|
||||
//import DomVideoPlayer from 'uniapp-video-player'
|
||||
import sunnyVideo from "@/uni_modules/sunny-video/components/sunny-video/sunny-video.vue";
|
||||
import downloadStore from "@/store/downloadStoreVideo.js";
|
||||
@@ -239,6 +242,12 @@ const addDownloadTask = (item) => {
|
||||
// 开始下载
|
||||
startDownload(taskIndex);
|
||||
};
|
||||
const onFullscreenChange = (e) => {
|
||||
let { fullScreen, direction } = e;
|
||||
nextTick(() => {
|
||||
isFullScreen.value = fullScreen;
|
||||
});
|
||||
};
|
||||
// 开始下载
|
||||
const startDownload = (index) => {
|
||||
const taskItem = downloadStore.getTask(index);
|
||||
@@ -260,7 +269,7 @@ const startDownload = (index) => {
|
||||
icon: "none",
|
||||
});
|
||||
downLoadStatus.value = 'completed';
|
||||
|
||||
|
||||
uni.saveFile({
|
||||
tempFilePath: res1.tempFilePath,
|
||||
success: function (res2) {
|
||||
@@ -342,17 +351,11 @@ const toCollection = () => {
|
||||
};
|
||||
const networkConfirm = () => {
|
||||
networkVisible.value = false;
|
||||
pointVisible.value = true;
|
||||
|
||||
if(welfareNum.value > 0) {
|
||||
useWelfareNum();
|
||||
}else{
|
||||
addDownloadTask({
|
||||
url: videoSrc.value,
|
||||
id: video_uuid.value,
|
||||
imgpath: videoInfo.value.imgpath,
|
||||
author: videoInfo.value.public_name,
|
||||
name: videoInfo.value.name,
|
||||
});
|
||||
pointVisible.value = true;
|
||||
}
|
||||
|
||||
};
|
||||
@@ -399,18 +402,7 @@ const videoDetail = async () => {
|
||||
if (res.code == 200) {
|
||||
const userInfo = uni.getStorageSync("userInfo");
|
||||
videoInfo.value = res.video;
|
||||
downloadTasks.value.forEach(item => {
|
||||
if (item.id == video_uuid.value) {
|
||||
uni.getSavedFileInfo({
|
||||
filePath: item.localPath, //仅做示例用,非真正的文件路径
|
||||
success: function (res) {
|
||||
hasDownload.value = true;
|
||||
downLoadStatus.value = 'completed';
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//hasDownload.value = downLoadList.value.includes(video_uuid.value);
|
||||
let vid = res.video.polyv_uuid;
|
||||
let uuid = vid.substring(0, 10);
|
||||
@@ -452,6 +444,24 @@ const VideoDownloadRecord = async () => {
|
||||
const res = await api.isVideoDownloadRecord({ video_uuid: video_uuid.value });
|
||||
if (res.code == 200) {
|
||||
isVideoDownloadRecord.value = res.result == 0 ? false : true;
|
||||
if(isVideoDownloadRecord.value) {
|
||||
downloadTasks.value.forEach(item => {
|
||||
if (item.id == video_uuid.value) {
|
||||
uni.getSavedFileInfo({
|
||||
filePath: item.localPath, //仅做示例用,非真正的文件路径
|
||||
success: function (res) {
|
||||
hasDownload.value = true;
|
||||
downLoadStatus.value = 'completed';
|
||||
},
|
||||
fail: function (err) {
|
||||
// hasDownload.value = false;
|
||||
// downLoadStatus.value = 'failed';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -496,17 +506,48 @@ const resumeDownloadingTasks = () => {
|
||||
onShow(() => {
|
||||
hasDownload.value = false;
|
||||
downLoadStatus.value = 'start';
|
||||
console.log('onShow');
|
||||
syncTasksFromStore();
|
||||
// 监听store变化
|
||||
downloadStore.addListener((tasks) => {
|
||||
downloadTasks.value = tasks;
|
||||
|
||||
});
|
||||
// 恢复正在下载的任务
|
||||
resumeDownloadingTasks();
|
||||
console.log('tasks');
|
||||
console.log(downloadTasks.value);
|
||||
if(downloadTasks.value.length > 0) {
|
||||
for(let i = 0; i < downloadTasks.value.length; i++) {
|
||||
if(downloadTasks.value[i].id == video_uuid.value) {
|
||||
console.log('runing');
|
||||
console.log(downloadTasks.value[i].status);
|
||||
hasDownload.value = true;
|
||||
if(downloadTasks.value[i].status == 'completed') {
|
||||
downLoadStatus.value = 'completed';
|
||||
}else if(downloadTasks.value[i].status == 'downloading') {
|
||||
uni.showToast({
|
||||
title: '视频缓存中',
|
||||
icon: 'none',
|
||||
});
|
||||
hasDownload.value = true;
|
||||
downLoadStatus.value = 'loading';
|
||||
}else if(downloadTasks.value[i].status == 'paused') {
|
||||
hasDownload.value = true;
|
||||
downLoadStatus.value = 'loading';
|
||||
}else if(downloadTasks.value[i].status == 'failed') {
|
||||
hasDownload.value = true;
|
||||
downLoadStatus.value = 'loading';
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if (activeTab.value == "comment") {
|
||||
videoCommentListV2();
|
||||
}
|
||||
videoDetail();
|
||||
if(from.value != 'download') {
|
||||
videoDetail();
|
||||
}
|
||||
uni.hideLoading();
|
||||
|
||||
});
|
||||
@@ -694,9 +735,12 @@ onLoad((options) => {
|
||||
});
|
||||
video_uuid.value = options.id;
|
||||
from.value = options.from;
|
||||
addVideoWatchRecord();
|
||||
VideoDownloadRecord();
|
||||
getWelfareNum();
|
||||
if(from.value != 'download') {
|
||||
addVideoWatchRecord();
|
||||
VideoDownloadRecord();
|
||||
getWelfareNum();
|
||||
}
|
||||
|
||||
// 从store同步任务列表
|
||||
syncTasksFromStore();
|
||||
// 监听store变化
|
||||
@@ -706,6 +750,18 @@ onLoad((options) => {
|
||||
});
|
||||
// 恢复正在下载的任务
|
||||
resumeDownloadingTasks();
|
||||
if(from.value == 'download') {
|
||||
downloadTasks.value.forEach(item => {
|
||||
if(item.id == video_uuid.value) {
|
||||
console.log(222222);
|
||||
console.log(item.localPath);
|
||||
videoSrc.value = item.localPath;
|
||||
showVideo.value = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// navTo({
|
||||
// url: "/pages_app/downLoadVideo/downLoadVideo",
|
||||
// });
|
||||
@@ -736,6 +792,7 @@ const payVideoDownload = async () => {
|
||||
author: videoInfo.value.public_name,
|
||||
name: videoInfo.value.name,
|
||||
});
|
||||
|
||||
} else if (res.code == 106) {
|
||||
notEnoughVisible.value = true;
|
||||
notEnoughContent.value = `您的积分不足,是否购买积分?`;
|
||||
@@ -885,6 +942,7 @@ $theme-color: #8b2316;
|
||||
}
|
||||
|
||||
.video-detail-page {
|
||||
border-top: 2rpx solid #cccccc;
|
||||
background: $bg-color;
|
||||
overflow: hidden;
|
||||
}
|
||||
@@ -914,7 +972,7 @@ $theme-color: #8b2316;
|
||||
top: calc(var(--status-bar-height) + 44px + 220px);
|
||||
padding: 24rpx 0 0;
|
||||
|
||||
border-bottom: 2rpx solid #cccccc;
|
||||
|
||||
width: 100%;
|
||||
z-index: 99;
|
||||
|
||||
@@ -926,7 +984,7 @@ $theme-color: #8b2316;
|
||||
align-items: center;
|
||||
padding: 16rpx 0 24rpx;
|
||||
color: $text-secondary;
|
||||
font-size: 28rpx;
|
||||
font-size: 28rpx!important;
|
||||
.tab-line {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
@@ -939,7 +997,11 @@ $theme-color: #8b2316;
|
||||
background: $theme-color;
|
||||
}
|
||||
&:nth-child(2) {
|
||||
display: flex;
|
||||
margin-left: 200rpx;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
&.active {
|
||||
color: $theme-color;
|
||||
@@ -963,7 +1025,7 @@ $theme-color: #8b2316;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
// padding: 24rpx 28rpx 40rpx;
|
||||
top: calc(var(--status-bar-height) + 44px + 220px + 88rpx);
|
||||
top: calc(var(--status-bar-height) + 44px + 220px + 99rpx);
|
||||
height: calc(100vh - var(--status-bar-height) - 44px - 220px - 90rpx);
|
||||
overflow-y: scroll;
|
||||
// background: red;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<uni-nav-bar
|
||||
<!-- <uni-nav-bar
|
||||
left-icon="left"
|
||||
title="诊疗指南"
|
||||
@clickLeft="goBack"
|
||||
@@ -8,14 +8,15 @@
|
||||
height="180rpx"
|
||||
:border="false"
|
||||
backgroundColor="#eeeeee"
|
||||
></uni-nav-bar>
|
||||
></uni-nav-bar> -->
|
||||
<navBar title="诊疗指南"/>
|
||||
<view class="zhinan-page" v-if="tab=='zhinan'">
|
||||
<!-- 导航栏 -->
|
||||
|
||||
|
||||
<!-- 固定搜索栏 -->
|
||||
<view class="search-container-fixed filter-bar">
|
||||
<view class="search-box">
|
||||
<view class="search-box" @click="goSearch">
|
||||
<uni-icons type="search" size="16" color="#999"></uni-icons>
|
||||
<text class="search-text">搜索</text>
|
||||
</view>
|
||||
@@ -263,7 +264,8 @@
|
||||
import delImg from "@/static/delete_paper.png"
|
||||
import api from '@/api/api.js'
|
||||
import docUrl from "@/utils/docUrl.js"
|
||||
import navTo from '@/utils/navTo.js';
|
||||
import navTo from '@/utils/navTo.js';
|
||||
import navBar from "@/components/navBar/navBar.vue"
|
||||
const total=ref(0);
|
||||
const tab=ref('zhinan')
|
||||
// 响应式数据
|
||||
@@ -285,7 +287,13 @@
|
||||
const showFilterPopup = () => {
|
||||
showFilter.value = true;
|
||||
};
|
||||
|
||||
const goSearch=()=>{
|
||||
uni.sendNativeEvent('goHomeSearch', {
|
||||
msg: 'goHomeSearch'
|
||||
},ret => {
|
||||
console.log(ret);
|
||||
})
|
||||
}
|
||||
const hideFilterPopup = () => {
|
||||
showFilter.value = false;
|
||||
};
|
||||
@@ -556,7 +564,7 @@ $accent-color: #4A90E2;
|
||||
// 固定搜索容器
|
||||
.search-container-fixed {
|
||||
position: fixed;
|
||||
top: 180rpx; // 导航栏高度
|
||||
top: calc(var(--status-bar-height) + 44px); // 导航栏高度
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 90;
|
||||
@@ -613,7 +621,7 @@ $accent-color: #4A90E2;
|
||||
padding: 30rpx;
|
||||
gap: 20rpx;
|
||||
margin:0 30rpx;
|
||||
margin-top: 100rpx; // 为固定搜索栏留出空间 (搜索栏高度约80rpx + 边距)
|
||||
margin-top: calc(var(--status-bar-height) + 44px + 106rpx); // 为固定搜索栏留出空间 (搜索栏高度约80rpx + 边距)
|
||||
|
||||
.guideline-item {
|
||||
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
<template>
|
||||
<view class="zhinan-list-page">
|
||||
<!-- 头部导航栏 -->
|
||||
<uni-nav-bar
|
||||
<view class="navbox">
|
||||
<view class="status_bar"></view>
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
:title="title"
|
||||
@clickLeft="goBack"
|
||||
fixed
|
||||
|
||||
color="#8B2316"
|
||||
height="180rpx"
|
||||
|
||||
:border="false"
|
||||
backgroundColor="#eeeeee"
|
||||
>
|
||||
<template v-slot:right>
|
||||
<view class="nav-right" @click="goGot">
|
||||
<view class="nav-right" @click="goGot" >
|
||||
<up-image :src="hotImg" width="40rpx" height="40rpx"></up-image>
|
||||
</view>
|
||||
</template>
|
||||
</uni-nav-bar>
|
||||
</view>
|
||||
<!-- 固定搜索栏 -->
|
||||
<view class="search-container-fixed filter-bar">
|
||||
<view class="search-box" @click="goToSearch">
|
||||
@@ -48,7 +51,7 @@
|
||||
class="guideline-item"
|
||||
v-for="(item, index) in guidelinesList"
|
||||
:key="item.uuid || index"
|
||||
@click="viewGuideline(item)"
|
||||
|
||||
>
|
||||
<!-- 指南信息 -->
|
||||
<view class="item-content">
|
||||
@@ -57,8 +60,9 @@
|
||||
<view class="item-date">{{ formatDate(item.releaseTime) }}</view>
|
||||
<!-- 操作按钮 -->
|
||||
<view class="item-action">
|
||||
<view class="download-btn" @click.stop="viewGuideline(item)" v-if="!downLoadList.includes(item.uuid)">
|
||||
<up-icon name="download" color="#8D2316" size="28"></up-icon>
|
||||
<view class="download-btn" @click.stop="downLoad(item)" v-if="!downLoadtaskList.includes(item.uuid)">
|
||||
<uni-icons type="arrow-down" size="26" color="#8D2316"></uni-icons>
|
||||
<!-- <up-icon name="download" color="#8D2316" size="56rpx" ></up-icon> -->
|
||||
</view>
|
||||
<view
|
||||
v-else
|
||||
@@ -139,7 +143,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ref, onMounted,computed,nextTick} from "vue";
|
||||
import api from "@/api/api.js";
|
||||
import { onShow, onLoad } from "@dcloudio/uni-app";
|
||||
import docUrl from "@/utils/docUrl.js";
|
||||
@@ -163,6 +167,13 @@ const title = ref("");
|
||||
const sort = ref(2);
|
||||
const showInnerSort = ref(false);
|
||||
const innerSortTitle = ref("上传时间");
|
||||
import downloadStore from "@/store/downloadStoreFile.js";
|
||||
const downloadTasks=ref([]);
|
||||
const downLoadtaskList=computed(()=>{
|
||||
console.log('downLoadtaskList');
|
||||
console.log(downloadTasks.value.map((item)=>item.id));
|
||||
return downloadTasks.value.map((item)=>item.id);
|
||||
});
|
||||
const chooseInnerSort = (index) => {
|
||||
sort.value = index;
|
||||
if (index == 1) {
|
||||
@@ -197,6 +208,15 @@ const toggleInnerSort = () => {
|
||||
showInnerSort.value = !showInnerSort.value;
|
||||
};
|
||||
onShow(() => {
|
||||
console.log('onShow');
|
||||
syncTasksFromStore();
|
||||
// 监听store变化
|
||||
downloadStore.addListener((tasks) => {
|
||||
downloadTasks.value = tasks;
|
||||
|
||||
});
|
||||
// 恢复正在下载的任务
|
||||
resumeDownloadingTasks();
|
||||
// 页面显示时,如果列表为空则加载数据
|
||||
if (guidelinesList.value.length === 0) {
|
||||
loadGuidelinesList(true);
|
||||
@@ -213,6 +233,13 @@ const goToSearch = () => {
|
||||
uni.navigateTo({
|
||||
url: `/pages_app/search/search?keywords=${q}&title=${t}${type}`,
|
||||
});
|
||||
// const goSearch=()=>{
|
||||
// uni.sendNativeEvent('goHomeSearch', {
|
||||
// msg: 'goHomeSearch'
|
||||
// },ret => {
|
||||
// console.log(ret);
|
||||
// })
|
||||
// }
|
||||
};
|
||||
|
||||
// scroll-view 下拉刷新
|
||||
@@ -392,51 +419,185 @@ const downloadGuideline = (item) => {
|
||||
fail: (err) => {
|
||||
console.error("下载失败:", err);
|
||||
uni.showToast({
|
||||
title: "下载失败",
|
||||
title: "下载失败1",
|
||||
icon: "none",
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 查看指南(支持常用文档直链:pdf/doc/docx/xls/xlsx/ppt/pptx/txt)
|
||||
const viewGuideline = (item) => {
|
||||
if (!item.path) {
|
||||
const downLoad = (item) => {
|
||||
if(!item.path){
|
||||
uni.showToast({
|
||||
title: "暂无下载链接",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
const pdfUrl = docUrl + item.path;
|
||||
let url = "https://view.xdocin.com/view?src=" + encodeURIComponent(pdfUrl);
|
||||
uni.downloadFile({
|
||||
url: pdfUrl,
|
||||
success: (res) => {
|
||||
if (res.statusCode === 200) {
|
||||
let index = downLoadList.value.find((cell) => item.uuid == cell.id);
|
||||
if (!index) {
|
||||
downLoadList.value.push(item.uuid);
|
||||
uni.setStorageSync("downLoadPdf", downLoadList.value);
|
||||
}
|
||||
navTo({
|
||||
url:
|
||||
"/pages_app/webview/webview?url=" +
|
||||
encodeURIComponent(url) +
|
||||
"&title=" +
|
||||
item.title,
|
||||
});
|
||||
}
|
||||
},
|
||||
addDownloadTask({
|
||||
url: docUrl + item.path,
|
||||
title: item.title,
|
||||
id: item.uuid,
|
||||
});
|
||||
};
|
||||
// 查看指南(支持常用文档直链:pdf/doc/docx/xls/xlsx/ppt/pptx/txt)
|
||||
const viewGuideline = (cell) => {
|
||||
console.log(cell);
|
||||
if (!cell.path) {
|
||||
uni.showToast({
|
||||
title: "暂无下载链接",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
const pdfUrl = docUrl + cell.path;
|
||||
console.log(downloadTasks.value);
|
||||
downloadTasks.value.forEach(item => {
|
||||
if(item.id == cell.uuid) {
|
||||
uni.openDocument({
|
||||
filePath: item.localPath,
|
||||
success: () => console.log('打开成功'),
|
||||
fail: (err) => console.error('打开失败', err)
|
||||
});
|
||||
}
|
||||
});
|
||||
// let url = "https://view.xdocin.com/view?src=" + encodeURIComponent(pdfUrl);
|
||||
// uni.downloadFile({
|
||||
// url: pdfUrl,
|
||||
// success: (res) => {
|
||||
// if (res.statusCode === 200) {
|
||||
// uni.openDocument({
|
||||
// filePath: res.tempFilePath, // 临时文件路径
|
||||
// fileType: 'pdf',
|
||||
// success: () => console.log('打开成功'),
|
||||
// fail: (err) => console.error('打开失败', err)
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// });
|
||||
};
|
||||
|
||||
// 返回上一页
|
||||
const goBack = () => {
|
||||
uni.navigateBack();
|
||||
};
|
||||
|
||||
// 添加下载任务
|
||||
const addDownloadTask = (item) => {
|
||||
// 使用store添加任务
|
||||
const taskIndex = downloadStore.addTask(item);
|
||||
// 同步任务列表
|
||||
syncTasksFromStore();
|
||||
// 开始下载
|
||||
startDownload(taskIndex);
|
||||
};
|
||||
|
||||
// 开始下载
|
||||
const startDownload = (index) => {
|
||||
const taskItem = downloadStore.getTask(index);
|
||||
if (!taskItem) return;
|
||||
if(taskItem.status == "loading"){
|
||||
uni.showToast({
|
||||
title: "正在下载",
|
||||
icon: "none",
|
||||
});
|
||||
return false;
|
||||
};
|
||||
downloadStore.updateTask(index, {
|
||||
status: "loading"
|
||||
});
|
||||
|
||||
const task = uni.downloadFile({
|
||||
url: taskItem.url,
|
||||
success: (res1) => {
|
||||
console.log("res1:"+JSON.stringify(res1));
|
||||
if (res1.statusCode === 200) {
|
||||
downloadStore.updateTask(index, {
|
||||
status: "completed",
|
||||
filePath: res1.tempFilePath,
|
||||
});
|
||||
|
||||
uni.showToast({
|
||||
title: "下载成功",
|
||||
icon: "none",
|
||||
});
|
||||
|
||||
|
||||
uni.saveFile({
|
||||
tempFilePath: res1.tempFilePath,
|
||||
success: function (res2) {
|
||||
console.log("res2:"+JSON.stringify(res2));
|
||||
uni.getSavedFileInfo({
|
||||
filePath: res2.savedFilePath,
|
||||
success: function (res) {
|
||||
console.log("res:"+JSON.stringify(res));
|
||||
console.log("size:"+res.size);
|
||||
downloadStore.updateTask(index, {
|
||||
status: "completed",
|
||||
localPath: res2.savedFilePath,
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
} else {
|
||||
downloadStore.updateTask(index, {
|
||||
status: "failed",
|
||||
});
|
||||
removeTask(index);
|
||||
uni.showToast({
|
||||
title: "下载失败2",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
downloadStore.updateTask(index, {
|
||||
status: "failed",
|
||||
});
|
||||
removeTask(index);
|
||||
uni.showToast({
|
||||
title: "下载失败3: " + (err.errMsg || "未知错误"),
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
// 监听下载进度
|
||||
task.onProgressUpdate((update) => {
|
||||
const currentTask = downloadStore.getTask(index);
|
||||
if (currentTask && currentTask.status === "downloading") {
|
||||
downloadStore.updateTask(index, {
|
||||
progress: update.progress
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 保存task对象到store(用于暂停/继续)
|
||||
downloadStore.updateTask(index, {
|
||||
task: task,
|
||||
});
|
||||
};
|
||||
|
||||
const syncTasksFromStore = () => {
|
||||
downloadTasks.value = downloadStore.getTasks();
|
||||
};
|
||||
const removeTask = (index) => {
|
||||
downloadStore.removeTask(index);
|
||||
syncTasksFromStore();
|
||||
};
|
||||
// 恢复正在下载的任务
|
||||
const resumeDownloadingTasks = () => {
|
||||
// 使用 nextTick 确保在页面渲染后再恢复下载任务
|
||||
nextTick(() => {
|
||||
downloadStore.resumeDownloadingTasks((index) => {
|
||||
// 重新开始下载(uni.downloadFile不支持断点续传,所以从0开始)
|
||||
console.log("恢复下载任务:", downloadStore.getTask(index)?.url);
|
||||
startDownload(index);
|
||||
});
|
||||
});
|
||||
};
|
||||
// 测试加载更多功能
|
||||
const testLoadMore = () => {
|
||||
console.log("=== 手动测试加载更多 ===");
|
||||
@@ -490,7 +651,7 @@ $white: #ffffff;
|
||||
}
|
||||
.popup-panel {
|
||||
position: fixed;
|
||||
top: 256rpx; /* 紧贴筛选栏 */
|
||||
top:285rpx;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: #fff;
|
||||
@@ -544,18 +705,18 @@ $white: #ffffff;
|
||||
|
||||
.guidelines-scroll-view {
|
||||
position: fixed;
|
||||
top: 285rpx;
|
||||
top: calc(var(--status-bar-height) + 44px + 106rpx);
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 99;
|
||||
height: calc(100vh - 180rpx);
|
||||
height: calc(100vh - var(--status-bar-height) - 44px - 106rpx);
|
||||
background-color: $bg-color;
|
||||
}
|
||||
// 固定搜索容器
|
||||
.search-container-fixed {
|
||||
position: fixed;
|
||||
top: 180rpx; // 导航栏高度
|
||||
top: calc(var(--status-bar-height) + 44px); // 导航栏高度
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 90;
|
||||
@@ -658,12 +819,12 @@ $white: #ffffff;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
background-color: rgba(255, 71, 87, 0.1);
|
||||
transition: all 0.3s ease;
|
||||
// transition: all 0.3s ease;
|
||||
|
||||
&:active {
|
||||
transform: scale(0.95);
|
||||
background-color: rgba(255, 71, 87, 0.2);
|
||||
}
|
||||
// &:active {
|
||||
// transform: scale(0.95);
|
||||
// background-color: rgba(255, 71, 87, 0.2);
|
||||
// }
|
||||
}
|
||||
|
||||
.view-btn {
|
||||
|
||||
Reference in New Issue
Block a user