|
@@ -37,7 +37,6 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-
|
|
|
import { reqLogin, reqOrgChoose, reqOrganizationId } from "@/api/login";
|
|
|
|
|
|
export default {
|
|
@@ -53,19 +52,18 @@ export default {
|
|
|
orgSelected: null
|
|
|
};
|
|
|
},
|
|
|
- created() {
|
|
|
- },
|
|
|
+ created() {},
|
|
|
methods: {
|
|
|
/* 登录按钮 */
|
|
|
onSignIn() {
|
|
|
reqLogin(this.form)
|
|
|
.then(res => {
|
|
|
- console.log(res)
|
|
|
localStorage.setItem("token", res.token);
|
|
|
this.doOrganizationChoose();
|
|
|
})
|
|
|
.catch(err => {
|
|
|
console.log("登录失败", err);
|
|
|
+ this.$message.error("登录失败:" + err);
|
|
|
});
|
|
|
},
|
|
|
handleSet: function() {
|
|
@@ -75,38 +73,43 @@ export default {
|
|
|
},
|
|
|
doOrganizationChoose() {
|
|
|
this.loading = true;
|
|
|
- reqOrgChoose().then(res => {
|
|
|
- if (res == null || res.length == 0) {
|
|
|
- this.$message.info("您没有加入任何组织!");
|
|
|
- } else if (res.length > 1) {
|
|
|
- this.isShowDialog = true;
|
|
|
- this.orgList = res;
|
|
|
- } else {
|
|
|
- console.log("6666")
|
|
|
- this.setOrganizationId(res[0].id);
|
|
|
- }
|
|
|
- }).catch(err => {
|
|
|
- console.log(err)
|
|
|
- this.loading = false;
|
|
|
- })
|
|
|
+ reqOrgChoose()
|
|
|
+ .then(res => {
|
|
|
+ if (res == null || res.length == 0) {
|
|
|
+ this.$message.info("您没有加入任何组织!");
|
|
|
+ } else if (res.length > 1) {
|
|
|
+ this.isShowDialog = true;
|
|
|
+ this.orgList = res;
|
|
|
+ } else {
|
|
|
+ this.setOrganizationId(res[0].id);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.log(err);
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.error("登录失败:" + err);
|
|
|
+ });
|
|
|
},
|
|
|
- setOrganizationId(id){
|
|
|
+ setOrganizationId(id) {
|
|
|
if (!id) {
|
|
|
this.$message.error("发生了一点不愉快的错误!");
|
|
|
return;
|
|
|
}
|
|
|
this.loading = true;
|
|
|
- reqOrganizationId({orgId: id}).then(res => {
|
|
|
- this.isShowDialog = false;
|
|
|
+ reqOrganizationId({ orgId: id })
|
|
|
+ .then(res => {
|
|
|
+ this.isShowDialog = false;
|
|
|
//导航到 正式页面
|
|
|
this.$router.replace("/home/firmInfo");
|
|
|
- }).catch(err => {
|
|
|
- if (err.errMsg) this.$message.error(err.errMsg);
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ if (err.errMsg) this.$message.error(err.errMsg);
|
|
|
else this.$message.error("服务器发生异常");
|
|
|
- }).finally( res => {
|
|
|
- this.loading = false;
|
|
|
- })
|
|
|
- },
|
|
|
+ })
|
|
|
+ .finally(res => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {}
|
|
|
};
|