Просмотр исходного кода

增加福建现场对接门户逻辑

jianggs 3 дней назад
Родитель
Сommit
77f1f2a364

+ 6 - 0
web/src/router/modules/idd-routes.js

@@ -47,4 +47,10 @@ export default [
     component: () => import('@xdjf/idd/views/resourceLibrary/library/recallTest.vue'),
     hidden: true,
   },
+  {
+    path: '/to-oca-xdjf',
+    name: 'toOcaXdjf',
+    fullscreen: true,
+    component: () => import('@xdjf/idd/views/toOcaXdjf/index.vue'),
+  },
 ];

+ 3 - 1
web/src/router/router-filter.js

@@ -42,7 +42,7 @@ const unLoginFn = (to, from, next) => {
   /**
    * 路由白名单(不作权限过滤),不跳转路由
    */
-  const whiteList = ['/login', '/forgetPwd', '/about', '/externalPage'];
+  const whiteList = ['/login', '/forgetPwd', '/about', '/externalPage', '/to-oca-xdjf'];
   if (whiteList.indexOf(to.path) !== -1) {
     // 2-1.当前访问路由,在免登录白名单中,直接访问当前
     next();
@@ -58,6 +58,8 @@ const unLoginFn = (to, from, next) => {
  * 路由前置拦截器
  */
 router.beforeEach(async (to, from, next) => {
+  console.log("to",to);
+  console.log("from",from);
   // 是否浏览器F5刷新
   const isBrowserRefresh = ifRefresh(from, to);
   NProgress.start(); // 开始进度条

+ 158 - 0
web/src/views/@xdjf/intelligent-due-diligence/views/toOcaXdjf/index.vue

@@ -0,0 +1,158 @@
+<template>
+  <div class="ToOcaXdjf" v-loading="loading" element-loading-text=""></div>
+</template>
+
+<script>
+import { mapActions } from 'vuex';
+import NProgress from 'nprogress';
+import 'nprogress/nprogress.css';
+import { renderWatermark } from '@/utils/util.js';
+
+export default {
+  name: 'ToOcaXdjf',
+  data() {
+    return {
+      loading: false,
+      min_duration: 2000,
+      max_duration: 10000,
+      timer: null,
+    };
+  },
+  mounted() {
+    console.log("this.$route.query",this.$route.query);
+    // 页面加载时显示一个旋转的加载图标
+    NProgress.start(); // 开始进度条
+    this.init();
+  },
+  methods: {
+    ...mapActions('oauth', ['getAccessToken']),
+    // 初始化
+    init() {
+      this.loading = true;
+      const { username, userName, usrname, usrName, sso_token } = this.$route.query;
+      const name = sso_token || username || usrname || usrName || userName;
+      console.log("name",name);
+      if (name) {
+        const encodedName = this.encodeUseName(name);
+        this.loginFn(encodedName);
+      } else {
+        this.$confirm('url缺少必要参数', '', {
+          showConfirmButton: false,
+          showCancelButton: false,
+          type: 'error',
+        }).catch(() => {
+          window.close();
+        });
+        if (this.timer) {
+          clearTimeout(this.timer);
+          this.timer = null;
+        }
+        this.timer = setTimeout(() => {
+          if (this.timer) {
+            clearTimeout(this.timer);
+          }
+          window.close();
+        }, this.min_duration);
+      }
+    },
+    // 加密用户名
+    encodeUseName(value) {
+      return this.desEncrypt(value);
+    },
+    /**
+     * DES CBC 加密
+     * @param {string} text 明文
+     * @returns {string} 大写十六进制密文
+     */
+    desEncrypt(text) {
+      if (!text) return '';
+      // 固定密钥和 IV
+      const KEY = CryptoJS.enc.Utf8.parse('Passw0rd');
+      const IV = CryptoJS.enc.Utf8.parse('Passw0rd');
+      // DES/CBC/PKCS5Padding 加密
+      const encrypted = CryptoJS.DES.encrypt(
+        CryptoJS.enc.Utf8.parse(text),
+        KEY,
+        {
+          iv: IV,
+          mode: CryptoJS.mode.CBC,
+          padding: CryptoJS.pad.Pkcs7
+        }
+      );
+      // 转换为大写十六进制
+      return encrypted.ciphertext.toString(CryptoJS.enc.Hex).toUpperCase();
+    },
+    // 用户名登录
+    loginFn(encodedName) {
+      if (this.timer) {
+        clearTimeout(this.timer);
+      }
+      this.timer = setTimeout(() => {
+        if (this.timer) {
+          clearTimeout(this.timer);
+        }
+        this.$confirm('请求超时', '', {
+          showConfirmButton: false,
+          showCancelButton: false,
+          type: 'error',
+        }).catch(() => {
+          window.close();
+        });
+        this.timer = setTimeout(() => {
+          if (this.timer) {
+            clearTimeout(this.timer);
+          }
+          window.close();
+        }, this.min_duration);
+      }, this.max_duration);
+      const data = {
+        params: {
+          grantType: 'union',
+          username: encodedName,
+        },
+        config: { showErrorMessage: false },
+      };
+      this.getAccessToken(data).then((res) => {
+        clearTimeout(this.timer);
+        // 登录成功,初始化数据
+        renderWatermark();
+        this.$store.dispatch('initSysData');
+        NProgress.done();
+        this.loading = false;
+        this.redirectToFrame();
+      }).catch(({ code, message, data, extData }) => {
+        if (this.timer) {
+          clearTimeout(this.timer);
+        }
+        this.$confirm(message, '', {
+          showConfirmButton: false,
+          showCancelButton: false,
+          type: 'error',
+        }).catch(() => {
+          window.close();
+        });
+        this.timer = setTimeout(() => {
+          if (this.timer) {
+            clearTimeout(this.timer);
+          }
+          window.close();
+        }, this.min_duration);
+      });
+    },
+    // 重定向路由到首页
+    redirectToFrame() {
+      window.vmrouter = this.$router;
+      this.$router.push({
+        path: this.redirect || '/',
+      });
+    },
+  },
+};
+</script>
+<style lang="scss">
+.ToOcaXdjf {
+  background-color: #fff;
+  width: 100%;
+  height: 100%;
+}
+</style>

+ 1 - 0
web/src/views/aiTagging/taggingResults/index.vue

@@ -12,6 +12,7 @@
             end-placeholder="结束日期"
             format="yyyy-MM-dd HH:mm:ss"
             value-format="yyyy-MM-dd HH:mm:ss"
+            :clearable="false"
             style="width: 300px;"
           ></el-date-picker>
         </el-form-item>