xiejun
2023-09-25 8470a4ae665d8b7f7621479c09664c7a3ff0f210
Source/UBCS-WEB/src/page/login/sso.vue
@@ -1,69 +1,41 @@
<template>
  <p>测试</p>
</template>
<script>
import {oaSsos} from "@/api/system/user.js"
import {ssoLogin} from "@/api/system/user.js"
import {mapGetters} from "vuex";
import {setStore} from "@/util/store";
export default {
  name: "sso",
  data() {
    return {
      loginForm:{
        //租户ID
        tenantId: "",
        //部门ID
        deptId: "",
        //角色ID
        roleId: "",
        //用户名
        username: "",
        //密码
        password: "",
        selectInput: '',
        //下拉input数据
        value: '管理组',
        //下拉菜单
        region: [],
        //账号类型
        type: "account",
        //验证码的索引
        key: "",
        //预加载白色背景
        image: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
      },
      PathString:'',
    }
  },
  computed: {
    ...mapGetters(["tagWel", "userInfo"])
    ...mapGetters(["tagWel"])
  },
  created() {
    this.onLoad()
  },
  methods: {
    // Onload() {
    //   let name = 'pwdfree'
    //   oaSsos(name).then(res=>{
    //     console.log(res)
    //     if(res.status === 200){
    //       // this.loginForm.tenantId=res.data.tenant_id;
    //       // this.loginForm.username=res.data.user_name;
    //       this.$store.dispatch("LoginBySso").then((res) => {
    //         console.log('res',res)
    //           this.$router.push({path: this.tagWel.value});
    //       })
    //       // console.log(this.tagWel)
    //       // this.$router.push({path: this.tagWel.value});
    //     }
    //   })
    // }
    onLoad() {
      //URL传递参数时 会将字符串中的 %2B 也就是+号转换为空格。
      this.PathString = decodeURIComponent(this.$route.query.empCode.replace(/\s/g, '+'));
      //console.log(this.$route);
      //console.log(this.PathString);
      this.$store.dispatch("LoginBySso", { PathString: this.PathString }).then((res) => {
        console.log('res', res)
        this.$router.push({ path: this.tagWel.value });
      })
    }
  }
}
</script>
<style scoped>
</style>
</style>