12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <template>
- <div class="home">
- </div>
- </template>
- <script>
- // @ is an alias to /src
- import Trend from '@/components/Trend'
- 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 {
- name: 'Index',
- components: {
- Trend,
- },
- data () {
- return {
- }
- },
- created(){
- this.getUUID();
- },
- 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 = window._CONFIG['ssoURL']+'/oauth/authorize?client_id=OAManager&response_type=code&redirect_url=https://oa.worldskillsmuseum.cn/#/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 = window._CONFIG['ssoURL']+'/oauth/authorize?client_id=OAManager&response_type=code&redirect_url=https://oa.worldskillsmuseum.cn/#/redirect/login'
- }
- },
- }
- }
- </script>
- <style scoped>
- .home {
- width: 900px;
- margin: 0 auto;
- padding: 25px 0;
- }
- .home > .banner {
- text-align: center;
- padding: 25px 0;
- margin: 25px 0;
- }
- </style>
|