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

移除node server

上级 14316cb5
module.exports = { module.exports = {
demain: 'dev.ezijing.com', demain: 'dev.ezijing.com',
url: 'http://dev.ezijing.com:4002/api', url: 'https://sofia-learning2.ezijing.com/api',
// apiBaseURL: '//demo-login.ezijing.com/' apiBaseURL: '/',
others: { others: {
url: '/app/learn/course' url: '/app/learn/course'
}, },
webpack: { webpack: {
externals: { externals: {
'CKEDITOR': 'window.CKEDITOR', CKEDITOR: 'window.CKEDITOR',
'VideoJs': 'window.swfobject', VideoJs: 'window.swfobject',
'Base64': 'window.Base64', Base64: 'window.Base64',
'md5': 'window.md5', md5: 'window.md5',
'regeneratorRuntime': 'window.regeneratorRuntime', regeneratorRuntime: 'window.regeneratorRuntime',
'$': 'window.$', $: 'window.$',
'Aliplayer': 'window.Aliplayer', Aliplayer: 'window.Aliplayer',
'AliPlayerComponent': 'window.AliPlayerComponent' AliPlayerComponent: 'window.AliPlayerComponent'
// 'sentNotify': 'window.sentNotify', // 'sentNotify': 'window.sentNotify',
} }
}, },
ProvidePlugin: { ProvidePlugin: {}
}
} }
module.exports = { module.exports = {
url: '//api.ezijing.com', url: '/',
DesDir: '../server/client-dist', DesDir: '../client-dist',
apiBaseURL: '/api', apiBaseURL: '/',
others: { others: {
url: '/app/learn/course' url: '/app/learn/course'
}, },
webpack: { webpack: {
externals: { externals: {
'CKEDITOR': 'window.CKEDITOR', CKEDITOR: 'window.CKEDITOR',
'VideoJs': 'window.swfobject', VideoJs: 'window.swfobject',
'Base64': 'window.Base64', Base64: 'window.Base64',
'md5': 'window.md5', md5: 'window.md5',
'regeneratorRuntime': 'window.regeneratorRuntime', regeneratorRuntime: 'window.regeneratorRuntime',
'$': 'window.$', $: 'window.$',
'Aliplayer': 'window.Aliplayer', Aliplayer: 'window.Aliplayer',
'AliPlayerComponent': 'window.AliPlayerComponent' AliPlayerComponent: 'window.AliPlayerComponent'
// 'sentNotify': 'window.sentNotify', // 'sentNotify': 'window.sentNotify',
} }
}, },
ProvidePlugin: { ProvidePlugin: {}
}
} }
module.exports = { module.exports = {
url: '//api.ezijing.com', url: '/',
DesDir: '../server/client-dist', DesDir: '../client-dist',
apiBaseURL: '/api', apiBaseURL: '/',
others: { others: {
url: '/app/learn/course' url: '/app/learn/course'
}, },
isUploadStatic: false, isUploadStatic: false,
webpack: { webpack: {
externals: { externals: {
'CKEDITOR': 'window.CKEDITOR', CKEDITOR: 'window.CKEDITOR',
'VideoJs': 'window.swfobject', VideoJs: 'window.swfobject',
'Base64': 'window.Base64', Base64: 'window.Base64',
'md5': 'window.md5', md5: 'window.md5',
'regeneratorRuntime': 'window.regeneratorRuntime', regeneratorRuntime: 'window.regeneratorRuntime',
'$': 'window.$', $: 'window.$',
'Aliplayer': 'window.Aliplayer', Aliplayer: 'window.Aliplayer',
'AliPlayerComponent': 'window.AliPlayerComponent' AliPlayerComponent: 'window.AliPlayerComponent'
// 'sentNotify': 'window.sentNotify', // 'sentNotify': 'window.sentNotify',
} }
}, },
ProvidePlugin: { ProvidePlugin: {}
}
} }
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"lodash": "^4.17.15", "lodash": "^4.17.15",
"promise.prototype.finally": "^3.1.2", "promise.prototype.finally": "^3.1.2",
"qs": "^6.9.4",
"regenerator": "^0.14.4", "regenerator": "^0.14.4",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-i18n": "^8.16.0", "vue-i18n": "^8.16.0",
......
...@@ -37,7 +37,11 @@ export default class OtherAction extends BaseACTION { ...@@ -37,7 +37,11 @@ export default class OtherAction extends BaseACTION {
*/ */
uploadFile (obj) { return Other.uploadFile(obj).then(res => res) } uploadFile (obj) { return Other.uploadFile(obj).then(res => res) }
/** /**
* 调用个人信心 - 修改密码 * 修改密码
*/ */
updatePwd (obj) { return Other.updatePwd(obj).then(res => res) } updatePwd (obj) { return Other.updatePwd(obj).then(res => res) }
/**
* 修改用户信息
*/
updateUser (obj) { return Other.updateUser(obj).then(res => res) }
} }
...@@ -4,11 +4,11 @@ export default class AffairsAPI extends BaseAPI { ...@@ -4,11 +4,11 @@ export default class AffairsAPI extends BaseAPI {
/** /**
* 获取事务类型 * 获取事务类型
*/ */
getAffairsType = () => this.get('/v2/lobby/affairs') getAffairsType = () => this.get('/api/lms/v2/lobby/affairs')
/** /**
* 获取事务类型 * 获取事务类型
*/ */
getAffairsData = (obj = {}) => this.get('/v2/lobby/processes', obj) getAffairsData = (obj = {}) => this.get('/api/lms/v2/lobby/processes', obj)
/** /**
* 提交活动申请 * 提交活动申请
* affair_id 活动名称 * affair_id 活动名称
...@@ -20,13 +20,13 @@ export default class AffairsAPI extends BaseAPI { ...@@ -20,13 +20,13 @@ export default class AffairsAPI extends BaseAPI {
* symposium_lecturer * symposium_lecturer
* 返回 {'flag' : true, 'errors' : []} * 返回 {'flag' : true, 'errors' : []}
*/ */
submitLearning = (obj = {}) => this.post('/v2/lobby/processes', obj, { headers: { 'Content-Type': 'multipart/form-data' } }) submitLearning = (obj = {}) => this.post('/api/lms/v2/lobby/processes', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
/* 删除事务 */ /* 删除事务 */
deleteAffairs = (reid) => this.delete(`/v2/lobby/processes/${reid}`, {}) deleteAffairs = (reid) => this.delete(`/api/lms/v2/lobby/processes/${reid}`, {})
/* 获取事务详情 */ /* 获取事务详情 */
getAffairsDetails = (rid) => this.get(`/v2/lobby/processes/${rid}`, {}) getAffairsDetails = (rid) => this.get(`/api/lms/v2/lobby/processes/${rid}`, {})
/* 修改事务 */ /* 修改事务 */
updateAffairs = (rid, obj = {}) => this.post(`/v2/lobby/processes/${rid}`, obj, { headers: { 'Content-Type': 'multipart/form-data' } }) updateAffairs = (rid, obj = {}) => this.post(`/api/lms/v2/lobby/processes/${rid}`, obj, { headers: { 'Content-Type': 'multipart/form-data' } })
/* 重修图片提交 */ /* 重修图片提交 */
uploadFile = (obj = {}) => this.post('/v2/lobby/tools/upload', obj, { headers: { 'Content-Type': 'multipart/form-data' } }) uploadFile = (obj = {}) => this.post('/api/lms/v2/lobby/tools/upload', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
} }
import axios from 'axios' import axios from 'axios'
import _ from 'lodash' import _ from 'lodash'
import qs from 'qs'
import { MessageBox, Message } from 'element-ui' import { MessageBox, Message } from 'element-ui'
export default class API { export default class API {
constructor (config) { constructor(config) {
/* 创建一个 自定义配置axios实例 */ /* 创建一个 自定义配置axios实例 */
// 让ajax携带cookie // 让ajax携带cookie
axios.defaults.withCredentials = true axios.defaults.withCredentials = true
...@@ -24,14 +25,16 @@ export default class API { ...@@ -24,14 +25,16 @@ export default class API {
} }
/* 获取当前Vue创建实例 */ /* 获取当前Vue创建实例 */
getVueInstance () { getVueInstance() {
return window.G.$instance_vue return window.G.$instance_vue
} }
/* 重新封装 请求时的执行函数 */ /* 重新封装 请求时的执行函数 */
_request (_config = {}) { _request(_config = {}) {
/* 具体执行请求成功后业务逻辑前,先执行该方法 */ /* 具体执行请求成功后业务逻辑前,先执行该方法 */
const beforeSuccess = _config.beforeSuccess ? _config.beforeSuccess : this._reqSuccess const beforeSuccess = _config.beforeSuccess
? _config.beforeSuccess
: this._reqSuccess
/* 具体执行请求失败后业务逻辑前,先执行该方法 */ /* 具体执行请求失败后业务逻辑前,先执行该方法 */
const beforeFail = _config.beforeFail ? _config.beforeFail : this._reqFail const beforeFail = _config.beforeFail ? _config.beforeFail : this._reqFail
const headers = { const headers = {
...@@ -40,13 +43,16 @@ export default class API { ...@@ -40,13 +43,16 @@ export default class API {
} }
_config.headers = _.assignIn(_config.headers, headers) _config.headers = _.assignIn(_config.headers, headers)
/* 判别 传输方式 */ /* 判别 传输方式 */
if (_config.headers['Content-Type'] === 'application/x-www-form-urlencoded') { if (
_config.headers['Content-Type'] === 'application/x-www-form-urlencoded'
) {
let str = '' let str = ''
const _obj = _config.data || _config.params const _obj = _config.data || _config.params
for (const key in _obj) { // for (const key in _obj) {
str += key + '=' + _obj[key] + '&' // str += key + '=' + _obj[key] + '&'
} // }
str = str.substr(0, str.length - 1) // str = str.substr(0, str.length - 1)
str = qs.stringify(_obj)
if (_config.data) { if (_config.data) {
_config.data = str _config.data = str
} else { } else {
...@@ -62,11 +68,13 @@ export default class API { ...@@ -62,11 +68,13 @@ export default class API {
_config.data = fr _config.data = fr
} }
/* 创建并根据参数发起请求 */ /* 创建并根据参数发起请求 */
return this._axios(_config) return this._axios(_config).then(
.then(beforeSuccess.bind(this), beforeFail.bind(this)) beforeSuccess.bind(this),
beforeFail.bind(this)
)
} }
setConfirm (titleStr, btnStr, msgStr) { setConfirm(titleStr, btnStr, msgStr) {
return MessageBox.confirm(msgStr, titleStr, { return MessageBox.confirm(msgStr, titleStr, {
confirmButtonText: btnStr, confirmButtonText: btnStr,
type: 'warning', type: 'warning',
...@@ -77,12 +85,16 @@ export default class API { ...@@ -77,12 +85,16 @@ export default class API {
}) })
} }
goLoginIndex (_vIn) { goLoginIndex(_vIn) {
const href = window.location.href const href = window.location.href
if (/\/login\/index/gi.test(href)) { if (/\/login\/index/gi.test(href)) {
_vIn.$router.go(0) _vIn.$router.go(0)
} else { } else {
_vIn.$router.push({ path: '/login/index?rd=' + encodeURIComponent(href.replace(/.*?\/\/.*?\//gi, '/')) }) _vIn.$router.push({
path:
'/login/index?rd=' +
encodeURIComponent(href.replace(/.*?\/\/.*?\//gi, '/'))
})
} }
} }
...@@ -91,35 +103,15 @@ export default class API { ...@@ -91,35 +103,15 @@ export default class API {
* 注意:如果不能满足需求,可在接口定义处重新实现 * 注意:如果不能满足需求,可在接口定义处重新实现
* @param {[object]} res 返回数据 * @param {[object]} res 返回数据
*/ */
_reqSuccess (res) { _reqSuccess(res) {
const _vIn = this.getVueInstance() const { data } = res
const { status, data } = res /* 带 code 参数,新接口模型 */
if (status === 200) { if (data.code !== undefined) {
/* 针对 不同的 接口做一下 统一处理 */ if (data.code !== 0 && !/get-user-info$/gi.test(res.config.url)) {
/* 带 code 参数,新接口模型 */ data.msg && Message({ type: 'error', message: data.msg })
if (data && data.code !== undefined) {
if (data.code !== 0) {
if (!/account\/get-user-info/gi.test(res.config.url)) {
data.msg && Message({ type: 'error', message: data.msg })
}
return data
} else if (data.code === 0) {
return data.data
}
} }
return data
} else if (status === 403 && !/\/getinfo$/gi.test(res.config.url)) {
/* 不带 code 参数,老接口模型 */
this.setConfirm('提示', '确定', '登录状态已过期, 请重新登录。').then(() => {
this.goLoginIndex(_vIn)
}).catch(() => {
Message({ type: 'info', message: '操作已取消,将不再记录任何数据操作,除非重新登录' })
})
} else if (status !== 200 && data.message) {
throw new Error(data.message)
} else {
throw new Error(JSON.stringify(res.data))
} }
return data
} }
/** /**
...@@ -127,28 +119,32 @@ export default class API { ...@@ -127,28 +119,32 @@ export default class API {
* 注意:如果不能满足需求,可在接口定义处重新实现 * 注意:如果不能满足需求,可在接口定义处重新实现
* @param {[object]} res 如果未到达 response 阶段,则无res.response * @param {[object]} res 如果未到达 response 阶段,则无res.response
*/ */
_reqFail (res) { _reqFail(res) {
const _vIn = this.getVueInstance() const _vIn = this.getVueInstance()
let err = null let err = null
if (res.code === 'ECONNABORTED') { if (res.code === 'ECONNABORTED') {
err = new Error('网络超时,请稍后重试') err = new Error('网络超时,请稍后重试')
} else if (res.response) { } else if (res.response) {
const { status, data } = res.response
/* 不带 code 参数,老接口模型 */ /* 不带 code 参数,老接口模型 */
if (res.response.data) { if (data) {
if (!/\/getinfo$/gi.test(res.config.url) && res.response.status === 403) { if (status === 403 && !/check-access$/gi.test(res.config.url)) {
this.setConfirm('提示', '确定', '登录状态已过期, 请重新登录。').then(() => { this.setConfirm('提示', '确定', '登录状态已过期, 请重新登录。')
this.goLoginIndex(_vIn) .then(() => {
}).catch(() => { this.goLoginIndex(_vIn)
Message({ type: 'info', message: '已取消,将不再记录任何数据操作,除非重新登录' }) })
}) .catch(() => {
Message({
type: 'info',
message: '已取消,将不再记录任何数据操作,除非重新登录'
})
})
} else if (status === 401) {
this.setConfirm('提示', '关闭', data.message).then(() => {})
} }
} else if (res.response.status === 401) {
this.setConfirm('提示', '关闭', res.response.data.message).then(() => {
_vIn.$router.go(0)
})
} }
err = new Error(res.response.data.message || JSON.stringify(res.response.data)) err = new Error(data.message || JSON.stringify(data))
err.code = res.response.data.code err.code = data.code
} else { } else {
err = new Error('msg:' + res.message + 'stack:' + res.stack) err = new Error('msg:' + res.message + 'stack:' + res.stack)
err.code = 500 err.code = 500
...@@ -158,11 +154,28 @@ export default class API { ...@@ -158,11 +154,28 @@ export default class API {
} }
/* 重新实现 get请求 */ /* 重新实现 get请求 */
get (url, data, config) { return this._request(_.assignIn({ url, method: 'GET', params: data }, config)) } get(url, data, config) {
return this._request(
_.assignIn({ url, method: 'GET', params: data }, config)
)
}
/* 重新实现 post请求 */ /* 重新实现 post请求 */
post (url, data, config) { return this._request(_.assignIn({ url, method: 'POST', data: data }, config)) } post(url, data, config) {
return this._request(
_.assignIn({ url, method: 'POST', data: data }, config)
)
}
/* 重新实现 put请求 */ /* 重新实现 put请求 */
put (url, data, config) { return this._request(_.assignIn({ url, method: 'PUT', data: data }, config)) } put(url, data, config) {
return this._request(_.assignIn({ url, method: 'PUT', data: data }, config))
}
/* 重新实现 delete请求 */ /* 重新实现 delete请求 */
delete (url, data, config) { return this._request(_.assignIn({ url, method: 'DELETE', params: data }, config)) } delete(url, data, config) {
return this._request(
_.assignIn({ url, method: 'DELETE', params: data }, config)
)
}
} }
...@@ -4,35 +4,35 @@ export default class CourseAPI extends BaseAPI { ...@@ -4,35 +4,35 @@ export default class CourseAPI extends BaseAPI {
/** /**
* 获取学期分类信息 * 获取学期分类信息
*/ */
getLearnFind = () => this.get('/v2/education/semesters', {}) getLearnFind = () => this.get('/api/lms/v2/education/semesters', {})
/** /**
* 获取所有课程列表 - 选课广场 和 我的课程 共用同一个,通过 isMy判断 * 获取所有课程列表 - 选课广场 和 我的课程 共用同一个,通过 isMy判断
* @param {[string]} isMy * @param {[string]} isMy
* @param {[object]} param * @param {[object]} param
*/ */
getCourseList = (isMy, param) => this.get('/v2/education/courses' + (isMy ? '/my' : ''), param) getCourseList = (isMy, param) => this.get('/api/lms/v2/education/courses' + (isMy ? '/my' : ''), param)
/** /**
* 获取某个课程详细信息 - 课程考核 和 课程讨论单独获取 * 获取某个课程详细信息 - 课程考核 和 课程讨论单独获取
* @param {[string]} id * @param {[string]} id
* @param {[string]} sid * @param {[string]} sid
*/ */
getCourseDetail = (id, sid) => this.get(`/v2/education/courses/${sid}/${id}`, {}) getCourseDetail = (id, sid) => this.get(`/api/lms/v2/education/courses/${sid}/${id}`, {})
/** /**
* 获取课程考核信息 * 获取课程考核信息
* @param {[string]} cid * @param {[string]} cid
* @param {[string]} sid * @param {[string]} sid
*/ */
getCourseAssess = (cid, sid) => this.get(`/v2/analytics/courses/${sid}/${cid}/evaluation`, {}) getCourseAssess = (cid, sid) => this.get(`/api/lms/v2/analytics/courses/${sid}/${cid}/evaluation`, {})
/** /**
* 选课 * 选课
* @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 }, { headers: { 'Content-Type': 'application/json' } }) selectCourse = (cid, sid) => this.post('/api/lms/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 }, { headers: { 'Content-Type': 'application/json' } }) outSelectCourse = (cid, sid) => this.post('/api/lms/v2/education/courses/drop', { course_id: cid, semester_id: sid }, { headers: { 'Content-Type': 'application/json' } })
} }
...@@ -8,7 +8,7 @@ export default class DiscussAPI extends BaseAPI { ...@@ -8,7 +8,7 @@ export default class DiscussAPI extends BaseAPI {
* @param {[string]} path * @param {[string]} path
* @param {[object]} dataJson * @param {[object]} dataJson
*/ */
getDiscussList = (path, dataJson) => this.get('/v2/qa/questions' + path, dataJson) getDiscussList = (path, dataJson) => this.get('/api/lms/v2/qa/questions' + path, dataJson)
/** /**
* 获取讨论题目列表,“课程的问题”信息 * 获取讨论题目列表,“课程的问题”信息
* dataJson.limit - 获取数量 * dataJson.limit - 获取数量
...@@ -18,50 +18,50 @@ export default class DiscussAPI extends BaseAPI { ...@@ -18,50 +18,50 @@ export default class DiscussAPI extends BaseAPI {
* @param {[string]} sid * @param {[string]} sid
* @param {[object]} dataJson * @param {[object]} dataJson
*/ */
getCourseDiscussList = (cid, sid, dataJson) => this.get(`/v2/qa/questions/course/${sid}/${cid}`, dataJson) getCourseDiscussList = (cid, sid, dataJson) => this.get(`/api/lms/v2/qa/questions/course/${sid}/${cid}`, dataJson)
/** /**
* 获取问题详情 * 获取问题详情
* @param {[string]} qid * @param {[string]} qid
*/ */
getDiscussDetail = (qid) => this.get(`/v2/qa/questions/${qid}`, {}) getDiscussDetail = (qid) => this.get(`/api/lms/v2/qa/questions/${qid}`, {})
/** /**
* 删除提问 * 删除提问
* @param {[string]} qid * @param {[string]} qid
*/ */
deleteDiscuss = (qid) => this.delete(`/v2/qa/questions/${qid}`, {}) deleteDiscuss = (qid) => this.delete(`/api/lms/v2/qa/questions/${qid}`, {})
/** /**
* 提出问题 * 提出问题
* @param {[object]} param * @param {[object]} param
*/ */
publishQues = (param) => this.post('/v2/qa/questions', param, { headers: { 'Content-Type': 'application/json' } }) publishQues = (param) => this.post('/api/lms/v2/qa/questions', param, { headers: { 'Content-Type': 'application/json' } })
/** /**
* 回答问题 * 回答问题
* @param {[object]} param * @param {[object]} param
*/ */
answerQues = (param) => this.post('/v2/qa/answers', param, { headers: { 'Content-Type': 'application/json' } }) answerQues = (param) => this.post('/api/lms/v2/qa/answers', param, { headers: { 'Content-Type': 'application/json' } })
/** /**
* 删除回答 * 删除回答
* @param {[string]} aid * @param {[string]} aid
*/ */
deleteAnswer = (aid) => this.delete(`/v2/qa/answers/${aid}`, {}) deleteAnswer = (aid) => this.delete(`/api/lms/v2/qa/answers/${aid}`, {})
/** /**
* 回复评论 * 回复评论
* @param {[object]} param * @param {[object]} param
*/ */
callbackComment = (param) => this.post('/v2/qa/comments', param, { headers: { 'Content-Type': 'application/json' } }) callbackComment = (param) => this.post('/api/lms/v2/qa/comments', param, { headers: { 'Content-Type': 'application/json' } })
/** /**
* 删除评论 * 删除评论
* @param {[string]} cid * @param {[string]} cid
*/ */
deleteComment = (cid) => this.delete(`/v2/qa/comments/${cid}`) deleteComment = (cid) => this.delete(`/api/lms/v2/qa/comments/${cid}`)
/** /**
* 点赞 * 点赞
* @param {[object]} param * @param {[object]} param
*/ */
like = (param) => this.post('/v2/qa/tags', param, { headers: { 'Content-Type': 'application/json' } }) like = (param) => this.post('/api/lms/v2/qa/tags', param, { headers: { 'Content-Type': 'application/json' } })
/** /**
* 取消点赞 * 取消点赞
* @param {[string]} tagid * @param {[string]} tagid
*/ */
unlike = (tagid) => this.delete(`/v2/qa/tags/${tagid}`, {}) unlike = (tagid) => this.delete(`/api/lms/v2/qa/tags/${tagid}`, {})
} }
...@@ -4,22 +4,22 @@ export default class FeedbackAPI extends BaseAPI { ...@@ -4,22 +4,22 @@ export default class FeedbackAPI extends BaseAPI {
/** /**
* 提交 重修课程 * 提交 重修课程
*/ */
submitRebuild = (obj = {}) => this.post('/v2/education/retake', obj, { headers: { 'Content-Type': 'multipart/form-data' } }) submitRebuild = (obj = {}) => this.post('/api/lms/v2/education/retake', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
/** /**
* 获取意见列表 * 获取意见列表
* type_id [int] * type_id [int]
* page [int] * page [int]
* pageSize [int] * pageSize [int]
*/ */
feedbackList = (obj = {}) => this.get('/v2/feedback/lists', obj, { headers: { 'Content-Type': 'multipart/form-data' } }) feedbackList = (obj = {}) => this.get('/api/lms/v2/feedback/lists', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
/** /**
* 意见反馈回复 * 意见反馈回复
* feedback_id [int] * feedback_id [int]
* contents [string] * contents [string]
*/ */
feedbackReply = (obj = {}) => this.post('/v2/feedback/reply', obj, { headers: { 'Content-Type': 'multipart/form-data' } }) feedbackReply = (obj = {}) => this.post('/api/lms/v2/feedback/reply', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
/** /**
* 意见反馈提交 * 意见反馈提交
*/ */
feedbackCommit = (obj = {}) => this.post('/v2/feedback/commit', obj, { headers: { 'Content-Type': 'multipart/form-data' } }) feedbackCommit = (obj = {}) => this.post('/api/lms/v2/feedback/commit', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
} }
...@@ -4,26 +4,26 @@ export default class GradeAPI extends BaseAPI { ...@@ -4,26 +4,26 @@ export default class GradeAPI extends BaseAPI {
/** /**
* 获取我的学分信息 * 获取我的学分信息
*/ */
getCredit = () => this.get('/v2/education/credits', {}) getCredit = () => this.get('/api/lms/v2/education/credits', {})
/** /**
* 提交 重修课程 * 提交 重修课程
*/ */
submitRebuild = (obj = {}) => this.post('/v2/education/retake', obj, { headers: { 'Content-Type': 'multipart/form-data' } }) submitRebuild = (obj = {}) => this.post('/api/lms/v2/education/retake', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
/** /**
* 获取意见列表 * 获取意见列表
* type_id [int] * type_id [int]
* page [int] * page [int]
* pageSize [int] * pageSize [int]
*/ */
feedbackList = (obj = {}) => this.get('/v2/feedback/lists', obj, { headers: { 'Content-Type': 'multipart/form-data' } }) feedbackList = (obj = {}) => this.get('/api/lms/v2/feedback/lists', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
/** /**
* 意见反馈回复 * 意见反馈回复
* feedback_id [int] * feedback_id [int]
* contents [string] * contents [string]
*/ */
feedbackReply = (obj = {}) => this.post('/v2/feedback/reply', obj, { headers: { 'Content-Type': 'multipart/form-data' } }) feedbackReply = (obj = {}) => this.post('/api/lms/v2/feedback/reply', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
/** /**
* 意见反馈提交 * 意见反馈提交
*/ */
feedbackCommit = (obj = {}) => this.post('/v2/feedback/commit', obj, { headers: { 'Content-Type': 'multipart/form-data' } }) feedbackCommit = (obj = {}) => this.post('/api/lms/v2/feedback/commit', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
} }
...@@ -3,32 +3,54 @@ import _ from 'lodash' ...@@ -3,32 +3,54 @@ import _ from 'lodash'
export default class OtherAPI extends BaseAPI { export default class OtherAPI extends BaseAPI {
/** /**
* 当前登录用户,检测是否该系统有权限 * 当前登录用户,检测是否该系统有权限
*/ */
getInfo = () => this.post('/user_center/get_user_info', {}, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) getInfo = () => this.get('/api/lms/user/getinfo')
/** /**
* 获取我的消息信息 * 获取我的消息信息
*/ */
getMyMsg = (obj) => this.get('/v2/education/message/my', obj, {}) getMyMsg = (obj) => this.get('/api/lms/v2/education/message/my', obj, {})
/** /**
* 标记已读未读 * 标记已读未读
*/ */
setMyMsg = (rid) => this.post(`/v2/education/message/${rid}`, {}) setMyMsg = (rid) => this.post(`/api/lms/v2/education/message/${rid}`, {})
getNavMsg = (rid) => this.get(`/v2/education/message/num?v=${new Date().getTime()}`, {})
getNavMsg = (rid) =>
this.get(`/api/lms/v2/education/message/num?v=${new Date().getTime()}`, {})
/** /**
* 调用退出登录 * 调用退出登录
*/ */
outLogin = () => this.post('/user_center/logout', {}, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) outLogin = () => this.get('/api/passport/rest/logout')
/** /**
* 文件提交 * 文件提交
* @param {[object]} obj * @param {[object]} obj
*/ */
uploadFile = (obj = {}) => this.post('/util/upload-file', obj, { headers: { 'Content-Type': 'multipart/form-data' } }) uploadFile = (obj = {}) =>
this.post('/api/usercenter/user/upload-image', obj, {
headers: { 'Content-Type': 'multipart/form-data' }
})
/** /**
* 个人信息 - 修改密码 * 个人信息 - 修改密码
* @param {[string]} obj.old_password 验证码 * @param {[string]} obj.old_password 验证码
* @param {[string]} obj.new_password 新的密码 * @param {[string]} obj.new_password 新的密码
* @param {[string]} obj.service 这里 一直是定值 h5.ezijing.com * @param {[string]} obj.service 这里 一直是定值 h5.ezijing.com
*/ */
updatePwd = (obj = {}) => this.post('/user_center/change_password', _.assignIn(obj, { service: 'h5.ezijing.com' }), { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) updatePwd = (obj = {}) =>
this.post(
'/api/usercenter/user/change-pwd-by-cookie',
_.assignIn(obj, { service: 'h5.ezijing.com' }),
{ headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }
)
/**
* 个人信息 - 上传头像
*/
updateUser = (obj = {}) =>
this.post('/api/usercenter/user/update-user', obj, {
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
})
} }
...@@ -7,24 +7,24 @@ export default class PlayerAPI extends BaseAPI { ...@@ -7,24 +7,24 @@ export default class PlayerAPI extends BaseAPI {
* @param {[string]} cur_semester_id -> sid * @param {[string]} cur_semester_id -> sid
* @param {[string]} cur_video_id -> vid * @param {[string]} cur_video_id -> vid
*/ */
getChapterList = (cid, sid, vid) => this.get(`/v2/education/courses/${sid}/${cid}`, {}) getChapterList = (cid, sid, vid) => this.get(`/api/lms/v2/education/courses/${sid}/${cid}`, {})
/** /**
* 获取对应某个章节的详细信息 * 获取对应某个章节的详细信息
* @param {[string]} vid * @param {[string]} vid
*/ */
getCurrentChapterDetail = (vid) => this.post('/v2/education/video-streaming', { vid }, { headers: { 'Content-Type': 'application/json' } }) getCurrentChapterDetail = (vid) => this.post('/api/lms/v2/education/video-streaming', { vid }, { headers: { 'Content-Type': 'application/json' } })
/** /**
* 获取对应某个章节的详细信息 * 获取对应某个章节的详细信息
* @param {[string]} vid * @param {[string]} vid
*/ */
getCurrentChapterDetailAliyun = (vid) => this.post('/v2/education/aliyun-video-streaming', { vid }, { headers: { 'Content-Type': 'application/json' } }) getCurrentChapterDetailAliyun = (vid) => this.post('/api/lms/v2/education/aliyun-video-streaming', { vid }, { headers: { 'Content-Type': 'application/json' } })
/** /**
* 获取进度信息 * 获取进度信息
* @param {[string]} vid * @param {[string]} vid
* @param {[string]} did * @param {[string]} did
* @param {[string]} sid * @param {[string]} sid
*/ */
getProgress = (vid, did, sid) => this.get(`/v2/education/video/${sid}/${vid}/device`, { device_id: did }) getProgress = (vid, did, sid) => this.get(`/api/lms/v2/education/video/${sid}/${vid}/device`, { device_id: did })
/** /**
* 提交进度信息 * 提交进度信息
* @param {[object]} obj * @param {[object]} obj
...@@ -37,66 +37,66 @@ export default class PlayerAPI extends BaseAPI { ...@@ -37,66 +37,66 @@ export default class PlayerAPI extends BaseAPI {
_m: obj.mpt, // 当前播放最大时间 _m: obj.mpt, // 当前播放最大时间
_c: obj.cpt // 当前播放位置 _c: obj.cpt // 当前播放位置
*/ */
updateProgress = (obj = {}) => this.get('/v2/analytics/upload-video', obj) updateProgress = (obj = {}) => this.get('/api/lms/v2/analytics/upload-video', obj)
/** /**
* 获取试题信息 * 获取试题信息
* @param {[string]} eid * @param {[string]} eid
* @param {[string]} cid * @param {[string]} cid
* @param {[string]} sid * @param {[string]} sid
*/ */
getExamDetail = (sid, cid, eid) => this.get(`/v2/education/homeworks/${sid}/${cid}/${eid}`, {}) getExamDetail = (sid, cid, eid) => this.get(`/api/lms/v2/education/homeworks/${sid}/${cid}/${eid}`, {})
/** /**
* 提交考试信息 * 提交考试信息
* @param {[object]} param * @param {[object]} param
*/ */
submitExamDetail = (param) => this.post('/v2/education/homeworks', param, { headers: { 'Content-Type': 'application/json' } }) submitExamDetail = (param) => this.post('/api/lms/v2/education/homeworks', param, { headers: { 'Content-Type': 'application/json' } })
/** /**
* 获取对应 作业或问题 回答 * 获取对应 作业或问题 回答
* @param {[string]} sid * @param {[string]} sid
* @param {[string]} cid * @param {[string]} cid
* @param {[string]} id resource_id * @param {[string]} id resource_id
*/ */
getHomework = (sid, cid, id) => this.get(`/v2/education/homeworks/${sid}/${cid}/${id}`, {}) getHomework = (sid, cid, id) => this.get(`/api/lms/v2/education/homeworks/${sid}/${cid}/${id}`, {})
/** /**
* 文件提交 * 文件提交
* @param {[object]} obj * @param {[object]} obj
*/ */
uploadFile = (obj = {}) => this.post('/util/upload-file', obj, { headers: { 'Content-Type': 'multipart/form-data' } }) uploadFile = (obj = {}) => this.post('/api/lms/util/upload-file', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
/** /**
* 提交课程 作业或问题 * 提交课程 作业或问题
*/ */
updateHomework = (obj = {}) => this.post('/v2/education/homeworks', obj, { headers: { 'Content-Type': 'multipart/form-data' } }) updateHomework = (obj = {}) => this.post('/api/lms/v2/education/homeworks', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
/** /**
* 课程作业截止时间 * 课程作业截止时间
*/ */
getHomeworkStopTime = (sid, cid, chapterId) => this.get(`/v2/education/homeworks/${sid}/${cid}/${chapterId}/deadline`, {}) getHomeworkStopTime = (sid, cid, chapterId) => this.get(`/api/lms/v2/education/homeworks/${sid}/${cid}/${chapterId}/deadline`, {})
/** /**
* 获取对应 大作业 回答 * 获取对应 大作业 回答
* @param {[string]} sid * @param {[string]} sid
* @param {[string]} cid * @param {[string]} cid
*/ */
getCourseHomework = (sid, cid) => this.get(`/v2/education/courses/${sid}/${cid}/essay`, {}) getCourseHomework = (sid, cid) => this.get(`/api/lms/v2/education/courses/${sid}/${cid}/essay`, {})
/** /**
* 提交课程 大作业 * 提交课程 大作业
* @param {[string]} sid * @param {[string]} sid
* @param {[string]} cid * @param {[string]} cid
*/ */
updateCourseHomework = (sid, cid, obj = {}) => this.post(`/v2/education/courses/${sid}/${cid}/essay`, obj, { headers: { 'Content-Type': 'multipart/form-data' } }) updateCourseHomework = (sid, cid, obj = {}) => this.post(`/api/lms/v2/education/courses/${sid}/${cid}/essay`, obj, { headers: { 'Content-Type': 'multipart/form-data' } })
/** /**
* 提交 课程考核 * 提交 课程考核
* @param {[string]} obj.sid * @param {[string]} obj.sid
* @param {[string]} obj.cid * @param {[string]} obj.cid
* @param {[string]} obj.raw (base64) * @param {[string]} obj.raw (base64)
*/ */
updateSurveyAnswer = (obj) => this.post('/v2/education/survey/answer', obj, { headers: { 'Content-Type': 'application/json' } }) updateSurveyAnswer = (obj) => this.post('/api/lms/v2/education/survey/answer', obj, { headers: { 'Content-Type': 'application/json' } })
/** /**
* 手机端 获取实时最新直播接口 * 手机端 获取实时最新直播接口
*/ */
getNewLiveMsg = (obj = {}) => this.get('/v2/education/lives/latest', obj) getNewLiveMsg = (obj = {}) => this.get('/api/lms/v2/education/lives/latest', obj)
/** /**
* 手机端 获取列表接口 * 手机端 获取列表接口
*/ */
getLiveList = (obj = {}) => this.get('/v2/education/lives/courses', obj) getLiveList = (obj = {}) => this.get('/api/lms/v2/education/lives/courses', obj)
/** /**
* 跨域接口请求 - 直接获取云课堂设置 * 跨域接口请求 - 直接获取云课堂设置
*/ */
...@@ -106,21 +106,21 @@ export default class PlayerAPI extends BaseAPI { ...@@ -106,21 +106,21 @@ export default class PlayerAPI extends BaseAPI {
* @param {[string]} course_id -> cid * @param {[string]} course_id -> cid
* @param {[string]} semester_id -> sid * @param {[string]} semester_id -> sid
*/ */
getExamInfo = (cid, sid) => this.get(`/v2/education/${sid}/${cid}/examination`, {}) getExamInfo = (cid, sid) => this.get(`/api/lms/v2/education/${sid}/${cid}/examination`, {})
/** /**
* 获取考卷结果 * 获取考卷结果
* @param {[string]} course_id -> cid * @param {[string]} course_id -> cid
* @param {[string]} semester_id -> sid * @param {[string]} semester_id -> sid
* @param {[string]} exam_id -> eid * @param {[string]} exam_id -> eid
*/ */
getExamAnswer = (cid, sid, eid, obj = {}) => this.get(`/v2/education/${sid}/${cid}/examination/${eid}/sheet`, obj) getExamAnswer = (cid, sid, eid, obj = {}) => this.get(`/api/lms/v2/education/${sid}/${cid}/examination/${eid}/sheet`, obj)
/** /**
* 获取考试状态 * 获取考试状态
* @param {[string]} course_id -> cid * @param {[string]} course_id -> cid
* @param {[string]} semester_id -> sid * @param {[string]} semester_id -> sid
* @param {[string]} exam_id -> eid * @param {[string]} exam_id -> eid
*/ */
getExamStatus = (cid, sid, eid) => this.get(`/v2/education/${sid}/${cid}/examination/${eid}/status`, {}) getExamStatus = (cid, sid, eid) => this.get(`/api/lms/v2/education/${sid}/${cid}/examination/${eid}/status`, {})
/** /**
* 提交考卷 * 提交考卷
* @param {[string]} course_id -> cid * @param {[string]} course_id -> cid
...@@ -128,5 +128,5 @@ export default class PlayerAPI extends BaseAPI { ...@@ -128,5 +128,5 @@ export default class PlayerAPI extends BaseAPI {
* @param {[string]} exam_id -> eid * @param {[string]} exam_id -> eid
* @param {[object]} obj -> 提交对象类 * @param {[object]} obj -> 提交对象类
*/ */
submitExam = (cid, sid, eid, obj = {}) => this.post(`/v2/education/${sid}/${cid}/examination/${eid}/sheet`, obj, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) submitExam = (cid, sid, eid, obj = {}) => this.post(`/api/lms/v2/education/${sid}/${cid}/examination/${eid}/sheet`, obj, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } })
} }
...@@ -4,11 +4,11 @@ export default class ReportAPI extends BaseAPI { ...@@ -4,11 +4,11 @@ export default class ReportAPI extends BaseAPI {
/** /**
* 获取所有通过报告列表 * 获取所有通过报告列表
*/ */
getReportList = () => this.get('/v2/education/symposium-report-all', {}) getReportList = () => this.get('/api/lms/v2/education/symposium-report-all', {})
/** /**
* 获取我的学术活动 * 获取我的学术活动
*/ */
getReportActiveList = () => this.get('/v2/education/symposium/my', {}) getReportActiveList = () => this.get('/api/lms/v2/education/symposium/my', {})
/** /**
* 提交活动申请 * 提交活动申请
* symposium_name 活动名称 * symposium_name 活动名称
...@@ -19,53 +19,53 @@ export default class ReportAPI extends BaseAPI { ...@@ -19,53 +19,53 @@ export default class ReportAPI extends BaseAPI {
* symposium_address 活动地点 * symposium_address 活动地点
* 返回 {'flag' : true, 'errors' : []} * 返回 {'flag' : true, 'errors' : []}
*/ */
submitReportActive = (obj = {}) => this.post('/v2/education/symposium', obj, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) submitReportActive = (obj = {}) => this.post('/api/lms/v2/education/symposium', obj, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } })
/** /**
* 获取学术活动详情 * 获取学术活动详情
*/ */
getReportActive = (rid) => this.get(`/v2/education/symposium/${rid}`, {}) getReportActive = (rid) => this.get(`/api/lms/v2/education/symposium/${rid}`, {})
/** /**
* 修改活动申请 * 修改活动申请
* 参数同上 * 参数同上
*/ */
updateReportActive = (rid, obj = {}) => this.post(`/v2/education/symposium/${rid}`, obj, { headers: { 'Content-Type': 'application/json' } }) updateReportActive = (rid, obj = {}) => this.post(`/api/lms/v2/education/symposium/${rid}`, obj, { headers: { 'Content-Type': 'application/json' } })
/** /**
* 删除活动申请 * 删除活动申请
* 参数同上 * 参数同上
*/ */
deleteReportActive = rid => this.delete(`/v2/education/symposium/${rid}`, {}) deleteReportActive = rid => this.delete(`/api/lms/v2/education/symposium/${rid}`, {})
/** /**
* 获取活动相关的学术报告 * 获取活动相关的学术报告
*/ */
getReportListAll = (rid) => this.get(`/v2/education/symposium/${rid}/report`, {}) getReportListAll = (rid) => this.get(`/api/lms/v2/education/symposium/${rid}/report`, {})
/** /**
* 提交学术报告 * 提交学术报告
* report_name 报告名称 * report_name 报告名称
* report_description 报告描述 * report_description 报告描述
* file_url 文章URL * file_url 文章URL
*/ */
submitReport = (rid, obj = {}) => this.post(`/v2/education/symposium/${rid}/report`, obj, { headers: { 'Content-Type': 'application/json' } }) submitReport = (rid, obj = {}) => this.post(`/api/lms/v2/education/symposium/${rid}/report`, obj, { headers: { 'Content-Type': 'application/json' } })
/** /**
* 获取学术报告详情 * 获取学术报告详情
*/ */
getSubmitReport = (rid, reid) => this.get(`/v2/education/symposium/report/${reid}`, {}) getSubmitReport = (rid, reid) => this.get(`/api/lms/v2/education/symposium/report/${reid}`, {})
/** /**
* 更新学术报告 * 更新学术报告
*/ */
updateSubmitReport = (rid, reid, obj = {}) => this.post(`/v2/education/symposium/${rid}/report/${reid}`, obj) updateSubmitReport = (rid, reid, obj = {}) => this.post(`/api/lms/v2/education/symposium/${rid}/report/${reid}`, obj)
/** /**
* 删除学术报告 * 删除学术报告
* 参数同上 * 参数同上
*/ */
deleteSubmitReport = (rid, reid) => this.delete(`/v2/education/symposium/report/${reid}`, {}) deleteSubmitReport = (rid, reid) => this.delete(`/api/lms/v2/education/symposium/report/${reid}`, {})
/** /**
* 获取事务类型 * 获取事务类型
*/ */
getAffairsType = () => this.get('/v2/lobby/affairs') getAffairsType = () => this.get('/api/lms/v2/lobby/affairs')
/** /**
* 获取事务类型 * 获取事务类型
*/ */
getAffairsData = (obj = {}) => this.get('/v2/lobby/processes', obj) getAffairsData = (obj = {}) => this.get('/api/lms/v2/lobby/processes', obj)
/** /**
* 提交活动申请 * 提交活动申请
* affair_id 活动名称 * affair_id 活动名称
...@@ -77,13 +77,13 @@ export default class ReportAPI extends BaseAPI { ...@@ -77,13 +77,13 @@ export default class ReportAPI extends BaseAPI {
* symposium_lecturer * symposium_lecturer
* 返回 {'flag' : true, 'errors' : []} * 返回 {'flag' : true, 'errors' : []}
*/ */
submitLearning = (obj = {}) => this.post('/v2/lobby/processes', obj) submitLearning = (obj = {}) => this.post('/api/lms/v2/lobby/processes', obj)
/* 删除事务 */ /* 删除事务 */
deleteAffairs = (reid) => this.delete(`/v2/lobby/processes/${reid}`, {}) deleteAffairs = (reid) => this.delete(`/api/lms/v2/lobby/processes/${reid}`, {})
/* 获取事务详情 */ /* 获取事务详情 */
getAffairsDetails = (rid) => this.get(`/v2/lobby/processes/${rid}`, {}) getAffairsDetails = (rid) => this.get(`/api/lms/v2/lobby/processes/${rid}`, {})
/* 修改事务 */ /* 修改事务 */
updateAffairs = (rid, obj = {}) => this.post(`/v2/lobby/processes/${rid}`, obj) updateAffairs = (rid, obj = {}) => this.post(`/api/lms/v2/lobby/processes/${rid}`, obj)
/* 重修图片提交 */ /* 重修图片提交 */
uploadFile = (obj = {}) => this.post('/v2/lobby/tools/upload', obj, { headers: { 'Content-Type': 'multipart/form-data' } }) uploadFile = (obj = {}) => this.post('/api/lms/v2/lobby/tools/upload', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
} }
import cAction from '@action' import cAction from '@action'
import { Message } from 'element-ui'
export default class Before { export default class Before {
constructor(opt) { constructor(opt) {
const UA = navigator.userAgent const UA = navigator.userAgent
...@@ -14,7 +12,7 @@ export default class Before { ...@@ -14,7 +12,7 @@ export default class Before {
'studentHelp', 'studentHelp',
'teacherHelp' 'teacherHelp'
] ]
this.isMobile = /android|iphone|ipod/i.test(UA) this.isMobile = /android|iphone|ipad|ipod/i.test(UA)
} }
async update(to, from, next) { async update(to, from, next) {
...@@ -45,13 +43,14 @@ export default class Before { ...@@ -45,13 +43,14 @@ export default class Before {
if (window.G.UserInfo) return true if (window.G.UserInfo) return true
return cAction.Other.getInfo() return cAction.Other.getInfo()
.then((res) => { .then((res) => {
window.G.UserInfo = res if (res.id) {
return true window.G.UserInfo = res
}) return true
.catch((res) => { } else {
if (res.code !== 80201) { return false
Message({ type: 'error', message: res.message })
} }
})
.catch(() => {
return false return false
}) })
} }
......
...@@ -123,15 +123,14 @@ export default { ...@@ -123,15 +123,14 @@ export default {
}, },
/* 退出登录 - 跳转方法 */ /* 退出登录 - 跳转方法 */
goOutLogin () { goOutLogin () {
cAction.Other.outLogin().then(response => { cAction.Other.outLogin()
if (response.status === 200) { .then(str => {
window.G.UserInfo = {}
this.$router.push({ path: '/login/index' }) this.$router.push({ path: '/login/index' })
} else { })
/* 出错 */ .catch(e => {
} this.$message.error(e.message)
}).catch(e => { })
this.$message.error(e.message)
})
/* 清空一下记录,然后调整到登录页 */ /* 清空一下记录,然后调整到登录页 */
// this.$router.push({ path: '/login/index' }) // this.$router.push({ path: '/login/index' })
}, },
...@@ -207,6 +206,7 @@ export default { ...@@ -207,6 +206,7 @@ export default {
width: 70px; width: 70px;
height: 70px; height: 70px;
border-radius: 50%; border-radius: 50%;
object-fit: cover;
} }
&:hover { &:hover {
.set-pic { .set-pic {
......
...@@ -7,7 +7,7 @@ const httpRequest = new BaseAPI(webConf) ...@@ -7,7 +7,7 @@ const httpRequest = new BaseAPI(webConf)
export const getDiscussList = (param) => { export const getDiscussList = (param) => {
const paramPath = param.path || '' const paramPath = param.path || ''
return httpRequest.get( return httpRequest.get(
`/v2/qa/questions${paramPath}`, `/api/lms/v2/qa/questions${paramPath}`,
param.dataJson param.dataJson
) )
} }
...@@ -17,7 +17,7 @@ export const getDiscussList = (param) => { ...@@ -17,7 +17,7 @@ export const getDiscussList = (param) => {
export const getCourseDiscussList = (param) => { export const getCourseDiscussList = (param) => {
const paramPath = param.path || '' const paramPath = param.path || ''
return httpRequest.get( return httpRequest.get(
`/v2/qa/questions/course${paramPath}`, `/api/lms/v2/qa/questions/course${paramPath}`,
param.dataJson param.dataJson
) )
} }
...@@ -26,7 +26,7 @@ export const getCourseDiscussList = (param) => { ...@@ -26,7 +26,7 @@ export const getCourseDiscussList = (param) => {
*/ */
export const deleteDiscuss = (qid) => { export const deleteDiscuss = (qid) => {
return httpRequest.delete( return httpRequest.delete(
`/v2/qa/questions/${qid}` `/api/lms/v2/qa/questions/${qid}`
) )
} }
...@@ -35,7 +35,7 @@ export const deleteDiscuss = (qid) => { ...@@ -35,7 +35,7 @@ export const deleteDiscuss = (qid) => {
*/ */
export const getDiscussDetail = (qid) => { export const getDiscussDetail = (qid) => {
return httpRequest.get( return httpRequest.get(
`/v2/qa/questions/${qid}` `/api/lms/v2/qa/questions/${qid}`
) )
} }
/** /**
...@@ -43,7 +43,7 @@ export const getDiscussDetail = (qid) => { ...@@ -43,7 +43,7 @@ export const getDiscussDetail = (qid) => {
*/ */
export const deleteComment = (cid) => { export const deleteComment = (cid) => {
return httpRequest.delete( return httpRequest.delete(
`/v2/qa/comments/${cid}` `/api/lms/v2/qa/comments/${cid}`
) )
} }
/** /**
...@@ -51,7 +51,7 @@ export const deleteComment = (cid) => { ...@@ -51,7 +51,7 @@ export const deleteComment = (cid) => {
*/ */
export const callbackComment = (param) => { export const callbackComment = (param) => {
return httpRequest.post( return httpRequest.post(
'/v2/qa/comments', '/api/lms/v2/qa/comments',
param, param,
{ headers: { 'Content-Type': 'application/json' } } { headers: { 'Content-Type': 'application/json' } }
) )
...@@ -62,7 +62,7 @@ export const callbackComment = (param) => { ...@@ -62,7 +62,7 @@ export const callbackComment = (param) => {
*/ */
export const answerQues = (param) => { export const answerQues = (param) => {
return httpRequest.post( return httpRequest.post(
'/v2/qa/answers', '/api/lms/v2/qa/answers',
param, param,
{ headers: { 'Content-Type': 'application/json' } } { headers: { 'Content-Type': 'application/json' } }
) )
...@@ -72,7 +72,7 @@ export const answerQues = (param) => { ...@@ -72,7 +72,7 @@ export const answerQues = (param) => {
*/ */
export const deleteAnswer = (aid) => { export const deleteAnswer = (aid) => {
return httpRequest.delete( return httpRequest.delete(
`/v2/qa/answers/${aid}` `/api/lms/v2/qa/answers/${aid}`
) )
} }
/** /**
...@@ -80,7 +80,7 @@ export const deleteAnswer = (aid) => { ...@@ -80,7 +80,7 @@ export const deleteAnswer = (aid) => {
*/ */
export const unlike = (tagid) => { export const unlike = (tagid) => {
return httpRequest.delete( return httpRequest.delete(
`/v2/qa/tags/${tagid}` `/api/lms/v2/qa/tags/${tagid}`
) )
} }
/** /**
...@@ -88,7 +88,7 @@ export const unlike = (tagid) => { ...@@ -88,7 +88,7 @@ export const unlike = (tagid) => {
*/ */
export const like = (param) => { export const like = (param) => {
return httpRequest.post( return httpRequest.post(
'/v2/qa/tags', '/api/lms/v2/qa/tags',
param, param,
{ headers: { 'Content-Type': 'application/json' } } { headers: { 'Content-Type': 'application/json' } }
) )
......
...@@ -7,42 +7,42 @@ export default class LoginAPI extends BaseAPI { ...@@ -7,42 +7,42 @@ export default class LoginAPI extends BaseAPI {
* @param {[string]} obj.password 密码 md5加密 * @param {[string]} obj.password 密码 md5加密
* @param {[string]} obj.service 传当前域名 * @param {[string]} obj.service 传当前域名
*/ */
userLogin = (obj = {}) => this.post('/user_center/login', obj, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) userLogin = (obj = {}) => this.post('/api/passport/rest/login', obj, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } })
/** /**
* 调用退出登录 * 调用退出登录
*/ */
outLogin = () => this.get('/user_center/logout', {}, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) outLogin = () => this.get('/api/passport/rest/logout', {}, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } })
/** /**
* 当前登录用户,检测是否该系统有权限 * 当前登录用户,检测是否该系统有权限
*/ */
getInfo = () => this.get('/user_center/get_user_info', {}, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) getInfo = () => this.get('/api/passport/account/get-user-info', {}, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } })
/** /**
* 发送验证码 * 发送验证码
* @param {[string]} obj.mobile 手机号 * @param {[string]} obj.mobile 手机号
* @param {[string]} obj.service 传当前域名 * @param {[string]} obj.service 传当前域名
*/ */
sendCode = (obj = {}) => this.post('/user_center/send_login_code', obj, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) sendCode = (obj = {}) => this.post('/api/usercenter/user/send-code', obj, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } })
/** /**
* 验证码登录 * 验证码登录
* @param {[string]} obj.mobile 手机号 * @param {[string]} obj.mobile 手机号
* @param {[string]} obj.code 验证码 * @param {[string]} obj.code 验证码
* @param {[string]} obj.service 传当前域名 * @param {[string]} obj.service 传当前域名
*/ */
codeLogin = (obj = {}) => this.post('/user_center/code_login', obj, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) codeLogin = (obj = {}) => this.post('/api/passport/rest/login', obj, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } })
/** /**
* 发送重置密码验证码 * 发送重置密码验证码
* @param {[string]} obj.contact 手机号/邮箱 * @param {[string]} obj.contact 手机号/邮箱
* @param {[string]} obj.source_type 值为 3 * @param {[string]} obj.source_type 值为 3
* @param {[string]} obj.service 传当前域名 * @param {[string]} obj.service 传当前域名
*/ */
sendResetPwdCode = (obj = {}) => this.post('/user_center/send_reset_password_code', obj, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) sendResetPwdCode = (obj = {}) => this.post('/api/usercenter/user/send-code', obj, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } })
/** /**
* 重置密码验证码确认 * 重置密码验证码确认
* @param {[string]} obj.contact 手机号/邮箱 * @param {[string]} obj.contact 手机号/邮箱
* @param {[string]} obj.code 验证码 * @param {[string]} obj.code 验证码
* @param {[string]} obj.service 传当前域名 * @param {[string]} obj.service 传当前域名
*/ */
validateCode = (obj = {}) => this.post('/user_center/validate_code', obj, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) validateCode = (obj = {}) => this.post('/api/passport/user_center/validate_code', obj, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } })
/** /**
* 重置密码 * 重置密码
* @param {[string]} obj.contact 手机号/邮箱 * @param {[string]} obj.contact 手机号/邮箱
...@@ -50,14 +50,14 @@ export default class LoginAPI extends BaseAPI { ...@@ -50,14 +50,14 @@ export default class LoginAPI extends BaseAPI {
* @param {[string]} obj.new_password 新的密码 * @param {[string]} obj.new_password 新的密码
* @param {[string]} obj.service 传当前域名 * @param {[string]} obj.service 传当前域名
*/ */
resetPwd = (obj = {}) => this.post('/user_center/reset_password', obj, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) resetPwd = (obj = {}) => this.post('/api/usercenter/user/update-pwd', obj, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } })
/** /**
* 个人信息 - 修改密码 * 个人信息 - 修改密码
* @param {[string]} obj.old_password 验证码 * @param {[string]} obj.old_password 验证码
* @param {[string]} obj.new_password 新的密码 * @param {[string]} obj.new_password 新的密码
* @param {[string]} obj.service 传当前域名 * @param {[string]} obj.service 传当前域名
*/ */
updatePwd = (obj = {}) => this.post('/user_center/change_password', obj, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) updatePwd = (obj = {}) => this.post('/api/usercenter/user/change-pwd-by-cookie', obj, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } })
/** /**
* 清空所有cookies * 清空所有cookies
*/ */
......
...@@ -110,9 +110,6 @@ export default { ...@@ -110,9 +110,6 @@ export default {
this.$refs.setAccountform.validate((valid) => { this.$refs.setAccountform.validate((valid) => {
if (valid) { if (valid) {
Login.codeLogin({ Login.codeLogin({
/* 老版 */
mobile: this.setAccount.user,
code: this.setAccount.pwd,
/* 新版 */ /* 新版 */
account: this.setAccount.user, account: this.setAccount.user,
password: this.setAccount.pwd, password: this.setAccount.pwd,
...@@ -120,7 +117,7 @@ export default { ...@@ -120,7 +117,7 @@ export default {
RememberMe: this.setAccount.isRemember ? 'true' : 'false', RememberMe: this.setAccount.isRemember ? 'true' : 'false',
service: window.location.origin service: window.location.origin
}).then(data => { }).then(data => {
if (!data) { return } if (data.code !== 0) { return }
if (data.url) { if (data.url) {
/* 查询上次跳转信息,并跳转回去 */ /* 查询上次跳转信息,并跳转回去 */
if (this.query.rd) { if (this.query.rd) {
......
<template> <template>
<div class="content-s"> <div class="content-s">
<el-steps :active="stepActive" align-center> <div class="step3">
<el-step :title="$t('LoginModule.ForgetLogin.step1')"></el-step> <el-form ref="form3" label-width="100px" :model="accountSet" :rules="accountRules" label-position="top">
<el-step :title="$t('LoginModule.ForgetLogin.step2')"></el-step> <el-row type="flex" class="row-bg" justify="center">
<el-step :title="$t('LoginModule.ForgetLogin.step3')"></el-step> <el-col :xs="24" :md="10">
</el-steps> <el-form-item prop="account" :label="$t('LoginModule.NormalLogin.account')">
<div v-if="stepActive === 1" class="step1"> <el-input v-model="accountSet.account" type="text" :placeholder="$t('LoginModule.ForgetLogin.inputStr')"></el-input>
<el-form ref="form1" :model="accountSet" :rules="accountRules" @submit.native.prevent>
<el-row>
<el-col :xs="24" :sm="5" :md="6" :lg="6" :xl="8"><el-form-item></el-form-item></el-col>
<el-col :xs="24" :sm="9" :md="8" :lg="8" :xl="5">
<el-form-item prop="account">
<el-input v-model="accountSet.account" type="text" :placeholder="$t('LoginModule.ForgetLogin.inputStr')" @keyup.enter.native="onSubmitForm1"></el-input>
</el-form-item> </el-form-item>
</el-col> <el-form-item prop="code" :label="(accountSet.type ? $t('LoginModule.ForgetLogin.mailCode') : $t('LoginModule.ForgetLogin.iphoneCode'))">
<el-col :xs="24" :sm="5" :md="4" :lg="4" :xl="3"> <el-input v-model="accountSet.code" type="text" :placeholder="$t('LoginModule.ForgetLogin.input4Code')">
<el-form-item> <el-button slot="append" type="primary" @click="sendCode">{{sendBtnText}}</el-button>
<el-button style="width: 100%;" type="primary" @click="onSubmitForm1">{{$t('LoginModule.ForgetLogin.sendCode')}}</el-button> </el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="5" :md="6" :lg="6" :xl="8"><el-form-item></el-form-item></el-col>
</el-row>
</el-form>
<slot name="go-back"></slot>
</div>
<div v-if="stepActive === 2" class="step2">
<div class="txt-title">
{{$t('LoginModule.ForgetLogin.codeStr')}}{{accountSet.account}}
</div>
<el-form ref="form2" :model="accountSet" :rules="accountRules" @submit.native.prevent>
<el-row>
<el-col :xs="24" :sm="1" :md="2" :lg="4" :xl="4"><el-form-item></el-form-item></el-col>
<el-col :xs="24" :sm="16" :md="14" :lg="11" :xl="11">
<el-form-item label-width="120px" prop="code" :label="(accountSet.type ? $t('LoginModule.ForgetLogin.mailCode') : $t('LoginModule.ForgetLogin.iphoneCode'))">
<el-input v-model="accountSet.code" type="text" :placeholder="$t('LoginModule.ForgetLogin.input4Code')"></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="6" :md="6" :lg="5" :xl="5">
<el-form-item>
<el-button style="width: 100%;" type="primary" :disabled="isSendCode" @click="sendCode">{{sendBtnText}}</el-button>
</el-form-item> </el-form-item>
</el-col> <el-form-item prop="newpwd" :label="$t('LoginModule.ForgetLogin.newPwd')">
<el-col :xs="24" :sm="1" :md="2" :lg="4" :xl="4"><el-form-item></el-form-item></el-col>
</el-row>
</el-form>
<div class="operate">
<el-row>
<el-col :span="12">
<el-button @click="goPrevStep">{{$t('LoginModule.ForgetLogin.prev')}}</el-button>
</el-col>
<el-col :span="12" style="text-align: right;">
<el-button @click="onSubmitForm2">{{$t('LoginModule.ForgetLogin.next')}}</el-button>
</el-col>
</el-row>
</div>
</div>
<div v-if="stepActive === 3" class="step3">
<el-form ref="form3" :model="accountSet" :rules="accountRules" label-position="left">
<el-row>
<el-col :xs="24" :sm="3" :md="5" :lg="6" :xl="6"><el-form-item></el-form-item></el-col>
<el-col :xs="24" :sm="18" :md="14" :lg="12" :xl="12">
<el-form-item label-width="120px" prop="newpwd" :label="$t('LoginModule.ForgetLogin.newPwd')">
<el-input v-model="accountSet.newpwd" type="password" :placeholder="$t('LoginModule.ForgetLogin.placeholder')"></el-input> <el-input v-model="accountSet.newpwd" type="password" :placeholder="$t('LoginModule.ForgetLogin.placeholder')"></el-input>
</el-form-item> </el-form-item>
<el-form-item label-width="120px" prop="repwd" :label="$t('LoginModule.ForgetLogin.repeatNewPwd')"> <el-form-item prop="repwd" :label="$t('LoginModule.ForgetLogin.repeatNewPwd')">
<el-input v-model="accountSet.repwd" type="password" :placeholder="$t('LoginModule.ForgetLogin.repeatPlaceholder')"></el-input> <el-input v-model="accountSet.repwd" type="password" :placeholder="$t('LoginModule.ForgetLogin.repeatPlaceholder')"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button style="width: 100%;" type="primary" @click="onSubmitForm3">{{$t('LoginModule.ForgetLogin.finish')}}</el-button> <el-button style="width: 100%;" type="primary" @click="onSubmitForm">{{$t('LoginModule.ForgetLogin.finish')}}</el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="3" :md="5" :lg="6" :xl="6"><el-form-item></el-form-item></el-col>
</el-row> </el-row>
</el-form> </el-form>
<slot name="go-back"></slot>
</div> </div>
<el-dialog <el-dialog
title="" title=""
...@@ -136,7 +88,6 @@ export default { ...@@ -136,7 +88,6 @@ export default {
} }
} }
return { return {
stepActive: 1,
isSendCode: false, // 是否已发送验证码 isSendCode: false, // 是否已发送验证码
timeInterval: null, // 定时器,倒计时 timeInterval: null, // 定时器,倒计时
sendBtnText: this.$t('LoginModule.ForgetLogin.sendCode'), // 按钮 文字 sendBtnText: this.$t('LoginModule.ForgetLogin.sendCode'), // 按钮 文字
...@@ -168,36 +119,11 @@ export default { ...@@ -168,36 +119,11 @@ export default {
}, },
beforeDestroy () { /* 清空倒计时 */ this.clearTime() }, beforeDestroy () { /* 清空倒计时 */ this.clearTime() },
methods: { methods: {
/* 上一步 */
goPrevStep () {
this.stepActive -= 1
/* 清空 第一步 填写内容 */
this.accountSet.account = ''
/* 清空倒计时 */
this.clearTime()
},
/* 第一步 提交 */
onSubmitForm1 () {
this.$refs.form1.validate((valid) => {
if (valid) {
/* 跳到第二步 */
this.stepActive = 2
/* 跳到第二步 并 发送验证码 */
this.sendCode()
} else {
this.$message.error(this.$t('LoginModule.ForgetLogin.checkRightStr'))
return false
}
})
},
/* 发送验证码 */ /* 发送验证码 */
sendCode () { sendCode () {
if (!this.isSendCode) { if (!this.isSendCode) {
Login.sendResetPwdCode({ Login.sendResetPwdCode({ account: this.accountSet.account }).then(res => {
contact: this.accountSet.account, if (res.code === 0) {
source_type: 3
}).then(res => {
if (res.status === 200) {
/* 发送验证码不管是否成功,都开始倒计时 */ /* 发送验证码不管是否成功,都开始倒计时 */
let time = 60 let time = 60
this.isSendCode = true this.isSendCode = true
...@@ -228,37 +154,17 @@ export default { ...@@ -228,37 +154,17 @@ export default {
this.sendBtnText = this.$t('LoginModule.ForgetLogin.sendCode') this.sendBtnText = this.$t('LoginModule.ForgetLogin.sendCode')
clearInterval(this.timeInterval) clearInterval(this.timeInterval)
}, },
/* 第二步 提交 */
onSubmitForm2 () {
this.$refs.form2.validate((valid) => {
if (valid) {
Login.validateCode({
contact: this.accountSet.account,
code: this.accountSet.code
}).then(data => {
if (data.status === 200) {
/* 跳到第三步 */
this.stepActive = 3
} else {
return new Error(JSON.stringify(data))
}
})
} else {
this.$message.error(this.$t('LoginModule.Others.formCheckStr'))
return false
}
})
},
/* 第三步 提交 */ /* 第三步 提交 */
onSubmitForm3 () { onSubmitForm () {
this.$refs.form3.validate((valid) => { this.$refs.form3.validate((valid) => {
if (valid) { if (valid) {
Login.resetPwd({ Login.resetPwd({
contact: this.accountSet.account, account: this.accountSet.account,
code: this.accountSet.code, code: this.accountSet.code,
new_password: this.accountSet.repwd password: this.accountSet.newpwd,
passwordR: this.accountSet.repwd
}).then(data => { }).then(data => {
if (data.status === 200) { if (data.code === 0) {
this.centerDialogVisible = true this.centerDialogVisible = true
} else { } else {
return new Error(JSON.stringify(data)) return new Error(JSON.stringify(data))
...@@ -285,19 +191,19 @@ export default { ...@@ -285,19 +191,19 @@ export default {
.content-s { .content-s {
position: absolute; position: absolute;
left: 50%; left: 50%;
top: 55%; top: 22%;
padding: 40px 0; padding: 20px 0;
width: 80%; width: calc(100% - 20px);
max-width: 1200px; max-width: 1000px;
box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.3); box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.3);
transform: translateX(-50%); transform: translateX(-50%);
background: #fff; background: #fff;
} }
/* forget 登录 */ /* forget 登录 */
.step1 { font-size: 16px; width: 90%; margin: 20px auto 0 auto; } .step1 { font-size: 16px; width: 90%; margin: 20px auto 0 auto; }
.step2 { font-size: 16px; width: 71%; margin: 20px auto 0 auto; } .step2 { font-size: 16px; width: 71%; margin: 20px auto 0 auto; }
.step2 .txt-title { margin-bottom: 0.3rem; color: #999; text-align: center; } .step2 .txt-title { margin-bottom: 0.3rem; color: #999; text-align: center; }
.step2 .operate { margin-top: 0.2rem; } .step2 .operate { margin-top: 0.2rem; }
.step3 { font-size: 16px; width: 80%; margin: 20px auto 0 auto; } .step3 { font-size: 16px; margin: 10px 20px 0; text-align: left;}
::v-deep .el-form-item__label{ line-height:1; }
</style> </style>
...@@ -66,16 +66,20 @@ export default { ...@@ -66,16 +66,20 @@ export default {
if (valid) { if (valid) {
Login.userLogin({ Login.userLogin({
/* 老版登录 */ /* 老版登录 */
login_name: this.setAccount.user, // login_name: this.setAccount.user,
password: md5('uokoaduw' + this.setAccount.pwd.split('').reverse().join('') + 'auhgniq'), // password: md5('uokoaduw' + this.setAccount.pwd.split('').reverse().join('') + 'auhgniq'),
/* 新版登录 */ /* 新版登录 */
account: this.setAccount.user, account: this.setAccount.user,
// password: this.setAccount.pwd, password: this.setAccount.pwd,
type: 1, type: 1,
RememberMe: this.setAccount.isRemember ? 'true' : 'false', RememberMe: this.setAccount.isRemember ? 'true' : 'false',
service: window.location.origin service: window.location.origin
}).then(res => { }).then(res => {
if (!res) { return } if (res.code !== 0) { return }
if (this.attr.url) {
window.location.href = this.attr.url
return
}
if (res.url) { if (res.url) {
/* 查询上次跳转信息,并跳转回去 */ /* 查询上次跳转信息,并跳转回去 */
if (this.query.rd) { if (this.query.rd) {
......
...@@ -8,7 +8,9 @@ const httpRequest = new BaseAPI(webConf) ...@@ -8,7 +8,9 @@ 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(`/v2/education/courses/${semesterId}/${courseId}`) return httpRequest.get(
`/api/lms/v2/education/courses/${semesterId}/${courseId}`
)
} }
/** /**
...@@ -17,7 +19,7 @@ export function getCourse(semesterId, courseId) { ...@@ -17,7 +19,7 @@ export function getCourse(semesterId, courseId) {
*/ */
export function getChapterVideo(vid) { export function getChapterVideo(vid) {
return httpRequest.post( return httpRequest.post(
'/v2/education/video-streaming', '/api/lms/v2/education/video-streaming',
{ vid }, { vid },
{ headers: { 'Content-Type': 'application/json' } } { headers: { 'Content-Type': 'application/json' } }
) )
...@@ -29,7 +31,7 @@ export function getChapterVideo(vid) { ...@@ -29,7 +31,7 @@ export function getChapterVideo(vid) {
*/ */
export function getChapterVideoAliyun(vid) { export function getChapterVideoAliyun(vid) {
return httpRequest.post( return httpRequest.post(
'/v2/education/aliyun-video-streaming', '/api/lms/v2/education/aliyun-video-streaming',
{ vid }, { vid },
{ headers: { 'Content-Type': 'application/json' } } { headers: { 'Content-Type': 'application/json' } }
) )
...@@ -43,7 +45,7 @@ export function getChapterVideoAliyun(vid) { ...@@ -43,7 +45,7 @@ export function getChapterVideoAliyun(vid) {
*/ */
export function getChapterVideoProgress(semesterId, resourseId, params) { export function getChapterVideoProgress(semesterId, resourseId, params) {
return httpRequest.get( return httpRequest.get(
`/v2/education/video/${semesterId}/${resourseId}/device`, `/api/lms/v2/education/video/${semesterId}/${resourseId}/device`,
params params
) )
} }
...@@ -53,7 +55,7 @@ export function getChapterVideoProgress(semesterId, resourseId, params) { ...@@ -53,7 +55,7 @@ export function getChapterVideoProgress(semesterId, resourseId, params) {
* @param {Object} params * @param {Object} params
*/ */
export function updateChapterVideoProgress(params) { export function updateChapterVideoProgress(params) {
return httpRequest.get('/v2/analytics/upload-video', params) return httpRequest.get('/api/lms/v2/analytics/upload-video', params)
} }
/** /**
...@@ -64,7 +66,7 @@ export function updateChapterVideoProgress(params) { ...@@ -64,7 +66,7 @@ export function updateChapterVideoProgress(params) {
*/ */
export function getChapterHomework(semesterId, courseId, resourseId) { export function getChapterHomework(semesterId, courseId, resourseId) {
return httpRequest.get( return httpRequest.get(
`/v2/education/homeworks/${semesterId}/${courseId}/${resourseId}` `/api/lms/v2/education/homeworks/${semesterId}/${courseId}/${resourseId}`
) )
} }
...@@ -76,7 +78,7 @@ export function getChapterHomework(semesterId, courseId, resourseId) { ...@@ -76,7 +78,7 @@ export function getChapterHomework(semesterId, courseId, resourseId) {
*/ */
export function getChapterHomeworkDeadline(semesterId, courseId, chapterId) { export function getChapterHomeworkDeadline(semesterId, courseId, chapterId) {
return httpRequest.get( return httpRequest.get(
`/v2/education/homeworks/${semesterId}/${courseId}/${chapterId}/deadline` `/api/lms/v2/education/homeworks/${semesterId}/${courseId}/${chapterId}/deadline`
) )
} }
...@@ -84,7 +86,7 @@ export function getChapterHomeworkDeadline(semesterId, courseId, chapterId) { ...@@ -84,7 +86,7 @@ export function getChapterHomeworkDeadline(semesterId, courseId, chapterId) {
* 提交考试 * 提交考试
*/ */
export function sbumitChapterHomework(params) { export function sbumitChapterHomework(params) {
return httpRequest.post('/v2/education/homeworks', params, { return httpRequest.post('/api/lms/v2/education/homeworks', params, {
headers: { 'Content-Type': 'application/json' } headers: { 'Content-Type': 'application/json' }
}) })
} }
...@@ -93,7 +95,7 @@ export function sbumitChapterHomework(params) { ...@@ -93,7 +95,7 @@ export function sbumitChapterHomework(params) {
* 上传文件 * 上传文件
*/ */
export function uploadFile(data) { export function uploadFile(data) {
return httpRequest.post('/util/upload-file', data, { return httpRequest.post('/api/lms/util/upload-file', data, {
headers: { 'Content-Type': 'multipart/form-data' } headers: { 'Content-Type': 'multipart/form-data' }
}) })
} }
...@@ -105,7 +107,7 @@ export function uploadFile(data) { ...@@ -105,7 +107,7 @@ export function uploadFile(data) {
*/ */
export function getCourseWork(semesterId, courseId) { export function getCourseWork(semesterId, courseId) {
return httpRequest.get( return httpRequest.get(
`/v2/education/courses/${semesterId}/${courseId}/essay` `/api/lms/v2/education/courses/${semesterId}/${courseId}/essay`
) )
} }
...@@ -116,7 +118,7 @@ export function getCourseWork(semesterId, courseId) { ...@@ -116,7 +118,7 @@ export function getCourseWork(semesterId, courseId) {
*/ */
export function updateCourseWork(semesterId, courseId, data) { export function updateCourseWork(semesterId, courseId, data) {
return httpRequest.post( return httpRequest.post(
`/v2/education/courses/${semesterId}/${courseId}/essay`, `/api/lms/v2/education/courses/${semesterId}/${courseId}/essay`,
data, data,
{ headers: { 'Content-Type': 'multipart/form-data' } } { headers: { 'Content-Type': 'multipart/form-data' } }
) )
...@@ -128,7 +130,9 @@ export function updateCourseWork(semesterId, courseId, data) { ...@@ -128,7 +130,9 @@ 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(`/v2/education/${semesterId}/${courseId}/examination`) return httpRequest.get(
`/api/lms/v2/education/${semesterId}/${courseId}/examination`
)
} }
/** /**
...@@ -139,7 +143,7 @@ export function getCourseExam(semesterId, courseId) { ...@@ -139,7 +143,7 @@ export function getCourseExam(semesterId, courseId) {
*/ */
export function getCourseExamStatus(semesterId, courseId, examId) { export function getCourseExamStatus(semesterId, courseId, examId) {
return httpRequest.get( return httpRequest.get(
`/v2/education/${semesterId}/${courseId}/examination/${examId}/status` `/api/lms/v2/education/${semesterId}/${courseId}/examination/${examId}/status`
) )
} }
...@@ -151,7 +155,7 @@ export function getCourseExamStatus(semesterId, courseId, examId) { ...@@ -151,7 +155,7 @@ export function getCourseExamStatus(semesterId, courseId, examId) {
*/ */
export function submitCourseExam(semesterId, courseId, examId, data) { export function submitCourseExam(semesterId, courseId, examId, data) {
return httpRequest.post( return httpRequest.post(
`/v2/education/${semesterId}/${courseId}/examination/${examId}/sheet`, `/api/lms/v2/education/${semesterId}/${courseId}/examination/${examId}/sheet`,
data, data,
{ headers: { 'Content-Type': 'application/x-www-form-urlencoded' } } { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }
) )
...@@ -165,7 +169,7 @@ export function submitCourseExam(semesterId, courseId, examId, data) { ...@@ -165,7 +169,7 @@ export function submitCourseExam(semesterId, courseId, examId, data) {
*/ */
export function getCourseExamResult(semesterId, courseId, examId, params) { export function getCourseExamResult(semesterId, courseId, examId, params) {
return httpRequest.get( return httpRequest.get(
`/v2/education/${semesterId}/${courseId}/examination/${examId}/sheet`, `/api/lms/v2/education/${semesterId}/${courseId}/examination/${examId}/sheet`,
params params
) )
} }
...@@ -231,7 +231,7 @@ export default { ...@@ -231,7 +231,7 @@ export default {
const user = window.G.UserInfo const user = window.G.UserInfo
const params = { const params = {
sid: user.student_info.id, sid: user.student_info.id,
uid: user.uid, uid: user.id,
d: Cookies.get('_idt'), d: Cookies.get('_idt'),
i: Cookies.get('_idt'), i: Cookies.get('_idt'),
c: this.cid, // 课程ID c: this.cid, // 课程ID
......
...@@ -68,16 +68,16 @@ export default { ...@@ -68,16 +68,16 @@ export default {
actionName: 'Other', actionName: 'Other',
functionName: 'updatePwd', functionName: 'updatePwd',
data: { data: {
old_password: md5('uokoaduw' + this.accountSetPwd.oldPwd.split('').reverse().join('') + 'auhgniq'), // old_password: md5('uokoaduw' + this.accountSetPwd.oldPwd.split('').reverse().join('') + 'auhgniq'),
new_password: this.accountSetPwd.newPwdAgain old_password: this.accountSetPwd.oldPwd,
password: this.accountSetPwd.newPwd,
passwordR: this.accountSetPwd.newPwdAgain
}, },
thenCallback: data => { thenCallback: data => {
if (data.status === 200) { if (data.code === 0) {
/* 重置密码 */ /* 重置密码 */
this.$refs.setpwdform.resetFields() this.$refs.setpwdform.resetFields()
this.$message.success('密码修改成功') this.$message.success('密码修改成功')
} else {
this.$message.error(data.message)
} }
}, },
catchCallback: () => {}, catchCallback: () => {},
......
...@@ -43,7 +43,6 @@ export default { ...@@ -43,7 +43,6 @@ export default {
components: {}, components: {},
data() { data() {
const Gu = window.G.UserInfo const Gu = window.G.UserInfo
console.log(Gu)
return { return {
imgUrl: Gu.avatar || '', imgUrl: Gu.avatar || '',
user: { user: {
...@@ -70,29 +69,6 @@ export default { ...@@ -70,29 +69,6 @@ export default {
this.file.lastModifiedDate = file.raw.lastModifiedDate this.file.lastModifiedDate = file.raw.lastModifiedDate
this.file.size = file.raw.size this.file.size = file.raw.size
this.file.avatar = file.raw this.file.avatar = file.raw
// try {
// /* 这个必然是IE */
// let stream = new ActiveXObject('ADODB.Stream') // eslint-disable-line
// stream.type = 1
// stream.open()
// // console.log(this.$refs.upFile.$el.children[0].children[1].files[0])
// debugger
// // stream.loadFromFile(filename)
// // text = stream.readText(adReadAll)
// // stream.close()
// } catch (e) {
// let reader = new FileReader() // eslint-disable-line
// reader.readAsBinaryString(this.$refs.upFile.$el.children[0].children[1].files[0]) // 这个读法是异步的
// reader.onloadend = () => {
// // 这个事件在读取结束后,无论成功或者失败都会触发
// if (reader.error) {
// /* 文件读取失败 */
// this.$message.error('文件读取失败,请重试')
// } else {
// this.file.avatar = reader.result
// }
// }
// }
}, },
uploadFile() { uploadFile() {
if (!/\.(jpg|jpeg|gif|png|bmp)$/gi.test(this.file.name)) { if (!/\.(jpg|jpeg|gif|png|bmp)$/gi.test(this.file.name)) {
...@@ -106,11 +82,10 @@ export default { ...@@ -106,11 +82,10 @@ export default {
spinner: '', spinner: '',
background: 'rgba(255, 255, 255, 0.9)' background: 'rgba(255, 255, 255, 0.9)'
}) })
action.Other.uploadFile(this.file) action.Other.uploadFile({ image: this.file.avatar })
.then(data => { .then(data => {
this.imgUrl = data.avatar this.imgUrl = data.url
window.G.UserInfo.avatar = data.avatar this.updateUser()
this.filesArr.pop()
}) })
.catch(() => { .catch(() => {
this.filesArr.pop() this.filesArr.pop()
...@@ -118,6 +93,13 @@ export default { ...@@ -118,6 +93,13 @@ export default {
.finally(() => { .finally(() => {
loading.close() loading.close()
}) })
},
updateUser() {
action.Other.updateUser({
SsoBasicUser: { info: { avatar: this.imgUrl } }
}).then(data => {
window.G.UserInfo.avatar = this.imgUrl
})
} }
} }
} }
...@@ -137,12 +119,9 @@ export default { ...@@ -137,12 +119,9 @@ export default {
border-radius: 50%; border-radius: 50%;
overflow: hidden; overflow: hidden;
img { img {
position: absolute;
top: 50%;
left: 50%;
width: 100%; width: 100%;
height: 100%; height: 100%;
transform: translate(-50%, -50%); object-fit: cover;
} }
} }
.info { .info {
......
...@@ -286,7 +286,7 @@ export default { ...@@ -286,7 +286,7 @@ export default {
const _userInfo = window.G.UserInfo const _userInfo = window.G.UserInfo
cAction.Player.updateProgress({ cAction.Player.updateProgress({
sid: (_userInfo && _userInfo.student_info && _userInfo.student_info.id) || '', sid: (_userInfo && _userInfo.student_info && _userInfo.student_info.id) || '',
uid: (_userInfo && _userInfo.uid) || '', uid: (_userInfo && _userInfo.id) || '',
d: cTool.other.getIdt(), d: cTool.other.getIdt(),
i: cTool.other.getIdt(), i: cTool.other.getIdt(),
c: this.cid, c: this.cid,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论