上传http与https的处理,优化Aajx的超时时间

This commit is contained in:
daihh
2023-03-28 16:10:15 +08:00
parent e34c9873bd
commit 7b72e42798
8 changed files with 40 additions and 145 deletions

View File

@@ -30,7 +30,7 @@ const formRequest=axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分 // axios中请求配置有baseURL选项表示请求URL公共部分
// baseURL: process.env.VUE_APP_CESOURCE_BASE_API, // baseURL: process.env.VUE_APP_CESOURCE_BASE_API,
//超时 //超时
timeout: 10000, timeout: 60000,
}) })
//发送json对象的拦截器 //发送json对象的拦截器
formRequest.interceptors.request.use(config => { formRequest.interceptors.request.use(config => {

View File

@@ -111,6 +111,11 @@ export default {
} }
}; };
}, },
mounted() {
//计算是http还是https
let urlPre=window.location.protocol;
this.uploadFileUrl=urlPre+this.uploadFileUrl.substring(this.uploadFileUrl.indexOf(':')+1);
},
computed: { computed: {
// 是否显示提示 // 是否显示提示
showTip() { showTip() {

View File

@@ -115,7 +115,7 @@
<!-- <el-table-column prop="finishTime" label="结束时间"></el-table-column> --> <!-- <el-table-column prop="finishTime" label="结束时间"></el-table-column> -->
<el-table-column prop="totalDuration" label="学习时长(分)"> <el-table-column prop="totalDuration" label="学习时长(分)">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.totalDuration == 0? '0': scope.row.totalDuration/60}} {{ scope.row.totalDuration == 0? '0': (scope.row.totalDuration/60).toFixed(2)}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="progress" label="进度"> <el-table-column prop="progress" label="进度">

View File

@@ -29,7 +29,7 @@ const jsonRequest=axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分 // axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: process.env.VUE_APP_BASE_API, baseURL: process.env.VUE_APP_BASE_API,
//超时 //超时
timeout: 10000, timeout: 60000,
}); });
//发送json对象的拦截器 //发送json对象的拦截器
jsonRequest.interceptors.request.use(config => { jsonRequest.interceptors.request.use(config => {

View File

@@ -1,87 +1,15 @@
<template> <template>
<div class="study-index" v-loading="loading"> <div class="study-index" v-loading="loading">
<Remark> <Remark>
1.学员个人中心首页当前简单后续会美化<br/> 1.学员个人中心首页,根据需求无需此页直接打开我的任务->我报名的
2.<br/>
3.<br/>
</Remark> </Remark>
<!-- <div style="display: flex;justify-content:space-between; padding: 10px;">
<div style="display: flex;justify-content: flex-start;">
<div><el-input v-model="params.name" placeholder="查询名称"></el-input></div>
<div style="padding-left: 10px;">
<el-select v-model="params.type" clearable placeholder="请选择">
<el-option label="微课" value="1"></el-option>
<el-option label="在线课" value="2"></el-option>
</el-select>
</div>
<div style="padding-left: 10px;">
<el-button type="primary" icon="el-icon-search">查询</el-button>
</div>
</div>
<div>
<el-badge :value="2" class="uc-badge">
<el-button >未开始</el-button>
</el-badge>
<el-badge :value="3" class="uc-badge">
<el-button >学习中</el-button>
</el-badge>
<el-badge :value="1" class="uc-badge" type="primary">
<el-button >已完成</el-button>
</el-badge>
</div>
</div> -->
<!--课程列表内容-->
<div>
<!-- <div v-if="lastStudy.itemId && lastStudy.itemId!=''">
<p class="title"><i class="el-icon-caret-right"></i> 上次学习</p>
<div>
<div>
<span>{{getCourseType(lastStudy.courseType)}} {{lastStudy.courseName}}, </span>
<span style="margin: 0px 10px;"> {{lastStudy.lastTime}} </span>
<span> {{lastStudy.contentName}} </span>
<span style="margin: 0px 10px;">
<el-link type="primary" :href="continueStudy(lastStudy)" target="_blank">继续学习</el-link>
</span>
</div>
</div>
</div> -->
</div>
<div>
<div>
<!-- <p class="title">
<router-link to="/uc/study/courses"><i class="el-icon-caret-right"></i> 正在学习</router-link>
<span v-if="couresList.length>5" class="more"><router-link to="/uc/study/courses">更多&nbsp;></router-link></span>
</p> -->
<div>
<!-- <div v-if="couresList.length>0" style="">
</div> -->
<!-- <div v-else style="text-align: center;padding: 20px;color: #ffaa00;">目前您没有正在学习的课程</div> -->
</div>
</div>
</div>
<div>
<div>
<!-- <p class="title">
<router-link to="/uc/study/task"><i class="el-icon-caret-right"></i> 正在进行的任务</router-link>
<span v-if="taskList.length>5" class="more"><router-link to="/uc/study/task">更多&nbsp;></router-link></span>
</p> -->
<div>
<!-- <div v-if="taskList.length>0">
</div> -->
<!-- <div v-else style="text-align: center;padding: 20px;color: #ffaa00; ">目前您没有正在进行的任务</div> -->
</div>
</div>
</div>
</div> </div>
</template> </template>
<script> <script>
import studyItem from '@/components/Course/studyItem.vue' import studyItem from '@/components/Course/studyItem.vue'
import apicourseStudy from '@/api/modules/courseStudy.js'; import apicourseStudy from '@/api/modules/courseStudy.js';
import apiBoeCourse from '@/api/boe/course.js'; // import apiBoeCourse from '@/api/boe/course.js';
import {resListMap, resOwnerListMap,courseType,getType} from '@/utils/tools.js'; import {resListMap, resOwnerListMap,courseType,getType} from '@/utils/tools.js';
import apiBoe from '@/api/boe/boeApiAjax.js'; import apiBoe from '@/api/boe/boeApiAjax.js';
import axios from 'axios' import axios from 'axios'
@@ -131,32 +59,32 @@
// cmtask_name:this.cmtask_name, // cmtask_name:this.cmtask_name,
} }
apiBoeCourse.cmtaskList(params).then(res=>{ // apiBoeCourse.cmtaskList(params).then(res=>{
if(res.status==200){ // if(res.status==200){
this.total = res.result.count // this.total = res.result.count
this.couresList = res.result.list; // this.couresList = res.result.list;
this.loading = false; // this.loading = false;
if(this.$route.fullPath != '/uc/study/task' && this.$route.fullPath != '/uc/study/courses' && this.$route.fullPath != '/study/index') { // if(this.$route.fullPath != '/uc/study/task' && this.$route.fullPath != '/uc/study/courses' && this.$route.fullPath != '/study/index') {
return; // return;
} // }
if(res.result.count > 0) { // if(res.result.count > 0) {
this.$router.push('/uc/study/task') // this.$router.push('/uc/study/task')
} else { // } else {
if(this.$route.query.study == '1') { // if(this.$route.query.study == '1') {
this.$router.push('/uc/study/task') // this.$router.push('/uc/study/task')
} else { // } else {
this.$router.push('/uc/study/courses') // this.$router.push('/uc/study/courses')
} // }
} // }
}else{ // }else{
this.$router.push('/uc/study/courses') // this.$router.push('/uc/study/courses')
} // }
}).catch(err=>{ // }).catch(err=>{
if(this.$route.fullPath != '/uc/study/task' || this.$route.fullPath != '/uc/study/courses' || this.$route.fullPath != '/study/index') { // if(this.$route.fullPath != '/uc/study/task' || this.$route.fullPath != '/uc/study/courses' || this.$route.fullPath != '/study/index') {
return; // return;
} // }
this.$router.push('/uc/study/courses'); // this.$router.push('/uc/study/courses');
}) // })
}, },
created() { created() {
//this.$router.push('/uc/study/courses'); //this.$router.push('/uc/study/courses');

View File

@@ -74,7 +74,7 @@
<el-table style="margin:10px 32px 10px 22px;" :data="pageData" border stripe> <el-table style="margin:10px 32px 10px 22px;" :data="pageData" border stripe>
<el-table-column label="序号" type="index" width="50"></el-table-column> <el-table-column label="序号" type="index" width="50"></el-table-column>
<el-table-column v-if="forChoose" label="选择" width="80"> <el-table-column v-if="forChoose" label="选择" width="80">
<template slot-scope="scope"> <template slot-scope="scope" v-if="scope.row.published">
<el-button type="default" size="mini" @click="handleChoose(scope.row)">选择</el-button> <el-button type="default" size="mini" @click="handleChoose(scope.row)">选择</el-button>
</template> </template>
</el-table-column> </el-table-column>

View File

@@ -74,7 +74,6 @@
<script> <script>
import studyItem from '@/components/Course/studyItem.vue'; import studyItem from '@/components/Course/studyItem.vue';
import apiBoeCourse from '@/api/boe/course.js';
import apiManage from '@/api/manage/manage.js' import apiManage from '@/api/manage/manage.js'
import {formatsec} from '@/utils/datetime.js' import {formatsec} from '@/utils/datetime.js'
export default { export default {
@@ -94,32 +93,7 @@ export default {
keyword:'', keyword:'',
formatsec, formatsec,
couresList:[], couresList:[],
total: 0, total: 0
options: [
{
label: '微课',
value: 1
},
{
label: '在线课',
value: 2,
children: [
{
label: '录播课',
value: 1
},
{
label: '直播课',
value: 1
}
]
},
{
label: '面授课',
value: 3
}
],
}; };
}, },
mounted() { mounted() {
@@ -167,18 +141,6 @@ export default {
}).catch(()=>{ }).catch(()=>{
this.loading=false; this.loading=false;
}) })
// apiBoeCourse.cmtaskList(params).then(res=>{
// if(res.status==200){
// this.total = res.result.count
// this.couresList = res.result.list;
// }else{
// this.$message.error('查询数据失败:'+res.message);
// }
// this.loading=false;
// }).catch(()=>{
// this.loading=false;
// })
}, },
search(){ search(){
this.page=1; this.page=1;