Access.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <div></div>
  3. </template>
  4. <script>
  5. import { mapActions } from "vuex";
  6. import { USER_SIGNIN } from "../store/user";
  7. import { CORE_API } from "@/constants/constants";
  8. export default {
  9. name: "Access",
  10. data() {
  11. return {
  12. accessInfo: {
  13. orgId: null,
  14. loginName: null,
  15. appId: null,
  16. timestamp: null,
  17. token: null,
  18. },
  19. };
  20. },
  21. created() {
  22. sessionStorage.clear();
  23. var params = this.$route.query;
  24. this.accessInfo.orgId = params.orgId;
  25. this.accessInfo.loginName = params.loginName;
  26. this.accessInfo.appId = params.appId;
  27. this.accessInfo.timestamp = params.timestamp;
  28. this.accessInfo.token = params.token;
  29. const url = CORE_API + "/auth/thirdPartyAccess";
  30. this.$httpWithMsg
  31. .post(url, new URLSearchParams(this.accessInfo), {
  32. headers: { "content-type": "application/x-www-form-urlencoded" },
  33. })
  34. .then((response) => {
  35. var user = response.data;
  36. this.USER_SIGNIN(user);
  37. this.$router.replace({ path: "/home/overview" });
  38. this.$notify({
  39. message: "接入成功",
  40. type: "success",
  41. });
  42. })
  43. .catch(() => {
  44. this.$notify({
  45. message: "接入失败",
  46. type: "error",
  47. });
  48. });
  49. },
  50. methods: {
  51. ...mapActions([USER_SIGNIN]),
  52. },
  53. };
  54. </script>