提交 7265f1ce authored 作者: 王鹏飞's avatar 王鹏飞

bug fixes

上级 a58da42f
......@@ -28,11 +28,11 @@ export default class CourseAPI extends BaseAPI {
* @param {[string]} cid
* @param {[string]} sid
*/
selectCourse = (cid, sid) => this.post('/v2/education/courses/major', { course_id: cid, semester_id: sid })
selectCourse = (cid, sid) => this.post('/v2/education/courses/major', { course_id: cid, semester_id: sid }, { headers: { 'Content-Type': 'application/json' } })
/**
* 退课
* @param {[string]} cid
* @param {[string]} sid
*/
outSelectCourse = (cid, sid) => this.post('/v2/education/courses/drop', { course_id: cid, semester_id: sid })
outSelectCourse = (cid, sid) => this.post('/v2/education/courses/drop', { course_id: cid, semester_id: sid }, { headers: { 'Content-Type': 'application/json' } })
}
......@@ -3,32 +3,52 @@ import cAction from '@action'
import { Message } from 'element-ui'
export default class Before {
constructor (opt) {
constructor(opt) {
const UA = navigator.userAgent
this.opt = opt || {}
// 免登录列表
this.whiteList = [
'login-normal',
'login-code',
'login-forget',
'studentHelp',
'teacherHelp'
]
this.isMobile = /android|iphone|ipad|ipod/i.test(UA)
}
async update (to, from, next) {
if (to.name === 'studentHelp' || to.name === 'teacherHelp') {
async update(to, from, next) {
// 免登录页面
if (this.whiteList.includes(to.name)) {
next()
} else if (to.name !== 'login-normal' && to.name !== 'login-code' && to.name !== 'login-forget') { // 所有登录页 不进行登录校验
return
}
// 检测登录状态
const isLogin = await this.isLogin()
if (isLogin) {
next()
} else {
next({ path: '/login/index?rd=' + encodeURIComponent(to.fullPath) }) // 需要传参并再传回来
if (!isLogin) {
next({
path: '/login/index',
query: { rd: encodeURIComponent(to.fullPath) }
})
return
}
} else {
next()
// 移动端
if (this.isMobile && to.name !== 'mobileIndex') {
next({ path: '/mobile/list' })
return
}
next()
}
/* 获取用户信息 */
isLogin () {
isLogin() {
if (window.G.UserInfo) return true
return cAction.Other.getInfo().then(res => {
return cAction.Other.getInfo()
.then((res) => {
window.G.UserInfo = res
return true
}).catch(res => {
})
.catch((res) => {
if (res.code !== 80201) {
Message({ type: 'error', message: res.message })
}
......
......@@ -4,6 +4,7 @@
<div class="detail-box">
<div class="box-thd">
<div class="title" @click="noWantThisCourse">{{headerInfo.title}}
<template v-if="tabs[1].chapterList.course[0].chapters[0].vid">
<template v-if='headerInfo.isStart && tabs[1].chapterList.currentChapterId'>
<el-button class="rbtn" type="primary" size="mini" @click='startLearn' :data-cid='cid' :data-sid='sid' :data-type='tabs[1].chapterList.currentVideoProvider' :data-vid='tabs[1].chapterList.currentChapterId'>继续学习</el-button>
</template>
......@@ -13,6 +14,7 @@
<template v-else>
<el-button class="rbtn" type="primary" size="mini" @click='wantThisCourse'>选课</el-button>
</template>
</template>
</div>
<div class="tags">
<template v-for="(item1, index) in headerInfo.arrTab">
......
......@@ -250,7 +250,7 @@ export default [
},
{
path: 'list',
name: 'list',
name: 'mobileIndex',
component: () => import('@/pages/mobileLive/list.vue'),
props: true
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论