ThirdAuthDialog.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <el-dialog
  3. class="third-auth-dialog"
  4. :visible.sync="modalIsShow"
  5. title="请选择阅卷身份"
  6. :close-on-click-modal="false"
  7. :close-on-press-escape="false"
  8. append-to-body
  9. fullscreen
  10. @open="visibleChange"
  11. >
  12. <div class="auth-list">
  13. <div
  14. v-for="item in roles"
  15. :key="item.type"
  16. class="auth-item"
  17. @click="toAuth(item)"
  18. >
  19. {{ item.name }}
  20. </div>
  21. </div>
  22. <div slot="footer"></div>
  23. </el-dialog>
  24. </template>
  25. <script>
  26. import { userSysRoles, yptAuth } from "../api";
  27. import { autoSubmitForm } from "@/plugins/utils";
  28. export default {
  29. name: "third-auth-dialog",
  30. data() {
  31. return {
  32. modalIsShow: false,
  33. roles: []
  34. };
  35. },
  36. methods: {
  37. visibleChange() {
  38. this.getRoles();
  39. },
  40. async getRoles() {
  41. this.roles = [];
  42. const data = await userSysRoles();
  43. this.roles = data || [];
  44. },
  45. cancel() {
  46. this.modalIsShow = false;
  47. },
  48. open() {
  49. this.modalIsShow = true;
  50. },
  51. async toAuth(item) {
  52. const data = await yptAuth(item.type);
  53. const url = data.redirectUrl;
  54. const params = { ...data, returnUrl: window.location.href };
  55. delete params.redirectUrl;
  56. autoSubmitForm(url, params);
  57. }
  58. }
  59. };
  60. </script>