提交 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,32 +3,52 @@ import cAction from '@action' ...@@ -3,32 +3,52 @@ 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') { // 免登录页面
if (this.whiteList.includes(to.name)) {
next() next()
} else if (to.name !== 'login-normal' && to.name !== 'login-code' && to.name !== 'login-forget') { // 所有登录页 不进行登录校验 return
}
// 检测登录状态
const isLogin = await this.isLogin() const isLogin = await this.isLogin()
if (isLogin) { if (!isLogin) {
next() next({
} else { path: '/login/index',
next({ path: '/login/index?rd=' + encodeURIComponent(to.fullPath) }) // 需要传参并再传回来 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 if (window.G.UserInfo) return true
return cAction.Other.getInfo().then(res => { return cAction.Other.getInfo()
.then((res) => {
window.G.UserInfo = res window.G.UserInfo = res
return true return true
}).catch(res => { })
.catch((res) => {
if (res.code !== 80201) { if (res.code !== 80201) {
Message({ type: 'error', message: res.message }) Message({ type: 'error', message: res.message })
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<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="tabs[1].chapterList.course[0].chapters[0].vid">
<template v-if='headerInfo.isStart && tabs[1].chapterList.currentChapterId'> <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> <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> </template>
...@@ -13,6 +14,7 @@ ...@@ -13,6 +14,7 @@
<template v-else> <template v-else>
<el-button class="rbtn" type="primary" size="mini" @click='wantThisCourse'>选课</el-button> <el-button class="rbtn" type="primary" size="mini" @click='wantThisCourse'>选课</el-button>
</template> </template>
</template>
</div> </div>
<div class="tags"> <div class="tags">
<template v-for="(item1, index) in headerInfo.arrTab"> <template v-for="(item1, index) in headerInfo.arrTab">
......
...@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论