{"remainingRequest":"D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\cssc-fvue\\src\\views\\Login.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\cssc-fvue\\src\\views\\Login.vue","mtime":1668071265581},{"path":"D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\cssc-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//\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\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 companyName: '',\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/login-bgimg.png')}) center / 100% 100% no-repeat`\r\n },\r\n totemStyle: {\r\n width: '400px',\r\n height: '420px',\r\n float: 'left',\r\n backgroundColor: '#282b33',\r\n background: `url(${require('@/assets/img/loginImg.jpg')}) no-repeat center / 100% 100%`\r\n }\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 mounted() {\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 }\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 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 }\r\n })\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 console.log(valid)\r\n this.inputGetFocus()\r\n this.setRouterPath()\r\n this.loading = true\r\n this.$store\r\n .dispatch('login/loginByPrincipal', this.principal)\r\n .then(loginStatus => {\r\n this.loading = false\r\n if (loginStatus && loginStatus == true) {\r\n //获取前台页面\r\n this.$router.push({\r\n path: `/CrewIndex`\r\n })\r\n this.$store.dispatch('menu/actionFrontMenus')\r\n //.then(res => {\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/frontIndex`\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 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 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}\r\n",null]}