mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-09 02:46:46 +08:00
内网环境判断
This commit is contained in:
@@ -5,115 +5,125 @@
|
||||
<u-toast ref="messager"></u-toast>
|
||||
<!-- <page-title :showBack="true"></page-title> -->
|
||||
<view class="playbox" v-if="isShowPdt"><!--内容播放区域-->
|
||||
<view style="min-height: 440upx;" >
|
||||
<view v-if="curContent.contentType==10" style="background-color: #000000;">
|
||||
<!--视频-->
|
||||
<view style="position: relative;">
|
||||
<video-player
|
||||
:url="blobUrl"
|
||||
:blobId="blobId"
|
||||
controls
|
||||
:enable-play-gesture="true"
|
||||
:inittime="curContent.lastStudyTime"
|
||||
@play="onPlayerPlay"
|
||||
@pause="onPlayerPause"
|
||||
@ended="onPlayerEnded"
|
||||
@timeupdate="onPlayerPlaying"
|
||||
@fullscreenchange="onFullScreen"
|
||||
:drag="curriculumData.isDrag"
|
||||
style="width: 100%; object-fit: fill">
|
||||
></video-player>
|
||||
<view class="player-box" v-if="playerBoxShow">
|
||||
<view class="player-praise">
|
||||
<view @click="praiseContent" style="cursor: pointer;">
|
||||
<image class="icon-small" v-if="isPraise" src="/static/images/icon/praise-active.png" />
|
||||
<image class="icon-small" v-else src="/static/images/icon/praise1.png" />
|
||||
<!-- {{ courseInfo.praises }} -->
|
||||
<view style="color:#fff;cursor: pointer;">赞</view>
|
||||
</view>
|
||||
<view style="margin-left: 15px;cursor: pointer;" @click="treadContent">
|
||||
<image class="icon-small" v-if="isTrample" src="/static/images/icon/trample-active.png" />
|
||||
<image class="icon-small" v-else src="/static/images/icon/trample.png" />
|
||||
<!-- {{ courseInfo.trampleCount }} -->
|
||||
<view style="color:#fff;cursor: pointer;">踩</view>
|
||||
</view>
|
||||
</view>
|
||||
<!--以下部分,已经移到下面了-->
|
||||
<!-- <view v-if="!scoreInfo.has" class="player-rate">
|
||||
<u-rate v-model="scoreInfo.score" active-color="#f7ba2a" text-color="#ff9900" score-template="{value}" void-color="#fff" @change="addScore"></u-rate>
|
||||
</view>
|
||||
<view v-if="scoreInfo.has" style="padding-top: 5px;display: flex;">
|
||||
<view class="player-rate" style="padding-left: 5px;">
|
||||
<u-rate readonly :count="5" active-color="#f7ba2a" v-model="scoreInfo.score"></u-rate>
|
||||
</view>
|
||||
<view class="score-text" style="margin-top:20px">
|
||||
<text style="color:#ffb30f;">{{ toScore(scoreInfo.score) }}</text>
|
||||
<text style="font-size: 12px;color: #fff">分</text>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!---->
|
||||
<view v-if="curContent.contentType==20">
|
||||
<!--音频播放-->
|
||||
<view style="text-align: center;padding-top: 40px;background-color: #FFFFFF;">
|
||||
<audio-player
|
||||
:src="blobUrl"
|
||||
:name="curContent.contentName"
|
||||
:drag="curriculumData.isDrag"
|
||||
@onPlay="audioPlay"
|
||||
@onPause="audioPause"
|
||||
@onPlaying="audioPlaying"
|
||||
@onEnded="audioEnd">
|
||||
</audio-player>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="curContent.contentType==30">
|
||||
<image :src="fileBaseUrl+curContent.content" style="width: 100%;"></image>
|
||||
</view>
|
||||
<view v-if="curContent.contentType==40">
|
||||
<!--pdf文档-->
|
||||
<view style="min-height: 500px;padding-top: 200upx;position: relative;">
|
||||
<pdf-preview v-if="curContent.content && curContent.content!=''" :src="curContent.content ? fileBaseUrl+curContent.content : ''"></pdf-preview>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="curContent.contentType==41">
|
||||
<view class="about-gongsi-info" :style="{height:articleMore? '500upx':'auto'}" style="padding: 15px;text-indent:40px;line-height: 28px;position: relative;">
|
||||
<u-parse :content="curContent.content"></u-parse>
|
||||
</view>
|
||||
<view v-if="articleMore" @click="showMore" style="text-align: center;color: #387DF7;"><text>查看更多∨</text> </view>
|
||||
</view>
|
||||
<div v-if="curContent.contentType == 50" style="min-height: 500px;">
|
||||
<!--因为web-view 动态切换地址不好用,所以这里先使用iframe-->
|
||||
<iframe id="iframe-scorm" v-if="scormUrl" :src="scormUrl" @load="iframeScormLoad()" frameborder="0" scrolling="no" border="0px" style="width:100%;min-height:500px;border:0px;"></iframe>
|
||||
</div>
|
||||
<view v-if="curContent.contentType==52">
|
||||
<!--外连接-->
|
||||
<view v-if="conLink.openType == 1">
|
||||
<view v-if="conLink.url!=''" style="min-height: 400px;position: relative;">
|
||||
<web-view :src="conLink.url"></web-view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<div style="text-align: center;padding: 20px;">{{ curContent.contentName }}</div>
|
||||
<div style="text-align: center;padding: 20px;">{{ conLink.url }}</div>
|
||||
</view>
|
||||
</view>
|
||||
<!--作业-->
|
||||
<view v-if="curContent.contentType==60">
|
||||
<course-homework :content="curContent" :studyId="studyId"></course-homework>
|
||||
</view>
|
||||
<!--考试-->
|
||||
<view v-if="curContent.contentType==61">
|
||||
<course-exam :courseType="courseInfo.type" :content="curContent" :studyId="studyId"></course-exam>
|
||||
</view>
|
||||
<!--评估-->
|
||||
<view v-if="curContent.contentType==62">
|
||||
<course-assess :content="curContent" :studyId="studyId"></course-assess>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="Internet != 2">
|
||||
<view style="min-height: 440upx;" >
|
||||
<view v-if="curContent.contentType==10" style="background-color: #000000;">
|
||||
<!--视频-->
|
||||
<view style="position: relative;">
|
||||
<video-player
|
||||
:url="blobUrl"
|
||||
:blobId="blobId"
|
||||
controls
|
||||
:enable-play-gesture="true"
|
||||
:inittime="curContent.lastStudyTime"
|
||||
@play="onPlayerPlay"
|
||||
@pause="onPlayerPause"
|
||||
@ended="onPlayerEnded"
|
||||
@timeupdate="onPlayerPlaying"
|
||||
@fullscreenchange="onFullScreen"
|
||||
:drag="curriculumData.isDrag"
|
||||
style="width: 100%; object-fit: fill">
|
||||
></video-player>
|
||||
<view class="player-box" v-if="playerBoxShow">
|
||||
<view class="player-praise">
|
||||
<view @click="praiseContent" style="cursor: pointer;">
|
||||
<image class="icon-small" v-if="isPraise" src="/static/images/icon/praise-active.png" />
|
||||
<image class="icon-small" v-else src="/static/images/icon/praise1.png" />
|
||||
<!-- {{ courseInfo.praises }} -->
|
||||
<view style="color:#fff;cursor: pointer;">赞</view>
|
||||
</view>
|
||||
<view style="margin-left: 15px;cursor: pointer;" @click="treadContent">
|
||||
<image class="icon-small" v-if="isTrample" src="/static/images/icon/trample-active.png" />
|
||||
<image class="icon-small" v-else src="/static/images/icon/trample.png" />
|
||||
<!-- {{ courseInfo.trampleCount }} -->
|
||||
<view style="color:#fff;cursor: pointer;">踩</view>
|
||||
</view>
|
||||
</view>
|
||||
<!--以下部分,已经移到下面了-->
|
||||
<!-- <view v-if="!scoreInfo.has" class="player-rate">
|
||||
<u-rate v-model="scoreInfo.score" active-color="#f7ba2a" text-color="#ff9900" score-template="{value}" void-color="#fff" @change="addScore"></u-rate>
|
||||
</view>
|
||||
<view v-if="scoreInfo.has" style="padding-top: 5px;display: flex;">
|
||||
<view class="player-rate" style="padding-left: 5px;">
|
||||
<u-rate readonly :count="5" active-color="#f7ba2a" v-model="scoreInfo.score"></u-rate>
|
||||
</view>
|
||||
<view class="score-text" style="margin-top:20px">
|
||||
<text style="color:#ffb30f;">{{ toScore(scoreInfo.score) }}</text>
|
||||
<text style="font-size: 12px;color: #fff">分</text>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!---->
|
||||
<view v-if="curContent.contentType==20">
|
||||
<!--音频播放-->
|
||||
<view style="text-align: center;padding-top: 40px;background-color: #FFFFFF;">
|
||||
<audio-player
|
||||
:src="blobUrl"
|
||||
:name="curContent.contentName"
|
||||
:drag="curriculumData.isDrag"
|
||||
@onPlay="audioPlay"
|
||||
@onPause="audioPause"
|
||||
@onPlaying="audioPlaying"
|
||||
@onEnded="audioEnd">
|
||||
</audio-player>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="curContent.contentType==30">
|
||||
<image :src="fileBaseUrl+curContent.content" style="width: 100%;"></image>
|
||||
</view>
|
||||
<view v-if="curContent.contentType==40">
|
||||
<!--pdf文档-->
|
||||
<view style="min-height: 500px;padding-top: 200upx;position: relative;">
|
||||
<pdf-preview v-if="curContent.content && curContent.content!=''" :src="curContent.content ? fileBaseUrl+curContent.content : ''"></pdf-preview>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="curContent.contentType==41">
|
||||
<view class="about-gongsi-info" :style="{height:articleMore? '500upx':'auto'}" style="padding: 15px;text-indent:40px;line-height: 28px;position: relative;">
|
||||
<u-parse :content="curContent.content"></u-parse>
|
||||
</view>
|
||||
<view v-if="articleMore" @click="showMore" style="text-align: center;color: #387DF7;"><text>查看更多∨</text> </view>
|
||||
</view>
|
||||
<div v-if="curContent.contentType == 50" style="min-height: 500px;">
|
||||
<!--因为web-view 动态切换地址不好用,所以这里先使用iframe-->
|
||||
<iframe id="iframe-scorm" v-if="scormUrl" :src="scormUrl" @load="iframeScormLoad()" frameborder="0" scrolling="no" border="0px" style="width:100%;min-height:500px;border:0px;"></iframe>
|
||||
</div>
|
||||
<view v-if="curContent.contentType==52">
|
||||
<!--外连接-->
|
||||
<view v-if="conLink.openType == 1">
|
||||
<view v-if="conLink.url!=''" style="min-height: 400px;position: relative;">
|
||||
<web-view :src="conLink.url"></web-view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<div style="text-align: center;padding: 20px;">{{ curContent.contentName }}</div>
|
||||
<div style="text-align: center;padding: 20px;">{{ conLink.url }}</div>
|
||||
</view>
|
||||
</view>
|
||||
<!--作业-->
|
||||
<view v-if="curContent.contentType==60">
|
||||
<course-homework :content="curContent" :studyId="studyId"></course-homework>
|
||||
</view>
|
||||
<!--考试-->
|
||||
<view v-if="curContent.contentType==61">
|
||||
<course-exam :courseType="courseInfo.type" :content="curContent" :studyId="studyId"></course-exam>
|
||||
</view>
|
||||
<!--评估-->
|
||||
<view v-if="curContent.contentType==62">
|
||||
<course-assess :content="curContent" :studyId="studyId"></course-assess>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="Internet == 2">
|
||||
<div style="margin-top:40px">
|
||||
<span>十分抱歉,您当前的网络环境不符合观看要求。为了保障案例信息的安全,您需要接入公司内网才能观看。</span>
|
||||
</div>
|
||||
<div style="margin-top:20px" @click="getInternet">
|
||||
<el-button type="primary">重新检测</el-button>
|
||||
</div>
|
||||
</view>
|
||||
</view>
|
||||
<view class="contentbox" v-if="courseInfo.name">
|
||||
<view v-if="!catalogShow">
|
||||
<view class="tabrow">
|
||||
@@ -405,6 +415,16 @@
|
||||
</u-popup>
|
||||
<interact-share ref="comShare" :data="courseInfo":type="1"></interact-share>
|
||||
</view>
|
||||
<view v-if="protocolDialogVisible" class="protocol-dialog" style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 30%; background-color: #fff; border-radius: 8px; z-index: 9999;">
|
||||
<view class="protocol-title" style="padding: 15px; border-bottom: 1px solid #eee; font-weight: bold;">{{warnTitle}}</view>
|
||||
<view class="protocol-content" style="padding: 20px;">
|
||||
  {{warn}}
|
||||
</view>
|
||||
<view class="dialog-footer" style="padding: 15px; text-align: center; border-top: 1px solid #eee;">
|
||||
<view class="button-primary" @click="protocolDialogVisible = false" style="display: inline-block; padding: 8px 16px; background-color: #409EFF; color: #fff; border-radius: 4px; cursor: pointer;">确定</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="protocolDialogVisible" class="dialog-mask" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); z-index: 9998;"></view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -497,7 +517,11 @@
|
||||
scormUrl:'',
|
||||
maxDuration:0, //非音频最大时长
|
||||
cumulativeDuration:0, //非音频累计时长
|
||||
defaultMaxTime:1800 //非音频默认最大时间
|
||||
defaultMaxTime:1800, //非音频默认最大时间
|
||||
Internet: 3,//1是成功 2是是失败 3是检测中
|
||||
protocolDialogVisible:false,
|
||||
warn:"测试内容",
|
||||
warnTitle:"测试提示"
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -604,6 +628,41 @@
|
||||
window.clearTimeout(this.handleTimeout);
|
||||
}
|
||||
},
|
||||
getXmlHttpRequest() {
|
||||
if (window.XMLHttpRequest) {
|
||||
return new XMLHttpRequest();
|
||||
}
|
||||
else if (window.ActiveXObject) {
|
||||
return new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
},
|
||||
getInternet(){
|
||||
this.Internet = 3;
|
||||
let $this = this;
|
||||
let xmlhttp = this.getXmlHttpRequest();
|
||||
let timedOut = false;
|
||||
let timer = setTimeout(function () {
|
||||
timedOut = true;
|
||||
xmlhttp.abort();
|
||||
}, 5000);
|
||||
xmlhttp.open("HEAD", window.location.protocol + "//uapi.boe.com.cn/500.html", true);
|
||||
xmlhttp.send();
|
||||
xmlhttp.onreadystatechange = function () {
|
||||
if (xmlhttp.readyState == 4) {
|
||||
if (xmlhttp.status == 200) {
|
||||
clearTimeout(timer);
|
||||
$this.Internet = 2;
|
||||
$this.protocolDialogVisible=true
|
||||
} else {
|
||||
clearTimeout(timer);
|
||||
$this.Internet = 2;
|
||||
}
|
||||
} else {
|
||||
if (timedOut) return;//忽略中止请求
|
||||
clearTimeout(timer);//取消等待的超时
|
||||
}
|
||||
}
|
||||
},
|
||||
iframeScormLoad(){
|
||||
setTimeout(function(){
|
||||
var scormIframe=document.getElementById('iframe-scorm');
|
||||
@@ -779,6 +838,10 @@
|
||||
//this.curContent=this.contentList[0];
|
||||
this.playContent(this.curContent,0);
|
||||
}
|
||||
if(rs.result.isPermission){
|
||||
this.getInternet()
|
||||
console.log("需要内网环境")
|
||||
}
|
||||
uni.hideLoading();
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user