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

增加登录成功回调地址

上级 55213ad4
...@@ -5,10 +5,10 @@ module.exports = { ...@@ -5,10 +5,10 @@ module.exports = {
// apiBaseURL: '//demo-login.ezijing.com/', // apiBaseURL: '//demo-login.ezijing.com/',
webpack: { webpack: {
externals: { externals: {
'CKEDITOR': 'window.CKEDITOR', CKEDITOR: 'window.CKEDITOR',
'Base64': 'window.Base64', Base64: 'window.Base64',
'md5': 'window.md5', md5: 'window.md5',
'regeneratorRuntime': 'window.regeneratorRuntime' regeneratorRuntime: 'window.regeneratorRuntime'
}, },
devServer: { devServer: {
proxy: { proxy: {
...@@ -31,10 +31,13 @@ module.exports = { ...@@ -31,10 +31,13 @@ module.exports = {
} }
} }
}, },
ProvidePlugin: { ProvidePlugin: {},
},
others: { others: {
sofia: {
url: 'http://sofia-learning2.ezijing.com'
},
ciis: {
url: 'http://ciis-learning2.ezijing.com'
}
} }
} }
...@@ -6,16 +6,19 @@ module.exports = { ...@@ -6,16 +6,19 @@ module.exports = {
isEnableToIphoneDebugger: false, isEnableToIphoneDebugger: false,
webpack: { webpack: {
externals: { externals: {
'CKEDITOR': 'window.CKEDITOR', CKEDITOR: 'window.CKEDITOR',
'Base64': 'window.Base64', Base64: 'window.Base64',
'md5': 'window.md5', md5: 'window.md5',
'regeneratorRuntime': 'window.regeneratorRuntime' regeneratorRuntime: 'window.regeneratorRuntime'
} }
}, },
ProvidePlugin: { ProvidePlugin: {},
},
others: { others: {
sofia: {
url: 'http://sofia-learning.ezijing.com'
},
ciis: {
url: 'http://ciis-learning.ezijing.com'
}
} }
} }
...@@ -7,16 +7,19 @@ module.exports = { ...@@ -7,16 +7,19 @@ module.exports = {
isEnableToIphoneDebugger: true, isEnableToIphoneDebugger: true,
webpack: { webpack: {
externals: { externals: {
'CKEDITOR': 'window.CKEDITOR', CKEDITOR: 'window.CKEDITOR',
'Base64': 'window.Base64', Base64: 'window.Base64',
'md5': 'window.md5', md5: 'window.md5',
'regeneratorRuntime': 'window.regeneratorRuntime' regeneratorRuntime: 'window.regeneratorRuntime'
} }
}, },
ProvidePlugin: { ProvidePlugin: {},
},
others: { others: {
sofia: {
url: 'http://sofia-learning2.ezijing.com'
},
ciis: {
url: 'http://ciis-learning2.ezijing.com'
}
} }
} }
差异被折叠。
...@@ -2,11 +2,7 @@ ...@@ -2,11 +2,7 @@
<div> <div>
<el-form :model="ruleForm" :rules="rules" ref="form" @submit.native.prevent> <el-form :model="ruleForm" :rules="rules" ref="form" @submit.native.prevent>
<el-form-item prop="account"> <el-form-item prop="account">
<el-input <el-input v-model="ruleForm.account" placeholder="邮箱/手机号" @keyup.enter.native="handleSubmit">
v-model="ruleForm.account"
placeholder="邮箱/手机号"
@keyup.enter.native="handleSubmit"
>
<i slot="prefix" class="el-input__icon el-icon-user"></i> <i slot="prefix" class="el-input__icon el-icon-user"></i>
</el-input> </el-input>
</el-form-item> </el-form-item>
...@@ -20,7 +16,7 @@ ...@@ -20,7 +16,7 @@
<i slot="prefix" class="el-input__icon el-icon-lock"></i> <i slot="prefix" class="el-input__icon el-icon-lock"></i>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-checkbox v-model="ruleForm.RememberMe" style="margin-bottom:10px;">记住我</el-checkbox> <el-checkbox v-model="ruleForm.RememberMe" style="margin-bottom: 10px">记住我</el-checkbox>
<el-button type="primary" class="submit-button" :loading="loading" @click="handleSubmit">登录</el-button> <el-button type="primary" class="submit-button" :loading="loading" @click="handleSubmit">登录</el-button>
</el-form> </el-form>
<div class="login-footer"> <div class="login-footer">
...@@ -47,9 +43,9 @@ export default { ...@@ -47,9 +43,9 @@ export default {
}, },
computed: { computed: {
// 重定向地址 // 重定向地址
redirectURI() { nextUrl() {
const { query } = this.$route const { query } = this.$route
return query.redirect_uri ? decodeURIComponent(query.redirect_uri) : '' return query.next_url ? decodeURIComponent(query.next_url) : ''
} }
}, },
methods: { methods: {
...@@ -68,13 +64,11 @@ export default { ...@@ -68,13 +64,11 @@ export default {
// 登录成功 // 登录成功
handleSuccess(response) { handleSuccess(response) {
this.$message({ type: 'success', message: '登录成功' }) this.$message({ type: 'success', message: '登录成功' })
if (document.referrer) { if (this.nextUrl) {
window.location.href = document.referrer window.location.href = this.nextUrl
} else {
this.$emit('success', response)
} }
// if (this.redirectURI) {
// } else {
// this.$router.replace('/')
// }
} }
} }
} }
......
...@@ -7,11 +7,7 @@ ...@@ -7,11 +7,7 @@
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item prop="password">
<el-input <el-input v-model="ruleForm.password" placeholder="请输入登录验证码" @keyup.enter.native="handleSubmit">
v-model="ruleForm.password"
placeholder="请输入登录验证码"
@keyup.enter.native="handleSubmit"
>
<i slot="prefix" class="el-input__icon el-icon-unlock"></i> <i slot="prefix" class="el-input__icon el-icon-unlock"></i>
<countdown <countdown
slot="suffix" slot="suffix"
...@@ -22,7 +18,7 @@ ...@@ -22,7 +18,7 @@
></countdown> ></countdown>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-checkbox v-model="ruleForm.RememberMe" style="margin-bottom:10px;">记住我</el-checkbox> <el-checkbox v-model="ruleForm.RememberMe" style="margin-bottom: 10px">记住我</el-checkbox>
<el-button type="primary" class="submit-button" @click="handleSubmit">登录</el-button> <el-button type="primary" class="submit-button" @click="handleSubmit">登录</el-button>
</el-form> </el-form>
<div class="login-footer"> <div class="login-footer">
...@@ -51,9 +47,9 @@ export default { ...@@ -51,9 +47,9 @@ export default {
}, },
computed: { computed: {
// 重定向地址 // 重定向地址
redirectURI() { nextUrl() {
const { query } = this.$route const { query } = this.$route
return query.redirect_uri ? decodeURIComponent(query.redirect_uri) : '' return query.next_url ? decodeURIComponent(query.next_url) : ''
}, },
disabledSend() { disabledSend() {
return !/^1[3-9]\d{9}$/.test(this.ruleForm.account) return !/^1[3-9]\d{9}$/.test(this.ruleForm.account)
...@@ -75,15 +71,11 @@ export default { ...@@ -75,15 +71,11 @@ export default {
// 登录成功 // 登录成功
handleSuccess(response) { handleSuccess(response) {
this.$message({ type: 'success', message: '登录成功' }) this.$message({ type: 'success', message: '登录成功' })
if (document.referrer) { if (this.nextUrl) {
window.location.href = document.referrer window.location.href = this.nextUrl
} else {
this.$emit('success', response)
} }
// if (this.redirectURI) {
// this.$message({ type: 'success', message: '登录成功' })
// window.location.href = this.redirectURI
// } else {
// this.$router.replace('/')
// }
}, },
// 验证码 // 验证码
sendCodeRequest() { sendCodeRequest() {
......
<template> <template>
<router-view></router-view> <router-view @success="handleSuccess"></router-view>
</template> </template>
<script> <script>
export default { name: 'CiisLogin' } export default {
name: 'CiisLogin',
methods: {
handleSuccess(response) {
const { url } = webConf.others.ciis
window.location.href = url
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="header-logo"> <div class="header-logo">
<img src="../assets/logo.png" /> <img src="../assets/logo.png" />
</div> </div>
<div class="header-title">在线学习系统11</div> <div class="header-title">在线学习系统</div>
</header> </header>
<section class="main"> <section class="main">
<router-view></router-view> <router-view></router-view>
......
<template> <template>
<div class="login"> <div class="login">
<el-row type="flex" justify="space-between" align="middle" style="width:100%"> <el-row type="flex" justify="space-between" align="middle" style="width: 100%">
<el-col :span="12" class="hidden-xs-only"> <el-col :span="12" class="hidden-xs-only">
<div class="login-logo"> <div class="login-logo">
<img src="./assets/login_logo.png" /> <img src="./assets/login_logo.png" />
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</el-col> </el-col>
<el-col :span="12" :xs="24"> <el-col :span="12" :xs="24">
<div class="login-box"> <div class="login-box">
<router-view></router-view> <router-view @success="handleSuccess"></router-view>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
...@@ -16,7 +16,15 @@ ...@@ -16,7 +16,15 @@
</template> </template>
<script> <script>
export default { name: 'SofiaLogin' } export default {
name: 'SofiaLogin',
methods: {
handleSuccess(response) {
const { url } = webConf.others.sofia
window.location.href = url
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论