mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-14 13:26:47 +08:00
内网环境判断
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
<u-toast ref="messager"></u-toast>
|
<u-toast ref="messager"></u-toast>
|
||||||
<!-- <page-title :showBack="true"></page-title> -->
|
<!-- <page-title :showBack="true"></page-title> -->
|
||||||
<view class="playbox" v-if="isShowPdt"><!--内容播放区域-->
|
<view class="playbox" v-if="isShowPdt"><!--内容播放区域-->
|
||||||
|
<view v-if="Internet != 2">
|
||||||
<view style="min-height: 440upx;" >
|
<view style="min-height: 440upx;" >
|
||||||
<view v-if="curContent.contentType==10" style="background-color: #000000;">
|
<view v-if="curContent.contentType==10" style="background-color: #000000;">
|
||||||
<!--视频-->
|
<!--视频-->
|
||||||
@@ -113,6 +114,15 @@
|
|||||||
<course-assess :content="curContent" :studyId="studyId"></course-assess>
|
<course-assess :content="curContent" :studyId="studyId"></course-assess>
|
||||||
</view>
|
</view>
|
||||||
</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>
|
||||||
<view class="contentbox" v-if="courseInfo.name">
|
<view class="contentbox" v-if="courseInfo.name">
|
||||||
<view v-if="!catalogShow">
|
<view v-if="!catalogShow">
|
||||||
@@ -405,6 +415,16 @@
|
|||||||
</u-popup>
|
</u-popup>
|
||||||
<interact-share ref="comShare" :data="courseInfo":type="1"></interact-share>
|
<interact-share ref="comShare" :data="courseInfo":type="1"></interact-share>
|
||||||
</view>
|
</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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -497,7 +517,11 @@
|
|||||||
scormUrl:'',
|
scormUrl:'',
|
||||||
maxDuration:0, //非音频最大时长
|
maxDuration:0, //非音频最大时长
|
||||||
cumulativeDuration:0, //非音频累计时长
|
cumulativeDuration:0, //非音频累计时长
|
||||||
defaultMaxTime:1800 //非音频默认最大时间
|
defaultMaxTime:1800, //非音频默认最大时间
|
||||||
|
Internet: 3,//1是成功 2是是失败 3是检测中
|
||||||
|
protocolDialogVisible:false,
|
||||||
|
warn:"测试内容",
|
||||||
|
warnTitle:"测试提示"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -604,6 +628,41 @@
|
|||||||
window.clearTimeout(this.handleTimeout);
|
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(){
|
iframeScormLoad(){
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
var scormIframe=document.getElementById('iframe-scorm');
|
var scormIframe=document.getElementById('iframe-scorm');
|
||||||
@@ -779,6 +838,10 @@
|
|||||||
//this.curContent=this.contentList[0];
|
//this.curContent=this.contentList[0];
|
||||||
this.playContent(this.curContent,0);
|
this.playContent(this.curContent,0);
|
||||||
}
|
}
|
||||||
|
if(rs.result.isPermission){
|
||||||
|
this.getInternet()
|
||||||
|
console.log("需要内网环境")
|
||||||
|
}
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user