单点登录

master
liangliang.Li 3 years ago
parent f631f82d52
commit 02e7cd190f
  1. 9
      src/components/common/Header.vue
  2. 34
      src/components/page/ClientLogin.vue
  3. 11
      src/components/page/Index.vue
  4. 41
      src/components/page/Login.vue
  5. 2
      src/components/page/PersonalCenter.vue
  6. 2
      src/components/page/RegisterForm.vue
  7. 3
      src/router/index.js
  8. 1
      src/utils/api.js

@ -34,17 +34,12 @@ export default {
this.userName = userName this.userName = userName
}) })
}, },
// computed: {
// username() {
// let username = sessionStorage.getItem('kd_client_username');
// return username ? username : this.name;
// }
// },
methods: { methods: {
loginout() { loginout() {
this.$store.replaceState({}) this.$store.replaceState({})
sessionStorage.removeItem('kd_client_username'); sessionStorage.removeItem('kd_client_username');
location.reload() this.$router.push('/login')
// location.reload()
}, },
toPersonalCenter(){ toPersonalCenter(){
this.$router.push('/personalcenter') this.$router.push('/personalcenter')

@ -127,8 +127,6 @@ export default {
activeName: '0', activeName: '0',
isReg: false, isReg: false,
loginForm: { loginForm: {
// username: '15794146134',
// password: '111aaa',
username: '', username: '',
password: '', password: '',
}, },
@ -164,13 +162,17 @@ export default {
phoneTimer: null, phoneTimer: null,
newPassword: '', newPassword: '',
emailOpener: '', emailOpener: '',
phoneOpener: '' phoneOpener: '',
urlData:'',
type:'',
accountName:''
}; };
}, },
components: { components: {
register register
}, },
mounted(){ mounted(){
this.autoLogin()
this.$once('hook:beforeDestroy', function () { this.$once('hook:beforeDestroy', function () {
clearInterval(this.phoneTimer) clearInterval(this.phoneTimer)
this.phoneTimer = null this.phoneTimer = null
@ -179,6 +181,29 @@ export default {
}) })
}, },
methods: { methods: {
//type
//01
autoLogin(){
let currentUrl = window.location.href
let A = currentUrl.split('?')
let B = A[1].split('&')
B.forEach(item => {
if(item.includes('account')){
let account = item.split('=')
this.loginForm.username = account[1]
}
if(item.includes('type')){
let type = item.split('=')
this.type = type[1]
console.log(this.type);
}
})
if(this.type == '1'){
this.loginForm.password = 'Qw654321'
this.getSchool('loginForm')
}
},
backIndex(){ backIndex(){
// this.$router.go(-1); // this.$router.go(-1);
this.$router.push('login'); this.$router.push('login');
@ -224,9 +249,6 @@ export default {
}); });
}, },
getRole(form) { getRole(form) {
// this.userId = this.schoolList.find((n,k) => {
// return n.schoolId == this.schoolId
// }).userId
let data = { let data = {
userId: this.userId, userId: this.userId,
schoolId: this.schoolId schoolId: this.schoolId

@ -50,7 +50,9 @@ export default {
}, },
mounted() { mounted() {
this.showChangePass() this.showChangePass()
}, },
methods:{
setPassword(){ setPassword(){
if(this.regForm.password !== this.regForm.rePassword){ if(this.regForm.password !== this.regForm.rePassword){
return this.$message.warning('两次输入的密码不一致,请重新输入') return this.$message.warning('两次输入的密码不一致,请重新输入')
@ -67,7 +69,12 @@ export default {
}, },
showChangePass(){ showChangePass(){
this.$get(this.api.isRequiredReset).then(res =>{ this.$get(this.api.isRequiredReset).then(res =>{
if(res.message && sessionStorage.getItem('kd_client_username').includes('专家')) this.changeVisible = true if(this.$store.state.userName.includes('专家')){
}else{
if(res.message) this.changeVisible = true
}
}).catch(err=>{}) }).catch(err=>{})
}, },
toFuture(){ toFuture(){
@ -76,7 +83,7 @@ export default {
toNext(val) { toNext(val) {
this.$router.push(`ProjectIntro?isFuture=${val}`) this.$router.push(`ProjectIntro?isFuture=${val}`)
}, },
}
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

@ -71,18 +71,36 @@ export default {
this.accessNum() this.accessNum()
}, },
methods:{ methods:{
// //
async userAuth(){ userAuth(){
axios.interceptors.response.use(response => { location.href = 'https://finance.uestc.cn/liuwanr/userInfo/loginSchoolPerson'
this.responseUrl = response.request.responseURL // axios.interceptors.response.use(response => {
return response;
}, error => { // // let res = JSON.parse(response.request.response)
return Promise.reject(error); // console.log('=>',response.request)
})
let rest = await this.$get(this.api.loginSchoolPerson) // // window.location.href = res.url
window.location.href = this.responseUrl // return response;
console.log('res1=>',rest); // }, error => {
// return Promise.reject(error);
// })
// axios({
// url:'https://finance.uestc.cn/liuwanr/userInfo/loginSchoolPerson',
// method:'get',
// })
// this.$get(this.api.loginSchoolPerson).then(res =>{
// // window.location.href = res.url
// }).catch(err=>{})
}, },
//
// async userAuth(){
// let rest = await this.$get(this.api.loginSchoolPerson)
// window.location.href = rest.url
// // console.log('res1=>',rest);
// },
accessNum(){ accessNum(){
this.$get(this.api.getAccessNum).then(res =>{ this.$get(this.api.getAccessNum).then(res =>{
this.proAccessNum.currentNum = res.currentNum, this.proAccessNum.currentNum = res.currentNum,
@ -91,7 +109,8 @@ export default {
}).catch(err=>{}) }).catch(err=>{})
}, },
toClient(){ toClient(){
location.href = location.host.includes('116.63.168.79') ? 'http://116.63.168.79/kdclient/#/clientLogin' : 'https://finance.uestc.cn/kdclient/#/clientLogin' // location.href = location.host.includes('116.63.168.79') ? 'http://116.63.168.79/kdclient/#/clientLogin?type=0' : 'https://finance.uestc.cn/kdclient/#/clientLogin?type=0'
this.$router.push(`/clientLogin?type=1&account=2017000000013`)
this.visiteShow = false this.visiteShow = false
}, },
toMang(){ toMang(){

@ -10,7 +10,7 @@
:action="this.api.uploadUserAvatars" :action="this.api.uploadUserAvatars"
:data="{userId:this.$store.state.userId}" :data="{userId:this.$store.state.userId}"
name="file" name="file"
:limit="3" :limit="1"
:on-success="getRes" :on-success="getRes"
> >
<div>点击更改头像</div> <div>点击更改头像</div>

@ -124,7 +124,7 @@ export default {
methods: { methods: {
// //
getVerificationCode(){ getVerificationCode(){
this.verifyCode = axios.defaults.baseURL + `/evaluation/tms/userInfo/getValidateCode?id=${Math.random()}` this.verifyCode = `https://finance.uestc.cn/evaluation/tms/userInfo/getValidateCode?id=${Math.random()}`
}, },
getProvince(){ getProvince(){
this.$get(this.api.queryProvince).then(res => { this.$get(this.api.queryProvince).then(res => {

@ -10,7 +10,8 @@ export default new Router({
{ {
path: '/', path: '/',
redirect: '/login' redirect: '/login'
// redirect: '/index' // redirect: '/dashboard'
// redirect: '/clientLogin'
}, },
{ {
path: '/teachingVideo', path: '/teachingVideo',

@ -10,7 +10,6 @@ let host = ''
if(process.env.NODE_ENV === 'development'){ if(process.env.NODE_ENV === 'development'){
// host = 'https://finance.uestc.cn' // host = 'https://finance.uestc.cn'
host = 'https://finance.uestc.cn' host = 'https://finance.uestc.cn'
axios.defaults.baseURL = location.host.includes('116.63.168.79') ? 'http://116.63.168.79' : 'https://finance.uestc.cn'
} }
export default { export default {

Loading…
Cancel
Save