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

增加课程播放页面

上级 1ef40519
......@@ -33,6 +33,6 @@ module.exports = {
},
ProvidePlugin: {},
others: {
WECHAT_REDIRECT_URL: 'https://passport2.ezijing.com'
loginUrl: 'https://login2.ezijing.com/xlearn/login/index'
}
}
......@@ -14,6 +14,6 @@ module.exports = {
},
ProvidePlugin: {},
others: {
WECHAT_REDIRECT_URL: 'https://passport.ezijing.com'
loginUrl: 'https://login.ezijing.com/xlearn/login/index'
}
}
......@@ -14,6 +14,6 @@ module.exports = {
},
ProvidePlugin: {},
others: {
WECHAT_REDIRECT_URL: 'https://passport2.ezijing.com'
loginUrl: 'https://login2.ezijing.com/xlearn/login/index'
}
}
......@@ -19,6 +19,7 @@
"window": false,
"webConf": false,
"wx": false,
"WeixinJSBridge": false
"WeixinJSBridge": false,
"Aliplayer": false
}
}
......@@ -18,7 +18,13 @@ export function getCourseList() {
* @param {string} courseId 课程ID
*/
export function getCourse(courseId) {
return httpRequest.get(`/api/zy/v2/education/courses/${courseId}`)
return httpRequest.get(`/api/zy/v2/education/courses/${courseId}`).then(response => {
response.chapters = response.chapters.filter(item => {
item.children = item.children.filter(child => child.type === 2)
return item.children.length
})
return response
})
}
/**
......
......@@ -55,6 +55,7 @@ export default {
<style lang="scss">
.search-bar {
display: flex;
align-items: center;
.el-input {
width: 240px;
......
......@@ -5,7 +5,7 @@
</template>
<template v-else>
<slot name="empty">
<div class="empty">暂无内容</div>
<div class="empty">暂无相关课程</div>
</slot>
</template>
</div>
......
......@@ -13,12 +13,11 @@
id="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no, viewport-fit=cover"
/>
<link rel="stylesheet" href="https://g.alicdn.com/de/prismplayer/2.9.1/skins/default/aliplayer-min.css" />
</head>
<body>
<div id="app"></div>
<script
type="text/javascript"
src="https://zws-imgs-pub.ezijing.com/static/build/learn-mba/static/common/runtime.js"
></script>
<script src="https://zws-imgs-pub.ezijing.com/static/build/learn-mba/static/common/runtime.js"></script>
<script src="https://g.alicdn.com/de/prismplayer/2.9.1/aliplayer-min.js"></script>
</body>
</html>
......@@ -2,11 +2,9 @@ import Vue from 'vue'
import router from './router'
import store from './store'
import App from './app.vue'
import './style.scss'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import './style.scss'
import BeforeEnter from './utils/beforeEnter'
const before = new BeforeEnter()
......
/* Automatically generated by './build/bin/build-entry.js' */
/* 模块基于 element-ui,一定在 element-ui后加载 */
import ExamModule from './exam-module'
const components = [ExamModule]
const install = function (Vue, opts = {}) {
const install = function(Vue, opts = {}) {
components.forEach(component => {
Vue.use(component, opts)
})
......
import BaseAPI from '@/api/base_api'
const httpRequest = new BaseAPI(webConf)
import httpRequest from '@/utils/axios'
/**
* 获取课程详情
......@@ -8,9 +6,13 @@ const httpRequest = new BaseAPI(webConf)
* @param {string} courseId 课程ID
*/
export function getCourse(semesterId, courseId) {
return httpRequest.get(
`/api/lms/v2/education/courses/${semesterId}/${courseId}`
)
return httpRequest.get(`/api/zy/v2/education/courses/${courseId}`).then(response => {
response.chapters = response.chapters.filter(item => {
item.children = item.children.filter(child => child.type === 2)
return item.children.length
})
return response
})
}
/**
......@@ -19,7 +21,7 @@ export function getCourse(semesterId, courseId) {
*/
export function getChapterVideo(vid) {
return httpRequest.post(
'/api/lms/v2/education/video-streaming',
'/api/zy/v2/education/video-streaming',
{ vid },
{ headers: { 'Content-Type': 'application/json' } }
)
......@@ -31,7 +33,7 @@ export function getChapterVideo(vid) {
*/
export function getChapterVideoAliyun(vid) {
return httpRequest.post(
'/api/lms/v2/education/aliyun-video-streaming',
'/api/zy/v2/education/aliyun-video-streaming',
{ vid },
{ headers: { 'Content-Type': 'application/json' } }
)
......@@ -44,10 +46,7 @@ export function getChapterVideoAliyun(vid) {
* @param {Object} params
*/
export function getChapterVideoProgress(semesterId, resourseId, params) {
return httpRequest.get(
`/api/lms/v2/education/video/${semesterId}/${resourseId}/device`,
params
)
return httpRequest.get(`/api/zy/v2/education/video/${resourseId}/device`, { params })
}
/**
......@@ -55,7 +54,7 @@ export function getChapterVideoProgress(semesterId, resourseId, params) {
* @param {Object} params
*/
export function updateChapterVideoProgress(params) {
return httpRequest.get('/api/lms/v2/analytics/upload-video', params)
return httpRequest.get('/api/zy/v2/analytics/upload-video', { params })
}
/**
......@@ -65,9 +64,7 @@ export function updateChapterVideoProgress(params) {
* @param {string} resourseId 章节的资源ID
*/
export function getChapterHomework(semesterId, courseId, resourseId) {
return httpRequest.get(
`/api/lms/v2/education/homeworks/${semesterId}/${courseId}/${resourseId}`
)
return httpRequest.get(`/api/zy/v2/education/homeworks/${courseId}/${resourseId}`)
}
/**
......@@ -77,16 +74,14 @@ export function getChapterHomework(semesterId, courseId, resourseId) {
* @param {string} chapterId 章节ID
*/
export function getChapterHomeworkDeadline(semesterId, courseId, chapterId) {
return httpRequest.get(
`/api/lms/v2/education/homeworks/${semesterId}/${courseId}/${chapterId}/deadline`
)
return httpRequest.get(`/api/zy/v2/education/homeworks/${courseId}/${chapterId}/deadline`)
}
/**
* 提交考试
*/
export function sbumitChapterHomework(params) {
return httpRequest.post('/api/lms/v2/education/homeworks', params, {
export function sbumitChapterHomework(data) {
return httpRequest.post('/api/zy/v2/education/homeworks', data, {
headers: { 'Content-Type': 'application/json' }
})
}
......@@ -95,7 +90,7 @@ export function sbumitChapterHomework(params) {
* 上传文件
*/
export function uploadFile(data) {
return httpRequest.post('/api/lms/util/upload-file', data, {
return httpRequest.post('/api/zy/util/upload-file', data, {
headers: { 'Content-Type': 'multipart/form-data' }
})
}
......@@ -106,9 +101,7 @@ export function uploadFile(data) {
* @param {string} courseId 课程ID
*/
export function getCourseWork(semesterId, courseId) {
return httpRequest.get(
`/api/lms/v2/education/courses/${semesterId}/${courseId}/essay`
)
return httpRequest.get(`/api/zy/v2/education/courses/${courseId}/essay`)
}
/**
......@@ -117,11 +110,9 @@ export function getCourseWork(semesterId, courseId) {
* @param {string} courseId 课程ID
*/
export function updateCourseWork(semesterId, courseId, data) {
return httpRequest.post(
`/api/lms/v2/education/courses/${semesterId}/${courseId}/essay`,
data,
{ headers: { 'Content-Type': 'multipart/form-data' } }
)
return httpRequest.post(`/api/zy/v2/education/courses/${courseId}/essay`, data, {
headers: { 'Content-Type': 'multipart/form-data' }
})
}
/**
......@@ -130,9 +121,7 @@ export function updateCourseWork(semesterId, courseId, data) {
* @param {string} courseId 课程ID
*/
export function getCourseExam(semesterId, courseId) {
return httpRequest.get(
`/api/lms/v2/education/${semesterId}/${courseId}/examination`
)
return httpRequest.get(`/api/zy/v2/education/${courseId}/examination`)
}
/**
......@@ -142,9 +131,7 @@ export function getCourseExam(semesterId, courseId) {
* @param {string} examId 试题ID
*/
export function getCourseExamStatus(semesterId, courseId, examId) {
return httpRequest.get(
`/api/lms/v2/education/${semesterId}/${courseId}/examination/${examId}/status`
)
return httpRequest.get(`/api/zy/v2/education/${courseId}/examination/${examId}/status`)
}
/**
......@@ -154,11 +141,9 @@ export function getCourseExamStatus(semesterId, courseId, examId) {
* @param {string} examId 试题ID
*/
export function submitCourseExam(semesterId, courseId, examId, data) {
return httpRequest.post(
`/api/lms/v2/education/${semesterId}/${courseId}/examination/${examId}/sheet`,
data,
{ headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }
)
return httpRequest.post(`/api/zy/v2/education/${courseId}/examination/${examId}/sheet`, data, {
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
})
}
/**
......@@ -168,8 +153,5 @@ export function submitCourseExam(semesterId, courseId, examId, data) {
* @param {string} examId 试题ID
*/
export function getCourseExamResult(semesterId, courseId, examId, params) {
return httpRequest.get(
`/api/lms/v2/education/${semesterId}/${courseId}/examination/${examId}/sheet`,
params
)
return httpRequest.get(`/api/zy/v2/education/${courseId}/examination/${examId}/sheet`, { params })
}
<template>
<aside class="course-viewer-aside">
<el-tabs v-model="activeName">
<el-tab-pane label="章节" name="0">
<el-tab-pane label="章节列表" name="0">
<div class="tab-pane">
<aside-chapter :data="data" :chapters="chapters" :active="active"></aside-chapter>
</div>
</el-tab-pane>
<el-tab-pane label="讲义" name="1" v-if="active && active.type === 2">
<el-tab-pane label="学习资料" name="1" v-if="active && active.type === 2">
<div class="tab-pane">
<aside-lecture :ppts="ppts" :pptIndex="pptIndex" v-on="$listeners"></aside-lecture>
</div>
......
......@@ -36,7 +36,7 @@ export default {
},
computed: {
user() {
return window.G.UserInfo ? window.G.UserInfo.student_info : {}
return this.$store.state.user
},
nickName() {
return this.user.personal_name || '匿名'
......
......@@ -34,7 +34,6 @@
</template>
<script>
import Cookies from 'js-cookie'
import { throttle } from 'lodash'
// api
import * as api from '../../api'
......@@ -57,6 +56,7 @@ export default {
// 是否跳过片头
const isSkip = window.localStorage.getItem('isSkip') === 'true'
return {
deviceId: 'jjhz92fn0.le2a6c06c9g0.thhg7ekb1f8',
videoVisible: true,
pptVisible: false,
isSkip,
......@@ -210,7 +210,7 @@ export default {
getChapterVideoProgress() {
api
.getChapterVideoProgress(this.sid, this.resourceId, {
device_id: Cookies.get('_idt')
device_id: this.deviceId
})
.then(response => {
this.progress = response
......@@ -223,12 +223,12 @@ export default {
// 更新章节视频进度
updateChapterVideoProgress(time, durations) {
// 登录用户信息
const user = window.G.UserInfo
const user = this.$store.state.user
const params = {
sid: user.student_info.id,
uid: user.id,
d: Cookies.get('_idt'),
i: Cookies.get('_idt'),
d: this.deviceId,
i: this.deviceId,
c: this.cid, // 课程ID
s: this.sid, // 学期ID
v: this.resourceId, // 视频资源ID
......
......@@ -3,23 +3,10 @@
<div class="course-viewer-main">
<!-- 顶部区域 -->
<div class="course-viewer-main-hd">
<router-link :to="`/app/learn/course-detail/${sid}/${cid}`">
<router-link :to="`/course/learn/${cid}`">
<i class="el-icon-arrow-left"></i>
</router-link>
<h1 class="course-viewer-main-hd__title">{{ detail.course_name }}</h1>
<!-- 直播的时候显示帮助按钮 -->
<template v-if="isLive">
<router-link to="/app/feedback/feedback-create" target="_blank">
<el-tooltip effect="light" content="意见反馈">
<i class="el-icon-self-fankuiyijian"></i>
</el-tooltip>
</router-link>
<router-link to="/mobile/help/student" target="_blank">
<el-tooltip effect="light" content="帮助">
<i class="el-icon-self-icon-test"></i>
</el-tooltip>
</router-link>
</template>
<div class="course-menu" @click="menuVisible = !menuVisible">
<i class="el-icon-s-unfold" v-if="menuVisible"></i>
<i class="el-icon-s-fold" v-else></i>
......@@ -122,7 +109,7 @@ export default {
type: 101
})
}
chapters.push(customeChapter)
// chapters.push(customeChapter)
return chapters
},
// 当前选中的章节
......
export default [
{
path: '/viewer/:sid/:cid',
path: '/viewer/:cid',
component: () => import('./index.vue'),
children: [
{
name: 'viewerCourseChapter',
path: ':id',
component: () => import('./components/layout.vue')
}
]
children: [{ name: 'viewerCourseChapter', path: ':id', component: () => import('./components/layout.vue') }]
}
]
......@@ -8,7 +8,7 @@
<el-input type="password" v-model="ruleForm.password" placeholder="请输入新密码"></el-input>
</el-form-item>
<el-form-item label="重复新密码" prop="passwordR">
<el-input type="password" v-model="ruleForm.passwordR" placeholder="请重复输入新密码"></el-input>
<el-input type="password" v-model="ruleForm.passwordR" placeholder="请重复新密码"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" :loading="submitLoading" @click="handleSubmit">保存</el-button>
......@@ -40,13 +40,13 @@ export default {
passwordR: ''
},
rules: {
old_password: { required: true, message: '请输入登录密码', trigger: 'blur' },
old_password: { required: true, message: '请输入密码', trigger: 'blur' },
password: [
{ required: true, message: '请输入新的登录密码', trigger: 'blur' },
{ required: true, message: '请输入新密码', trigger: 'blur' },
{ min: 6, max: 20, message: '长度为6-20个字符', trigger: 'blur' }
],
passwordR: [
{ required: true, message: '请再次输入新的登录密码', trigger: 'blur' },
{ required: true, message: '请重复新密码', trigger: 'blur' },
{ validator: validatePass, trigger: 'blur' }
]
},
......
......@@ -57,7 +57,9 @@ export default {
this.loaded = true
})
},
handleClick(data) {}
handleClick(data) {
this.$router.push({ name: 'viewerCourseChapter', params: { cid: this.courseId, id: data.id } })
}
},
beforeMount() {
this.getCourse()
......
<template>
<el-collapse v-model="activeNames">
<div element-loading-text="加载中..." v-loading="!loaded">
<el-collapse v-model="activeNames" v-if="detail.chapters.length">
<el-collapse-item :title="item.name" :name="item.id" v-for="item in detail.chapters" :key="item.id">
<ul>
<li v-for="subItem in item.tag" :key="subItem.id" @click="handleClick(subItem)">
......@@ -8,6 +9,8 @@
</ul>
</el-collapse-item>
</el-collapse>
<div class="empty" v-else>暂无相关内容</div>
</div>
</template>
<script>
......@@ -24,6 +27,7 @@ export default {
},
data() {
return {
loaded: false,
detail: { chapters: [] },
activeNames: []
}
......@@ -31,9 +35,15 @@ export default {
methods: {
// 获取知识点列表
getCourseTagList() {
api.getCourseTagList(this.courseId).then(response => {
this.loaded = false
api
.getCourseTagList(this.courseId)
.then(response => {
this.detail = response
})
.finally(() => {
this.loaded = true
})
},
handleClick(data) {
this.$router.push({ name: 'courseTagItem', params: { id: data.id } })
......
......@@ -65,7 +65,12 @@ export default {
this.$router.push({ path })
},
// 去课程视频页面
toCourseVideo() {}
toCourseVideo() {
this.$router.push({
name: 'viewerCourseChapter',
params: { cid: this.detail.course_id, id: this.detail.section_id }
})
}
},
beforeMount() {
this.getCourseTag()
......
import Layout from '@/components/layout'
import viewerRoutes from '@/modules/viewer/routes.js'
// 考证课程
const courseRoutes = [
......@@ -218,5 +219,6 @@ export default [
{ path: 'course', component: () => import(/* webpackChunkName: "my" */ '@/pages/my/course') },
{ path: 'test', component: () => import(/* webpackChunkName: "my" */ '@/pages/my/test') }
]
}
},
...viewerRoutes
]
import Vue from 'vue'
import Vuex from 'vuex'
import Cookies from 'js-cookie'
import { getUser, logout, getIsVip, createGuestUser } from '@/api/account'
Vue.use(Vuex)
......@@ -8,7 +7,6 @@ Vue.use(Vuex)
const store = new Vuex.Store({
state: {
user: {},
token: '',
isVip: false,
isLogin: false,
isIos: /iphone|ipad|ipod/i.test(navigator.userAgent),
......@@ -17,9 +15,6 @@ const store = new Vuex.Store({
guestUser: { user_id: '', student_id: '' }
},
mutations: {
setToken(state, token) {
state.token = token
},
setUser(state, user) {
state.user = user
},
......@@ -56,12 +51,10 @@ const store = new Vuex.Store({
const isLogin = await getUser()
.then(response => {
commit('setUser', response)
commit('setToken', Cookies.get('TGC'))
return true
})
.catch(() => {
commit('setUser', {})
commit('setToken', '')
return false
})
commit('setIsLogin', isLogin)
......
$--color-primary: #c01540;
/* 改变 icon 字体路径变量,必需 */
$--font-path: '~element-ui/lib/theme-chalk/fonts';
@import '~element-ui/packages/theme-chalk/src/index';
body,
h1,
h2,
......@@ -81,6 +87,10 @@ html {
-ms-text-size-adjust: 100%;
}
:root {
--main-color: #c01540;
}
body {
font-size: 14px;
line-height: 1.4;
......
......@@ -7,7 +7,8 @@ const httpRequest = axios.create({
timeout: 60000,
withCredentials: true,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
'Content-Type': 'application/x-www-form-urlencoded',
tenant: 'transport'
}
})
......@@ -35,12 +36,15 @@ httpRequest.interceptors.response.use(
return data
},
function(error) {
console.log(error)
console.log(error.response)
if (error.response) {
const { status, message } = error.response.data
if (status === 400) {
Message.error(message)
// 未登录
if (status === 403) {
// window.location.href = `${webConf.others.loginUrl}?rd=${encodeURIComponent(window.location.href)}`
}
Message.error(message || error.response.data)
return Promise.reject(error.response)
} else {
Message.error(error)
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论