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

bug fixes

上级 e77f851c
......@@ -105,9 +105,6 @@ export default class API {
if (!/account\/get-user-info/gi.test(res.config.url)) {
Message({ type: 'error', message: data.msg })
}
return data
} else if (data.code === 0) {
return data.data
}
}
return data
......
......@@ -73,7 +73,7 @@ export default class PlayerAPI extends BaseAPI {
/**
* 课程作业截止时间
*/
getHomeworkStopTime = (sid, cid, chapterId) => this.get(`/api/lms/v2/education/homeworks/${sid}/${cid}/${chapterId}/deadline`, {})
getHomeworkStopTime = (sid, cid, chapterId) => this.get(`/api/lms/v2/education/homeworks/${cid}/${chapterId}/deadline`, {})
/**
* 获取对应 大作业 回答
* @param {[string]} cid
......
......@@ -45,7 +45,7 @@ export default class Before {
if (window.G.UserInfo) return true
return Promise.all([cAction.Other.getInfo(), cAction.Other.getUser()])
.then(([p1, p2]) => {
const res = { student_info: p1, data: p2 }
const res = { student_info: p1, data: p2.data }
if (res.data.id) {
window.G.UserInfo = res
return true
......
......@@ -28,7 +28,7 @@ export default class LoginAPI extends BaseAPI {
* @param {[string]} obj.code 验证码
* @param {[string]} obj.service 传当前域名
*/
codeLogin = (obj = {}) => this.post('/api/passport/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 手机号/邮箱
......@@ -50,7 +50,7 @@ export default class LoginAPI extends BaseAPI {
* @param {[string]} obj.new_password 新的密码
* @param {[string]} obj.service 传当前域名
*/
resetPwd = (obj = {}) => this.post('/api/passport/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 验证码
......
......@@ -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>
</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>
</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">
<div class="step3">
<el-form ref="form3" label-width="120px" :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="account" :label="$t('LoginModule.ForgetLogin.newPwd')">
<el-input v-model="accountSet.account" type="text" :placeholder="$t('LoginModule.ForgetLogin.inputStr')"></el-input>
</el-form-item>
<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">{{$t('LoginModule.ForgetLogin.sendCode')}}</el-button>
</el-input>
</el-form-item>
<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 +90,6 @@ export default {
}
}
return {
stepActive: 1,
isSendCode: false, // 是否已发送验证码
timeInterval: null, // 定时器,倒计时
sendBtnText: this.$t('LoginModule.ForgetLogin.sendCode'), // 按钮 文字
......@@ -168,28 +121,6 @@ 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) {
......@@ -225,37 +156,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))
......
......@@ -75,7 +75,7 @@ export default {
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
......
......@@ -159,7 +159,7 @@ export default {
let str = ''
let stuAnswer = '' // 学生答案
let stuIsCorrect = 0 // 学生是否答对
let _json = JSON.parse(_.question_options)
let _json = _.question_options ? JSON.parse(_.question_options) : []
_json.forEach(function (__, j) {
if (__.checked) {
switch (j) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论