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

bug fixes

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