|
|
@@ -158,6 +158,11 @@ import LangSelector from "@/components/LangSelector";
|
|
|
import { login } from "@/api/user";
|
|
|
import CryptoJS from "crypto-js";
|
|
|
// import { getSysList } from "../http/moudules/sys";
|
|
|
+import {
|
|
|
+ getUserIP,
|
|
|
+ getUserLocation,
|
|
|
+ getAddressLocation
|
|
|
+} from "@/utils/ipAndAddress.js";
|
|
|
export default {
|
|
|
name: "Login",
|
|
|
inject: ["reload"],
|
|
|
@@ -189,7 +194,8 @@ export default {
|
|
|
tipVisibility: false,
|
|
|
optionList: [],
|
|
|
sysId: null,
|
|
|
- systemType: "1" //系统类型
|
|
|
+ systemType: "1", //系统类型
|
|
|
+ addressInfo: {} //当前登录信息
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
@@ -238,8 +244,8 @@ export default {
|
|
|
password: this.loginForm.password,
|
|
|
captcha: this.loginForm.captcha.toLowerCase(),
|
|
|
captchaId: this.loginForm.captchaId,
|
|
|
- sysId: this.sysId,
|
|
|
- systemType: this.systemType
|
|
|
+ sysId: this.sysId
|
|
|
+ // systemType: this.systemType
|
|
|
};
|
|
|
|
|
|
// this.$store
|
|
|
@@ -299,6 +305,7 @@ export default {
|
|
|
// alert(res.data);
|
|
|
} else {
|
|
|
Cookies.set("token", res.data); // 放置token到Cookie
|
|
|
+ this.submitLocation();
|
|
|
this.getDictItems();
|
|
|
this.getUser();
|
|
|
}
|
|
|
@@ -317,6 +324,27 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ /**提交当前位置信息 */
|
|
|
+ submitLocation() {
|
|
|
+ let location = {
|
|
|
+ systemType: this.systemType,
|
|
|
+ ...this.addressInfo
|
|
|
+ };
|
|
|
+ this.$api.login.uploadLocationInfo(location).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
getDictItems() {
|
|
|
//--数据字典--
|
|
|
// 性别
|
|
|
@@ -451,6 +479,12 @@ export default {
|
|
|
},
|
|
|
mounted() {
|
|
|
this.refreshCaptcha();
|
|
|
+ /**获取当前登录的ip地址 */
|
|
|
+ getUserIP(ip => {
|
|
|
+ getAddressLocation(ip, info => {
|
|
|
+ this.addressInfo = info;
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState({
|