From f42aa899f6264062d66a53e41e8954468725aa7a Mon Sep 17 00:00:00 2001
From: zzzz <690498789@qq.com>
Date: Tue, 23 Apr 2024 00:16:26 +0800
Subject: [PATCH] 1

---
 src/page/login/index.vue    |   67 +++++++++++++++++++++++++++++----
 src/page/register/index.vue |   24 ++++++++---
 src/API/login.js            |   10 +++--
 src/i18n/zh.json            |    1 
 4 files changed, 83 insertions(+), 19 deletions(-)

diff --git a/src/API/login.js b/src/API/login.js
index 8c18c82..1301d59 100644
--- a/src/API/login.js
+++ b/src/API/login.js
@@ -27,11 +27,13 @@
 //注册用户
 ///
 const registerUser = (params) => {
-  return requestHttp({
-    url: "api/user/register",
-    method: "post",
+  return httpJson({
+    // url: "api/user/register",
+    url: "api/localuser!registerNoVerifcode",
+    method: "get",
     isLoading: true,
-    data: objectToFormData(params),
+    // data: objectToFormData(params),
+    params,
   });
 };
 //登录
diff --git a/src/i18n/zh.json b/src/i18n/zh.json
index 5835215..998f012 100644
--- a/src/i18n/zh.json
+++ b/src/i18n/zh.json
@@ -1940,6 +1940,7 @@
   "是否认购": "是否认购",
   "USDC充值": "USDC充值",
   "BNB充值": "BNB充值",
+  "記住帳戶密碼": "記住帳戶密碼",
   "请先实名认证!": "请先实名认证!",
   "请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。": "请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。"
 }
\ No newline at end of file
diff --git a/src/page/login/index.vue b/src/page/login/index.vue
index 34bb5ca..e880925 100644
--- a/src/page/login/index.vue
+++ b/src/page/login/index.vue
@@ -27,13 +27,22 @@
       v-model="password"
       typeText="password"
     />
-    <div class="forget colorMain" @click="$router.push('/forget')">
-      {{ $t("忘记密码?") }}
-    </div>
-    <div class="remember" data-v-8cc76a7b="">
-      <van-checkbox @change="checkboxChange" v-model="checked">{{
-        $t("記住帳戶密碼")
-      }}</van-checkbox>
+    <div
+      style="
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        margin-top: 10px;
+      "
+    >
+      <div class="forget colorMain" @click="$router.push('/forget')">
+        {{ $t("忘记密码?") }}
+      </div>
+      <div class="remember" data-v-8cc76a7b="">
+        <van-checkbox @change="checkboxChange" v-model="checked">{{
+          $t("記住帳戶密碼")
+        }}</van-checkbox>
+      </div>
     </div>
     <div class="btn btnMain" @click="verifyLogin">{{ $t("登录") }}</div>
     <div class="noTips textColor">
@@ -74,6 +83,27 @@
       icon: "",
     };
   },
+  mounted() {
+    const ret = window.localStorage.getItem("login_admin");
+    this.checked = window.localStorage.getItem("login_checked") === "true";
+    console.log(ret, this.checked);
+    if (ret && this.checked) {
+      this.password = JSON.parse(ret).password;
+      this.username = JSON.parse(ret).username;
+    }
+  },
+  activated() {
+    const ret = window.localStorage.getItem("login_admin");
+    this.checked = window.localStorage.getItem("login_checked") === "true";
+    console.log(ret, this.checked);
+    if (ret && this.checked) {
+      this.password = JSON.parse(ret).password;
+      this.username = JSON.parse(ret).username;
+    } else {
+      this.password = "";
+      this.username = "";
+    }
+  },
   computed: {
     ...mapGetters({
       theme: "home/theme",
@@ -81,7 +111,9 @@
   },
   methods: {
     ...mapActions("user", [GET_USERINFO, SET_CONFIG]),
-    checkboxChange(e) {},
+    checkboxChange(e) {
+      window.localStorage.setItem("login_checked", e);
+    },
     getRegType(activeIndex, bFlag) {
       switch (activeIndex) {
         case 0:
@@ -148,6 +180,18 @@
         password: this.password,
       })
         .then((res) => {
+          if (this.checked) {
+            window.localStorage.setItem(
+              "login_admin",
+              JSON.stringify({
+                username: this.username,
+                password: this.password,
+              })
+            );
+          } else {
+            window.localStorage.setItem("login_admin", "");
+          }
+
           this.GET_USERINFO(res.data);
           this.SET_CONFIG(); //获取判断是否乘以杠杆字段
           this.$router.push("/home");
@@ -165,6 +209,13 @@
 </script>
 
 <style lang="scss" scoped>
+::v-deep .van-icon {
+  width: 1.3rem;
+  height: 1.3rem;
+}
+::v-deep .van-checkbox__icon {
+  height: auto;
+}
 .login {
   width: 100%;
   padding: 30px;
diff --git a/src/page/register/index.vue b/src/page/register/index.vue
index f3355e1..5953ca2 100644
--- a/src/page/register/index.vue
+++ b/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,20 @@
     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,
+      //   }).then((res) => {
+      //     if (res.code == 0) {
+      //       this.registerApi();
+      //     } else {
+      //       this.$toast(this.$t(res.msg));
+      //     }
+      //   });
     },
     onFail() {
       this.msg = "";
@@ -235,7 +245,7 @@
         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;
       }
@@ -243,7 +253,6 @@
         this.$toast(this.$t("请输入邀请码"));
         return;
       }
-
       if (!this.agree) {
         this.$toast(this.$t("请同意服务条款"));
         return;
@@ -257,6 +266,7 @@
       Axios.registerUser({
         ...this.form,
         type: 2,
+        em: this.form.email,
       })
         .then((res) => {
           console.log(res, "=======");

--
Gitblit v1.9.3