|
@@ -92,6 +92,9 @@
|
|
>鄂ICP备12000033号-10</a
|
|
>鄂ICP备12000033号-10</a
|
|
>
|
|
>
|
|
</div>
|
|
</div>
|
|
|
|
+
|
|
|
|
+ <!-- ResetPwd -->
|
|
|
|
+ <reset-pwd ref="ResetPwd" @confirm="pwdModified"></reset-pwd>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -99,9 +102,10 @@
|
|
import { LOGIN_BY_USERNAME } from "../../store/action-types";
|
|
import { LOGIN_BY_USERNAME } from "../../store/action-types";
|
|
import { ORG_CODE } from "../../constant/constants";
|
|
import { ORG_CODE } from "../../constant/constants";
|
|
import { getLogo } from "@/api/login";
|
|
import { getLogo } from "@/api/login";
|
|
|
|
+import ResetPwd from "@/views/Layout/components/ResetPwd.vue";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
- // components: { BasicContainer },
|
|
|
|
|
|
+ components: { ResetPwd },
|
|
name: "Login",
|
|
name: "Login",
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -121,42 +125,61 @@ export default {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
async submitBtn() {
|
|
async submitBtn() {
|
|
- this.$refs["form"].validate(async (valid) => {
|
|
|
|
- if (valid) {
|
|
|
|
- try {
|
|
|
|
- this.loading = true;
|
|
|
|
- await this.$store.dispatch(LOGIN_BY_USERNAME, {
|
|
|
|
- loginName: this.user.username,
|
|
|
|
- password: this.user.password,
|
|
|
|
- code: ORG_CODE,
|
|
|
|
- });
|
|
|
|
- // console.log(res);
|
|
|
|
- // localStorage.setItem("themis-user", res.data);
|
|
|
|
-
|
|
|
|
- const user = this.$store.state.user;
|
|
|
|
- const needLiveUrl =
|
|
|
|
- user.roleCodes.includes("SUPER_ADMIN") ||
|
|
|
|
- user.roleCodes.includes("ADMIN") ||
|
|
|
|
- user.roleCodes.includes("INSPECTION") ||
|
|
|
|
- user.roleCodes.includes("INVIGILATE");
|
|
|
|
- if (needLiveUrl)
|
|
|
|
- await this.$store.dispatch("invigilation/fetchLiveDomains");
|
|
|
|
|
|
+ const valid = await this.$refs["form"].validate();
|
|
|
|
+ if (!valid) return;
|
|
|
|
|
|
- this.$message({
|
|
|
|
- message: "登录成功",
|
|
|
|
- type: "success",
|
|
|
|
- duration: 1.5,
|
|
|
|
- showClose: true,
|
|
|
|
- });
|
|
|
|
- this.$router.push("/home");
|
|
|
|
- } catch (error) {
|
|
|
|
- // console.log(error?.response?.data?.message);
|
|
|
|
- this.user.errorInfo = error?.response?.data?.message || "";
|
|
|
|
- } finally {
|
|
|
|
- this.loading = false;
|
|
|
|
- }
|
|
|
|
|
|
+ try {
|
|
|
|
+ this.loading = true;
|
|
|
|
+ await this.$store.dispatch(LOGIN_BY_USERNAME, {
|
|
|
|
+ loginName: this.user.username,
|
|
|
|
+ password: this.user.password,
|
|
|
|
+ code: ORG_CODE,
|
|
|
|
+ });
|
|
|
|
+ if (!this.$store.state.user.pwdForce) {
|
|
|
|
+ this.$refs.ResetPwd.open();
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ await this.loginSuccess();
|
|
|
|
+ } catch (error) {
|
|
|
|
+ // console.log(error?.response?.data?.message);
|
|
|
|
+ this.user.errorInfo = error?.response?.data?.message || "";
|
|
|
|
+ } finally {
|
|
|
|
+ this.loading = false;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ async pwdModified(userData) {
|
|
|
|
+ try {
|
|
|
|
+ this.loading = true;
|
|
|
|
+ await this.$store.dispatch(LOGIN_BY_USERNAME, {
|
|
|
|
+ loginName: this.user.username,
|
|
|
|
+ password: userData.password,
|
|
|
|
+ code: ORG_CODE,
|
|
|
|
+ });
|
|
|
|
+ await this.loginSuccess();
|
|
|
|
+ } catch (error) {
|
|
|
|
+ this.user.errorInfo = error?.response?.data?.message || "";
|
|
|
|
+ } finally {
|
|
|
|
+ this.loading = false;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ async loginSuccess() {
|
|
|
|
+ const user = this.$store.state.user;
|
|
|
|
+ const needLiveUrl =
|
|
|
|
+ user.roleCodes.includes("SUPER_ADMIN") ||
|
|
|
|
+ user.roleCodes.includes("ADMIN") ||
|
|
|
|
+ user.roleCodes.includes("INSPECTION") ||
|
|
|
|
+ user.roleCodes.includes("INVIGILATE");
|
|
|
|
+ if (needLiveUrl)
|
|
|
|
+ await this.$store.dispatch("invigilation/fetchLiveDomains");
|
|
|
|
+
|
|
|
|
+ this.$message({
|
|
|
|
+ message: "登录成功",
|
|
|
|
+ type: "success",
|
|
|
|
+ duration: 1.5,
|
|
|
|
+ showClose: true,
|
|
});
|
|
});
|
|
|
|
+ this.$router.push("/home");
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
};
|