mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-06 17:36:42 +08:00
内网环境判断
This commit is contained in:
@@ -630,7 +630,7 @@
|
||||
let urlSign = encodeURIComponent(encrypt(beforeUrl));
|
||||
cookies.set('PLAYSIGN_TIME', ctime); //写客户端的cookie保存
|
||||
//以下判断是为了区分本地环境和服务器环境
|
||||
if (process.env.NODE_ENV == 'development') {
|
||||
if (true) {
|
||||
this.blobUrl = process.env.VUE_APP_FILE_BASE_URL + u;
|
||||
} else {
|
||||
this.blobUrl = process.env.VUE_APP_BASE_API + '/xboe/m/course/cware/resource?sign=' + urlSign;
|
||||
@@ -1386,12 +1386,55 @@
|
||||
this.totalContent = rs.result.contents.length;
|
||||
//加载学习的数据
|
||||
this.loadStudyData(rs.result);
|
||||
|
||||
if (rs.result.course.isPermission){
|
||||
this.getInternet()
|
||||
console.log('需要内网环境')
|
||||
}
|
||||
} else {
|
||||
this.$message.error(rs.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 检测是否为内网
|
||||
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 = 1;
|
||||
$this.$store.dispatch("userTrigger", {
|
||||
key: "ViewCase",//后台的事件key 发布文章且审核通过
|
||||
title: '查看案例',//事件的标题
|
||||
parameters: "",//用户自定义参数 name:value,name:value
|
||||
content: '查看了案例',//事件的内容
|
||||
objId: $this.resolveId,//关联的id
|
||||
objType: "3",//关联的类型
|
||||
objInfo: $this.caseDetail?.title,
|
||||
aid: $this.userInfo.aid, //当前登录人的id
|
||||
aname: $this.userInfo.name,//当前人的姓名
|
||||
status: 1 //状态,直接写1
|
||||
});
|
||||
$this.sendEventData();
|
||||
} else {
|
||||
clearTimeout(timer);
|
||||
$this.Internet = 2;
|
||||
}
|
||||
} else {
|
||||
if (timedOut) return;//忽略中止请求
|
||||
clearTimeout(timer);//取消等待的超时
|
||||
}
|
||||
}
|
||||
},
|
||||
loadStudyData(result) {
|
||||
let $this=this;
|
||||
this.loadScorePraiseAndTrample();
|
||||
|
||||
Reference in New Issue
Block a user