zzzz
2024-04-16 273d548631148f99e17b6898d55a867a0ba93a25
1
{"ast":null,"code":"import \"core-js/modules/es.array.push.js\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\nimport ExInput from \"@/components/ex-input\";\nimport Axios from \"@/API/login.js\";\nimport { mapActions, mapGetters } from \"vuex\";\nimport { GET_USERINFO, SET_CONFIG, SET_KEFU } from \"@/store/const.store\";\nimport nationalityList from \"../authentication/components/nationalityList.vue\";\nexport default {\n  props: {},\n  components: {\n    ExInput,\n    nationalityList\n  },\n  data() {\n    return {\n      username: \"\",\n      password: \"\",\n      activeIndex: 0,\n      isArea: false,\n      typeText: \"password\",\n      dialCode: 0,\n      //电话号前缀\n      icon: \"\"\n    };\n  },\n  computed: {\n    ...mapGetters({\n      theme: \"home/theme\"\n    })\n  },\n  methods: {\n    ...mapActions(\"user\", [GET_USERINFO, SET_CONFIG]),\n    getRegType(activeIndex, bFlag) {\n      switch (activeIndex) {\n        case 0:\n          return bFlag ? this.$t(\"账号\") : this.$t(\"请输入账号\");\n        case 1:\n          return bFlag ? this.$t(\"邮箱\") : this.$t(\"请输入您的邮箱\");\n        case 2:\n          return bFlag ? this.$t(\"手机号\") : this.$t(\"请输入手机号\");\n      }\n    },\n    onSelectArea() {\n      this.openBtn();\n    },\n    //打开国家列表底部弹窗\n    openBtn() {\n      this.$refs.controlChild.open();\n    },\n    //获取到当前选中国家的code值\n    getName(params) {\n      this.icon = params[1];\n      this.dialCode = params[2];\n    },\n    changeIndex(index) {\n      this.activeIndex = index;\n      switch (index) {\n        case 0:\n        case 1:\n          {\n            this.isArea = false;\n            break;\n          }\n        case 2:\n          {\n            this.isArea = true;\n            break;\n          }\n      }\n    },\n    verifyLogin() {\n      if (this.username == \"\") {\n        switch (this.activeIndex) {\n          case 0:\n            {\n              this.$toast(this.$t(\"请输入账号\"));\n              break;\n            }\n          case 1:\n            {\n              this.$toast(this.$t(\"请输入邮箱\"));\n              break;\n            }\n          case 2:\n            {\n              this.$toast(this.$t(\"请输入手机号\"));\n              break;\n            }\n        }\n        return false;\n      }\n      if (this.password == \"\") {\n        this.$toast(this.$t(\"请输入密码\"));\n        return false;\n      }\n      this.login();\n    },\n    async login() {\n      Axios.loginUser({\n        username: this.username,\n        password: this.password\n      }).then(res => {\n        this.GET_USERINFO(res.data);\n        this.SET_CONFIG(); //获取判断是否乘以杠杆字段\n        this.$router.push(\"/home\");\n      }).catch(error => {\n        if (error.code === \"ECONNABORTED\") {\n          this.$toast(this.$t(\"网络超时!\"));\n        } else if (error.msg !== undefined) {\n          this.$toast(this.$t(error.msg));\n        }\n      });\n    }\n  }\n};","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}