cube-text-contrast.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <div :class="$style.mainDiv">
  3. <div v-show="loading" :class="$style.loadingDiv">
  4. <a-spin :spinning="loading" tip="单点认证中..."></a-spin>
  5. </div>
  6. <div v-show="!loading" :class="$style.frameDiv">
  7. <!-- <a-card> -->
  8. <iframe v-show="showFrame" :src="frameSrc" frameborder="0"></iframe>
  9. <!-- </a-card> -->
  10. </div>
  11. </div>
  12. </template>
  13. <script>
  14. import cubeServices from '@product/iam/cube/cube-services'
  15. import axios from '@/common/services/axios-instance'
  16. import { sdLocalStorage } from '@/common/services/storage-service'
  17. import { Modal } from '@/common/one-ui'
  18. import components from './_import-components/cube-text-contrast-import'
  19. export default {
  20. name: 'CubeTextContrast',
  21. metaInfo: {
  22. title: '文本对比',
  23. },
  24. components,
  25. data() {
  26. return {
  27. loading: true, // 默认先显示加载中
  28. showFrame: false, // 默认不显示frame,拼接好url才显示
  29. frameSrc: '',
  30. }
  31. },
  32. mounted() {
  33. // 加载时,获取token
  34. setTimeout(() => {
  35. this.loading = false
  36. }, 2000)
  37. this.getFrameUrl()
  38. },
  39. methods: {
  40. // 获取要素提取页面地址,主要是拼接token
  41. getFrameUrl() {
  42. cubeServices.checkCubeToken('textdiff').then((res) => {
  43. if (!res) {
  44. Modal.warning({
  45. title: '提示',
  46. content: '未开启CUBE集成功能参数或单点认证失败,请联系管理员',
  47. })
  48. return false
  49. }
  50. const cubeJson = JSON.parse(sdLocalStorage.getItem('cube') || '{}')
  51. // 项目修改
  52. axios.get('api/xcoa-mobile/v1/iamcubecontract/getCubeWebUrl').then((res) => {
  53. if (res.data !== '') {
  54. this.frameSrc =
  55. res.data +
  56. `/projects/10/textdiff/o/textdiff_promote?access_token=${cubeJson.textdiff_token}&banner=false`
  57. this.showFrame = true
  58. }
  59. })
  60. })
  61. },
  62. },
  63. }
  64. </script>
  65. <style module lang="scss">
  66. @use '@/common/design' as *;
  67. .main-div {
  68. width: 100%;
  69. height: 100%;
  70. text-align: center;
  71. background: #fff;
  72. .loading-div {
  73. padding-top: 15%;
  74. }
  75. }
  76. .frame-div {
  77. width: 100%;
  78. height: 100%;
  79. :global(.ant-card) {
  80. width: 100%;
  81. height: 100%;
  82. }
  83. :global(.ant-card-body) {
  84. width: 100%;
  85. height: 100%;
  86. }
  87. iframe {
  88. width: 100%;
  89. height: 100%;
  90. }
  91. }
  92. </style>