12.16提交
This commit is contained in:
parent
c86aa03f01
commit
8025b2abab
3
App.vue
3
App.vue
@ -240,4 +240,7 @@ page {
|
|||||||
height: calc(var(--status-bar-height) + 44px);
|
height: calc(var(--status-bar-height) + 44px);
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
|
.share-content .share-item:last-child{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -657,6 +657,9 @@ const api = {
|
|||||||
deleteComment(data){
|
deleteComment(data){
|
||||||
return request('/expertAPI/deleteComment', data, 'post', false);
|
return request('/expertAPI/deleteComment', data, 'post', false);
|
||||||
},
|
},
|
||||||
|
downloadGanDanFile(data){
|
||||||
|
return request('/expertAPI/downloadGanDanFile', data, 'post', false,'application/json',{},'arraybuffer');
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default api
|
export default api
|
||||||
@ -61,7 +61,8 @@
|
|||||||
},
|
},
|
||||||
"ios" : {
|
"ios" : {
|
||||||
"dSYMs" : false,
|
"dSYMs" : false,
|
||||||
"idfa" : false
|
"idfa" : false,
|
||||||
|
"urlschemewhitelist" : [ "weixin", "wechat" ]
|
||||||
},
|
},
|
||||||
/* ios打包配置 */
|
/* ios打包配置 */
|
||||||
"sdkConfigs" : {
|
"sdkConfigs" : {
|
||||||
|
|||||||
65
pages.json
65
pages.json
@ -334,6 +334,36 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pptDetail/pptDetail",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"navigationBarTitleText": "uni-app分页",
|
||||||
|
"app": {
|
||||||
|
"bounce": "none"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "ppt/ppt",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"navigationBarTitleText": "uni-app分页",
|
||||||
|
"app": {
|
||||||
|
"bounce": "none"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pay/pay",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"navigationBarTitleText": "uni-app分页",
|
||||||
|
"app": {
|
||||||
|
"bounce": "none"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "articleDownload/articleDownload",
|
"path": "articleDownload/articleDownload",
|
||||||
"style": {
|
"style": {
|
||||||
@ -731,16 +761,7 @@
|
|||||||
// "app": { "bounce": "none" }
|
// "app": { "bounce": "none" }
|
||||||
// }
|
// }
|
||||||
// },
|
// },
|
||||||
// {
|
|
||||||
// "path": "ppt/ppt",
|
|
||||||
// "style": {
|
|
||||||
// "navigationStyle": "custom",
|
|
||||||
// "navigationBarTitleText": "uni-app分页",
|
|
||||||
// "app": {
|
|
||||||
// "bounce": "none"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// {
|
// {
|
||||||
// "path": "pointMall/pointMall",
|
// "path": "pointMall/pointMall",
|
||||||
// "style": {
|
// "style": {
|
||||||
@ -751,16 +772,7 @@
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// },
|
// },
|
||||||
// {
|
|
||||||
// "path": "pay/pay",
|
|
||||||
// "style": {
|
|
||||||
// "navigationStyle": "custom",
|
|
||||||
// "navigationBarTitleText": "uni-app分页",
|
|
||||||
// "app": {
|
|
||||||
// "bounce": "none"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// {
|
// {
|
||||||
// "path": "buyPoint/buyPoint",
|
// "path": "buyPoint/buyPoint",
|
||||||
// "style": {
|
// "style": {
|
||||||
@ -1083,16 +1095,7 @@
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// },
|
// },
|
||||||
// {
|
|
||||||
// "path": "pptDetail/pptDetail",
|
|
||||||
// "style": {
|
|
||||||
// "navigationStyle": "custom",
|
|
||||||
// "navigationBarTitleText": "uni-app分页",
|
|
||||||
// "app": {
|
|
||||||
// "bounce": "none"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// {
|
// {
|
||||||
// "path": "patientMsg/patientMsg",
|
// "path": "patientMsg/patientMsg",
|
||||||
// "style": {
|
// "style": {
|
||||||
@ -1472,7 +1475,7 @@
|
|||||||
"list": [
|
"list": [
|
||||||
{
|
{
|
||||||
"name": "",
|
"name": "",
|
||||||
"path": "",
|
"path": "pages/index/index",
|
||||||
"query": ""
|
"query": ""
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -112,7 +112,7 @@ const innerSortTitle=ref('上传时间');
|
|||||||
import downloadStore from "@/store/downloadStoreFile.js";
|
import downloadStore from "@/store/downloadStoreFile.js";
|
||||||
const downloadTasks=ref([]);
|
const downloadTasks=ref([]);
|
||||||
const downLoadtaskList=computed(()=>{
|
const downLoadtaskList=computed(()=>{
|
||||||
return downloadTasks.value.filter((item)=>item.status == "completed").map((item)=>item.id);
|
return downloadTasks.value.filter((item)=>item.status == "completed" && item.type == "zhinan").map((item)=>item.id);
|
||||||
});
|
});
|
||||||
const chooseInnerSort=(index)=>{
|
const chooseInnerSort=(index)=>{
|
||||||
sort.value=index;
|
sort.value=index;
|
||||||
|
|||||||
@ -467,8 +467,29 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const toggleTag = (index) => {
|
const toggleTag = (index) => {
|
||||||
filterTags.value[index].selected = !filterTags.value[index].selected;
|
const currentTag = filterTags.value[index];
|
||||||
|
|
||||||
|
// 如果当前标签已选中,直接取消选中
|
||||||
|
if (currentTag.selected) {
|
||||||
|
currentTag.selected = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果当前标签未选中,检查已选中的标签数量
|
||||||
|
const selectedCount = filterTags.value.filter(tag => tag.selected).length;
|
||||||
|
|
||||||
|
// 如果已选中3个或更多,不允许再选中
|
||||||
|
if (selectedCount >= 3) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '最多只能选择3个标签',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 允许选中
|
||||||
|
currentTag.selected = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const resetFilter = () => {
|
const resetFilter = () => {
|
||||||
@ -487,13 +508,15 @@
|
|||||||
const confirmFilter = () => {
|
const confirmFilter = () => {
|
||||||
const selectedTags = filterTags.value.filter(tag => tag.selected);
|
const selectedTags = filterTags.value.filter(tag => tag.selected);
|
||||||
console.log('选中的筛选标签:', selectedTags);
|
console.log('选中的筛选标签:', selectedTags);
|
||||||
|
let words='';
|
||||||
for (var i = 0; i < selectedTags.length; i++) {
|
for (var i = 0; i < selectedTags.length; i++) {
|
||||||
if(keywords.value){
|
if(words){
|
||||||
keywords.value+=","+selectedTags[i].NAME
|
words+=","+selectedTags[i].NAME
|
||||||
}else{
|
}else{
|
||||||
keywords.value=selectedTags[i].NAME
|
words=selectedTags[i].NAME
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
keywords.value=words;
|
||||||
isFilterActive.value=true;
|
isFilterActive.value=true;
|
||||||
hideFilterPopup();
|
hideFilterPopup();
|
||||||
// 根据选中的标签重新加载数据
|
// 根据选中的标签重新加载数据
|
||||||
@ -931,7 +954,7 @@ const goSearch = () => {
|
|||||||
}
|
}
|
||||||
.bar {
|
.bar {
|
||||||
width: 2rpx;
|
width: 2rpx;
|
||||||
margin: 0 26rpx 0 6rpx;
|
margin: 0 43rpx 0 0rpx;
|
||||||
height: 32rpx;
|
height: 32rpx;
|
||||||
background-color: #666;
|
background-color: #666;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
<text class="option-desc" v-if="balance<paymentInfo.amount/100">余额不足</text>
|
<text class="option-desc" v-if="balance<paymentInfo.amount/100">余额不足</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="option-right">
|
<view class="option-right">
|
||||||
{{ selectedPayment === 'balance' }}
|
|
||||||
<radio
|
<radio
|
||||||
:checked="selectedPayment === 'balance'"
|
:checked="selectedPayment === 'balance'"
|
||||||
value="balance"
|
value="balance"
|
||||||
@ -59,7 +59,7 @@
|
|||||||
<text class="option-title">微信支付</text>
|
<text class="option-title">微信支付</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="option-right">
|
<view class="option-right">
|
||||||
{{ selectedPayment === 'balance' }}
|
|
||||||
<radio
|
<radio
|
||||||
:checked="selectedPayment === 'wechat'"
|
:checked="selectedPayment === 'wechat'"
|
||||||
value="wechat"
|
value="wechat"
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 头部导航栏 -->
|
<!-- 头部导航栏 -->
|
||||||
<uni-nav-bar
|
<view class="navbox">
|
||||||
|
<view class="status_bar"></view>
|
||||||
|
<uni-nav-bar
|
||||||
left-icon="left"
|
left-icon="left"
|
||||||
title="肝胆课件"
|
title="肝胆课件"
|
||||||
@clickLeft="goBack"
|
@clickLeft="goBack"
|
||||||
fixed
|
|
||||||
color="#8B2316"
|
color="#8B2316"
|
||||||
height="180rpx"
|
|
||||||
:border="false"
|
:border="false"
|
||||||
backgroundColor="#eeeeee"
|
backgroundColor="#eeeeee"
|
||||||
>
|
>
|
||||||
@ -15,7 +15,8 @@
|
|||||||
<text style="font-size: 24rpx; color: #8B2316;">测试加载</text>
|
<text style="font-size: 24rpx; color: #8B2316;">测试加载</text>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</uni-nav-bar>
|
</uni-nav-bar>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="courseware-container">
|
<view class="courseware-container">
|
||||||
|
|
||||||
@ -66,13 +67,13 @@
|
|||||||
<text class="view-count">{{ item.readnum }}人阅读</text>
|
<text class="view-count">{{ item.readnum }}人阅读</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="price">
|
<view class="price" v-if="item.price>=0">
|
||||||
<view class="priceImg">
|
<view class="priceImg" style="margin-top: -4rpx;">
|
||||||
<up-image :src="downLoadImg" width="32rpx" height="32rpx" ></up-image>
|
<up-image :src="downLoadImg" width="32rpx" height="32rpx" ></up-image>
|
||||||
</view>
|
</view>
|
||||||
<text class="price-value" v-if="item.price>0"><text class="money-unit">¥</text>{{ item.price>item.discount?fromatPrice(item.discount):fromatPrice(item.price) }}</text>
|
<text class="price-value" v-if="item.price>0"><text class="money-unit">¥</text>{{ item.price>item.discount?fromatPrice(item.discount):fromatPrice(item.price) }}</text>
|
||||||
<text class="yuanjia" v-if="item.price>0 && item.price>item.discount">原价<text class="jiaprice">{{fromatPrice(item.price/100)}}</text></text>
|
<text class="yuanjia" v-if="item.price>0 && item.price>item.discount">原价<text class="jiaprice">{{fromatPrice(item.price/100)}}</text></text>
|
||||||
<text v-else class="free">免费</text>
|
<text v-if="item.price==0" class="free">免费</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -143,7 +144,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
onLoad(()=>{
|
onLoad(()=>{
|
||||||
|
|
||||||
checkUser();
|
checkUser();
|
||||||
|
loadData(false);
|
||||||
})
|
})
|
||||||
|
|
||||||
// 方法
|
// 方法
|
||||||
@ -167,8 +170,11 @@
|
|||||||
const toggleSort = () => {
|
const toggleSort = () => {
|
||||||
sort.value = sort.value === 0 ? 1 : 0;
|
sort.value = sort.value === 0 ? 1 : 0;
|
||||||
console.log('切换排序:', sort.value);
|
console.log('切换排序:', sort.value);
|
||||||
|
page.value=1;
|
||||||
|
coursewareList.value = [];
|
||||||
|
noMore.value = false;
|
||||||
// 切换排序后重新加载数据
|
// 切换排序后重新加载数据
|
||||||
loadData(true);
|
loadData(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -220,9 +226,9 @@
|
|||||||
// 重置数据
|
// 重置数据
|
||||||
page.value = 1;
|
page.value = 1;
|
||||||
noMore.value = false;
|
noMore.value = false;
|
||||||
|
coursewareList.value = [];
|
||||||
// 重新加载第一页数据
|
// 重新加载第一页数据
|
||||||
await loadData(true);
|
await loadData(false);
|
||||||
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '刷新成功',
|
title: '刷新成功',
|
||||||
@ -377,6 +383,18 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const toggleTag = (index) => {
|
const toggleTag = (index) => {
|
||||||
|
// 已选中的标签数量
|
||||||
|
const selectedCount = filterTags.value.filter(tag => tag.selected).length;
|
||||||
|
|
||||||
|
// 当前是未选中 -> 试图选中,且已达到上限
|
||||||
|
if (!filterTags.value[index].selected && selectedCount >= 3) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '最多选择3个标签',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
filterTags.value[index].selected = !filterTags.value[index].selected;
|
filterTags.value[index].selected = !filterTags.value[index].selected;
|
||||||
//isFilterActive.value = filterTags.value.some(tag => tag.selected);
|
//isFilterActive.value = filterTags.value.some(tag => tag.selected);
|
||||||
};
|
};
|
||||||
@ -389,16 +407,21 @@
|
|||||||
const confirmFilter = () => {
|
const confirmFilter = () => {
|
||||||
const selectedTags = filterTags.value.filter(tag => tag.selected);
|
const selectedTags = filterTags.value.filter(tag => tag.selected);
|
||||||
console.log('选中的筛选标签:', selectedTags);
|
console.log('选中的筛选标签:', selectedTags);
|
||||||
|
let words='';
|
||||||
for (var i = 0; i < selectedTags.length; i++) {
|
for (var i = 0; i < selectedTags.length; i++) {
|
||||||
if(keywords.value){
|
if(words){
|
||||||
keywords.value+=","+selectedTags[i].NAME
|
words+=","+selectedTags[i].NAME
|
||||||
}else{
|
}else{
|
||||||
keywords.value=selectedTags[i].NAME
|
words=selectedTags[i].NAME
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
keywords.value=words;
|
||||||
isFilterActive.value =true;
|
isFilterActive.value =true;
|
||||||
hideFilterPopup();
|
hideFilterPopup();
|
||||||
loadData(true);
|
page.value=1;
|
||||||
|
coursewareList.value = [];
|
||||||
|
noMore.value = false;
|
||||||
|
loadData(false);
|
||||||
// 这里可以根据选中的标签进行数据筛选
|
// 这里可以根据选中的标签进行数据筛选
|
||||||
};
|
};
|
||||||
const fromatPrice=(price)=>{
|
const fromatPrice=(price)=>{
|
||||||
@ -411,7 +434,7 @@
|
|||||||
onShow(() => {
|
onShow(() => {
|
||||||
// 页面显示时加载数据
|
// 页面显示时加载数据
|
||||||
console.log('页面显示,开始加载课件数据');
|
console.log('页面显示,开始加载课件数据');
|
||||||
loadData(true);
|
|
||||||
loadGuideTags()
|
loadGuideTags()
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -513,14 +536,15 @@
|
|||||||
height: 100rpx;
|
height: 100rpx;
|
||||||
background-color: $white;
|
background-color: $white;
|
||||||
@include flex-center;
|
@include flex-center;
|
||||||
gap: 100rpx;
|
|
||||||
border-bottom: 1rpx solid $border-color;
|
border-bottom: 1rpx solid $border-color;
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 180rpx;
|
top: calc(var(--status-bar-height) + 44px);
|
||||||
z-index: 99;
|
z-index: 99;
|
||||||
.divider{
|
.divider{
|
||||||
width: 2rpx;
|
width: 2rpx;
|
||||||
height: 30rpx;
|
height: 30rpx;
|
||||||
|
margin:0 80rpx;
|
||||||
background-color: #999;
|
background-color: #999;
|
||||||
}
|
}
|
||||||
.filter-item{
|
.filter-item{
|
||||||
@ -539,7 +563,7 @@
|
|||||||
|
|
||||||
.courseware-list {
|
.courseware-list {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top:280rpx;
|
top:calc(var(--status-bar-height) + 44px + 100rpx);
|
||||||
flex: 1;
|
flex: 1;
|
||||||
bottom:0;
|
bottom:0;
|
||||||
left:30rpx;
|
left:30rpx;
|
||||||
@ -619,7 +643,7 @@
|
|||||||
.price {
|
.price {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-left: 30rpx;
|
margin-left: 30rpx;
|
||||||
align-items: baseline;
|
align-items: center;
|
||||||
gap: 4rpx;
|
gap: 4rpx;
|
||||||
|
|
||||||
.price-symbol {
|
.price-symbol {
|
||||||
|
|||||||
@ -1,20 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="ppt-detail-page">
|
<view class="ppt-detail-page">
|
||||||
<!-- 顶部导航栏 -->
|
<!-- 顶部导航栏 -->
|
||||||
<uni-nav-bar
|
<view class="navbox">
|
||||||
|
<view class="status_bar"></view>
|
||||||
|
<uni-nav-bar
|
||||||
left-icon="left"
|
left-icon="left"
|
||||||
title="课件详情"
|
title="课件详情"
|
||||||
@clickLeft="goBack"
|
@clickLeft="goBack"
|
||||||
fixed
|
|
||||||
color="#8B2316"
|
color="#8B2316"
|
||||||
height="180rpx"
|
|
||||||
:border="false"
|
:border="false"
|
||||||
backgroundColor="#eeeeee"
|
backgroundColor="#eeeeee"
|
||||||
>
|
>
|
||||||
<template v-slot:right>
|
<template v-slot:right>
|
||||||
<view class="nav-actions">
|
<view class="nav-actions">
|
||||||
<uni-icons type="paperplane" size="22" color="#8B2316"></uni-icons>
|
<view class="collect-img" @click="shareToggle" style="margin-right: 20rpx;">
|
||||||
<view class="collect-img" @click="toggleCollection">
|
<image class="share-img-icon" :src="shareIcon" mode="aspectFill" />
|
||||||
|
</view>
|
||||||
|
<view class="collect-img" @click="toggleCollection" style="margin-left: 20rpx;">
|
||||||
<image
|
<image
|
||||||
class="collect-img-icon"
|
class="collect-img-icon"
|
||||||
:src="isCollection==1 ? collectImg : discollectImg"
|
:src="isCollection==1 ? collectImg : discollectImg"
|
||||||
@ -24,18 +28,39 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</uni-nav-bar>
|
</uni-nav-bar>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 下载提示条 -->
|
<!-- 下载提示条 -->
|
||||||
|
|
||||||
|
|
||||||
<view
|
<view
|
||||||
class="download-bar"
|
class="download-bar"
|
||||||
@click="goView"
|
@click="goView"
|
||||||
v-if="order && order.order_status == 'paid'"
|
v-if="order && order.order_status == 'paid' && hasDownload && downLoadStatus == 'completed'"
|
||||||
>
|
>
|
||||||
<view class="download-inner">
|
<view class="download-inner">
|
||||||
<text class="download-text">查看课件</text>
|
<text class="download-text">查看课件</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="download-bar" @click="goPay" v-else>
|
<view
|
||||||
|
class="download-bar"
|
||||||
|
@click="alertDownloading"
|
||||||
|
v-else-if="order && order.order_status == 'paid' && hasDownload && downLoadStatus == 'loading'"
|
||||||
|
>
|
||||||
|
<view class="download-inner">
|
||||||
|
<text class="download-text">下载中...</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="download-bar"
|
||||||
|
@click="downloadGanDanFile"
|
||||||
|
v-else-if="order && order.order_status == 'paid' && !hasDownload"
|
||||||
|
>
|
||||||
|
<view class="download-inner">
|
||||||
|
<text class="download-text">重新下载本课件</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="download-bar" @click="goPay" v-else-if="!order && price>0">
|
||||||
<view class="download-inner">
|
<view class="download-inner">
|
||||||
<u-icon name="download" color="#fff" size="28"></u-icon>
|
<u-icon name="download" color="#fff" size="28"></u-icon>
|
||||||
<text class="download-text">本课件下载</text>
|
<text class="download-text">本课件下载</text>
|
||||||
@ -43,7 +68,21 @@
|
|||||||
<text class="download-unit">元</text>
|
<text class="download-unit">元</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <web-view :src="src"></web-view> -->
|
<view class="download-bar" v-else-if="!order && price<0">
|
||||||
|
<view class="download-inner">
|
||||||
|
<u-icon name="download" color="#fff" size="28"></u-icon>
|
||||||
|
<text class="download-text">本课件不支持下载</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="download-bar" @click="downloadGanDanFile" v-else>
|
||||||
|
<view class="download-inner">
|
||||||
|
<u-icon name="download" color="#fff" size="28"></u-icon>
|
||||||
|
<text class="download-text">本课件</text>
|
||||||
|
<text class="download-price">免费</text>
|
||||||
|
<text class="download-unit">下载</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <web-view :src="src"></web-view> -->
|
||||||
<!-- 图片浏览 -->
|
<!-- 图片浏览 -->
|
||||||
<!-- <view class="viewer">
|
<!-- <view class="viewer">
|
||||||
<swiper
|
<swiper
|
||||||
@ -60,34 +99,405 @@
|
|||||||
</swiper-item>
|
</swiper-item>
|
||||||
</swiper>
|
</swiper>
|
||||||
<view class="page-indicator">{{ currentIndex + 1 }}/{{ images.length }}</view>
|
<view class="page-indicator">{{ currentIndex + 1 }}/{{ images.length }}</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
|
<unidialog
|
||||||
|
:visible="freeVisible"
|
||||||
|
:content="freeContent"
|
||||||
|
@close="freeClose"
|
||||||
|
@confirm="freeConfirm"
|
||||||
|
></unidialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from "vue";
|
import { ref, computed, nextTick } from "vue";
|
||||||
import { onShow, onLoad } from "@dcloudio/uni-app";
|
import { onShow, onLoad, onHide, onUnload } from "@dcloudio/uni-app";
|
||||||
import api from "@/api/api";
|
import api from "@/api/api";
|
||||||
import navTo from "@/utils/navTo.js";
|
import navTo from "@/utils/navTo.js";
|
||||||
import collectImg from '@/static/icon_book_collect_sel.png';
|
import collectImg from "@/static/icon_book_collect_sel.png";
|
||||||
import discollectImg from '@/static/icon_book_collect_nor.png';
|
import discollectImg from "@/static/icon_book_collect_nor.png";
|
||||||
|
import shareIcon from "@/static/icon_share.png";
|
||||||
|
import sinaImg from "@/static/share_sina.png";
|
||||||
|
import wxImg from "@/static/share_weixin.png";
|
||||||
|
import friendImg from "@/static/share_wxc.png";
|
||||||
|
import logoImg from "@/static/weiboShare.png";
|
||||||
|
import downloadStore from "@/store/downloadStorePpt.js";
|
||||||
|
import unidialog from "@/components/dialog/dialog.vue";
|
||||||
|
const freeVisible = ref(false);
|
||||||
|
const freeContent = ref('');
|
||||||
|
const freeConfirm = () => {
|
||||||
|
freeVisible.value = false;
|
||||||
|
downloadGanDanFile();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const downloadTasks=ref([]);
|
||||||
|
const downLoadtaskList=computed(()=>{
|
||||||
|
return downloadTasks.value.filter((item)=>item.status == "completed" && item.type == "ppt").map((item)=>item.id);
|
||||||
|
});
|
||||||
const uuid = ref("");
|
const uuid = ref("");
|
||||||
const hcp_token = ref("");
|
const hcp_token = ref("");
|
||||||
const order = ref(null);
|
const order = ref(null);
|
||||||
const isCollection = ref(0);
|
const isCollection = ref(0);
|
||||||
|
const hasDownload = ref(false);
|
||||||
|
const downLoadStatus = ref('start');
|
||||||
|
const orderInfo = ref(null);
|
||||||
|
// ===== 分享相关 =====
|
||||||
|
const summary = ref("");
|
||||||
|
const shareLink = ref("");
|
||||||
|
const shareImg = ref(logoImg);
|
||||||
|
const shareTitle = ref("课件分享");
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
console.log(options);
|
console.log(options);
|
||||||
uuid.value = options.uuid;
|
uuid.value = options.uuid;
|
||||||
|
|
||||||
checkUser(options);
|
checkUser(options);
|
||||||
});
|
});
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
ganDanFileDetials();
|
hasDownload.value = false;
|
||||||
});
|
downLoadStatus.value = 'start';
|
||||||
const goView = () => {
|
syncTasksFromStore();
|
||||||
navTo({
|
// 监听store变化
|
||||||
url: "/pages_app/pptView/pptView?uuid=" + uuid.value,
|
downloadStore.addListener((tasks) => {
|
||||||
|
downloadTasks.value = tasks;
|
||||||
});
|
});
|
||||||
|
// 恢复正在下载的任务
|
||||||
|
resumeDownloadingTasks();
|
||||||
|
ganDanFileDetials();
|
||||||
|
if(downloadTasks.value.length > 0) {
|
||||||
|
for(let i = 0; i < downloadTasks.value.length; i++) {
|
||||||
|
if(downloadTasks.value[i].id == uuid.value) {
|
||||||
|
hasDownload.value = true;
|
||||||
|
if(downloadTasks.value[i].status == 'completed') {
|
||||||
|
downLoadStatus.value = 'completed';
|
||||||
|
}else if(downloadTasks.value[i].status == 'downloading') {
|
||||||
|
downLoadStatus.value = 'loading';
|
||||||
|
}else if(downloadTasks.value[i].status == 'paused') {
|
||||||
|
downLoadStatus.value = 'paused';
|
||||||
|
}else if(downloadTasks.value[i].status == 'failed') {
|
||||||
|
downLoadStatus.value = 'failed';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
// ===== 原生分享弹窗(复制自 webview.vue 并适配)=====
|
||||||
|
// 分享弹窗引用(这里只用原生弹窗,不使用 uni-popup)
|
||||||
|
const shareToggle = () => {
|
||||||
|
showNativePopup();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 原生弹窗相关
|
||||||
|
const nativeMaskView = ref(null);
|
||||||
|
const nativePopupView = ref(null);
|
||||||
|
const popupShowing = ref(false);
|
||||||
|
// 保存弹窗尺寸信息,供事件处理使用
|
||||||
|
const popupInfo = ref({
|
||||||
|
screenW: 0,
|
||||||
|
screenH: 0,
|
||||||
|
panelH: 0,
|
||||||
|
cancelH: 0,
|
||||||
|
contentTop: 0,
|
||||||
|
iconSize: 0,
|
||||||
|
textSize: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
function createNativePopup() {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (nativeMaskView.value || nativePopupView.value) return;
|
||||||
|
const screenW = plus.screen.resolutionWidth;
|
||||||
|
const screenH = plus.screen.resolutionHeight;
|
||||||
|
const panelH = uni.upx2px(520); // 面板高度(含标题+内容+取消)
|
||||||
|
const radius = uni.upx2px(20);
|
||||||
|
|
||||||
|
// 保存尺寸信息
|
||||||
|
const iconSize = 50; // 图标大小80px(与图标文件尺寸一致)
|
||||||
|
const titleH = uni.upx2px(80);
|
||||||
|
const cancelH = uni.upx2px(100);
|
||||||
|
const contentTop = uni.upx2px(90) + titleH;
|
||||||
|
const textSize = uni.upx2px(24);
|
||||||
|
|
||||||
|
popupInfo.value = {
|
||||||
|
screenW,
|
||||||
|
screenH,
|
||||||
|
panelH,
|
||||||
|
cancelH,
|
||||||
|
contentTop,
|
||||||
|
iconSize,
|
||||||
|
textSize
|
||||||
|
};
|
||||||
|
// 遮罩
|
||||||
|
nativeMaskView.value = new plus.nativeObj.View('native-share-mask', {
|
||||||
|
left: '0px',
|
||||||
|
top: '0px',
|
||||||
|
width: screenW + 'px',
|
||||||
|
height: screenH + 'px',
|
||||||
|
zindex: 99998,
|
||||||
|
touchable: true,
|
||||||
|
interceptTouchEvent: true
|
||||||
|
}, [
|
||||||
|
{ tag: 'rect', id: 'mask', position: { left: '0px', top: '0px', width: screenW + 'px', height: screenH + 'px' }, color: 'rgba(0,0,0,0.5)' }
|
||||||
|
]);
|
||||||
|
// 面板
|
||||||
|
nativePopupView.value = new plus.nativeObj.View('native-share-panel', {
|
||||||
|
left: '0px',
|
||||||
|
top: (screenH - panelH) + 'px',
|
||||||
|
width: screenW + 'px',
|
||||||
|
height: panelH + 'px',
|
||||||
|
zindex: 99999,
|
||||||
|
touchable: true,
|
||||||
|
interceptTouchEvent: true
|
||||||
|
}, []);
|
||||||
|
// 背景+圆角
|
||||||
|
nativePopupView.value.drawRect({
|
||||||
|
color: '#FFFFFF',
|
||||||
|
radius: radius,
|
||||||
|
rectStyles: {}
|
||||||
|
}, {
|
||||||
|
left: uni.upx2px(0) + 'px',
|
||||||
|
top: uni.upx2px(0) + 'px',
|
||||||
|
width: screenW + 'px',
|
||||||
|
height: panelH + 'px'
|
||||||
|
});
|
||||||
|
// 标题
|
||||||
|
nativePopupView.value.drawText('分享到', {
|
||||||
|
left: '0px',
|
||||||
|
top: uni.upx2px(20) + 'px',
|
||||||
|
width: screenW + 'px',
|
||||||
|
height: titleH + 'px'
|
||||||
|
}, {
|
||||||
|
size: uni.upx2px(32) + 'px',
|
||||||
|
color: '#333333',
|
||||||
|
align: 'center',
|
||||||
|
verticalAlign: 'middle',
|
||||||
|
weight: '500'
|
||||||
|
});
|
||||||
|
const items = [
|
||||||
|
{ id: 'it-wechat', text: '微信' },
|
||||||
|
{ id: 'it-moments', text: '朋友圈' },
|
||||||
|
// { id: 'it-weibo', text: '微博' }
|
||||||
|
];
|
||||||
|
// 三个分享项区域(使用图标)
|
||||||
|
const itemW = screenW / items.length;
|
||||||
|
const iconTop = contentTop;
|
||||||
|
const textTop = iconTop + iconSize + uni.upx2px(16);
|
||||||
|
|
||||||
|
// 图标文件名映射(直接使用文件名,避免路径转换问题)
|
||||||
|
const iconFiles = [
|
||||||
|
'share_weixin.png', // 微信
|
||||||
|
'share_wxc.png', // 朋友圈
|
||||||
|
'share_sina.png' // 微博
|
||||||
|
];
|
||||||
|
|
||||||
|
items.forEach((it, idx) => {
|
||||||
|
const left = idx * itemW;
|
||||||
|
// 计算图标居中位置(确保是整数像素)
|
||||||
|
const iconLeft = Math.round(left + (itemW - iconSize) / 2);
|
||||||
|
const iconLeftPx = iconLeft;
|
||||||
|
// 确保所有图标使用相同的 top 值,保证在一行
|
||||||
|
const iconTopPx = Math.round(iconTop);
|
||||||
|
const iconSizePx = iconSize;
|
||||||
|
|
||||||
|
// 构建图标本地路径
|
||||||
|
let iconPath = null;
|
||||||
|
try {
|
||||||
|
const iconFile = iconFiles[idx];
|
||||||
|
// 使用 _www 相对路径,避免 iOS 下 file:// 路径导致图片不显示
|
||||||
|
iconPath = '_www/static/' + iconFile;
|
||||||
|
} catch (e) {
|
||||||
|
iconPath = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 绘制图标
|
||||||
|
if (iconPath) {
|
||||||
|
try {
|
||||||
|
try {
|
||||||
|
nativePopupView.value.drawBitmap(iconPath, {}, {
|
||||||
|
left: iconLeftPx + 'px',
|
||||||
|
top: iconTopPx + 'px',
|
||||||
|
width: iconSizePx + 'px',
|
||||||
|
height: iconSizePx + 'px'
|
||||||
|
});
|
||||||
|
} catch (e1) {
|
||||||
|
nativePopupView.value.drawBitmap(iconPath, {
|
||||||
|
left: iconLeftPx + 'px',
|
||||||
|
top: iconTopPx + 'px',
|
||||||
|
width: iconSizePx + 'px',
|
||||||
|
height: iconSizePx + 'px'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
const bgColor = idx === 2 ? '#E6162D' : '#07C160';
|
||||||
|
nativePopupView.value.drawRect({
|
||||||
|
color: bgColor,
|
||||||
|
radius: Math.round(iconSize / 2)
|
||||||
|
}, {
|
||||||
|
left: Math.round(iconLeft) + 'px',
|
||||||
|
top: Math.round(iconTop) + 'px',
|
||||||
|
width: Math.round(iconSize) + 'px',
|
||||||
|
height: Math.round(iconSize) + 'px'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const bgColor = idx === 2 ? '#E6162D' : '#07C160';
|
||||||
|
nativePopupView.value.drawRect({
|
||||||
|
color: bgColor,
|
||||||
|
radius: Math.round(iconSize / 2)
|
||||||
|
}, {
|
||||||
|
left: Math.round(iconLeft) + 'px',
|
||||||
|
top: Math.round(iconTop) + 'px',
|
||||||
|
width: Math.round(iconSize) + 'px',
|
||||||
|
height: Math.round(iconSize) + 'px'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 绘制文字
|
||||||
|
nativePopupView.value.drawText(it.text, {
|
||||||
|
left: left + 'px',
|
||||||
|
top: textTop + 'px',
|
||||||
|
width: itemW + 'px',
|
||||||
|
height: textSize + uni.upx2px(20) + 'px'
|
||||||
|
}, {
|
||||||
|
size: textSize + 'px',
|
||||||
|
color: '#666666',
|
||||||
|
align: 'center',
|
||||||
|
verticalAlign: 'top'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
// 取消按钮分割线
|
||||||
|
const cancelTop = panelH - cancelH;
|
||||||
|
nativePopupView.value.drawRect({ color: '#F0F0F0' }, {
|
||||||
|
left: '0px',
|
||||||
|
top: (cancelTop - 1) + 'px',
|
||||||
|
width: screenW + 'px',
|
||||||
|
height: '1px'
|
||||||
|
});
|
||||||
|
nativePopupView.value.drawText('取消', {
|
||||||
|
left: '0px',
|
||||||
|
top: cancelTop + 'px',
|
||||||
|
width: screenW + 'px',
|
||||||
|
height: cancelH + 'px'
|
||||||
|
}, {
|
||||||
|
size: uni.upx2px(32) + 'px',
|
||||||
|
color: '#333333',
|
||||||
|
align: 'center',
|
||||||
|
verticalAlign: 'middle'
|
||||||
|
});
|
||||||
|
// 事件处理函数
|
||||||
|
const handleMaskClick = () => {
|
||||||
|
closeNativePopup();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlePanelClick = (e) => {
|
||||||
|
const info = popupInfo.value;
|
||||||
|
|
||||||
|
// 获取点击坐标
|
||||||
|
let x = 0;
|
||||||
|
let y = 0;
|
||||||
|
|
||||||
|
if (e.clientX !== undefined && e.clientY !== undefined) {
|
||||||
|
x = e.clientX;
|
||||||
|
y = e.clientY;
|
||||||
|
} else if (e.pageX !== undefined && e.pageY !== undefined) {
|
||||||
|
x = e.pageX;
|
||||||
|
y = e.pageY;
|
||||||
|
} else if (e.touches && e.touches.length > 0) {
|
||||||
|
x = e.touches[0].clientX || e.touches[0].pageX || 0;
|
||||||
|
y = e.touches[0].clientY || e.touches[0].pageY || 0;
|
||||||
|
} else if (e.changedTouches && e.changedTouches.length > 0) {
|
||||||
|
x = e.changedTouches[0].clientX || e.changedTouches[0].pageX || 0;
|
||||||
|
y = e.changedTouches[0].clientY || e.changedTouches[0].pageY || 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!x || !y) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 相对坐标换算
|
||||||
|
let relativeY = y;
|
||||||
|
let relativeX = x;
|
||||||
|
|
||||||
|
if (y < info.panelH) {
|
||||||
|
relativeY = y;
|
||||||
|
relativeX = x;
|
||||||
|
} else if (y >= (info.screenH - info.panelH)) {
|
||||||
|
relativeY = y - (info.screenH - info.panelH);
|
||||||
|
relativeX = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消区域
|
||||||
|
const cancelTop = info.panelH - info.cancelH;
|
||||||
|
if (relativeY >= cancelTop) {
|
||||||
|
closeNativePopup();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分享区域
|
||||||
|
const shareAreaTop = info.contentTop;
|
||||||
|
const shareAreaBottom = shareAreaTop + info.iconSize + info.textSize + uni.upx2px(20);
|
||||||
|
|
||||||
|
if (relativeY >= shareAreaTop && relativeY <= shareAreaBottom) {
|
||||||
|
const itemWidth = info.screenW / 2; // 目前只有两个:微信、朋友圈
|
||||||
|
const idx = Math.min(1, Math.max(0, Math.floor(relativeX / itemWidth)));
|
||||||
|
|
||||||
|
if (idx === 0) {
|
||||||
|
shareToWechat();
|
||||||
|
closeNativePopup();
|
||||||
|
} else if (idx === 1) {
|
||||||
|
shareToMoments();
|
||||||
|
closeNativePopup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 同时监听 click 和 touchstart 事件
|
||||||
|
nativeMaskView.value.addEventListener('click', handleMaskClick, false);
|
||||||
|
nativeMaskView.value.addEventListener('touchstart', handleMaskClick, false);
|
||||||
|
|
||||||
|
nativePopupView.value.addEventListener('click', handlePanelClick, false);
|
||||||
|
nativePopupView.value.addEventListener('touchstart', handlePanelClick, false);
|
||||||
|
nativePopupView.value.addEventListener('touchend', handlePanelClick, false);
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
function showNativePopup() {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (popupShowing.value) return;
|
||||||
|
if (!nativeMaskView.value || !nativePopupView.value) {
|
||||||
|
createNativePopup();
|
||||||
|
}
|
||||||
|
nativeMaskView.value && nativeMaskView.value.show();
|
||||||
|
nativePopupView.value && nativePopupView.value.show();
|
||||||
|
popupShowing.value = true;
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeNativePopup() {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (!popupShowing.value) return;
|
||||||
|
nativeMaskView.value && nativeMaskView.value.hide();
|
||||||
|
nativePopupView.value && nativePopupView.value.hide();
|
||||||
|
popupShowing.value = false;
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// 统一关闭方法,方便后面扩展 H5 等
|
||||||
|
const closeShare = () => {
|
||||||
|
closeNativePopup();
|
||||||
|
};
|
||||||
|
const goView = () => {
|
||||||
|
for(let i = 0; i < downloadTasks.value.length; i++) {
|
||||||
|
if(downloadTasks.value[i].id == uuid.value) {
|
||||||
|
plus.runtime.openFile(downloadTasks.value[i].localPath, function(e) {
|
||||||
|
console.log('打开成功');
|
||||||
|
}, function(e) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '打开失败:' + e.message,
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const collection = () => {
|
const collection = () => {
|
||||||
@ -102,6 +512,7 @@ const collection = () => {
|
|||||||
title: "收藏成功",
|
title: "收藏成功",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
|
ganDanFileDetials();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -113,8 +524,7 @@ const toggleCollection = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const discollection = () => {
|
const discollection = () => {
|
||||||
api
|
api.discollection({
|
||||||
.discollection({
|
|
||||||
other_uuid: uuid.value,
|
other_uuid: uuid.value,
|
||||||
type: 6,
|
type: 6,
|
||||||
})
|
})
|
||||||
@ -125,6 +535,7 @@ const discollection = () => {
|
|||||||
title: "取消收藏成功",
|
title: "取消收藏成功",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
|
ganDanFileDetials();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -132,48 +543,276 @@ const checkUser = async (options) => {
|
|||||||
const res = await api.checkUser();
|
const res = await api.checkUser();
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
hcp_token.value = res.data.hcp_token;
|
hcp_token.value = res.data.hcp_token;
|
||||||
|
const resInfo = uni.getSystemInfoSync(); // 或者使用 uni.getSystemInfo({...}).then(res => {...})
|
||||||
|
let statusBarHeight = resInfo.statusBarHeight;
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
let wv = plus.webview.create("", "custom-webview", {
|
let wv = plus.webview.create("", "custom-webview", {
|
||||||
top: "180rpx",
|
top:(statusBarHeight+44+50)+"px",
|
||||||
});
|
});
|
||||||
wv.loadURL(decodeURIComponent(options.src));
|
shareLink.value = decodeURIComponent(options.src);
|
||||||
|
|
||||||
let newstr = `document.cookie="hcp_token=${hcp_token.value};domain=.igandan.com;path=/;"`;
|
let newstr = `document.cookie="hcp_token=${hcp_token.value};domain=.igandan.com;path=/;"`;
|
||||||
/* 获取屏幕信息 */
|
/* 获取屏幕信息 */
|
||||||
let pages = getCurrentPages();
|
let pages = getCurrentPages();
|
||||||
let page = pages[pages.length - 1];
|
let page = pages[pages.length - 1];
|
||||||
|
|
||||||
var currentWebview = page.$getAppWebview(); //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效
|
var currentWebview = page.$getAppWebview(); //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效
|
||||||
currentWebview.append(wv);
|
currentWebview.append(wv);
|
||||||
|
wv.loadURL(decodeURIComponent(options.src))
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
wv = currentWebview.children()[0];
|
wv = currentWebview.children()[0];
|
||||||
wv.setStyle({ top: 200, height: 1000 });
|
wv.setStyle({ top:(statusBarHeight+44+50)+"px", height: 1000 });
|
||||||
}, 1000); //如果是页面初始化调用时,需要延时一下
|
},1000); //如果是页面初始化调用时,需要延时一下
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
wv.onloaded = (e) => {
|
wv.onloaded = (e) => {
|
||||||
console.log(newstr);
|
|
||||||
wv.evalJS(newstr);
|
wv.evalJS(newstr);
|
||||||
wv.evalJS(
|
wv.evalJS(
|
||||||
`document.cookie="hcp_from=expert_app;domain=.igandan.com;path=/"`
|
`document.cookie="hcp_from=expert_app;domain=.igandan.com;path=/"`
|
||||||
);
|
);
|
||||||
wv.show();
|
wv.show();
|
||||||
|
setTimeout(function () {
|
||||||
|
if(wv.getURL().indexOf('hcp') > -1){
|
||||||
|
wv.loadURL(decodeURIComponent(options.src));
|
||||||
|
}
|
||||||
|
},2000);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const freeClose = () => {
|
||||||
|
freeVisible.value = false;
|
||||||
|
goPay();
|
||||||
|
};
|
||||||
const goPay = () => {
|
const goPay = () => {
|
||||||
navTo({
|
navTo({
|
||||||
url: "/pages_app/pay/pay?uuid=" + uuid.value + "&type=ganDanFile",
|
url: "/pages_app/pay/pay?uuid=" + uuid.value + "&type=ganDanFile",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const downLoadByType=()=>{
|
||||||
|
if(orderInfo.value.price==0){
|
||||||
|
downloadGanDanFile();
|
||||||
|
}else if(orderInfo.value.price>0){
|
||||||
|
if(orderInfo.value.welfareNum>0){
|
||||||
|
freeVisible.value = true;
|
||||||
|
freeContent.value = '您还有'+orderInfo.value.welfareNum+'次免费下载机会,希望本次下载免费吗?';
|
||||||
|
}else if(orderInfo.value.freeRecord>0){
|
||||||
|
freeVisible.value = true;
|
||||||
|
freeContent.value = '您还有'+orderInfo.value.freeRecord+'次免费下载机会,希望本次下载免费吗?';
|
||||||
|
}else if(orderInfo.value.order && orderInfo.value.order.order_status == 'paid'){
|
||||||
|
downloadGanDanFile()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const downloadGanDanFile = () => {
|
||||||
|
let order_id='';
|
||||||
|
if(orderInfo.value.price==0){
|
||||||
|
order_id='Free';
|
||||||
|
}else if(orderInfo.value.price>0){
|
||||||
|
if(orderInfo.value.welfareNum>0){
|
||||||
|
order_id='USEWELFARENUM';
|
||||||
|
}else if(orderInfo.value.freeRecord>0){
|
||||||
|
order_id='FREERECORD';
|
||||||
|
}else if(orderInfo.value.order && orderInfo.value.order.order_status == 'paid'){
|
||||||
|
order_id=uuid.value+"&R";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if(downLoadStatus.value == 'loading'){
|
||||||
|
uni.showToast({
|
||||||
|
title: "正在下载中",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 使用store添加任务
|
||||||
|
const taskIndex = downloadStore.addTask({
|
||||||
|
title: orderInfo.value.name,
|
||||||
|
id: uuid.value,
|
||||||
|
type: 'ppt',
|
||||||
|
status: 'downloading',
|
||||||
|
});
|
||||||
|
hasDownload.value = true;
|
||||||
|
downLoadStatus.value = 'loading';
|
||||||
|
// 同步任务列表
|
||||||
|
syncTasksFromStore();
|
||||||
|
// 开始下载
|
||||||
|
// startDownload(taskIndex);
|
||||||
|
api.downloadGanDanFile({
|
||||||
|
file_uuid: uuid.value,
|
||||||
|
order_id: order_id,
|
||||||
|
}).then((res) => {
|
||||||
|
|
||||||
|
console.log(res);
|
||||||
|
const base64 = uni.arrayBufferToBase64(res);
|
||||||
|
base64ToFile(base64, orderInfo.value.name+'.pdf', (path) => {
|
||||||
|
downLoadStatus.value = 'completed';
|
||||||
|
uni.showToast({
|
||||||
|
title: "下载成功",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
downloadStore.updateTask(taskIndex, {
|
||||||
|
status: "completed",
|
||||||
|
localPath: path,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const base64ToFile=(base64Str, fileName, callback)=>{
|
||||||
|
// #ifdef H5
|
||||||
|
// 去除base64前缀
|
||||||
|
var index = base64Str.indexOf(',');
|
||||||
|
base64Str = base64Str.slice(index + 1, base64Str.length);
|
||||||
|
|
||||||
|
// 创建Blob对象
|
||||||
|
var blob = dataURItoBlob(base64Str);
|
||||||
|
|
||||||
|
// 创建一个新的Blob URL
|
||||||
|
var blobUrl = window.URL.createObjectURL(blob);
|
||||||
|
|
||||||
|
// 创建一个新的a标签用于下载
|
||||||
|
var a = document.createElement('a');
|
||||||
|
a.href = blobUrl;
|
||||||
|
a.download = fileName;
|
||||||
|
document.body.appendChild(a);
|
||||||
|
|
||||||
|
// 模拟点击a标签触发下载
|
||||||
|
a.click();
|
||||||
|
|
||||||
|
// 移除a标签和Blob URL
|
||||||
|
document.body.removeChild(a);
|
||||||
|
window.URL.revokeObjectURL(blobUrl);
|
||||||
|
|
||||||
|
// 回调
|
||||||
|
callback && callback(blobUrl);
|
||||||
|
|
||||||
|
// 将base64字符串转换为Blob对象
|
||||||
|
function dataURItoBlob(dataURI) {
|
||||||
|
var byteString = atob(dataURI);
|
||||||
|
var arrayBuffer = new ArrayBuffer(byteString.length);
|
||||||
|
var uint8Array = new Uint8Array(arrayBuffer);
|
||||||
|
for (var i = 0; i < byteString.length; i++) {
|
||||||
|
uint8Array[i] = byteString.charCodeAt(i);
|
||||||
|
}
|
||||||
|
return new Blob([uint8Array], {
|
||||||
|
type: 'application/octet-stream'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
// 去除base64前缀
|
||||||
|
var index = base64Str.indexOf(',')
|
||||||
|
var base64Str = base64Str.slice(index + 1, base64Str.length)
|
||||||
|
|
||||||
|
plus.io.requestFileSystem(plus.io.PRIVATE_DOC, function(fs) {
|
||||||
|
fs.root.getFile(fileName, {
|
||||||
|
create: true
|
||||||
|
}, function(entry) {
|
||||||
|
// 获得本地路径URL,file:///xxx/doc/1663062980631.xlsx
|
||||||
|
var fullPath = entry.fullPath;
|
||||||
|
let platform = uni.getSystemInfoSync().platform;
|
||||||
|
if (platform == 'android') {
|
||||||
|
var FileOutputStream = plus.android.importClass("java.io.FileOutputStream");
|
||||||
|
try {
|
||||||
|
function base64ToByteArray(base64Str) {
|
||||||
|
const binaryString = atob(base64Str);
|
||||||
|
const uint8Array = new Uint8Array(binaryString.length);
|
||||||
|
|
||||||
|
for (let i = 0; i < binaryString.length; i++) {
|
||||||
|
uint8Array[i] = binaryString.charCodeAt(i);
|
||||||
|
}
|
||||||
|
let arr = []
|
||||||
|
Array.from(uint8Array).map(num => {
|
||||||
|
arr.push(num >= 128 ? (num - 256) : num)
|
||||||
|
})
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
var out = new FileOutputStream(fullPath);
|
||||||
|
let bytes = base64ToByteArray(base64Str);
|
||||||
|
if (bytes == null || bytes.length == 0) {
|
||||||
|
out.close();
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.showModal({
|
||||||
|
title: "生成失败",
|
||||||
|
content: "nativeJS限制参数长度无法获取文件!",
|
||||||
|
showCancel: false
|
||||||
|
})
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
out.write(bytes);
|
||||||
|
out.close();
|
||||||
|
// 回调
|
||||||
|
callback && callback(entry.toLocalURL());
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e.message);
|
||||||
|
}
|
||||||
|
} else if (platform == 'ios') {
|
||||||
|
var NSData = plus.ios.importClass('NSData');
|
||||||
|
var nsData = new NSData();
|
||||||
|
nsData = nsData.initWithBase64EncodedStringoptions(base64Str, 0);
|
||||||
|
if (nsData) {
|
||||||
|
nsData.plusCallMethod({
|
||||||
|
writeToFile: fullPath,
|
||||||
|
atomically: true
|
||||||
|
});
|
||||||
|
plus.ios.deleteObject(nsData);
|
||||||
|
}
|
||||||
|
// 回调
|
||||||
|
callback && callback(entry.toLocalURL());
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const ganDanFileDetials = async () => {
|
const ganDanFileDetials = async () => {
|
||||||
const res = await api.ganDanFileDetials({
|
const res = await api.ganDanFileDetials({
|
||||||
file_uuid: uuid.value,
|
file_uuid: uuid.value,
|
||||||
});
|
});
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {res.data
|
||||||
isCollection.value = res.data.iscollection;
|
orderInfo.value = res.data;
|
||||||
|
// 设置分享文案
|
||||||
|
shareTitle.value = res.data.name || "课件分享";
|
||||||
|
summary.value = "分享一份来自“肝胆相照”的课件:" + shareTitle.value;
|
||||||
|
// H5 或其他平台可以用统一分享链接
|
||||||
|
shareLink.value = "https://www.igandan.com";
|
||||||
|
// 分享图片:接口若返回封面图可替换此处
|
||||||
|
if (res.data.cover) {
|
||||||
|
shareImg.value = res.data.cover;
|
||||||
|
}
|
||||||
|
isCollection.value = res.data.iscollection;
|
||||||
order.value = res.data.order;
|
order.value = res.data.order;
|
||||||
let money = (res.data.price - res.data.welfareNum) / 100;
|
let money = res.data.price/ 100;
|
||||||
price.value = money > 1 ? money.toFixed(1) : money.toFixed(2);
|
price.value = money > 1 ? money.toFixed(1) : money.toFixed(2);
|
||||||
|
|
||||||
|
downloadTasks.value.forEach(item => {
|
||||||
|
if (item.id == uuid.value) {
|
||||||
|
uni.getSavedFileInfo({
|
||||||
|
filePath: item.localPath, //仅做示例用,非真正的文件路径
|
||||||
|
success: function (res) {
|
||||||
|
hasDownload.value = true;
|
||||||
|
downLoadStatus.value = 'completed';
|
||||||
|
},
|
||||||
|
fail: function (err) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -199,9 +838,156 @@ const goBack = () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const alertDownloading = () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: "文件正在下载中...",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const syncTasksFromStore = () => {
|
||||||
|
downloadTasks.value = downloadStore.getTasks();
|
||||||
|
};
|
||||||
|
// 恢复正在下载的任务
|
||||||
|
const resumeDownloadingTasks = () => {
|
||||||
|
// 使用 nextTick 确保在页面渲染后再恢复下载任务
|
||||||
|
nextTick(() => {
|
||||||
|
downloadStore.resumeDownloadingTasks((index) => {
|
||||||
|
// 重新开始下载(uni.downloadFile不支持断点续传,所以从0开始)
|
||||||
|
console.log("恢复下载任务:", downloadStore.getTask(index)?.url);
|
||||||
|
startDownload(index);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===== 分享到微信 =====
|
||||||
|
const shareToWechat = () => {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
uni.share({
|
||||||
|
provider: "weixin",
|
||||||
|
scene: "WXSceneSession",
|
||||||
|
type: 0,
|
||||||
|
title: shareTitle.value,
|
||||||
|
summary: summary.value,
|
||||||
|
href: shareLink.value,
|
||||||
|
imageUrl: shareImg.value,
|
||||||
|
success: function (res) {
|
||||||
|
console.log("success:" + JSON.stringify(res));
|
||||||
|
},
|
||||||
|
fail: function (err) {
|
||||||
|
console.log("fail:" + JSON.stringify(err));
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef H5
|
||||||
|
if (navigator.share) {
|
||||||
|
navigator
|
||||||
|
.share({
|
||||||
|
title: shareTitle.value,
|
||||||
|
text: summary.value,
|
||||||
|
url: shareLink.value,
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: "分享成功",
|
||||||
|
icon: "success",
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: "分享失败",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
uni.setClipboardData({
|
||||||
|
data: summary.value + "\n链接:" + shareLink.value,
|
||||||
|
success: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: "已复制到剪贴板",
|
||||||
|
icon: "success",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
closeShare();
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===== 分享到朋友圈 =====
|
||||||
|
const shareToMoments = () => {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
uni.share({
|
||||||
|
provider: "weixin",
|
||||||
|
scene: "WXSceneTimeline",
|
||||||
|
type: 0,
|
||||||
|
title: shareTitle.value,
|
||||||
|
summary: summary.value,
|
||||||
|
href: shareLink.value,
|
||||||
|
imageUrl: shareImg.value,
|
||||||
|
success: function (res) {
|
||||||
|
console.log("success:" + JSON.stringify(res));
|
||||||
|
},
|
||||||
|
fail: function (err) {
|
||||||
|
console.log("fail:" + JSON.stringify(err));
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef H5
|
||||||
|
uni.setClipboardData({
|
||||||
|
data: summary.value + "\n链接:" + shareLink.value,
|
||||||
|
success: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: "已复制到剪贴板,可分享到朋友圈",
|
||||||
|
icon: "success",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
closeShare();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 页面隐藏/卸载时清理原生弹窗
|
||||||
|
onHide(() => {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
closeNativePopup();
|
||||||
|
// #endif
|
||||||
|
});
|
||||||
|
onUnload(() => {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
try{
|
||||||
|
nativeMaskView.value && nativeMaskView.value.close && nativeMaskView.value.close();
|
||||||
|
nativePopupView.value && nativePopupView.value.close && nativePopupView.value.close();
|
||||||
|
}catch(e){}
|
||||||
|
nativeMaskView.value = null;
|
||||||
|
nativePopupView.value = null;
|
||||||
|
popupShowing.value = false;
|
||||||
|
// #endif
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.navbox {
|
||||||
|
:deep(.uni-navbar__header-btns-right) {
|
||||||
|
width: 100px !important;
|
||||||
|
}
|
||||||
|
:deep(.uni-navbar__header-btns-left) {
|
||||||
|
min-width: 100px;
|
||||||
|
width: 100px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.share-img-icon {
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
}
|
||||||
|
.collect-img-icon {
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
}
|
||||||
.ppt-detail-page {
|
.ppt-detail-page {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
@ -217,7 +1003,7 @@ const goBack = () => {
|
|||||||
|
|
||||||
.download-bar {
|
.download-bar {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top:220rpx;
|
top:calc(var(--status-bar-height) + 44px);
|
||||||
z-index: 89;
|
z-index: 89;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: #6f6f6f; // 接近截图灰条
|
background-color: #6f6f6f; // 接近截图灰条
|
||||||
|
|||||||
@ -42,11 +42,12 @@
|
|||||||
></uni-load-more>
|
></uni-load-more>
|
||||||
|
|
||||||
<!-- 空状态 -->
|
<!-- 空状态 -->
|
||||||
<view class="empty-state" v-if="meetingList.length === 0 && !loading">
|
<empty v-if="meetingList.length === 0 && !loading"></empty>
|
||||||
|
<!-- <view class="empty-state" v-if="meetingList.length === 0 && !loading">
|
||||||
<view class="empty-content">
|
<view class="empty-content">
|
||||||
<text class="empty-text">暂无数据</text>
|
<text class="empty-text">暂无数据</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -57,6 +58,7 @@
|
|||||||
import navBar from '@/components/navBar/navBar.vue';
|
import navBar from '@/components/navBar/navBar.vue';
|
||||||
import api from '@/api/api.js';
|
import api from '@/api/api.js';
|
||||||
import navTo from '@/utils/navTo';
|
import navTo from '@/utils/navTo';
|
||||||
|
import empty from "@/components/empty/empty.vue";
|
||||||
// 会议列表数据
|
// 会议列表数据
|
||||||
const typeUuid=ref('');
|
const typeUuid=ref('');
|
||||||
const typeName=ref('');
|
const typeName=ref('');
|
||||||
|
|||||||
@ -214,10 +214,11 @@
|
|||||||
></uni-load-more>
|
></uni-load-more>
|
||||||
|
|
||||||
<!-- Empty State -->
|
<!-- Empty State -->
|
||||||
<view class="empty-state" v-if="videoList.length === 0 && !loading">
|
<empty v-if="videoList.length === 0 && !loading"></empty>
|
||||||
|
<!-- <view class="empty-state" v-if="videoList.length === 0 && !loading">
|
||||||
<image src="/static/empty-video.png" mode="aspectFit"></image>
|
<image src="/static/empty-video.png" mode="aspectFit"></image>
|
||||||
<text>暂无视频内容</text>
|
<text>暂无视频内容</text>
|
||||||
</view>
|
</view> -->
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<view class="btnbox" @click="goPatientVideo">
|
<view class="btnbox" @click="goPatientVideo">
|
||||||
<up-image :src="videoImg" width="44rpx" height="44rpx"></up-image>
|
<up-image :src="videoImg" width="44rpx" height="44rpx"></up-image>
|
||||||
@ -317,6 +318,7 @@ import meetImg from "@/static/videoIcon.png";
|
|||||||
import formatNumber from "@/utils/formatNumber.js";
|
import formatNumber from "@/utils/formatNumber.js";
|
||||||
import navBar from "@/components/navBar/navBar.vue";
|
import navBar from "@/components/navBar/navBar.vue";
|
||||||
const isAllActive = ref(false);
|
const isAllActive = ref(false);
|
||||||
|
import empty from "@/components/empty/empty.vue";
|
||||||
// 响应式数据
|
// 响应式数据
|
||||||
const videoList = ref([]);
|
const videoList = ref([]);
|
||||||
const bannerVideo = ref(null);
|
const bannerVideo = ref(null);
|
||||||
@ -810,7 +812,21 @@ const hideFilterPopup = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const toggleTag = (index) => {
|
const toggleTag = (index) => {
|
||||||
filterTags.value[index].selected = !filterTags.value[index].selected;
|
const currentTag = filterTags.value[index];
|
||||||
|
const selectedCount = filterTags.value.filter((tag) => tag.selected).length;
|
||||||
|
|
||||||
|
// 如果当前标签未选中,且已选中数量达到3个,则不允许再选中
|
||||||
|
if (!currentTag.selected && selectedCount >= 3) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "最多只能选择3个标签",
|
||||||
|
icon: "none",
|
||||||
|
duration: 2000,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 切换标签选中状态
|
||||||
|
currentTag.selected = !currentTag.selected;
|
||||||
isFilterActive.value = filterTags.value.some((tag) => tag.selected);
|
isFilterActive.value = filterTags.value.some((tag) => tag.selected);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -938,6 +954,9 @@ $padding-small: 10px;
|
|||||||
display: flex;
|
display: flex;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
:deep(.emptybox){
|
||||||
|
height:500rpx!important;
|
||||||
|
}
|
||||||
.btnbox {
|
.btnbox {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
|||||||
@ -310,8 +310,13 @@ function createNativePopup() {
|
|||||||
verticalAlign: 'middle',
|
verticalAlign: 'middle',
|
||||||
weight: '500'
|
weight: '500'
|
||||||
});
|
});
|
||||||
|
const items = [
|
||||||
|
{ id: 'it-wechat', text: '微信' },
|
||||||
|
{ id: 'it-moments', text: '朋友圈' },
|
||||||
|
// { id: 'it-weibo', text: '微博' }
|
||||||
|
];
|
||||||
// 三个分享项区域(使用图标)
|
// 三个分享项区域(使用图标)
|
||||||
const itemW = screenW / 3;
|
const itemW = screenW / items.length;
|
||||||
const iconTop = contentTop;
|
const iconTop = contentTop;
|
||||||
const textTop = iconTop + iconSize + uni.upx2px(16);
|
const textTop = iconTop + iconSize + uni.upx2px(16);
|
||||||
|
|
||||||
@ -330,11 +335,7 @@ function createNativePopup() {
|
|||||||
'share_sina.png' // 微博
|
'share_sina.png' // 微博
|
||||||
];
|
];
|
||||||
|
|
||||||
const items = [
|
|
||||||
{ id: 'it-wechat', text: '微信' },
|
|
||||||
{ id: 'it-moments', text: '朋友圈' },
|
|
||||||
{ id: 'it-weibo', text: '微博' }
|
|
||||||
];
|
|
||||||
|
|
||||||
items.forEach((it, idx) => {
|
items.forEach((it, idx) => {
|
||||||
const left = idx * itemW;
|
const left = idx * itemW;
|
||||||
@ -527,7 +528,7 @@ function createNativePopup() {
|
|||||||
|
|
||||||
if (relativeY >= shareAreaTop && relativeY <= shareAreaBottom) {
|
if (relativeY >= shareAreaTop && relativeY <= shareAreaBottom) {
|
||||||
// 计算点击的是第几个分享项(0:微信, 1:朋友圈, 2:微博)
|
// 计算点击的是第几个分享项(0:微信, 1:朋友圈, 2:微博)
|
||||||
const itemWidth = info.screenW / 3;
|
const itemWidth = info.screenW / items.length;
|
||||||
const idx = Math.min(2, Math.max(0, Math.floor(relativeX / itemWidth)));
|
const idx = Math.min(2, Math.max(0, Math.floor(relativeX / itemWidth)));
|
||||||
|
|
||||||
console.log('点击了分享项:', idx, ', x =', relativeX, ', itemWidth =', itemWidth);
|
console.log('点击了分享项:', idx, ', x =', relativeX, ', itemWidth =', itemWidth);
|
||||||
@ -542,8 +543,8 @@ function createNativePopup() {
|
|||||||
closeNativePopup();
|
closeNativePopup();
|
||||||
} else if (idx === 2) {
|
} else if (idx === 2) {
|
||||||
console.log('执行微博分享');
|
console.log('执行微博分享');
|
||||||
shareToWeibo();
|
// shareToWeibo();
|
||||||
closeNativePopup();
|
// closeNativePopup();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log('点击位置不在分享区域内, relativeY =', relativeY, ', 需要范围:', shareAreaTop, '到', shareAreaBottom);
|
console.log('点击位置不在分享区域内, relativeY =', relativeY, ', 需要范围:', shareAreaTop, '到', shareAreaBottom);
|
||||||
|
|||||||
@ -404,6 +404,7 @@ const confirmFilter = throttle(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
keywords.value=words;
|
keywords.value=words;
|
||||||
|
if(!keywords.value) return;
|
||||||
console.log(1111111);
|
console.log(1111111);
|
||||||
console.log('看看执行了几次');
|
console.log('看看执行了几次');
|
||||||
navTo({
|
navTo({
|
||||||
|
|||||||
@ -44,6 +44,7 @@
|
|||||||
@refresherrefresh="onRefresh"
|
@refresherrefresh="onRefresh"
|
||||||
@scrolltolower="onScrollToLower"
|
@scrolltolower="onScrollToLower"
|
||||||
:show-scrollbar="false"
|
:show-scrollbar="false"
|
||||||
|
:scroll-top="scrollTop"
|
||||||
>
|
>
|
||||||
<!-- 指南列表 -->
|
<!-- 指南列表 -->
|
||||||
<view class="guidelines-list">
|
<view class="guidelines-list">
|
||||||
@ -91,10 +92,11 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 无数据提示 -->
|
<!-- 无数据提示 -->
|
||||||
<view class="no-data" v-if="guidelinesList.length === 0 && !isLoading">
|
<empty v-if="guidelinesList.length === 0 && !isLoading"></empty>
|
||||||
|
<!-- <view class="no-data" v-if="guidelinesList.length === 0 && !isLoading">
|
||||||
<uni-icons type="info" size="60" color="#999"></uni-icons>
|
<uni-icons type="info" size="60" color="#999"></uni-icons>
|
||||||
<text>暂无数据</text>
|
<text>暂无数据</text>
|
||||||
</view>
|
</view> -->
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 组内排序弹窗 -->
|
<!-- 组内排序弹窗 -->
|
||||||
@ -152,6 +154,7 @@ import navTo from "@/utils/navTo.js";
|
|||||||
import hotImg from "@/static/hot_booklist.png";
|
import hotImg from "@/static/hot_booklist.png";
|
||||||
import downIng from "@/static/icon_library_down.png";
|
import downIng from "@/static/icon_library_down.png";
|
||||||
let downList = uni.getStorageSync("downLoadPdf") || [];
|
let downList = uni.getStorageSync("downLoadPdf") || [];
|
||||||
|
import empty from "@/components/empty/empty.vue";
|
||||||
const downLoadList = ref(downList);
|
const downLoadList = ref(downList);
|
||||||
// 响应式数据
|
// 响应式数据
|
||||||
const guidelinesList = ref([]);
|
const guidelinesList = ref([]);
|
||||||
@ -173,8 +176,9 @@ const isSetStatus=ref(false);
|
|||||||
import downloadStore from "@/store/downloadStoreFile.js";
|
import downloadStore from "@/store/downloadStoreFile.js";
|
||||||
const downloadTasks=ref([]);
|
const downloadTasks=ref([]);
|
||||||
const downLoadtaskList=computed(()=>{
|
const downLoadtaskList=computed(()=>{
|
||||||
return downloadTasks.value.filter((item)=>item.status == "completed").map((item)=>item.id);
|
return downloadTasks.value.filter((item)=>item.status == "completed" && item.type == "zhinan").map((item)=>item.id);
|
||||||
});
|
});
|
||||||
|
const scrollTop = ref(0);
|
||||||
const chooseInnerSort = (index) => {
|
const chooseInnerSort = (index) => {
|
||||||
sort.value = index;
|
sort.value = index;
|
||||||
isSetStatus.value = true;
|
isSetStatus.value = true;
|
||||||
@ -186,7 +190,20 @@ const chooseInnerSort = (index) => {
|
|||||||
innerSortTitle.value = "标题";
|
innerSortTitle.value = "标题";
|
||||||
}
|
}
|
||||||
showInnerSort.value = false;
|
showInnerSort.value = false;
|
||||||
loadGuidelinesList(true);
|
currentPage.value = 1;
|
||||||
|
hasMoreData.value = true;
|
||||||
|
loadMoreStatus.value = "more";
|
||||||
|
guidelinesList.value = [];
|
||||||
|
// 滚动到顶部
|
||||||
|
scrollTop.value = 0;
|
||||||
|
|
||||||
|
loadGuidelinesList(false);
|
||||||
|
nextTick(() => {
|
||||||
|
scrollTop.value = 0.01; // 触发滚动
|
||||||
|
nextTick(() => {
|
||||||
|
scrollTop.value = 0;
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
console.log(options);
|
console.log(options);
|
||||||
@ -223,7 +240,7 @@ onShow(() => {
|
|||||||
if (guidelinesList.value.length === 0) {
|
if (guidelinesList.value.length === 0) {
|
||||||
loadGuidelinesList(false);
|
loadGuidelinesList(false);
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
// 跳转到搜索页
|
// 跳转到搜索页
|
||||||
const goToSearch = () => {
|
const goToSearch = () => {
|
||||||
@ -292,11 +309,12 @@ const onScrollToLower = () => {
|
|||||||
// 刷新数据
|
// 刷新数据
|
||||||
const refreshData = async () => {
|
const refreshData = async () => {
|
||||||
try {
|
try {
|
||||||
|
guidelinesList.value = [];
|
||||||
currentPage.value = 1;
|
currentPage.value = 1;
|
||||||
hasMoreData.value = true;
|
hasMoreData.value = true;
|
||||||
loadMoreStatus.value = "more";
|
loadMoreStatus.value = "more";
|
||||||
|
|
||||||
await loadGuidelinesList(true);
|
await loadGuidelinesList(false);
|
||||||
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "刷新成功",
|
title: "刷新成功",
|
||||||
@ -325,7 +343,6 @@ const loadGuidelinesList = async (isRefresh = false) => {
|
|||||||
try {
|
try {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
loadMoreStatus.value = "loading";
|
loadMoreStatus.value = "loading";
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
page: currentPage.value,
|
page: currentPage.value,
|
||||||
pageSize: pageSize.value,
|
pageSize: pageSize.value,
|
||||||
@ -336,7 +353,7 @@ const loadGuidelinesList = async (isRefresh = false) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const res = await api.searchLibraryU(params);
|
const res = await api.searchLibraryU(params);
|
||||||
console.log("指南列表响应:", res);
|
console.log("指南列表响应:", res.data.list);
|
||||||
|
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
const newData = res.data.list;
|
const newData = res.data.list;
|
||||||
@ -348,10 +365,7 @@ const loadGuidelinesList = async (isRefresh = false) => {
|
|||||||
guidelinesList.value = [...guidelinesList.value, ...newData];
|
guidelinesList.value = [...guidelinesList.value, ...newData];
|
||||||
console.log("加载更多:追加数据到列表");
|
console.log("加载更多:追加数据到列表");
|
||||||
}
|
}
|
||||||
console.log(222222);
|
|
||||||
console.log(res.data.pageSize);
|
|
||||||
console.log(newData.length);
|
|
||||||
// 判断是否还有更多数据
|
|
||||||
if (newData.length <res.data.pageSize) {
|
if (newData.length <res.data.pageSize) {
|
||||||
loadMoreStatus.value = "noMore";
|
loadMoreStatus.value = "noMore";
|
||||||
hasMoreData.value = false;
|
hasMoreData.value = false;
|
||||||
@ -359,8 +373,6 @@ const loadGuidelinesList = async (isRefresh = false) => {
|
|||||||
} else {
|
} else {
|
||||||
loadMoreStatus.value = "more";
|
loadMoreStatus.value = "more";
|
||||||
hasMoreData.value = true;
|
hasMoreData.value = true;
|
||||||
console.log(333333);
|
|
||||||
console.log(!isRefresh);
|
|
||||||
// 只有在加载更多模式下才递增页码
|
// 只有在加载更多模式下才递增页码
|
||||||
if (!isRefresh) {
|
if (!isRefresh) {
|
||||||
currentPage.value++;
|
currentPage.value++;
|
||||||
@ -385,11 +397,7 @@ const loadGuidelinesList = async (isRefresh = false) => {
|
|||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
console.log("=== loadGuidelinesList 结束 ===");
|
console.log("=== loadGuidelinesList 结束 ===");
|
||||||
console.log("最终状态:", {
|
|
||||||
loadMoreStatus: loadMoreStatus.value,
|
|
||||||
page: currentPage.value,
|
|
||||||
listLength: guidelinesList.value.length,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
141
store/downloadStorePpt.js
Normal file
141
store/downloadStorePpt.js
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
// 下载任务全局状态管理
|
||||||
|
class DownloadStorePpt {
|
||||||
|
constructor() {
|
||||||
|
let tasks = uni.getStorageSync('downloadPptTasks');
|
||||||
|
this.tasks = tasks || [] ; // 下载任务列表
|
||||||
|
this.listeners = []; // 监听器列表
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加任务
|
||||||
|
addTask(data) {
|
||||||
|
const taskIndex = this.tasks.length;
|
||||||
|
const taskItem = {
|
||||||
|
id: Date.now() + Math.random(), // 唯一ID
|
||||||
|
url: '',
|
||||||
|
status: 'downloading', // downloading, paused, completed, failed
|
||||||
|
progress: 0,
|
||||||
|
title:'',
|
||||||
|
type:'',
|
||||||
|
releaseTime:'',
|
||||||
|
task: null,
|
||||||
|
filePath: '',
|
||||||
|
createTime: Date.now(),
|
||||||
|
localPath:''
|
||||||
|
};
|
||||||
|
Object.assign(taskItem, data);
|
||||||
|
this.tasks.push(taskItem);
|
||||||
|
this.notifyListeners();
|
||||||
|
this.saveToStorage();
|
||||||
|
|
||||||
|
return taskIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新任务
|
||||||
|
updateTask(index, updates) {
|
||||||
|
if (this.tasks[index]) {
|
||||||
|
Object.assign(this.tasks[index], updates);
|
||||||
|
this.notifyListeners();
|
||||||
|
this.saveToStorage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除任务
|
||||||
|
removeTask(index) {
|
||||||
|
const taskItem = this.tasks[index];
|
||||||
|
if (taskItem && taskItem.task && taskItem.status === 'downloading') {
|
||||||
|
taskItem.task.abort();
|
||||||
|
}
|
||||||
|
this.tasks.splice(index, 1);
|
||||||
|
this.notifyListeners();
|
||||||
|
this.saveToStorage();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取所有任务
|
||||||
|
getTasks() {
|
||||||
|
return this.tasks;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取任务
|
||||||
|
getTask(index) {
|
||||||
|
return this.tasks[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加监听器
|
||||||
|
addListener(callback) {
|
||||||
|
this.listeners.push(callback);
|
||||||
|
// 返回取消监听的函数
|
||||||
|
return () => {
|
||||||
|
const index = this.listeners.indexOf(callback);
|
||||||
|
if (index > -1) {
|
||||||
|
this.listeners.splice(index, 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// 通知所有监听器
|
||||||
|
notifyListeners() {
|
||||||
|
// 创建新数组引用,确保Vue能检测到变化
|
||||||
|
const tasksCopy = [...this.tasks];
|
||||||
|
this.listeners.forEach(callback => {
|
||||||
|
try {
|
||||||
|
callback(tasksCopy);
|
||||||
|
} catch (e) {
|
||||||
|
console.error('DownloadStoreFile listener error:', e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存到本地存储
|
||||||
|
saveToStorage() {
|
||||||
|
// 只保存基本信息,不保存task对象
|
||||||
|
const tasksToSave = this.tasks.map(item => ({
|
||||||
|
id: item.id,
|
||||||
|
url: item.url,
|
||||||
|
status: item.status,
|
||||||
|
progress: item.progress,
|
||||||
|
filePath: item.filePath,
|
||||||
|
createTime: item.createTime,
|
||||||
|
localPath:item.localPath,
|
||||||
|
title:item.title,
|
||||||
|
type:item.type,
|
||||||
|
releaseTime:item.releaseTime,
|
||||||
|
}));
|
||||||
|
uni.setStorageSync('downloadPptTasks', tasksToSave);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从本地存储加载
|
||||||
|
loadFromStorage() {
|
||||||
|
const savedTasks = uni.getStorageSync('downloadPptTasks');
|
||||||
|
if (savedTasks && Array.isArray(savedTasks)) {
|
||||||
|
this.tasks = savedTasks.map(item => ({
|
||||||
|
...item,
|
||||||
|
task: null // task对象无法序列化,需要重新创建
|
||||||
|
}));
|
||||||
|
this.notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 恢复下载中的任务
|
||||||
|
resumeDownloadingTasks(startDownloadCallback) {
|
||||||
|
this.tasks.forEach((taskItem, index) => {
|
||||||
|
// 如果任务状态是下载中,但task对象为null,说明需要重新创建下载任务
|
||||||
|
if (taskItem.status === 'downloading' && !taskItem.task) {
|
||||||
|
if (typeof startDownloadCallback === 'function') {
|
||||||
|
startDownloadCallback(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建单例
|
||||||
|
const downloadStorePpt = new DownloadStorePpt();
|
||||||
|
|
||||||
|
// 在应用启动时加载存储的任务
|
||||||
|
// #ifndef VUE3
|
||||||
|
if (typeof Vue !== 'undefined') {
|
||||||
|
Vue.prototype.$downloadStorePpt = downloadStorePpt;
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
export default downloadStorePpt;
|
||||||
@ -77,6 +77,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,18 +1,4 @@
|
|||||||
|
|
||||||
//let BASE_URL='https://dev-app.igandan.com/app';
|
let BASE_URL='https://dev-app.igandan.com/app';
|
||||||
let BASE_URL='https://app.igandan.com/app'
|
//let BASE_URL='https://app.igandan.com/app'
|
||||||
// try {
|
|
||||||
// const app = getApp({allowDefault: true});
|
|
||||||
|
|
||||||
// if(app.globalData.apiHost && app.globalData.apiHost.indexOf('dev')>-1){
|
|
||||||
// BASE_URL='https://dev-app.igandan.com/app'
|
|
||||||
// }else{
|
|
||||||
// BASE_URL='https://app.igandan.com/app'
|
|
||||||
// }
|
|
||||||
// console.log(app);
|
|
||||||
// } catch (error) {
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
export default BASE_URL
|
export default BASE_URL
|
||||||
@ -1,6 +1,6 @@
|
|||||||
//const app = getApp({allowDefault: true});
|
//const app = getApp({allowDefault: true});
|
||||||
//let DOC_URL='https://dev-doc.igandan.com/app/';
|
let DOC_URL='https://dev-doc.igandan.com/app/';
|
||||||
let DOC_URL='https://doc.igandan.com/app/'
|
//let DOC_URL='https://doc.igandan.com/app/'
|
||||||
// if(app.globalData.apiHost.indexOf('dev')>-1){
|
// if(app.globalData.apiHost.indexOf('dev')>-1){
|
||||||
// DOC_URL='https://dev-doc.igandan.com/app/'
|
// DOC_URL='https://dev-doc.igandan.com/app/'
|
||||||
// }else{
|
// }else{
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
//let OTHER_HOST='https://dev-wx.igandan.com'
|
let OTHER_HOST='https://dev-wx.igandan.com'
|
||||||
let OTHER_HOST='https://wx.igandan.com'
|
//let OTHER_HOST='https://wx.igandan.com'
|
||||||
//const app = getApp({allowDefault: true});
|
//const app = getApp({allowDefault: true});
|
||||||
// if(app.globalData.apiHost && app.globalData.apiHost.indexOf('dev')>-1){
|
// if(app.globalData.apiHost && app.globalData.apiHost.indexOf('dev')>-1){
|
||||||
// OTHER_HOST='https://dev-wx.igandan.com'
|
// OTHER_HOST='https://dev-wx.igandan.com'
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import BASE_URL from "./config.js";
|
|||||||
import version from '@/utils/version.js'
|
import version from '@/utils/version.js'
|
||||||
import client_type from "@/utils/client_type.js"
|
import client_type from "@/utils/client_type.js"
|
||||||
export const request = (url, data = {}, method = 'post', loading = false, contentType =
|
export const request = (url, data = {}, method = 'post', loading = false, contentType =
|
||||||
'application/json',extraHeader={}) => {
|
'application/json',extraHeader={},responseType=false) => {
|
||||||
if (loading) {
|
if (loading) {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '加载中',
|
title: '加载中',
|
||||||
@ -98,8 +98,11 @@ export const request = (url, data = {}, method = 'post', loading = false, conten
|
|||||||
method: method,
|
method: method,
|
||||||
sslVerify: false,
|
sslVerify: false,
|
||||||
header:{...header,...extraHeader},
|
header:{...header,...extraHeader},
|
||||||
timeout: 10000,
|
responseType:responseType?responseType:"text",
|
||||||
|
timeout: 100000,
|
||||||
success: async (res) => {
|
success: async (res) => {
|
||||||
|
console.log(222222222)
|
||||||
|
console.log(res)
|
||||||
var Authorization_token = res.header.Authorization;
|
var Authorization_token = res.header.Authorization;
|
||||||
if (Authorization_token) {
|
if (Authorization_token) {
|
||||||
uni.setStorageSync('AUTH_TOKEN_App', Authorization_token);
|
uni.setStorageSync('AUTH_TOKEN_App', Authorization_token);
|
||||||
@ -132,6 +135,9 @@ export const request = (url, data = {}, method = 'post', loading = false, conten
|
|||||||
|
|
||||||
if(url.indexOf('addOutPatientA')!=-1 || url.indexOf('checkVersion')!=-1){
|
if(url.indexOf('addOutPatientA')!=-1 || url.indexOf('checkVersion')!=-1){
|
||||||
e(res.data)
|
e(res.data)
|
||||||
|
}else if(url.indexOf('downloadGanDanFile')!=-1){
|
||||||
|
console.log(res)
|
||||||
|
e(res.data)
|
||||||
}else if(res.data.code==35002){
|
}else if(res.data.code==35002){
|
||||||
n(res)
|
n(res)
|
||||||
uni.sendNativeEvent('goTabbarPage', {
|
uni.sendNativeEvent('goTabbarPage', {
|
||||||
@ -155,6 +161,8 @@ export const request = (url, data = {}, method = 'post', loading = false, conten
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: function(err) {
|
fail: function(err) {
|
||||||
|
console.log(444444444)
|
||||||
|
console.log(err)
|
||||||
"request:fail " === err.errMsg && msg("请求数据失败!"), n(err.data);
|
"request:fail " === err.errMsg && msg("请求数据失败!"), n(err.data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user