diff --git a/App.vue b/App.vue index 4e03ce8..2d54195 100644 --- a/App.vue +++ b/App.vue @@ -5,15 +5,18 @@ plAd: true, dotNumber: { - } + }, + apiHost: 'https://dev-app.igandan.com/app', + //BASE_URL='https://dev-app.igandan.com/app' }, onLaunch(options) { - + //uni.setStorageSync('apiHost', 'value') console.log('打印options'); console.log(options); if (options && options.referrerInfo.extraData && options.referrerInfo.extraData.token) { uni.setStorageSync("AUTH_TOKEN_App", options.referrerInfo.extraData.token); uni.setStorageSync("userInfo", options.referrerInfo.extraData.userInfo); + //getApp({allowDefault: true}).globalData.apiHost = options.referrerInfo.extraData.apiHost; }; if (options && options.referrerInfo.extraData && options.referrerInfo.extraData.targetPath) { uni.navigateTo({ diff --git a/package.json b/package.json index ad874f6..0072a1b 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "mobx": "^6.6.1", "nim-web-sdk-ng": "^10.9.50", "pinyin": "^4.0.0", + "uni-packing-wgt": "^1.2.3", "uniapp-video-player": "^1.3.0", "uview-plus": "^3.4.73", "vconsole": "^3.15.1" diff --git a/pages.json b/pages.json index 1bc8774..dde06f3 100644 --- a/pages.json +++ b/pages.json @@ -9,16 +9,16 @@ } }, "pages": [ - { - "path": "pages/loading/loading", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom", - "app": { - "bounce": "none" - } - } - }, + // { + // "path": "pages/loading/loading", + // "style": { + // "navigationBarTitleText": "", + // "navigationStyle": "custom", + // "app": { + // "bounce": "none" + // } + // } + // }, { "path": "pages/index/index", "style": { @@ -281,6 +281,28 @@ } } }, + { + "path": "video/video", + "style": { + "navigationStyle": "custom", + "navigationBarRightButton":{ "hide": true}, + "navigationBarTitleText": "uni-app分页", + "app": { + "bounce": "none" + } + } + }, + { + "path": "patientVideo/patientVideo", + "style": { + "navigationStyle": "custom", + "navigationBarRightButton":{ "hide": true}, + "navigationBarTitleText": "uni-app分页", + "app": { + "bounce": "none" + } + } + }, { "path": "videoDetail/videoDetail", "style": { @@ -527,17 +549,7 @@ // } // } // }, - // { - // "path": "patientVideo/patientVideo", - // "style": { - // "navigationStyle": "custom", - // "navigationBarRightButton":{ "hide": true}, - // "navigationBarTitleText": "uni-app分页", - // "app": { - // "bounce": "none" - // } - // } - // }, + // { // "path": "selectPatient/selectPatient", diff --git a/pages/index/index.vue b/pages/index/index.vue index 99dd37f..cebae79 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -703,31 +703,31 @@ let url = ""; if (name == "我的患者") { url = "/pages_app/patientMsg/patientMsg"; - sendAppMsgEvent('goPatientMsg', name); + //sendAppMsgEvent('goPatientMsg', name); } else if (name == "肝胆视频") { url = "/pages_app/video/video"; - sendAppMsgEvent('goGdVideo', name); + //sendAppMsgEvent('goGdVideo', name); } else if (name == "公益咨询") { url = "/pages_app/consult/consult"; - sendAppMsgEvent('goFreeConsult', name); + //sendAppMsgEvent('goFreeConsult', name); } else if (name == "指南杂志") { url = "/pages_app/zhinan/zhinan"; - sendAppMsgEvent('goGuide', name); + //sendAppMsgEvent('goGuide', name); } else if (name == "肝胆新闻") { url = "/pages_app/newsList/newsList"; - sendAppMsgEvent('goGdNews', name); + //sendAppMsgEvent('goGdNews', name); } else if (name == "肝胆课件") { url = "/pages_app/ppt/ppt"; - sendAppMsgEvent('goGdPpt', name); + //sendAppMsgEvent('goGdPpt', name); } else if (name == "精品课") { url = "/pages_course/course/course"; - sendAppMsgEvent('goCourse', name); + //sendAppMsgEvent('goCourse', name); } else if (name == "积分商城") { url = "/pages_goods/pointMall/pointMall"; - sendAppMsgEvent('goPointMall', name); + //sendAppMsgEvent('goPointMall', name); } else if (name == "我的福利") { url = "/pages_app/myWelfare/myWelfare"; - sendAppMsgEvent('goMyWelfare', name); + //sendAppMsgEvent('goMyWelfare', name); } else if (name == "专题e站") { const encoded = encodeURIComponent( "https://wx.igandan.com/Esite/index.htm#/home?fromtype=doctor" @@ -738,9 +738,11 @@ }); } else { url = "/pages_app/myApplication/myApplication"; - sendAppMsgEvent('goMyApplication', name); + // sendAppMsgEvent('goMyApplication', name); } - + navTo({ + url: url, + }); }; const sendAppMsg = () => { uni.sendNativeEvent('openPage', { diff --git a/pages_app/videoDetail/videoDetail.vue b/pages_app/videoDetail/videoDetail.vue index 03ee63c..a9a1d87 100644 --- a/pages_app/videoDetail/videoDetail.vue +++ b/pages_app/videoDetail/videoDetail.vue @@ -115,9 +115,10 @@ - + + 点击下载(限时5折,仅需{{videoInfo.point}}积分) + 查看缓存 + { notEnoughVisible.value = false; @@ -226,6 +231,7 @@ const toCollection = () => { const networkConfirm = () => { networkVisible.value = false; pointVisible.value = true; + downAndSave(videoSrc.value,video_uuid.value); }; const addVideoWatchRecord = async () => { const res = await api.addVideoWatchRecord({ @@ -253,7 +259,7 @@ const videoDetail = async () => { if (res.code == 200) { const userInfo = uni.getStorageSync("userInfo"); videoInfo.value = res.video; - + hasDownload.value = downLoadList.value.includes(video_uuid.value); let vid = res.video.polyv_uuid; let uuid = vid.substring(0, 10); let index = vid.lastIndexOf("_"); @@ -294,9 +300,27 @@ const VideoDownloadRecord = async () => { const res = await api.isVideoDownloadRecord({ video_uuid: video_uuid.value }); if (res.code == 200) { isVideoDownloadRecord.value = res.result == 0 ? false : true; + console.log(isVideoDownloadRecord.value); } }; +const downAndSave = (url,uuid) => { + //let url='https://view.xdocin.com/view?src='+encodeURIComponent(pdfUrl); + uni.downloadFile({ + url: url, + success: (res) => { + if (res.statusCode === 200) { + let index = downLoadList.value.find(cell => uuid == cell); + if (!index) { + downLoadList.value.push(item.uuid); + uni.setStorageSync('downLoadVideo', downLoadList.value); + }; + + + } + }, + }); + }; const getWelfareNum = async () => { const res = await api.getWelfareNum({ type: 1, @@ -329,6 +353,7 @@ onShow(() => { } videoDetail(); uni.hideLoading(); + }); const shareRef = ref(); @@ -545,6 +570,7 @@ const payVideoDownload = async () => { notEnoughContent.value = `您的积分不足,是否购买积分?`; } }; + const onDownload = () => { console.log(isVideoDownloadRecord.value); if (!isVideoDownloadRecord.value) { @@ -563,9 +589,14 @@ const onDownload = () => { }, }); } else { - navTo({ - url: "/pages_app/myDownLoad/myDownLoad", - }); + if(hasDownload.value) { + navTo({ + url: "/pages_app/myDownLoad/myDownLoad", + }); + } else { + downAndSave(videoSrc.value,video_uuid.value); + } + } }; @@ -752,7 +783,7 @@ overflow-y: scroll; } .intro { // background: #fff; - padding: 24rpx 28rpx 40rpx; + padding: 24rpx 28rpx 100rpx; // margin-top: calc(var(--status-bar-height) + 44px + 220px + 88rpx); // height: calc(100vh - var(--status-bar-height) - 44px - 220px - 88rpx); // overflow-y: scroll; diff --git a/tsconfig.json b/tsconfig.json index 461e401..71c4c0e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -59,6 +59,10 @@ + + + + diff --git a/utils/config.js b/utils/config.js index 3e4a7fb..ca59088 100644 --- a/utils/config.js +++ b/utils/config.js @@ -1,19 +1,18 @@ -let BASE_URL='' -if(process.env.UNI_PLATFORM =="h5"){ - if (window.location.href.indexOf('//casedata.igandan.com')>-1){ - BASE_URL='https://dev-app.igandan.com/app' - }else{ - BASE_URL='https://dev-app.igandan.com/app' - } -}else if(process.env.UNI_PLATFORM =="mp-weixin"){ - const { envVersion } = uni.getAccountInfoSync().miniProgram; - if (envVersion == "release") { - BASE_URL='https://app.igandan.com/app' - }else{ - BASE_URL='https://dev-app.igandan.com/app' - } -}else{ - //BASE_URL='https://dev-app.igandan.com/app' - BASE_URL='https://app.igandan.com/app' -} + +console.log('打印app'); +let BASE_URL='https://dev-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 \ No newline at end of file diff --git a/utils/docUrl.js b/utils/docUrl.js index c9a5042..4f5546f 100644 --- a/utils/docUrl.js +++ b/utils/docUrl.js @@ -1,19 +1,26 @@ -let DOC_URL='' -if(process.env.UNI_PLATFORM =="h5"){ - if (window.location.href.indexOf('//casedata.igandan.com')>-1){ - DOC_URL='https://doc.igandan.com/app/' - }else{ - DOC_URL='https://dev-doc.igandan.com/app/' - } -}else if(process.env.UNI_PLATFORM =="mp-weixin"){ - const { envVersion } = uni.getAccountInfoSync().miniProgram; - if (envVersion == "release") { - DOC_URL='https://app.igandan.com/app/' - }else{ - DOC_URL='https://dev-doc.igandan.com/app/' - } -}else{ - //DOC_URL='https://dev-doc.igandan.com/app/' - DOC_URL='https://doc.igandan.com/app/' -} +//const app = getApp(); +let DOC_URL='https://dev-doc.igandan.com/app/'; +// if(app.globalData.apiHost.indexOf('dev')>-1){ +// DOC_URL='https://dev-doc.igandan.com/app/' +// }else{ +// DOC_URL='https://doc.igandan.com/app/' +// } +// if(process.env.UNI_PLATFORM =="h5"){ +// if (window.location.href.indexOf('//casedata.igandan.com')>-1){ +// DOC_URL='https://doc.igandan.com/app/' +// }else{ +// DOC_URL='https://dev-doc.igandan.com/app/' +// } +// }else if(process.env.UNI_PLATFORM =="mp-weixin"){ +// const { envVersion } = uni.getAccountInfoSync().miniProgram; +// if (envVersion == "release") { +// DOC_URL='https://app.igandan.com/app/' +// }else{ +// DOC_URL='https://dev-doc.igandan.com/app/' +// } +// }else{ +// //DOC_URL='https://dev-doc.igandan.com/app/' +// DOC_URL='https://doc.igandan.com/app/' +// } + export default DOC_URL \ No newline at end of file diff --git a/utils/otherHost.js b/utils/otherHost.js index ac2a67f..3ca83e8 100644 --- a/utils/otherHost.js +++ b/utils/otherHost.js @@ -1,13 +1,19 @@ -let OTHER_HOST='' - if(process.env.UNI_PLATFORM =="mp-weixin"){ - const { envVersion } = uni.getAccountInfoSync().miniProgram; - if (envVersion == "release") { - OTHER_HOST='https://wx.igandan.com' - }else{ - OTHER_HOST='https://dev-wx.igandan.com' - } -}else{ - //OTHER_HOST='https://dev-wx.igandan.com' - OTHER_HOST='https://wx.igandan.com' -} +let OTHER_HOST='https://dev-wx.igandan.com' +//const app = getApp({allowDefault: true}); +// if(app.globalData.apiHost && app.globalData.apiHost.indexOf('dev')>-1){ +// OTHER_HOST='https://dev-wx.igandan.com' +// }else{ +// OTHER_HOST='https://wx.igandan.com' +// } +// if(process.env.UNI_PLATFORM =="mp-weixin"){ +// const { envVersion } = uni.getAccountInfoSync().miniProgram; +// if (envVersion == "release") { +// OTHER_HOST='https://wx.igandan.com' +// }else{ +// OTHER_HOST='https://dev-wx.igandan.com' +// } +// }else{ +// //OTHER_HOST='https://dev-wx.igandan.com' +// OTHER_HOST='https://wx.igandan.com' +// } export default OTHER_HOST \ No newline at end of file diff --git a/utils/request.js b/utils/request.js index bf8bddf..9b0e218 100644 --- a/utils/request.js +++ b/utils/request.js @@ -106,6 +106,10 @@ export const request = (url, data = {}, method = 'post', loading = false, conten if (loading) { uni.hideLoading(); }; + uni.showToast({ + title: res.data.code, + icon: 'none' + }); if(url.indexOf('manager/getSystemTimeStamp')!=-1){ e(res) }else if (res.data.code == 200 || res.data.code == 1 || res.data.code == "1" || res.data.code == "200"){ @@ -133,12 +137,20 @@ export const request = (url, data = {}, method = 'post', loading = false, conten e(res.data) }else if(res.data.code==35002){ n(res) - uni.sendNativeEvent('goTabbarPage', { - msg: 'home' - },ret => { - console.log(ret); - }) - plus.runtime.quit() + uni.showToast({ + title: '登录过期,请重新登录', + icon: 'none' + }); + uni.redirectTo({ + url: '/pages_app/login/login' + }); + // uni.sendNativeEvent('goTabbarPage', { + // msg: 'home' + // },ret => { + // console.log(ret); + // }) + // plus.runtime.quit(); + }else{ uni.showToast({ title: res.data.message,