12.16提交

This commit is contained in:
zoujiandong 2025-12-16 17:42:25 +08:00
parent c86aa03f01
commit 8025b2abab
20 changed files with 1159 additions and 146 deletions

View File

@ -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>

View File

@ -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

View File

@ -61,7 +61,8 @@
}, },
"ios" : { "ios" : {
"dSYMs" : false, "dSYMs" : false,
"idfa" : false "idfa" : false,
"urlschemewhitelist" : [ "weixin", "wechat" ]
}, },
/* ios */ /* ios */
"sdkConfigs" : { "sdkConfigs" : {

View File

@ -333,6 +333,36 @@
"bounce": "none" "bounce": "none"
} }
} }
},
{
"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",
@ -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": ""
} }
] ]

View File

@ -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;

View File

@ -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;
} }

View File

@ -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"

View File

@ -1,12 +1,12 @@
<template> <template>
<!-- 头部导航栏 --> <!-- 头部导航栏 -->
<view class="navbox">
<view class="status_bar"></view>
<uni-nav-bar <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"
> >
@ -16,6 +16,7 @@
</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 {

View File

@ -1,20 +1,24 @@
<template> <template>
<view class="ppt-detail-page"> <view class="ppt-detail-page">
<!-- 顶部导航栏 --> <!-- 顶部导航栏 -->
<view class="navbox">
<view class="status_bar"></view>
<uni-nav-bar <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,6 +68,20 @@
<text class="download-unit"></text> <text class="download-unit"></text>
</view> </view>
</view> </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> --> <!-- <web-view :src="src"></web-view> -->
<!-- 图片浏览 --> <!-- 图片浏览 -->
<!-- <view class="viewer"> <!-- <view class="viewer">
@ -62,32 +101,403 @@
<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(() => {
hasDownload.value = false;
downLoadStatus.value = 'start';
syncTasksFromStore();
// store
downloadStore.addListener((tasks) => {
downloadTasks.value = tasks;
});
//
resumeDownloadingTasks();
ganDanFileDetials(); 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 = () => { const goView = () => {
navTo({ for(let i = 0; i < downloadTasks.value.length; i++) {
url: "/pages_app/pptView/pptView?uuid=" + uuid.value, 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,12 +543,14 @@ 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();
@ -145,35 +558,261 @@ const checkUser = async (options) => {
var currentWebview = page.$getAppWebview(); //html5plusplus.webview.currentWebview()uni-appvue使plus.webview.currentWebview() var currentWebview = page.$getAppWebview(); //html5plusplus.webview.currentWebview()uni-appvue使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();
// aBlob URL
document.body.removeChild(a);
window.URL.revokeObjectURL(blobUrl);
//
callback && callback(blobUrl);
// base64Blob
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) {
// URLfile:///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
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; 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.downloadFile0
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; //

View File

@ -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('');

View File

@ -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;

View File

@ -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);

View File

@ -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({

View File

@ -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
View 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;

View File

@ -77,6 +77,10 @@

View File

@ -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

View File

@ -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{

View File

@ -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'

View File

@ -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);
} }
}); });