{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xq-web-fvue\\src\\views\\Login.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\src\\views\\Login.vue","mtime":1667327529872},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\r\nimport Cookie from 'js-cookie'\r\nimport portal from '@/api/portal.js'\r\nimport {mapState} from 'vuex'\r\nexport default {\r\n  name: 'login',\r\n  props: ['tenant'],\r\n  data() {\r\n    var checkAccount = (rule, value, callback) => {\r\n      if (!value) {\r\n        return callback(new Error('请输入账号'))\r\n      }\r\n      if (/^[a-zA-Z0-9_-]{2,20}$/.test(value)) {\r\n        return callback()\r\n      } else {\r\n        return callback(new Error('账号格式不符合规范'))\r\n      }\r\n    }\r\n    return {\r\n      fullscreenLoading: true,\r\n      hasMask: true,\r\n      logoSrc: require('@/assets/logo.png'),\r\n      codeUrl: `${window.location.origin}/mobilevue`,\r\n      logo: '',\r\n      name: 'EDP',\r\n      showTenant: false,\r\n      showLogo: false,\r\n      companyName: '',\r\n      tenantName: '',\r\n      principal: {\r\n        account: '',\r\n        password: '',\r\n        remberPwd: 0\r\n      },\r\n      rules: {\r\n        account: [{validator: checkAccount, trigger: 'blur'}],\r\n        password: [{required: true, message: '请输入密码', trigger: 'blur'}]\r\n      },\r\n      responseError: '',\r\n      loading: false,\r\n      backStyle: {\r\n        width: '100%',\r\n        height: '100%',\r\n        background: `url(${require('@/assets/img/bg.jpg')}) center / 100% 100% no-repeat`\r\n      },\r\n\r\n      totemStyle: {\r\n        width: '420PX',\r\n        height: '420PX',\r\n        float: 'left',\r\n        // backgroundColor: \"rgb(169 187 205 / 13%)\",\r\n        backgroundColor: '#282b33',\r\n        background: `url(${require('@/assets/img/loginImg.jpg')}) no-repeat center / 100% 100%`\r\n        // background: `#1975FF url(${require(\"@/assets/img/totem.png\")}) center / 100% auto no-repeat`\r\n        // background: `transparent url(${require(\"@/assets/img/totem1.png\")}) no-repeat center 30% / 100% 70% `\r\n      },\r\n      //负责的是登录页授权文件相关数据变量\r\n      isIeExplorer: false,\r\n      dialogVisible: false,\r\n      downLoading: false,\r\n      accept: '.lic',\r\n      files: [],\r\n      uploadingFiles: {}\r\n    }\r\n  },\r\n  mounted() {\r\n    if (!this.$route.query || !this.$route.query.tokenKey) {\r\n      this.hasMask = false\r\n      this.fullscreenLoading = false\r\n    }\r\n    window.webSocket && window.webSocket.close()\r\n    this.setDefaultValue()\r\n    //获取租户信息\r\n    let tenant = this.tenant ? this.tenant : 'platform'\r\n    if (tenant) {\r\n      let url = '${uc}/uc/tenantManage/v1/getTenantByCode?code=' + tenant\r\n      let _this = this\r\n      this.$http.get(url).then(resp => {\r\n        if (resp.data) {\r\n          let tenantManage = resp.data\r\n          _this.showTenant = true\r\n          _this.companyName = tenantManage.nameFront\r\n          if (tenant != 'platform') {\r\n            _this.principal.tenantId = resp.data.id\r\n          }\r\n          if (tenantManage.ico) {\r\n            let ico = JSON.parse(tenantManage.ico)\r\n            if (ico && ico.length > 0) {\r\n              _this.showLogo = true\r\n              _this.logo =\r\n                window.context.portal +\r\n                '/system/file/v1/getLogoFile?logoType=front&tenantId=' +\r\n                tenantManage.id\r\n            }\r\n          }\r\n        }\r\n      })\r\n    } else {\r\n      //不是租户\r\n      this.sysSetting()\r\n    }\r\n  },\r\n  methods: {\r\n    //如果记住密码则默认表单赋值\r\n    setDefaultValue() {\r\n      let account = Cookie.get('account'),\r\n        remberPwd = Number(Cookie.get('remberPwd')),\r\n        password = Cookie.get('accountPwd')\r\n      if (remberPwd) {\r\n        // 如果有记住密码 取密文解密放进输入框\r\n        let Base64 = require('js-base64').Base64\r\n        password = Base64.decode(password)\r\n      }\r\n      this.principal = {\r\n        ...this.principal,\r\n        ...{account, password, remberPwd}\r\n      }\r\n    },\r\n    //获取系统默认配置 系统Logo、名称\r\n    sysSetting() {\r\n      const _this = this\r\n      let url =\r\n        window.context.portal + '/sys/sysProperties/v1/getDecryptBySysSetting'\r\n      this.$http.get(url).then(response => {\r\n        if (response && response.data && response.data.value) {\r\n          _this.showTenant = true\r\n          let sysSettingData = JSON.parse(response.data.value)\r\n          if (sysSettingData.frontName == '') {\r\n            _this.companyName = _this.name\r\n          } else {\r\n            _this.companyName = sysSettingData.frontName\r\n          }\r\n          if (sysSettingData.ico.length > 0) {\r\n            let ico = sysSettingData.ico\r\n            _this.showLogo = true\r\n            _this.logo =\r\n              window.context.portal +\r\n              '/system/file/v1/downloadFile?fileId=' +\r\n              ico[0].id\r\n          }\r\n        }\r\n      })\r\n    },\r\n    querySearch(queryString, cb) {\r\n      if (!queryString) {\r\n        cb([])\r\n        return\r\n      }\r\n      let queryFilter = {}\r\n      queryFilter.pageBean = {\r\n        page: 1,\r\n        pageSize: 20,\r\n        total: 0,\r\n        showTotal: true\r\n      }\r\n      let query = {\r\n        property: 'name_',\r\n        value: queryString,\r\n        group: 'main',\r\n        operation: 'LIKE',\r\n        relation: 'AND'\r\n      }\r\n      if (!queryFilter.querys) {\r\n        queryFilter.querys = []\r\n      }\r\n      queryFilter.querys.push(query)\r\n\r\n      this.$http\r\n        .post(`${window.context.uc}/uc/tenantManage/v1/listJson`, queryFilter)\r\n        .then(res => {\r\n          // 调用 callback 返回建议列表的数据\r\n          cb(res.data.rows)\r\n        })\r\n    },\r\n    handleSelect(item) {\r\n      this.tenantName = item.name\r\n      this.principal.tenantId = item.id\r\n    },\r\n    setRouterPath() {\r\n      this.$store.dispatch('login/actionLoginAccount', this.principal.account)\r\n      localStorage.setItem(\r\n        this.principal.account + 'loginRoutePath',\r\n        this.$route.path\r\n      )\r\n    },\r\n    submitForm(formName) {\r\n      this.$refs[formName].validate(valid => {\r\n        if (valid) {\r\n          this.inputGetFocus()\r\n          this.setRouterPath()\r\n          this.loading = true\r\n          console.log(this.principal, 'login')\r\n          this.$store\r\n            .dispatch('login/loginByPrincipal', this.principal)\r\n            .then(loginStatus => {\r\n              console.log(loginStatus,'loginStatus')\r\n              if (loginStatus && loginStatus == true) {\r\n                this.$router.push({\r\n                  path: this.$route.query.redirect\r\n                    ? this.$route.query.redirect\r\n                    : '/'\r\n                })\r\n                this.$store.dispatch('menu/actionSysMenus')\r\n                //获取前台页面\r\n                this.$store.dispatch('menu/actionFrontMenus').then(res => {\r\n                  // this.loading = false\r\n                  this.$router.push({\r\n                    path: `/frontPlat/${res[0].alias}`\r\n                  })\r\n                  // if (window.context.railway) {\r\n                  //   this.$router.push({\r\n                  //     path: `/frontPlat/${res[0].alias}`\r\n                  //   })\r\n                  // } else {\r\n                    // this.$router.push({\r\n                    //   path: `/frontPlat/workBench`\r\n                    // })\r\n                  // }\r\n                  this.loading = false\r\n                })\r\n                // 连接websocket\r\n                this.$bus.$emit('login')\r\n                this.getAllDict()\r\n              } else if (loginStatus == false) {\r\n                this.$router.push({\r\n                  name: 'resetPwdView',\r\n                  params: {account: this.principal.account}\r\n                })\r\n              }\r\n            })\r\n            .catch(msg => {\r\n              console.log(msg,'msg')\r\n              this.loading = false\r\n              if (msg.startsWith('timeout of')) {\r\n                msg = '登录超时'\r\n              }\r\n              this.responseError = msg\r\n            })\r\n        } else {\r\n          return false\r\n        }\r\n      })\r\n    },\r\n    getAllDict() {\r\n      portal.getSysDict().then(data => {\r\n        // console.log(data, '字典')\r\n        if (data) {\r\n          sessionStorage.setItem('dict_data', JSON.stringify(data))\r\n        }\r\n      })\r\n    },\r\n    inputGetFocus() {\r\n      this.responseError = ''\r\n    },\r\n    resetForm(formName) {\r\n      this.responseError = ''\r\n      this.$refs[formName].resetFields()\r\n    },\r\n    onResize() {\r\n      this.isShowTotem = document.body.offsetWidth > 500\r\n    }\r\n  },\r\n  created() {\r\n    let USER_AGENT = navigator.userAgent.toLowerCase()\r\n    let isChrome = /.*(chrome)\\/([\\w.]+).*/\r\n    if (!isChrome.test(USER_AGENT)) {\r\n      this.isIeExplorer = true\r\n    }\r\n    this.isShowTotem = document.body.offsetWidth > 500\r\n    window.addEventListener('resize', this.onResize)\r\n  }\r\n}\r\n",null]}