|
@@ -7,7 +7,12 @@
|
|
|
// @ is an alias to /src
|
|
|
|
|
|
import Trend from '@/components/Trend'
|
|
|
-import { WindowsFill } from '@ant-design/icons/lib/dist';
|
|
|
+ import { WindowsFill } from '@ant-design/icons/lib/dist';
|
|
|
+ import { mapActions } from 'vuex'
|
|
|
+ import Vue from 'vue'
|
|
|
+ import { ACCESS_TOKEN, ENCRYPTED_STRING, USER_INFO } from '@/store/mutation-types'
|
|
|
+ import store from '@/store/'
|
|
|
+ import { timeFix } from '@/utils/util'
|
|
|
|
|
|
|
|
|
export default {
|
|
@@ -17,14 +22,66 @@ import { WindowsFill } from '@ant-design/icons/lib/dist';
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
- targetTime: new Date().getTime() + 3900000
|
|
|
}
|
|
|
},
|
|
|
created(){
|
|
|
- window.location.href = 'http://172.18.91.12:8888/sso/oauth/authorize?client_id=OAManager&response_type=code&redirect_url=http://172.18.91.36:8083/#/redirect/login'
|
|
|
+ this.getUUID();
|
|
|
},
|
|
|
+ // created(){
|
|
|
+ // window.location.href = 'http://172.18.91.12:8888/sso/oauth/authorize?client_id=OAManager&response_type=code&redirect_url=http://172.18.91.36:8083/#/redirect/login'
|
|
|
+ // },
|
|
|
methods: {
|
|
|
-
|
|
|
+ ...mapActions(['uuidLogin']),
|
|
|
+ getUUID(){
|
|
|
+ var url = window.location.href ;
|
|
|
+ // var dz_url = url.split('#')[0]; //获取#/之前的字符串
|
|
|
+ var cs = url.split('?')[1]; //获取?之后的参数字符串
|
|
|
+ if(cs==undefined){
|
|
|
+ window.location.href = 'http://172.18.91.12:8888/sso/oauth/authorize?client_id=OAManager&response_type=code&redirect_url=http://172.18.91.36:8083/#/redirect/login'
|
|
|
+ }
|
|
|
+ var cs_arr = cs.split('&'); //参数字符串分割为数组
|
|
|
+ var cs={};
|
|
|
+ for(var i=0;i<cs_arr.length;i++){ //遍历数组,拿到json对象
|
|
|
+ cs[cs_arr[i].split('=')[0]] = cs_arr[i].split('=')[1]
|
|
|
+ }
|
|
|
+
|
|
|
+ this.uuid = cs.uuid;
|
|
|
+ this.redirect = cs.redirect;
|
|
|
+ if(this.uuid){
|
|
|
+ this.uuidLogin({'uuid':this.uuid}).then(res=>{
|
|
|
+ if (res.success) {
|
|
|
+ console.log('用户信息', res)
|
|
|
+ let multi_depart = res.result.multi_depart
|
|
|
+ // 0:无部门 1:一个部门 2:多个部门
|
|
|
+ if (multi_depart == 0) {
|
|
|
+ this.$notification.warn({
|
|
|
+ message: '提示',
|
|
|
+ description: `您尚未归属公司,请确认OA账号信息`,
|
|
|
+ duration: 3
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ console.log('登录')
|
|
|
+ const userInfo = res.result.userInfo
|
|
|
+ Vue.ls.set(USER_INFO, userInfo, 7 * 24 * 60 * 60 * 1000)
|
|
|
+ store.commit('SET_INFO', userInfo)
|
|
|
+ if(this.redirect){
|
|
|
+ this.$router.push({ name: this.redirect })
|
|
|
+ }else{
|
|
|
+ this.$router.push({ name: 'dashboard' })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).catch(err=>{
|
|
|
+ this.$notification['error']({
|
|
|
+ message: '认证失败',
|
|
|
+ description: ((err.response || {}).data || {}).message || err.message || '请求出现错误,请稍后再试',
|
|
|
+ duration: 4
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ window.location.href = 'http://172.18.91.12:8888/sso/oauth/authorize?client_id=OAManager&response_type=code&redirect_url=http://172.18.91.36:8083/#/redirect/login'
|
|
|
+ }
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|