1
zzzz
2024-04-23 adeb6ead0a164d65844efea1a75c2379b6923f39
src/page/register/index.vue
@@ -30,7 +30,7 @@
    />
    <ExInput
      :placeholderText="$t('请确认密码')"
      v-model="form.rePassword"
      v-model="form.re_password"
      typeText="password"
    />
    <ExInput
@@ -114,7 +114,7 @@
        code: "",
        username: "",
        password: "",
        rePassword: "",
        re_password: "",
        usercode: "",
      },
      show: false,
@@ -193,10 +193,21 @@
    onClose() {
      console.log("onClose");
    },
    onSuccess() {
      console.log("onSuccess");
      this.registerApi();
    async onSuccess() {
      this.show = false;
      //   this.registerApi();
      AxiosuserCenter.invitationCode({
        email: this.form.email,
        verificationCode: this.form.code,
        code: this.form.usercode,
        phone: this.form.phone,
      })
        .then(() => {
          this.registerApi();
        })
        .catch((err) => {
          //   this.$toast(this.$t(res.msg));
        });
    },
    onFail() {
      this.msg = "";
@@ -235,11 +246,14 @@
        this.$toast(this.$t("请输入密码"));
        return;
      }
      if (this.form.password !== this.form.rePassword) {
      if (this.form.password !== this.form.re_password) {
        this.$toast(this.$t("密码不一致"));
        return;
      }
      if (this.form.usercode == "") {
        this.$toast(this.$t("请输入邀请码"));
        return;
      }
      if (!this.agree) {
        this.$toast(this.$t("请同意服务条款"));
        return;
@@ -249,52 +263,24 @@
    async registerApi() {
      this.$store.state.user.userInfo.token = undefined;
      await AxiosuserCenter.invitationCode({
        code: this.form.usercode,
      console.log({
        ...this.form,
        type: 0,
        em: this.form.email,
      });
      Axios.registerUser({
        username: this.form.email,
        password: this.form.password,
        re_password: this.form.rePassword,
        type: 2,
        usercode: this.form.usercode,
        ...this.form,
        type: 4,
        em: this.form.email,
      })
        .then((res) => {
          this.GET_USERINFO(res.data);
          this.bindEmail(res.data.token)
            .then((val) => {
              // console.log(val);
              Axios.registerTest({
                username: this.form.username,
                phone: this.form.phone,
                email: this.form.email,
                tokne: res.data.token,
              })
                .then((data) => {
                  this.$toast(this.$t("注册成功"));
                  setTimeout(() => {
                    this.$router.push("login");
                  }, 1000);
                })
                .catch((error) => {
                  this.codeButTexst = "发送验证码";
                  clearInterval(this.tiem);
                  if (error.code === "ECONNABORTED") {
                    this.$toast(this.$t("网络超时!"));
                  } else if (error.msg !== undefined) {
                    this.$toast(this.$t(error.msg));
                  }
                });
            })
            .catch((error) => {
              this.codeButTexst = "发送验证码";
              clearInterval(this.tiem);
              if (error.code === "ECONNABORTED") {
                this.$toast(this.$t("网络超时!"));
              } else if (error.msg !== undefined) {
                this.$toast(this.$t(error.msg));
              }
            });
          console.log(res, "=======");
          // this.GET_USERINFO(res.data);
          // this.bindEmail(res.data.token);
          this.$toast(this.$t("注册成功"));
          setTimeout(() => {
            this.$router.push("login");
          }, 1000);
        })
        .catch((error) => {
          this.codeButTexst = "发送验证码";