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

增加课程播放页面

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