{"ast":null,"code":"import \"vant/es/popup/style\";\nimport _Popup from \"vant/es/popup\"; //\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//\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 \"core-js/modules/es.array.push.js\";\nimport ExInput from \"@/components/ex-input\";\nimport Step from \"./step.vue\";\nimport Axios from \"@/API/login.js\";\nimport AxiosuserCenter from \"@/API/userCenter.js\";\nimport { mapActions, mapGetters } from \"vuex\";\nimport { GET_USERINFO } from \"@/store/const.store\";\nimport nationalityList from \"../authentication/components/nationalityList.vue\";\nimport Vcode from \"vue-puzzle-vcode\";\nimport img1 from \"../../assets/image/slider/1.png\";\nimport img2 from \"../../assets/image/slider/2.png\";\nimport { getStorage } from \"@/utils/utis\";\nimport { log } from \"qrcode/lib/core/galois-field\";\n// /sendVerifyCode\nexport default {\n props: {},\n components: {\n [_Popup.name]: _Popup,\n ExInput,\n Step,\n nationalityList,\n Vcode\n },\n data() {\n return {\n // 发送验证码倒计时定时器\n tiem: null,\n codeButTexst: \"发送验证码\",\n form: {\n phone: \"\",\n email: \"\",\n code: \"\",\n username: \"\",\n password: \"\",\n rePassword: \"\",\n usercode: \"\"\n },\n show: false,\n msg: \"\",\n type: 3,\n // 1手机 2 邮箱 3账号\n agree: false,\n username: \"\",\n password: \"\",\n repassword: \"\",\n invitCode: \"\",\n //邀请码\n activeIndex: 1,\n typeText: \"password\",\n isArea: false,\n dialCode: 0,\n //电话号前缀\n icon: \"\",\n img1,\n img2\n };\n },\n beforeDestroy() {\n if (this.tiem) {\n clearInterval(this.tiem);\n this.tiem = null;\n }\n },\n mounted() {\n let usercode = getStorage(\"usercode\");\n if (usercode) {\n this.invitCode = usercode;\n }\n },\n computed: {\n ...mapGetters({\n theme: \"home/theme\"\n })\n },\n methods: {\n async bindEmail() {\n await AxiosuserCenter.bindEmail({\n email: this.form.email,\n verifcode: this.form.code\n });\n return true;\n },\n ...mapActions(\"user\", [GET_USERINFO]),\n async sendCode() {\n // codeButTexst === '发送验证码' ? '' : ' S-but'\n if (this.codeButTexst !== \"发送验证码\") {\n return;\n }\n if (this.form.email) {\n await Axios.sendVerifyCode({\n target: this.form.email\n });\n this.codeButTexst = 60;\n this.tiem = setInterval(() => {\n this.codeButTexst = this.codeButTexst - 1;\n if (this.codeButTexst === 0) {\n this.codeButTexst = \"发送验证码\";\n clearInterval(this.tiem);\n }\n }, 1000);\n }\n },\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 onClose() {\n console.log(\"onClose\");\n },\n onSuccess() {\n console.log(\"onSuccess\");\n this.registerApi();\n this.show = false;\n },\n onFail() {\n this.msg = \"\";\n },\n onRefresh() {\n this.msg = \"\";\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 agreeProt() {\n this.agree = !this.agree;\n },\n register() {\n if (this.form.username == \"\") {\n return this.$toast(this.$t(\"请输入姓名\"));\n }\n let match = this.form.email.search(/@/);\n if (this.form.email == \"\" || match == -1) {\n return this.$toast(this.$t(\"请输入正确的邮箱地址\"));\n }\n if (this.form.phone == \"\") {\n this.$toast(this.$t(\"请输入手机号\"));\n return;\n }\n if (this.form.password == \"\") {\n this.$toast(this.$t(\"请输入密码\"));\n return;\n }\n if (this.form.password !== this.form.rePassword) {\n this.$toast(this.$t(\"密码不一致\"));\n return;\n }\n if (!this.agree) {\n this.$toast(this.$t(\"请同意服务条款\"));\n return;\n }\n this.show = true;\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 async registerApi() {\n Axios.registerTest(this.form).then(res => {\n console.log(44444, res);\n // this.GET_USERINFO(res.data);\n this.$toast(this.$t(\"注册成功\"));\n setTimeout(() => {\n this.$router.push(\"login\");\n }, 1000);\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":[]}