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

移除node server

上级 14316cb5
module.exports = {
demain: 'dev.ezijing.com',
url: 'http://dev.ezijing.com:4002/api',
// apiBaseURL: '//demo-login.ezijing.com/'
url: 'https://sofia-learning2.ezijing.com/api',
apiBaseURL: '/',
others: {
url: '/app/learn/course'
},
webpack: {
externals: {
'CKEDITOR': 'window.CKEDITOR',
'VideoJs': 'window.swfobject',
'Base64': 'window.Base64',
'md5': 'window.md5',
'regeneratorRuntime': 'window.regeneratorRuntime',
'$': 'window.$',
'Aliplayer': 'window.Aliplayer',
'AliPlayerComponent': 'window.AliPlayerComponent'
CKEDITOR: 'window.CKEDITOR',
VideoJs: 'window.swfobject',
Base64: 'window.Base64',
md5: 'window.md5',
regeneratorRuntime: 'window.regeneratorRuntime',
$: 'window.$',
Aliplayer: 'window.Aliplayer',
AliPlayerComponent: 'window.AliPlayerComponent'
// 'sentNotify': 'window.sentNotify',
}
},
ProvidePlugin: {
}
ProvidePlugin: {}
}
module.exports = {
url: '//api.ezijing.com',
DesDir: '../server/client-dist',
apiBaseURL: '/api',
url: '/',
DesDir: '../client-dist',
apiBaseURL: '/',
others: {
url: '/app/learn/course'
},
webpack: {
externals: {
'CKEDITOR': 'window.CKEDITOR',
'VideoJs': 'window.swfobject',
'Base64': 'window.Base64',
'md5': 'window.md5',
'regeneratorRuntime': 'window.regeneratorRuntime',
'$': 'window.$',
'Aliplayer': 'window.Aliplayer',
'AliPlayerComponent': 'window.AliPlayerComponent'
CKEDITOR: 'window.CKEDITOR',
VideoJs: 'window.swfobject',
Base64: 'window.Base64',
md5: 'window.md5',
regeneratorRuntime: 'window.regeneratorRuntime',
$: 'window.$',
Aliplayer: 'window.Aliplayer',
AliPlayerComponent: 'window.AliPlayerComponent'
// 'sentNotify': 'window.sentNotify',
}
},
ProvidePlugin: {
}
ProvidePlugin: {}
}
module.exports = {
url: '//api.ezijing.com',
DesDir: '../server/client-dist',
apiBaseURL: '/api',
url: '/',
DesDir: '../client-dist',
apiBaseURL: '/',
others: {
url: '/app/learn/course'
},
isUploadStatic: false,
webpack: {
externals: {
'CKEDITOR': 'window.CKEDITOR',
'VideoJs': 'window.swfobject',
'Base64': 'window.Base64',
'md5': 'window.md5',
'regeneratorRuntime': 'window.regeneratorRuntime',
'$': 'window.$',
'Aliplayer': 'window.Aliplayer',
'AliPlayerComponent': 'window.AliPlayerComponent'
CKEDITOR: 'window.CKEDITOR',
VideoJs: 'window.swfobject',
Base64: 'window.Base64',
md5: 'window.md5',
regeneratorRuntime: 'window.regeneratorRuntime',
$: 'window.$',
Aliplayer: 'window.Aliplayer',
AliPlayerComponent: 'window.AliPlayerComponent'
// 'sentNotify': 'window.sentNotify',
}
},
ProvidePlugin: {
}
ProvidePlugin: {}
}
......@@ -69,6 +69,7 @@
"js-cookie": "^2.2.1",
"lodash": "^4.17.15",
"promise.prototype.finally": "^3.1.2",
"qs": "^6.9.4",
"regenerator": "^0.14.4",
"vue": "^2.6.11",
"vue-i18n": "^8.16.0",
......
......@@ -37,7 +37,11 @@ export default class OtherAction extends BaseACTION {
*/
uploadFile (obj) { return Other.uploadFile(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 {
/**
* 获取事务类型
*/
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 活动名称
......@@ -20,13 +20,13 @@ export default class AffairsAPI extends BaseAPI {
* symposium_lecturer
* 返回 {'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 _ from 'lodash'
import qs from 'qs'
import { MessageBox, Message } from 'element-ui'
export default class API {
constructor (config) {
constructor(config) {
/* 创建一个 自定义配置axios实例 */
// 让ajax携带cookie
axios.defaults.withCredentials = true
......@@ -24,14 +25,16 @@ export default class API {
}
/* 获取当前Vue创建实例 */
getVueInstance () {
getVueInstance() {
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 headers = {
......@@ -40,13 +43,16 @@ export default class API {
}
_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 = ''
const _obj = _config.data || _config.params
for (const key in _obj) {
str += key + '=' + _obj[key] + '&'
}
str = str.substr(0, str.length - 1)
// for (const key in _obj) {
// str += key + '=' + _obj[key] + '&'
// }
// str = str.substr(0, str.length - 1)
str = qs.stringify(_obj)
if (_config.data) {
_config.data = str
} else {
......@@ -62,11 +68,13 @@ export default class API {
_config.data = fr
}
/* 创建并根据参数发起请求 */
return this._axios(_config)
.then(beforeSuccess.bind(this), beforeFail.bind(this))
return this._axios(_config).then(
beforeSuccess.bind(this),
beforeFail.bind(this)
)
}
setConfirm (titleStr, btnStr, msgStr) {
setConfirm(titleStr, btnStr, msgStr) {
return MessageBox.confirm(msgStr, titleStr, {
confirmButtonText: btnStr,
type: 'warning',
......@@ -77,12 +85,16 @@ export default class API {
})
}
goLoginIndex (_vIn) {
goLoginIndex(_vIn) {
const href = window.location.href
if (/\/login\/index/gi.test(href)) {
_vIn.$router.go(0)
} 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 {
* 注意:如果不能满足需求,可在接口定义处重新实现
* @param {[object]} res 返回数据
*/
_reqSuccess (res) {
const _vIn = this.getVueInstance()
const { status, data } = res
if (status === 200) {
/* 针对 不同的 接口做一下 统一处理 */
_reqSuccess(res) {
const { data } = res
/* 带 code 参数,新接口模型 */
if (data && data.code !== undefined) {
if (data.code !== 0) {
if (!/account\/get-user-info/gi.test(res.config.url)) {
if (data.code !== undefined) {
if (data.code !== 0 && !/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))
}
}
/**
......@@ -127,28 +119,32 @@ export default class API {
* 注意:如果不能满足需求,可在接口定义处重新实现
* @param {[object]} res 如果未到达 response 阶段,则无res.response
*/
_reqFail (res) {
_reqFail(res) {
const _vIn = this.getVueInstance()
let err = null
if (res.code === 'ECONNABORTED') {
err = new Error('网络超时,请稍后重试')
} else if (res.response) {
const { status, data } = res.response
/* 不带 code 参数,老接口模型 */
if (res.response.data) {
if (!/\/getinfo$/gi.test(res.config.url) && res.response.status === 403) {
this.setConfirm('提示', '确定', '登录状态已过期, 请重新登录。').then(() => {
if (data) {
if (status === 403 && !/check-access$/gi.test(res.config.url)) {
this.setConfirm('提示', '确定', '登录状态已过期, 请重新登录。')
.then(() => {
this.goLoginIndex(_vIn)
}).catch(() => {
Message({ type: 'info', message: '已取消,将不再记录任何数据操作,除非重新登录' })
})
}
} else if (res.response.status === 401) {
this.setConfirm('提示', '关闭', res.response.data.message).then(() => {
_vIn.$router.go(0)
.catch(() => {
Message({
type: 'info',
message: '已取消,将不再记录任何数据操作,除非重新登录'
})
})
} else if (status === 401) {
this.setConfirm('提示', '关闭', data.message).then(() => {})
}
err = new Error(res.response.data.message || JSON.stringify(res.response.data))
err.code = res.response.data.code
}
err = new Error(data.message || JSON.stringify(data))
err.code = data.code
} else {
err = new Error('msg:' + res.message + 'stack:' + res.stack)
err.code = 500
......@@ -158,11 +154,28 @@ export default class API {
}
/* 重新实现 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 (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 (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 (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 {
/**
* 获取学期分类信息
*/
getLearnFind = () => this.get('/v2/education/semesters', {})
getLearnFind = () => this.get('/api/lms/v2/education/semesters', {})
/**
* 获取所有课程列表 - 选课广场 和 我的课程 共用同一个,通过 isMy判断
* @param {[string]} isMy
* @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]} 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]} 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]} 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]} 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 {
* @param {[string]} path
* @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 - 获取数量
......@@ -18,50 +18,50 @@ export default class DiscussAPI extends BaseAPI {
* @param {[string]} sid
* @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
*/
getDiscussDetail = (qid) => this.get(`/v2/qa/questions/${qid}`, {})
getDiscussDetail = (qid) => this.get(`/api/lms/v2/qa/questions/${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
*/
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
*/
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
*/
deleteAnswer = (aid) => this.delete(`/v2/qa/answers/${aid}`, {})
deleteAnswer = (aid) => this.delete(`/api/lms/v2/qa/answers/${aid}`, {})
/**
* 回复评论
* @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
*/
deleteComment = (cid) => this.delete(`/v2/qa/comments/${cid}`)
deleteComment = (cid) => this.delete(`/api/lms/v2/qa/comments/${cid}`)
/**
* 点赞
* @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
*/
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 {
/**
* 提交 重修课程
*/
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]
* page [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]
* 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 {
/**
* 获取我的学分信息
*/
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]
* page [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]
* 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' } })
}
......@@ -5,30 +5,52 @@ 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}`, {})
getNavMsg = (rid) => this.get(`/v2/education/message/num?v=${new Date().getTime()}`, {})
setMyMsg = (rid) => this.post(`/api/lms/v2/education/message/${rid}`, {})
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
*/
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.new_password 新的密码
* @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 {
* @param {[string]} cur_semester_id -> sid
* @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
*/
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
*/
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]} did
* @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
......@@ -37,66 +37,66 @@ export default class PlayerAPI extends BaseAPI {
_m: obj.mpt, // 当前播放最大时间
_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]} cid
* @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
*/
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]} cid
* @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
*/
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]} 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]} 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.cid
* @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 {
* @param {[string]} course_id -> cid
* @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]} semester_id -> sid
* @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]} semester_id -> sid
* @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
......@@ -128,5 +128,5 @@ export default class PlayerAPI extends BaseAPI {
* @param {[string]} exam_id -> eid
* @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 {
/**
* 获取所有通过报告列表
*/
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 活动名称
......@@ -19,53 +19,53 @@ export default class ReportAPI extends BaseAPI {
* symposium_address 活动地点
* 返回 {'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_description 报告描述
* 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 活动名称
......@@ -77,13 +77,13 @@ export default class ReportAPI extends BaseAPI {
* symposium_lecturer
* 返回 {'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 { Message } from 'element-ui'
export default class Before {
constructor(opt) {
const UA = navigator.userAgent
......@@ -14,7 +12,7 @@ export default class Before {
'studentHelp',
'teacherHelp'
]
this.isMobile = /android|iphone|ipod/i.test(UA)
this.isMobile = /android|iphone|ipad|ipod/i.test(UA)
}
async update(to, from, next) {
......@@ -45,13 +43,14 @@ export default class Before {
if (window.G.UserInfo) return true
return cAction.Other.getInfo()
.then((res) => {
if (res.id) {
window.G.UserInfo = res
return true
})
.catch((res) => {
if (res.code !== 80201) {
Message({ type: 'error', message: res.message })
} else {
return false
}
})
.catch(() => {
return false
})
}
......
......@@ -123,13 +123,12 @@ export default {
},
/* 退出登录 - 跳转方法 */
goOutLogin () {
cAction.Other.outLogin().then(response => {
if (response.status === 200) {
cAction.Other.outLogin()
.then(str => {
window.G.UserInfo = {}
this.$router.push({ path: '/login/index' })
} else {
/* 出错 */
}
}).catch(e => {
})
.catch(e => {
this.$message.error(e.message)
})
/* 清空一下记录,然后调整到登录页 */
......@@ -207,6 +206,7 @@ export default {
width: 70px;
height: 70px;
border-radius: 50%;
object-fit: cover;
}
&:hover {
.set-pic {
......
......@@ -7,7 +7,7 @@ const httpRequest = new BaseAPI(webConf)
export const getDiscussList = (param) => {
const paramPath = param.path || ''
return httpRequest.get(
`/v2/qa/questions${paramPath}`,
`/api/lms/v2/qa/questions${paramPath}`,
param.dataJson
)
}
......@@ -17,7 +17,7 @@ export const getDiscussList = (param) => {
export const getCourseDiscussList = (param) => {
const paramPath = param.path || ''
return httpRequest.get(
`/v2/qa/questions/course${paramPath}`,
`/api/lms/v2/qa/questions/course${paramPath}`,
param.dataJson
)
}
......@@ -26,7 +26,7 @@ export const getCourseDiscussList = (param) => {
*/
export const deleteDiscuss = (qid) => {
return httpRequest.delete(
`/v2/qa/questions/${qid}`
`/api/lms/v2/qa/questions/${qid}`
)
}
......@@ -35,7 +35,7 @@ export const deleteDiscuss = (qid) => {
*/
export const getDiscussDetail = (qid) => {
return httpRequest.get(
`/v2/qa/questions/${qid}`
`/api/lms/v2/qa/questions/${qid}`
)
}
/**
......@@ -43,7 +43,7 @@ export const getDiscussDetail = (qid) => {
*/
export const deleteComment = (cid) => {
return httpRequest.delete(
`/v2/qa/comments/${cid}`
`/api/lms/v2/qa/comments/${cid}`
)
}
/**
......@@ -51,7 +51,7 @@ export const deleteComment = (cid) => {
*/
export const callbackComment = (param) => {
return httpRequest.post(
'/v2/qa/comments',
'/api/lms/v2/qa/comments',
param,
{ headers: { 'Content-Type': 'application/json' } }
)
......@@ -62,7 +62,7 @@ export const callbackComment = (param) => {
*/
export const answerQues = (param) => {
return httpRequest.post(
'/v2/qa/answers',
'/api/lms/v2/qa/answers',
param,
{ headers: { 'Content-Type': 'application/json' } }
)
......@@ -72,7 +72,7 @@ export const answerQues = (param) => {
*/
export const deleteAnswer = (aid) => {
return httpRequest.delete(
`/v2/qa/answers/${aid}`
`/api/lms/v2/qa/answers/${aid}`
)
}
/**
......@@ -80,7 +80,7 @@ export const deleteAnswer = (aid) => {
*/
export const unlike = (tagid) => {
return httpRequest.delete(
`/v2/qa/tags/${tagid}`
`/api/lms/v2/qa/tags/${tagid}`
)
}
/**
......@@ -88,7 +88,7 @@ export const unlike = (tagid) => {
*/
export const like = (param) => {
return httpRequest.post(
'/v2/qa/tags',
'/api/lms/v2/qa/tags',
param,
{ headers: { 'Content-Type': 'application/json' } }
)
......
......@@ -7,42 +7,42 @@ export default class LoginAPI extends BaseAPI {
* @param {[string]} obj.password 密码 md5加密
* @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.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.code 验证码
* @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.source_type 值为 3
* @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.code 验证码
* @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 手机号/邮箱
......@@ -50,14 +50,14 @@ export default class LoginAPI extends BaseAPI {
* @param {[string]} obj.new_password 新的密码
* @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.new_password 新的密码
* @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
*/
......
......@@ -110,9 +110,6 @@ export default {
this.$refs.setAccountform.validate((valid) => {
if (valid) {
Login.codeLogin({
/* 老版 */
mobile: this.setAccount.user,
code: this.setAccount.pwd,
/* 新版 */
account: this.setAccount.user,
password: this.setAccount.pwd,
......@@ -120,7 +117,7 @@ export default {
RememberMe: this.setAccount.isRemember ? 'true' : 'false',
service: window.location.origin
}).then(data => {
if (!data) { return }
if (data.code !== 0) { return }
if (data.url) {
/* 查询上次跳转信息,并跳转回去 */
if (this.query.rd) {
......
<template>
<div class="content-s">
<el-steps :active="stepActive" align-center>
<el-step :title="$t('LoginModule.ForgetLogin.step1')"></el-step>
<el-step :title="$t('LoginModule.ForgetLogin.step2')"></el-step>
<el-step :title="$t('LoginModule.ForgetLogin.step3')"></el-step>
</el-steps>
<div v-if="stepActive === 1" class="step1">
<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>
<div class="step3">
<el-form ref="form3" label-width="100px" :model="accountSet" :rules="accountRules" label-position="top">
<el-row type="flex" class="row-bg" justify="center">
<el-col :xs="24" :md="10">
<el-form-item prop="account" :label="$t('LoginModule.NormalLogin.account')">
<el-input v-model="accountSet.account" type="text" :placeholder="$t('LoginModule.ForgetLogin.inputStr')"></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="5" :md="4" :lg="4" :xl="3">
<el-form-item>
<el-button style="width: 100%;" type="primary" @click="onSubmitForm1">{{$t('LoginModule.ForgetLogin.sendCode')}}</el-button>
<el-form-item 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-button slot="append" type="primary" @click="sendCode">{{sendBtnText}}</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-col>
<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-form-item prop="newpwd" :label="$t('LoginModule.ForgetLogin.newPwd')">
<el-input v-model="accountSet.newpwd" type="password" :placeholder="$t('LoginModule.ForgetLogin.placeholder')"></el-input>
</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-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-col>
<el-col :xs="24" :sm="3" :md="5" :lg="6" :xl="6"><el-form-item></el-form-item></el-col>
</el-row>
</el-form>
<slot name="go-back"></slot>
</div>
<el-dialog
title=""
......@@ -136,7 +88,6 @@ export default {
}
}
return {
stepActive: 1,
isSendCode: false, // 是否已发送验证码
timeInterval: null, // 定时器,倒计时
sendBtnText: this.$t('LoginModule.ForgetLogin.sendCode'), // 按钮 文字
......@@ -168,36 +119,11 @@ export default {
},
beforeDestroy () { /* 清空倒计时 */ this.clearTime() },
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 () {
if (!this.isSendCode) {
Login.sendResetPwdCode({
contact: this.accountSet.account,
source_type: 3
}).then(res => {
if (res.status === 200) {
Login.sendResetPwdCode({ account: this.accountSet.account }).then(res => {
if (res.code === 0) {
/* 发送验证码不管是否成功,都开始倒计时 */
let time = 60
this.isSendCode = true
......@@ -228,37 +154,17 @@ export default {
this.sendBtnText = this.$t('LoginModule.ForgetLogin.sendCode')
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) => {
if (valid) {
Login.resetPwd({
contact: this.accountSet.account,
account: this.accountSet.account,
code: this.accountSet.code,
new_password: this.accountSet.repwd
password: this.accountSet.newpwd,
passwordR: this.accountSet.repwd
}).then(data => {
if (data.status === 200) {
if (data.code === 0) {
this.centerDialogVisible = true
} else {
return new Error(JSON.stringify(data))
......@@ -285,19 +191,19 @@ export default {
.content-s {
position: absolute;
left: 50%;
top: 55%;
padding: 40px 0;
width: 80%;
max-width: 1200px;
top: 22%;
padding: 20px 0;
width: calc(100% - 20px);
max-width: 1000px;
box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.3);
transform: translateX(-50%);
background: #fff;
}
/* forget 登录 */
.step1 { font-size: 16px; width: 90%; 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 .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>
......@@ -66,16 +66,20 @@ export default {
if (valid) {
Login.userLogin({
/* 老版登录 */
login_name: this.setAccount.user,
password: md5('uokoaduw' + this.setAccount.pwd.split('').reverse().join('') + 'auhgniq'),
// login_name: this.setAccount.user,
// password: md5('uokoaduw' + this.setAccount.pwd.split('').reverse().join('') + 'auhgniq'),
/* 新版登录 */
account: this.setAccount.user,
// password: this.setAccount.pwd,
password: this.setAccount.pwd,
type: 1,
RememberMe: this.setAccount.isRemember ? 'true' : 'false',
service: window.location.origin
}).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 (this.query.rd) {
......
......@@ -8,7 +8,9 @@ const httpRequest = new BaseAPI(webConf)
* @param {string} courseId 课程ID
*/
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) {
*/
export function getChapterVideo(vid) {
return httpRequest.post(
'/v2/education/video-streaming',
'/api/lms/v2/education/video-streaming',
{ vid },
{ headers: { 'Content-Type': 'application/json' } }
)
......@@ -29,7 +31,7 @@ export function getChapterVideo(vid) {
*/
export function getChapterVideoAliyun(vid) {
return httpRequest.post(
'/v2/education/aliyun-video-streaming',
'/api/lms/v2/education/aliyun-video-streaming',
{ vid },
{ headers: { 'Content-Type': 'application/json' } }
)
......@@ -43,7 +45,7 @@ export function getChapterVideoAliyun(vid) {
*/
export function getChapterVideoProgress(semesterId, resourseId, params) {
return httpRequest.get(
`/v2/education/video/${semesterId}/${resourseId}/device`,
`/api/lms/v2/education/video/${semesterId}/${resourseId}/device`,
params
)
}
......@@ -53,7 +55,7 @@ export function getChapterVideoProgress(semesterId, resourseId, params) {
* @param {Object} 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) {
*/
export function getChapterHomework(semesterId, courseId, resourseId) {
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) {
*/
export function getChapterHomeworkDeadline(semesterId, courseId, chapterId) {
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) {
* 提交考试
*/
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' }
})
}
......@@ -93,7 +95,7 @@ export function sbumitChapterHomework(params) {
* 上传文件
*/
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' }
})
}
......@@ -105,7 +107,7 @@ export function uploadFile(data) {
*/
export function getCourseWork(semesterId, courseId) {
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) {
*/
export function updateCourseWork(semesterId, courseId, data) {
return httpRequest.post(
`/v2/education/courses/${semesterId}/${courseId}/essay`,
`/api/lms/v2/education/courses/${semesterId}/${courseId}/essay`,
data,
{ headers: { 'Content-Type': 'multipart/form-data' } }
)
......@@ -128,7 +130,9 @@ export function updateCourseWork(semesterId, courseId, data) {
* @param {string} courseId 课程ID
*/
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) {
*/
export function getCourseExamStatus(semesterId, courseId, examId) {
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) {
*/
export function submitCourseExam(semesterId, courseId, examId, data) {
return httpRequest.post(
`/v2/education/${semesterId}/${courseId}/examination/${examId}/sheet`,
`/api/lms/v2/education/${semesterId}/${courseId}/examination/${examId}/sheet`,
data,
{ headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }
)
......@@ -165,7 +169,7 @@ export function submitCourseExam(semesterId, courseId, examId, data) {
*/
export function getCourseExamResult(semesterId, courseId, examId, params) {
return httpRequest.get(
`/v2/education/${semesterId}/${courseId}/examination/${examId}/sheet`,
`/api/lms/v2/education/${semesterId}/${courseId}/examination/${examId}/sheet`,
params
)
}
......@@ -231,7 +231,7 @@ export default {
const user = window.G.UserInfo
const params = {
sid: user.student_info.id,
uid: user.uid,
uid: user.id,
d: Cookies.get('_idt'),
i: Cookies.get('_idt'),
c: this.cid, // 课程ID
......
......@@ -68,16 +68,16 @@ export default {
actionName: 'Other',
functionName: 'updatePwd',
data: {
old_password: md5('uokoaduw' + this.accountSetPwd.oldPwd.split('').reverse().join('') + 'auhgniq'),
new_password: this.accountSetPwd.newPwdAgain
// old_password: md5('uokoaduw' + this.accountSetPwd.oldPwd.split('').reverse().join('') + 'auhgniq'),
old_password: this.accountSetPwd.oldPwd,
password: this.accountSetPwd.newPwd,
passwordR: this.accountSetPwd.newPwdAgain
},
thenCallback: data => {
if (data.status === 200) {
if (data.code === 0) {
/* 重置密码 */
this.$refs.setpwdform.resetFields()
this.$message.success('密码修改成功')
} else {
this.$message.error(data.message)
}
},
catchCallback: () => {},
......
......@@ -43,7 +43,6 @@ export default {
components: {},
data() {
const Gu = window.G.UserInfo
console.log(Gu)
return {
imgUrl: Gu.avatar || '',
user: {
......@@ -70,29 +69,6 @@ export default {
this.file.lastModifiedDate = file.raw.lastModifiedDate
this.file.size = file.raw.size
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() {
if (!/\.(jpg|jpeg|gif|png|bmp)$/gi.test(this.file.name)) {
......@@ -106,11 +82,10 @@ export default {
spinner: '',
background: 'rgba(255, 255, 255, 0.9)'
})
action.Other.uploadFile(this.file)
action.Other.uploadFile({ image: this.file.avatar })
.then(data => {
this.imgUrl = data.avatar
window.G.UserInfo.avatar = data.avatar
this.filesArr.pop()
this.imgUrl = data.url
this.updateUser()
})
.catch(() => {
this.filesArr.pop()
......@@ -118,6 +93,13 @@ export default {
.finally(() => {
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 {
border-radius: 50%;
overflow: hidden;
img {
position: absolute;
top: 50%;
left: 50%;
width: 100%;
height: 100%;
transform: translate(-50%, -50%);
object-fit: cover;
}
}
.info {
......
......@@ -286,7 +286,7 @@ export default {
const _userInfo = window.G.UserInfo
cAction.Player.updateProgress({
sid: (_userInfo && _userInfo.student_info && _userInfo.student_info.id) || '',
uid: (_userInfo && _userInfo.uid) || '',
uid: (_userInfo && _userInfo.id) || '',
d: cTool.other.getIdt(),
i: cTool.other.getIdt(),
c: this.cid,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论