|
@@ -5,6 +5,7 @@
|
|
|
v-if="form.basics && form.basics.loginBanner"
|
|
|
:src="form.basics.loginBanner"
|
|
|
/>
|
|
|
+ <!-- <img v-if="parent.location.href.includes('lyxx') || parent.location.href.includes('liyuan')" src="https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/20250421-1139511745206807965.jpg"> -->
|
|
|
<img v-else src="@/assets/login2.jpg" />
|
|
|
</div>
|
|
|
<div class="lp_right">
|
|
@@ -36,7 +37,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div class="fa_i_item">
|
|
|
+ <!-- <div class="fa_i_item">
|
|
|
<span>组织</span>
|
|
|
<div>
|
|
|
<el-select
|
|
@@ -50,19 +51,17 @@
|
|
|
<el-option
|
|
|
v-for="item in OrgOptions"
|
|
|
:key="item.Uorg"
|
|
|
- :label="item.name ? item.name + '-' + item.schoolName : item.schoolName"
|
|
|
+ :label="
|
|
|
+ item.name
|
|
|
+ ? item.name + '-' + item.schoolName
|
|
|
+ : item.schoolName
|
|
|
+ "
|
|
|
:value="item.Uorg"
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
- <!-- <input
|
|
|
- type="text"
|
|
|
- placeholder="请输入组织号"
|
|
|
- v-model="org"
|
|
|
- @keyup.enter="loginFn"
|
|
|
- /> -->
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
|
|
|
<div class="fa_i_item">
|
|
|
<span>密码</span>
|
|
@@ -97,23 +96,11 @@
|
|
|
>
|
|
|
账号密码登录
|
|
|
</div>
|
|
|
- <div
|
|
|
- class="btn_box"
|
|
|
- v-if="loginType == 'bind'"
|
|
|
- >
|
|
|
- <div
|
|
|
- class="lp_r_b_btn"
|
|
|
- @click="loginFn"
|
|
|
- v-loading="loading"
|
|
|
- >
|
|
|
+ <div class="btn_box" v-if="loginType == 'bind'">
|
|
|
+ <div class="lp_r_b_btn" @click="loginFn" v-loading="loading">
|
|
|
确认绑定
|
|
|
</div>
|
|
|
- <div
|
|
|
- class="lp_r_b_btn"
|
|
|
- @click="loginType = 'default'"
|
|
|
- >
|
|
|
- 返回登录
|
|
|
- </div>
|
|
|
+ <div class="lp_r_b_btn" @click="loginType = 'default'">返回登录</div>
|
|
|
</div>
|
|
|
<div class="lp_r_b_line">
|
|
|
<template v-if="['default', 'weChat'].includes(loginType)">
|
|
@@ -152,7 +139,6 @@ import qs from "qs";
|
|
|
import { API_CONFIG } from "@/common/apiConfig";
|
|
|
import "@/common/wxLogin";
|
|
|
import { getUser } from "@/api/user";
|
|
|
-import { loginOut } from '@/api/user';
|
|
|
|
|
|
export default {
|
|
|
name: "loginPage",
|
|
@@ -164,7 +150,11 @@ export default {
|
|
|
loading: false,
|
|
|
loginType: "default",
|
|
|
redirect: this.$route.query["redirect"],
|
|
|
- org2: this.$route.query["org"] || (window.location.href.includes('/liyuan') ? window.sessionStorage.getItem('org2') : ''),
|
|
|
+ org2:
|
|
|
+ this.$route.query["org"] ||
|
|
|
+ (window.location.href.includes("/liyuan")
|
|
|
+ ? window.sessionStorage.getItem("org2")
|
|
|
+ : ""),
|
|
|
oid: this.$route.query["oid"],
|
|
|
// 组织列表
|
|
|
OrgOptions: [],
|
|
@@ -174,7 +164,9 @@ export default {
|
|
|
openid: "",
|
|
|
allowOrgList: [
|
|
|
{
|
|
|
- id: "3823a6a5-1b6e-11f0-a66a-005056924926",
|
|
|
+ area:
|
|
|
+ parent.location.href.includes("lyxx") ||
|
|
|
+ parent.location.href.includes("liyuan"),
|
|
|
list: [
|
|
|
"3823a6a5-1b6e-11f0-a66a-005056924926",
|
|
|
"292e34dc-1b6e-11f0-a66a-005056924926",
|
|
@@ -199,11 +191,13 @@ export default {
|
|
|
methods: {
|
|
|
...mapActions({
|
|
|
login: "user/login",
|
|
|
- logout: 'user/logout'
|
|
|
+ logout: "user/logout",
|
|
|
}),
|
|
|
async loginFn() {
|
|
|
if (this.loading) return;
|
|
|
-
|
|
|
+ const regEmail = new RegExp(
|
|
|
+ "^[A-Za-z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$"
|
|
|
+ );
|
|
|
if (this.account.length <= 0) {
|
|
|
this.$message.error("请输入账号");
|
|
|
return;
|
|
@@ -214,21 +208,37 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (this.allowOrgList.find((i) => i.id == this.org2)) {
|
|
|
- let _list = this.allowOrgList.find((i) => i.id == this.org2).list;
|
|
|
- let _nowOrgId = this.OrgOptions.find((i) => i.Uorg == this.org).id;
|
|
|
- if (!_list.includes(_nowOrgId)) {
|
|
|
+ let str = this.account.replace(/(^\s*)|(\s*$)/g, "");
|
|
|
+
|
|
|
+ if (!regEmail.test(str)) {
|
|
|
+ return this.$message.error(
|
|
|
+ "请在账号后添加组织后缀(账号@组织号.com 如:123456@cocorobo.com)"
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.allowOrgList.findIndex((i) => i.area) != -1) {
|
|
|
+ let _index = this.allowOrgList.findIndex((i) => i.area);
|
|
|
+ let _list = this.allowOrgList[_index].list;
|
|
|
+ if (
|
|
|
+ !_list.includes(this.OrgOptions.find((i) => i.Uorg == this.org).id)
|
|
|
+ ) {
|
|
|
+ return this.$message.error("该组织/学校不允许登录");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ let mergedList = this.allowOrgList.reduce((acc, curr) => {
|
|
|
+ return [...acc, ...curr.list];
|
|
|
+ }, []);
|
|
|
+ if (
|
|
|
+ mergedList.includes(
|
|
|
+ this.OrgOptions.find((i) => i.Uorg == this.org).id
|
|
|
+ )
|
|
|
+ ) {
|
|
|
return this.$message.error("该组织/学校不允许登录");
|
|
|
}
|
|
|
- window.sessionStorage.setItem('org2',this.org2)
|
|
|
}
|
|
|
|
|
|
let orgValue = this.org ? "@" + this.org : "@cocorobo.cc";
|
|
|
let email = "";
|
|
|
- const regEmail = new RegExp(
|
|
|
- "^[A-Za-z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$"
|
|
|
- );
|
|
|
- let str = this.account.replace(/(^\s*)|(\s*$)/g, "");
|
|
|
|
|
|
// 判断用户输入账户带不带后缀
|
|
|
if (!regEmail.test(str)) {
|
|
@@ -252,15 +262,19 @@ export default {
|
|
|
.then(async (res) => {
|
|
|
console.log("res", res);
|
|
|
let _data = res.data[0][0];
|
|
|
- let userjson = await getUser({userid: _data.userid})
|
|
|
- console.log('userjson', userjson);
|
|
|
+ let userjson = await getUser({ userid: _data.userid });
|
|
|
+ console.log("userjson", userjson);
|
|
|
if (_data.active === 1) {
|
|
|
window.localStorage["identity"] = JSON.stringify(_data.identity);
|
|
|
this.$message.success("登录成功");
|
|
|
await this.login();
|
|
|
- if(userjson.data[0][0].type == 1 && userjson.data[0][0].role == 1 && userjson.data[0][0].rrole == 1 ){
|
|
|
+ if (
|
|
|
+ userjson.data[0][0].type == 1 &&
|
|
|
+ userjson.data[0][0].role == 1 &&
|
|
|
+ userjson.data[0][0].rrole == 1
|
|
|
+ ) {
|
|
|
this.$router.push({ path: "/kanban" });
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
this.$router.push({ path: this.redirect || "/" });
|
|
|
}
|
|
|
} else {
|
|
@@ -305,8 +319,8 @@ export default {
|
|
|
.then(async (res) => {
|
|
|
console.log("res", res);
|
|
|
let _data = res.data[0][0];
|
|
|
- let userjson = await getUser({userid: _data.userid})
|
|
|
- console.log('userjson', userjson);
|
|
|
+ let userjson = await getUser({ userid: _data.userid });
|
|
|
+ console.log("userjson", userjson);
|
|
|
if (_data.active === 1) {
|
|
|
await this.$ajax.post(API_CONFIG.baseUrl2 + "UpdateOpenId", [
|
|
|
{ userid: _data.userid, openid: this.openid },
|
|
@@ -314,9 +328,13 @@ export default {
|
|
|
window.localStorage["identity"] = JSON.stringify(_data.identity);
|
|
|
this.$message.success("绑定成功");
|
|
|
await this.login();
|
|
|
- if(userjson.data[0][0].type == 1 && userjson.data[0][0].role == 1 && userjson.data[0][0].rrole == 1 ){
|
|
|
+ if (
|
|
|
+ userjson.data[0][0].type == 1 &&
|
|
|
+ userjson.data[0][0].role == 1 &&
|
|
|
+ userjson.data[0][0].rrole == 1
|
|
|
+ ) {
|
|
|
this.$router.push({ path: "/kanban" });
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
this.$router.push({ path: this.redirect || "/" });
|
|
|
}
|
|
|
} else {
|
|
@@ -362,12 +380,30 @@ export default {
|
|
|
.then((res) => {
|
|
|
console.log("res", res);
|
|
|
this.org = "";
|
|
|
- this.OrgOptions = "";
|
|
|
+ this.OrgOptions = [];
|
|
|
+
|
|
|
+ let getList = res.data[0];
|
|
|
|
|
|
- this.OrgOptions = res.data[0];
|
|
|
+ if (this.allowOrgList.findIndex((i) => i.area) != -1) {
|
|
|
+ let _index = this.allowOrgList.findIndex((i) => i.area);
|
|
|
+ let _list = this.allowOrgList[_index].list;
|
|
|
+ getList = getList.filter((i) => _list.includes(i.id));
|
|
|
+ } else {
|
|
|
+ let mergedList = this.allowOrgList.reduce((acc, curr) => {
|
|
|
+ return [...acc, ...curr.list];
|
|
|
+ }, []);
|
|
|
+ getList = getList.filter((i) => !mergedList.includes(i.id));
|
|
|
+ }
|
|
|
+
|
|
|
+ this.OrgOptions = getList;
|
|
|
if (this.OrgOptions.length == 1) {
|
|
|
this.org = this.OrgOptions[0].Uorg;
|
|
|
- this.$forceUpdate();
|
|
|
+ } else if (this.OrgOptions.length > 0) {
|
|
|
+ // if (this.OrgOptions.map((i) => i.Uorg).includes("@cocorobo.cc")) {
|
|
|
+ // this.org = "@cocorobo.cc";
|
|
|
+ // } else {
|
|
|
+ // this.org = this.OrgOptions[0].Uorg;
|
|
|
+ // }
|
|
|
}
|
|
|
resolve();
|
|
|
})
|
|
@@ -442,33 +478,63 @@ export default {
|
|
|
this.account = _data.username;
|
|
|
await this.getOrgData();
|
|
|
|
|
|
- if (this.allowOrgList.find((i) => i.id == this.org2)) {
|
|
|
- let _list = this.allowOrgList.find((i) => i.id == this.org2).list;
|
|
|
- let _nowOrgId = this.OrgOptions.find((i) => i.Uorg == this.org).id;
|
|
|
- if (!_list.includes(_nowOrgId)) {
|
|
|
- this.wechatLogin();
|
|
|
- await loginOut()
|
|
|
- await this.logout();
|
|
|
+ // if (
|
|
|
+ // (this.allowOrgList.find((i) => i.id == this.org2) &&
|
|
|
+ // parent.location.href.includes("lyxx")) ||
|
|
|
+ // parent.location.href.includes("liyuan")
|
|
|
+ // ) {
|
|
|
+ // let _list = this.allowOrgList.find((i) => i.id == this.org2).list;
|
|
|
+ // let _nowOrgId = this.OrgOptions.find((i) => i.Uorg == this.org).id;
|
|
|
+ // if (!_list.includes(_nowOrgId)) {
|
|
|
+ // this.wechatLogin();
|
|
|
+ // await loginOut();
|
|
|
+ // await this.logout();
|
|
|
+ // return this.$message.error("该组织/学校不允许登录");
|
|
|
+ // }
|
|
|
+ // window.sessionStorage.setItem("org2", this.org2);
|
|
|
+ // }
|
|
|
+
|
|
|
+ if (this.allowOrgList.findIndex((i) => i.area) != -1) {
|
|
|
+ let _index = this.allowOrgList.findIndex((i) => i.area);
|
|
|
+ let _list = this.allowOrgList[_index].list;
|
|
|
+ if (
|
|
|
+ !_list.includes(
|
|
|
+ this.OrgOptions.find((i) => i.Uorg == this.org).id
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ return this.$message.error("该组织/学校不允许登录");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ let mergedList = this.allowOrgList.reduce((acc, curr) => {
|
|
|
+ return [...acc, ...curr.list];
|
|
|
+ }, []);
|
|
|
+ if (
|
|
|
+ mergedList.includes(
|
|
|
+ this.OrgOptions.find((i) => i.Uorg == this.org).id
|
|
|
+ )
|
|
|
+ ) {
|
|
|
return this.$message.error("该组织/学校不允许登录");
|
|
|
}
|
|
|
- window.sessionStorage.setItem('org2',this.org2)
|
|
|
}
|
|
|
- let userjson = await getUser({userid: _data.userid})
|
|
|
- console.log('userjson', userjson);
|
|
|
+ let userjson = await getUser({ userid: _data.userid });
|
|
|
+ console.log("userjson", userjson);
|
|
|
if (_data.active === 1) {
|
|
|
window.localStorage["identity"] = JSON.stringify(_data.identity);
|
|
|
this.$message.success("登录成功");
|
|
|
await this.login();
|
|
|
- if(userjson.data[0][0].type == 1 && userjson.data[0][0].role == 1 && userjson.data[0][0].rrole == 1 ){
|
|
|
+ if (
|
|
|
+ userjson.data[0][0].type == 1 &&
|
|
|
+ userjson.data[0][0].role == 1 &&
|
|
|
+ userjson.data[0][0].rrole == 1
|
|
|
+ ) {
|
|
|
this.$router.push({ path: "/kanban" });
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
this.$router.push({ path: this.redirect || "/" });
|
|
|
}
|
|
|
} else {
|
|
|
this.$message.error("登录失败");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
this.loading = false;
|
|
|
})
|
|
|
.catch((err) => {
|
|
@@ -575,12 +641,14 @@ export default {
|
|
|
height: 100%;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
- justify-content: space-around;
|
|
|
+ /* align-items: center; */
|
|
|
+ justify-content: center;
|
|
|
}
|
|
|
|
|
|
.fa_i_item {
|
|
|
width: 100%;
|
|
|
height: 70px;
|
|
|
+ margin-bottom: 30px;
|
|
|
}
|
|
|
|
|
|
.fa_i_item > span {
|
|
@@ -730,8 +798,7 @@ export default {
|
|
|
height: 100%;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-.btn_box{
|
|
|
+.btn_box {
|
|
|
display: flex;
|
|
|
gap: 10px;
|
|
|
}
|