|
@@ -59,7 +59,7 @@
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="4" :offset="1">
|
|
<el-col :span="4" :offset="1">
|
|
<div class="login-code">
|
|
<div class="login-code">
|
|
- <img :src="codeUrl" @click="getCode" class="login-code-img" />
|
|
|
|
|
|
+ <img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
|
</div>
|
|
</div>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
@@ -70,7 +70,7 @@
|
|
<img :src="codeUrl" @click="getCode" class="login-code-img" />
|
|
<img :src="codeUrl" @click="getCode" class="login-code-img" />
|
|
</div> -->
|
|
</div> -->
|
|
<el-checkbox v-model="loginForm.rememberMe" class="aaa"
|
|
<el-checkbox v-model="loginForm.rememberMe" class="aaa"
|
|
- >在这个设备上记住我
|
|
|
|
|
|
+ >在这个设备上记住我
|
|
</el-checkbox>
|
|
</el-checkbox>
|
|
</el-row>
|
|
</el-row>
|
|
|
|
|
|
@@ -79,7 +79,7 @@
|
|
class="logg"
|
|
class="logg"
|
|
:loading="loading"
|
|
:loading="loading"
|
|
@click.native.prevent="handleLogin"
|
|
@click.native.prevent="handleLogin"
|
|
- >登录
|
|
|
|
|
|
+ >登录
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
</el-form>
|
|
</el-form>
|
|
@@ -87,10 +87,10 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { getCodeImg, isTenantExist, ssoLogin } from "@/api/login";
|
|
|
|
-import { changeDatasource } from "@/api/dataEngine";
|
|
|
|
|
|
+import {getCodeImg, isTenantExist, ssoLogin} from "@/api/login";
|
|
|
|
+import {changeDatasource} from "@/api/dataEngine";
|
|
import Cookies from "js-cookie";
|
|
import Cookies from "js-cookie";
|
|
-import { encrypt, decrypt } from "@/utils/jsencrypt";
|
|
|
|
|
|
+import {encrypt, decrypt} from "@/utils/jsencrypt";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "Login",
|
|
name: "Login",
|
|
@@ -111,12 +111,12 @@ export default {
|
|
},
|
|
},
|
|
loginRules: {
|
|
loginRules: {
|
|
username: [
|
|
username: [
|
|
- { required: true, trigger: "blur", message: "请输入您的账号" },
|
|
|
|
|
|
+ {required: true, trigger: "blur", message: "请输入您的账号"},
|
|
],
|
|
],
|
|
password: [
|
|
password: [
|
|
- { required: true, trigger: "blur", message: "请输入您的密码" },
|
|
|
|
|
|
+ {required: true, trigger: "blur", message: "请输入您的密码"},
|
|
],
|
|
],
|
|
- code: [{ required: true, trigger: "blur", message: "请输入验证码" }],
|
|
|
|
|
|
+ code: [{required: true, trigger: "blur", message: "请输入验证码"}],
|
|
},
|
|
},
|
|
loading: true,
|
|
loading: true,
|
|
// 验证码开关
|
|
// 验证码开关
|
|
@@ -142,15 +142,16 @@ export default {
|
|
methods: {
|
|
methods: {
|
|
// client_id=x3qwrgrO1wYdz72joZ8YyIuD&scope=basic&response_type=code&state=AB1357&redirect_uri=http://127.0.0.1:8001/login
|
|
// client_id=x3qwrgrO1wYdz72joZ8YyIuD&scope=basic&response_type=code&state=AB1357&redirect_uri=http://127.0.0.1:8001/login
|
|
|
|
|
|
|
|
+
|
|
// 校验url
|
|
// 校验url
|
|
validateTenantId() {
|
|
validateTenantId() {
|
|
let tenantCode = this.$route.query["tenantCode"];
|
|
let tenantCode = this.$route.query["tenantCode"];
|
|
if (tenantCode != null) {
|
|
if (tenantCode != null) {
|
|
// 得到tenantId 查询裤中是否存在该租户
|
|
// 得到tenantId 查询裤中是否存在该租户
|
|
- isTenantExist({ tenantCode: tenantCode }).then((res) => {
|
|
|
|
|
|
+ isTenantExist({tenantCode: tenantCode}).then((res) => {
|
|
if (res == undefined) {
|
|
if (res == undefined) {
|
|
this.$message.warning("请访问正确地址!");
|
|
this.$message.warning("请访问正确地址!");
|
|
- this.$router.push({ path: "/401" });
|
|
|
|
|
|
+ this.$router.push({path: "/401"});
|
|
} else if (res.data?.tenantId) {
|
|
} else if (res.data?.tenantId) {
|
|
// 判断当前编号是否存在库中
|
|
// 判断当前编号是否存在库中
|
|
this.tenantId = res.data.tenantId;
|
|
this.tenantId = res.data.tenantId;
|
|
@@ -164,11 +165,11 @@ export default {
|
|
this.getCookie();
|
|
this.getCookie();
|
|
} else {
|
|
} else {
|
|
// 当前访问链接中的租户编号不存在
|
|
// 当前访问链接中的租户编号不存在
|
|
- this.$router.push({ path: "/401" });
|
|
|
|
|
|
+ this.$router.push({path: "/401"});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
- this.$router.push({ path: "/401" });
|
|
|
|
|
|
+ this.$router.push({path: "/401"});
|
|
}
|
|
}
|
|
},
|
|
},
|
|
setConfig() {
|
|
setConfig() {
|
|
@@ -190,9 +191,9 @@ export default {
|
|
|
|
|
|
console.log(
|
|
console.log(
|
|
"" +
|
|
"" +
|
|
- `url(${
|
|
|
|
- process.env.VUE_APP_BASE_IMG_API + loginPageBackgroundImage
|
|
|
|
- })`
|
|
|
|
|
|
+ `url(${
|
|
|
|
+ process.env.VUE_APP_BASE_IMG_API + loginPageBackgroundImage
|
|
|
|
+ })`
|
|
);
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -268,7 +269,7 @@ export default {
|
|
if (valid) {
|
|
if (valid) {
|
|
this.loading = true;
|
|
this.loading = true;
|
|
if (this.loginForm.rememberMe) {
|
|
if (this.loginForm.rememberMe) {
|
|
- Cookies.set("username", this.loginForm.username, { expires: 30 });
|
|
|
|
|
|
+ Cookies.set("username", this.loginForm.username, {expires: 30});
|
|
Cookies.set("password", encrypt(this.loginForm.password), {
|
|
Cookies.set("password", encrypt(this.loginForm.password), {
|
|
expires: 30,
|
|
expires: 30,
|
|
});
|
|
});
|
|
@@ -281,34 +282,29 @@ export default {
|
|
Cookies.remove("rememberMe");
|
|
Cookies.remove("rememberMe");
|
|
}
|
|
}
|
|
let form = {
|
|
let form = {
|
|
- uri: "?client_id=xzz&scope=basic&response_type=code&state=AB1357&redirect_uri=http://192.168.110.76:8066/oauth/callback",
|
|
|
|
|
|
+ uri: "?client_id=mestool&scope=basic&response_type=code&state=AB1357&redirect_uri=http://192.168.110.114:8066/oauth/callback",
|
|
...this.loginForm,
|
|
...this.loginForm,
|
|
tenantID: this.tenantId,
|
|
tenantID: this.tenantId,
|
|
};
|
|
};
|
|
// 调用单点登录
|
|
// 调用单点登录
|
|
- ssoLogin(form)
|
|
|
|
- .then((response) => {
|
|
|
|
- this.loading = false;
|
|
|
|
- if (response.code === 200) {
|
|
|
|
- // Message({message: response.msg, type: "success"});
|
|
|
|
- console.log("认证成功!", response);
|
|
|
|
- // response.msg 当前用户唯一标识 跳转其他系统使用
|
|
|
|
- // this.$store.dispatch("setoauthUUID", response.msg);
|
|
|
|
- window.localStorage.setItem(
|
|
|
|
- "setoauthUUID" + this.loginForm.username,
|
|
|
|
- response.msg
|
|
|
|
- );
|
|
|
|
- setTimeout(() => {
|
|
|
|
- global.window.location.href = response.data;
|
|
|
|
- }, 1000);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- .catch(() => {
|
|
|
|
- this.loading = false;
|
|
|
|
- if (this.captchaEnabled) {
|
|
|
|
- this.getCode();
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ ssoLogin(form).then((response) => {
|
|
|
|
+ this.loading = false;
|
|
|
|
+ if (response.code === 200) {
|
|
|
|
+ // Message({message: response.msg, type: "success"});
|
|
|
|
+ console.log("认证成功!", response)
|
|
|
|
+ // response.msg 当前用户唯一标识 跳转其他系统使用
|
|
|
|
+ // this.$store.dispatch("setoauthUUID", response.msg);
|
|
|
|
+ window.localStorage.setItem("setoauthUUID" + this.loginForm.username, response.msg);
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ global.window.location.href = response.data;
|
|
|
|
+ }, 1000);
|
|
|
|
+ }
|
|
|
|
+ }).catch(() => {
|
|
|
|
+ this.loading = false;
|
|
|
|
+ if (this.captchaEnabled) {
|
|
|
|
+ this.getCode();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
|
|
// this.$store
|
|
// this.$store
|
|
// .dispatch("Login", form)
|
|
// .dispatch("Login", form)
|
|
@@ -379,9 +375,9 @@ export default {
|
|
opacity: 1;
|
|
opacity: 1;
|
|
border-radius: 27px;
|
|
border-radius: 27px;
|
|
background: linear-gradient(
|
|
background: linear-gradient(
|
|
- 135deg,
|
|
|
|
- rgba(79, 138, 255, 1) 0%,
|
|
|
|
- rgba(75, 94, 255, 1) 100%
|
|
|
|
|
|
+ 135deg,
|
|
|
|
+ rgba(79, 138, 255, 1) 0%,
|
|
|
|
+ rgba(75, 94, 255, 1) 100%
|
|
);
|
|
);
|
|
box-shadow: 0px 4px 16px rgba(179, 192, 231, 1);
|
|
box-shadow: 0px 4px 16px rgba(179, 192, 231, 1);
|
|
color: #fff;
|
|
color: #fff;
|