|
@@ -323,29 +323,32 @@ export default {
|
|
|
},
|
|
|
// 输入账号获取组织
|
|
|
getOrgData() {
|
|
|
- let params = [
|
|
|
- {
|
|
|
- functionName: API_CONFIG.ajax_liYuanOrg.functionName,
|
|
|
- uname: this.account,
|
|
|
- },
|
|
|
- ];
|
|
|
- this.$ajax
|
|
|
- .post(API_CONFIG.baseUrl, params)
|
|
|
- .then((res) => {
|
|
|
- console.log("res", res);
|
|
|
- this.org = "";
|
|
|
- this.OrgOptions = "";
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ let params = [
|
|
|
+ {
|
|
|
+ functionName: API_CONFIG.ajax_liYuanOrg.functionName,
|
|
|
+ uname: this.account,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ this.$ajax
|
|
|
+ .post(API_CONFIG.baseUrl, params)
|
|
|
+ .then((res) => {
|
|
|
+ console.log("res", res);
|
|
|
+ this.org = "";
|
|
|
+ this.OrgOptions = "";
|
|
|
|
|
|
- this.OrgOptions = res.data[0];
|
|
|
- if (this.OrgOptions.length == 1) {
|
|
|
- this.org = this.OrgOptions[0].Uorg;
|
|
|
- this.$forceUpdate();
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.log(err);
|
|
|
- this.$message.error("获取组织失败");
|
|
|
- });
|
|
|
+ this.OrgOptions = res.data[0];
|
|
|
+ if (this.OrgOptions.length == 1) {
|
|
|
+ this.org = this.OrgOptions[0].Uorg;
|
|
|
+ this.$forceUpdate();
|
|
|
+ }
|
|
|
+ resolve();
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err);
|
|
|
+ this.$message.error("获取组织失败");
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
//获取组织或学校的数据
|
|
|
getOrdOidData() {
|
|
@@ -407,36 +410,28 @@ export default {
|
|
|
.then(async (res) => {
|
|
|
console.log("res", res);
|
|
|
let _data = res.data[0][0];
|
|
|
- axios.defaults.withCredentials = false;
|
|
|
- this.$ajax
|
|
|
- .get("https://pbl.cocorobo.cn/api/pbl/selectUser/selectUser", {
|
|
|
- userid: _data.userid,
|
|
|
- })
|
|
|
- .then(async (res2) => {
|
|
|
- console.log("👈", res2);
|
|
|
- let _uorg = res2.data[0][0].org;
|
|
|
- if (this.allowOrgList.find((i) => i.id == this.org2)) {
|
|
|
- let _list = this.allowOrgList.find(
|
|
|
- (i) => i.id == this.org2
|
|
|
- ).list;
|
|
|
- if (!_list.includes(_uorg)) {
|
|
|
- this.wechatLogin();
|
|
|
- console.log("不允许登录");
|
|
|
- return this.$message.error("该组织/学校不允许登录");
|
|
|
- }
|
|
|
- }
|
|
|
- if (_data.active === 1) {
|
|
|
- window.localStorage["identity"] = JSON.stringify(
|
|
|
- _data.identity
|
|
|
- );
|
|
|
- this.$message.success("登录成功");
|
|
|
- await this.login();
|
|
|
- this.$router.push({ path: this.redirect || "/" });
|
|
|
- } else {
|
|
|
- this.$message.error("登录失败");
|
|
|
- }
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
+ // let userData = await this.ajax.get("https://pbl.cocorobo.cn/api/pbl/selectUser/selectUser", { userid: _data.userid });
|
|
|
+ // let _uorg = userData.data[0][0].org;
|
|
|
+ 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();
|
|
|
+ return this.$message.error("该组织/学校不允许登录");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (_data.active === 1) {
|
|
|
+ window.localStorage["identity"] = JSON.stringify(_data.identity);
|
|
|
+ this.$message.success("登录成功");
|
|
|
+ await this.login();
|
|
|
+ this.$router.push({ path: this.redirect || "/" });
|
|
|
+ } else {
|
|
|
+ this.$message.error("登录失败");
|
|
|
+ }
|
|
|
+ this.loading = false;
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
console.log(err.response);
|