Browse Source

feat: 国内分销商注册登录改造

周玉环 4 days ago
parent
commit
08fd80648b

+ 1 - 0
xinkeaboard-web/assets/language/en.js

@@ -515,6 +515,7 @@ export const lang_en = {
     '请输入新邮箱':'Please enter a new email address',
     '确定提交':'determine',
     '请先绑定邮箱,再进行登陆密码操作!':'Please bind the email first, and then sign in the password!',
+    '请先绑定手机号,再进行登陆密码操作': 'Please bind the phone first, and then sign in the password!',
 
     //个人中心-询盘列表
     '序号': 'Index',

+ 1 - 0
xinkeaboard-web/assets/language/zh.js

@@ -556,6 +556,7 @@ export const lang_zn = {
     '请输入新邮箱':'请输入新邮箱',
     '确定提交':'确定',
     '请先绑定邮箱,再进行登陆密码操作!':'请先绑定邮箱,再进行登陆密码操作!',
+    '请先绑定手机号,再进行登陆密码操作': '请先绑定手机号,再进行登陆密码操作',
 
     //个人中心-我的余额
     '总金额': '总金额',

+ 496 - 0
xinkeaboard-web/components/retrieve/RetrievePwdByPhone.vue

@@ -0,0 +1,496 @@
+<template>
+  <div class="center">
+    <div class="item account">
+      <span
+        style="color: #bbb; font-size: 21px; padding-top: 7px"
+        class="icon iconfont icon-wode"
+      ></span>
+      <input
+        type="text"
+        v-model="memberMobile"
+        :placeholder="L['请输入手机号']"
+        class="input"
+      />
+      <div
+        data-type="userName"
+        class="cancel"
+        @click="clearInputVal('memberMobile')"
+      >
+        <span style="color: #bbb" class="iconfont icon-cuowu"></span>
+      </div>
+    </div>
+    <div class="error" v-if="mobileErrorMsg">
+      <span
+        style="color: #e1251b; font-size: 14px"
+        class="iconfont icon-jubao"
+      ></span>
+      {{ mobileErrorMsg }}
+    </div>
+    <!-- 邮箱验证码 -->
+    <div class="verify-code">
+      <span class="verify-code-icon">
+        <img src="/register/mail_success.png" alt="" />
+      </span>
+      <input
+        type="text"
+        v-model="mobileCode"
+        :placeholder="L['请输入验证码']"
+        class="input"
+        autocomplete="off"
+      />
+      <span class="verify-code-accept">
+        <el-button
+          @click="showHMVerify"
+          :disabled="countDownNumer"
+          :loading="getVerifyCodeLoading"
+        >
+          <span>{{ codeText }}</span>
+          <span v-if="countDownNumer">{{ `(${countDownNumer})` }}</span>
+        </el-button>
+      </span>
+    </div>
+    <div class="error" v-if="mobileCodeErrorMsg">
+      <span
+        style="color: #e1251b; font-size: 14px"
+        class="iconfont icon-jubao"
+      ></span>
+      {{ mobileCodeErrorMsg }}
+    </div>
+    <div class="item password">
+      <span
+        style="color: #bbb; font-size: 21px; padding-top: 7px"
+        class="icon iconfont icon-mima1"
+      ></span>
+      <input
+        :type="showPwdFlag ? 'text' : 'password'"
+        v-model="password"
+        :placeholder="L['请输入密码']"
+        class="input"
+        @focus="checkPwdValidate"
+        @blur="checkPwdValidate"
+      />
+      <div class="cancel" @click="isShowPwd">
+        <span
+          :style="{
+            color: '#bbb',
+            fontSize: showPwdFlag ? '20px' : '16px',
+          }"
+          :class="{
+            iconfont: true,
+            'icon-bukejian11': !showPwdFlag,
+            'icon-kejian': showPwdFlag,
+            show_pwd: showPwdFlag,
+          }"
+        ></span>
+      </div>
+      <div class="error" v-if="checkPwdErrorMsg">
+        <span
+          style="color: #e1251b; font-size: 14px"
+          class="iconfont icon-jubao"
+        ></span>
+        {{ checkPwdErrorMsg }}
+      </div>
+    </div>
+    <div class="item confirm">
+      <span style="color: #bbb; font-size: 21px; padding-top: 7px" class="icon"
+        ><img src="/register/pwd_confirm.png" alt=""
+      /></span>
+      <input
+        class="input"
+        v-model="confirmPassword"
+        :type="showConfirmPwdFlag ? 'text' : 'password'"
+        :placeholder="L['register']['请确认密码']"
+        @blur="checkPwdMatched"
+      />
+      <div class="cancel" @click="isShowConfirmPwd">
+        <span
+          :style="{
+            color: '#bbb',
+            fontSize: showConfirmPwdFlag ? '20px' : '16px',
+          }"
+          :class="{
+            iconfont: true,
+            'icon-bukejian11': !showConfirmPwdFlag,
+            'icon-kejian': showConfirmPwdFlag,
+            show_pwd: showConfirmPwdFlag,
+          }"
+        ></span>
+      </div>
+    </div>
+    <div class="error" v-if="checkErrorMsg">
+      <span
+        style="color: #e1251b; font-size: 14px"
+        class="iconfont icon-jubao"
+      ></span>
+      {{ checkErrorMsg }}
+    </div>
+    <el-button
+      @click="forgetPwd"
+      :class="{ submit: true, disabled: forgetPwdDisabled }"
+      :disabled="forgetPwdDisabled"
+      :loading="forgetPwdLoading"
+      >{{ L["找回密码"] }}</el-button
+    >
+    <el-dialog
+      :title="L['register']['滑动验证']"
+      destroy-on-close
+      width="500px"
+      center
+      modal-class="retrieve-verify-model"
+      v-model="modalVisible"
+    >
+      <SliderVerify
+        :slideVerifyOptions="{ show: false, w: 450, h: 220 }"
+        @onSuccess="verifySuccess"
+        @onFail="verifyFail"
+      />
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import { showMessage, startCountdown } from "@/utils/common";
+import { getCurLanguage } from "@/composables/common.js";
+
+const emits = defineEmits(["success"]);
+
+const L = getCurLanguage();
+const mobileCalc = ref();
+const memberMobile = ref(""); //用户邮箱
+const mobileErrorMsg = ref(); //错误提示
+const mobileCode = ref(""); // 邮箱验证码
+const mobileCodeErrorMsg = ref(); //验证码错误提示
+
+// 倒计时展示
+const countDownNumer = ref(0);
+const getVerifyCodeLoading = ref(false);
+// 人机验证弹窗显示标识
+const modalVisible = ref(false);
+
+// 重新获取验证码标识
+const isReacquireCode = ref(false);
+
+const checkErrorMsg = ref(""); // 密码一致性错误提示
+const password = ref(""); //密码
+const confirmPassword = ref(""); //二次确认密码
+const showPwdFlag = ref(false); //密码是否明文显示,默认密文
+const showConfirmPwdFlag = ref(false); // 二次密码是否明文显示,默认密文
+
+const forgetPwdLoading = ref(false);
+const checkPwdErrorMsg = ref("");
+
+const forgetPwdDisabled = computed(
+  () => !memberMobile.value || !password.value || !confirmPassword.value
+);
+
+// 获取验证码的文案
+const codeText = computed(() => {
+  return isReacquireCode.value
+    ? L["register"]["重新获取"]
+    : L["register"]["获取验证码"];
+});
+
+
+//密码是否显示
+const isShowPwd = () => {
+  showPwdFlag.value = !showPwdFlag.value;
+};
+
+const checkPwdValidate = () => {
+  const regex = /^[A-Za-z0-9!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]{6,20}$/;
+  if (regex.test(password.value)) {
+    checkPwdErrorMsg.value = "";
+    return true;
+  }
+  checkPwdErrorMsg.value = L["请输入6~20位英文、数字、符号"];
+  return false;
+};
+
+//开启人机校验
+const showHMVerify = () => {
+  // 校验手机非空以及格式
+  if (!validatePhone()) return;
+  modalVisible.value = true;
+};
+
+// 二次确认密码是否显示
+const isShowConfirmPwd = () => {
+  showConfirmPwdFlag.value = !showConfirmPwdFlag.value;
+};
+
+const checkPwdMatched = () => {
+  if (password.value === confirmPassword.value) {
+    checkErrorMsg.value = "";
+    return true;
+  }
+  checkErrorMsg.value = L["register"]["两次输入的密码不一致"];
+  return false;
+};
+
+// 人机验证成功
+const verifySuccess = () => {
+  modalVisible.value = false;
+  getVerifyCode();
+};
+
+//清空输入框内容
+const clearInputVal = (type) => {
+  if (type == "memberMobile") {
+    memberMobile.value = "";
+  }
+};
+
+// 人机校验失败
+const verifyFail = () => {
+  showMessage({
+    message: L["register"]["校验不通过"],
+    type: "warning",
+  });
+};
+
+// 校验邮箱
+const validatePhone = () => {
+  //邮箱非空的验证
+  if (!memberMobile.value) {
+    mobileErrorMsg.value = L["请输入邮箱"];
+    return false;
+  }
+
+  // 邮箱格式验证
+  mobileCalc.value = checkPhone(memberMobile.value);
+  if (mobileCalc.value !== true) {
+    mobileErrorMsg.value = mobileCalc.value;
+    return false;
+  }
+  mobileErrorMsg.value = "";
+
+  return true;
+};
+
+// 邮箱验证码验证
+const validateMobileCode = () => {
+  if (!mobileCode.value) {
+    mobileCodeErrorMsg.value = L["register"]["请输入邮箱验证码"];
+    return false;
+  }
+  mobileCodeErrorMsg.value = "";
+
+  return true;
+};
+
+const getVerifyCode = () => {
+  getVerifyCodeLoading.value = true;
+  post("v3/member/front/active/verification/code", {
+    mobile: memberMobile.value,
+    source: 1,
+    type: 2, // 忘记密码
+  })
+    .then((res) => {
+      if (res.state === 200) {
+        showMessage({
+          message: L["register"]["验证码已发送"],
+          type: "success",
+        });
+        // 设置倒计时
+        startCountdown(60, (time) => (countDownNumer.value = time));
+        isReacquireCode.value = true;
+      } else {
+        showMessage({
+          message: res.msg,
+          type: "warning",
+        });
+      }
+    })
+    .finally(() => {
+      getVerifyCodeLoading.value = false;
+    });
+};
+
+const forgetPwd = () => {
+  if (!validatePhone() || !validateMobileCode()) return;
+  forgetPwdLoading.value = true;
+  post("v3/member/front/active/email/reset/pwdNew", {
+    confirmPassWord: confirmPassword.value,
+    mobile: memberMobile.value,
+    loginPwd: password.value,
+    verificationCode: mobileCode.value,
+  })
+    .then((res) => {
+      if (res.state == 200) {
+        //成功提示,并返回到登录页面
+        showMessage({
+          message: L["register"]["重置成功"],
+          type: "success",
+        });
+        emits("success");
+      } else {
+        //提示错误
+        showMessage({
+          message: res.msg,
+          type: "error",
+        });
+      }
+    })
+    .finally(() => {
+      forgetPwdLoading.value = false;
+    });
+};
+
+watch(memberMobile, (val) => {
+  if (val) {
+    mobileErrorMsg.value = "";
+  }
+});
+
+watch(mobileCode, (val) => {
+  if (val) {
+    mobileCodeErrorMsg.value = "";
+  }
+});
+</script>
+
+<style lang="scss" scoped>
+.center {
+  padding: 30px 30px 40px;
+
+  .item {
+    position: relative;
+    margin-top: 15px;
+    border-radius: 2px;
+
+    &:first-child {
+      margin-top: 0;
+    }
+
+    .icon {
+      position: absolute;
+      left: 1px;
+      top: 1px;
+      width: 50px;
+      text-align: center;
+      height: 38px;
+      background: #f8f8f8;
+
+      img {
+        width: 20px;
+      }
+
+      .input {
+        border: 1px solid #e8e8e8;
+        height: 40px;
+        padding: 0 44px 0 60px;
+        width: 326px;
+      }
+    }
+
+    .input {
+      border: 1px solid #e8e8e8;
+      height: 40px;
+      padding: 0 44px 0 60px;
+      width: 326px;
+    }
+
+    &.code {
+      .input {
+        padding-right: 10px;
+        width: 150px;
+      }
+    }
+  }
+
+  .cancel {
+    position: absolute;
+    right: 0;
+    top: 1px;
+    width: 44px;
+    height: 38px;
+    cursor: pointer;
+
+    :before {
+      position: absolute;
+      top: 9px;
+      // left: 14px;
+    }
+  }
+
+  .error {
+    margin-top: 10px;
+    position: relative;
+    color: $colorMain;
+    height: 16px;
+    line-height: 16px;
+  }
+
+  .verify-code {
+    display: flex;
+    width: 326px;
+    height: 40px;
+    margin-top: 10px;
+
+    &-icon {
+      width: 50px;
+      display: flex;
+      justify-content: center;
+      align-items: center;
+      border: 1px solid #e8e8e8;
+      border-right: none;
+      background: #f8f8f8;
+
+      img {
+        width: 20px;
+      }
+    }
+
+    input {
+      border: 1px solid #e8e8e8;
+      border-left: none;
+      border-right: none;
+      height: 40px;
+      padding: 0 0 0 10px;
+      width: 190px;
+    }
+
+    &-accept {
+      display: flex;
+      justify-content: center;
+      align-items: center;
+      width: 90px;
+
+      .el-button {
+        width: 100%;
+        height: 100%;
+        color: #666;
+        background: #f8f8f8;
+        border-left: none;
+        border-radius: 0;
+        font-size: 12px;
+
+        &:hover {
+          border-color: #e8e8e8;
+          color: $colorMain;
+        }
+      }
+    }
+  }
+
+  .submit {
+    margin-top: 35px;
+    background: $colorMain;
+    color: #fff;
+    text-align: center;
+    border-radius: 2px;
+    width: 100%;
+    height: 45px;
+    font-size: 18px;
+    letter-spacing: 0px;
+
+    &:hover {
+      opacity: 0.9;
+    }
+
+    &.disabled {
+      background-color: #909399;
+    }
+  }
+}
+</style>

+ 2 - 2
xinkeaboard-web/pages/member/account.vue

@@ -58,13 +58,13 @@
             <div class="s2" v-if="contactType === 'mobile'">
               <span
                 class="oprate pointer"
-                @click="toPage('/member/email', 'edit')"
+                @click="toPage('/member/phone', 'edit')"
                 v-if="memberInfo.data.memberMobile"
                 >{{L["修改手机号"]}}</span
               >
               <span
                 class="oprate pointer"
-                @click="toPage('/member/email', 'bind')"
+                @click="toPage('/member/phone', 'bind')"
                 v-if="!memberInfo.data.memberMobile"
                 >{{L["绑定手机号"]}}</span
               >

+ 2 - 2
xinkeaboard-web/pages/member/index/home.vue

@@ -7,8 +7,8 @@
           <img :src="memberInfoFromData.info.memberAvatar" class="head_img" />
         </div>
         <div class="info">
-            <p>{{ L['会员名:'] }}:  {{ memberInfoFromData.info.memberNickName }} ({{ contactType === 'email' ? memberInfoFromData.info.memberName : memberInfoFromData.info.memberMobile }})</p>
-            <p v-if="contactType === 'email'">Email:  {{memberInfoFromData.info.memberEmail}}</p>
+            <p>{{ L['会员名:'] }}  {{ memberInfoFromData.info.memberNickName }} ({{ contactType === 'email' ? memberInfoFromData.info.memberName : memberInfoFromData.info.memberMobile }})</p>
+            <p v-if="contactType === 'email'">Email  {{memberInfoFromData.info.memberEmail}}</p>
             <p v-if="contactType === 'mobile'">联系方式:  {{ memberInfoFromData.info.memberMobile }}</p>
         </div>
       </div>

+ 4 - 1
xinkeaboard-web/pages/member/login/forget.vue

@@ -35,7 +35,8 @@
             <div class="item1">{{ L["找回密码"] }}</div>
           </div>
           <!-- 找回密码 -->
-          <RetrievePassword v-if="currentStep === 'reset'" @success="() => currentStep = 'finish'"/>
+          <RetrievePwdByPhone v-if="contactType === 'mobile' && currentStep === 'reset'" @success="() => currentStep = 'finish'" />
+          <RetrievePassword v-if="contactType === 'email' && currentStep === 'reset'" @success="() => currentStep = 'finish'"/>
           <RetrieveSuccess v-if="currentStep === 'finish'"/>
         </div>
       </div>
@@ -48,6 +49,8 @@ import { useUserInfo } from "@/store/user.js";
 // import { lang_zn } from "@/assets/language/zh";
 import { getCurLanguage } from "@/composables/common.js";
 import { useFiltersStore } from "@/store/filter.js";
+import { getContactType } from "@/utils/common";
+const contactType = getContactType();
 
 const filtersStore = useFiltersStore();
 const L = getCurLanguage();

+ 3 - 3
xinkeaboard-web/pages/member/phone.vue

@@ -246,7 +246,7 @@ watch([old_sms_code, new_sms_code, new_mobile], () => {
 
 <style lang="scss" scoped>
 .sld_phone_mange {
-  width: 1007px;
+  width: 957px;
   float: left;
   margin-left: 10px;
 
@@ -266,7 +266,7 @@ watch([old_sms_code, new_sms_code, new_mobile], () => {
     }
 
     .mange_con {
-      width: 360px;
+      width: 460px;
       margin: 62px auto 0;
 
       .current {
@@ -348,7 +348,7 @@ watch([old_sms_code, new_sms_code, new_mobile], () => {
 <style lang="scss">
 .sld_phone_mange {
   .el-input {
-    width: 280px;
+    width: 300px;
     height: 40px;
     border-radius: 3px 0 0 3px;
     position: inherit;

+ 10 - 4
xinkeaboard-web/pages/member/pwd/login.vue

@@ -15,21 +15,24 @@
         {{ L["登录密码"] }}
       </div>
       <div class="mange_con">
-        <div class="without_phone_tip" v-if="!memberInfo.data.memberEmail">
+        <div class="without_phone_tip" v-if="!memberInfo.data.memberEmail && contactType === 'email'">
           {{ L["请先绑定邮箱,再进行登陆密码操作!"] }}
         </div>
+        <div class="without_phone_tip" v-if="!memberInfo.data.memberMobile && contactType === 'mobile'">
+          {{ L["请先绑定手机号,再进行登陆密码操作!"] }}
+        </div>
         <!-- 修改登录密码 start -->
         <template v-if="memberInfo.data.hasLoginPassword">
           <span class="current"
-            >{{ L["当前邮箱账号"] }}
+            >{{ L[contactType ==='email' ? "当前邮箱账号" : '当前手机号'] }}
             {{
-              memberInfo.data.memberEmail ? memberInfo.data.memberEmail : "--"
+              contactType ==='email' ? memberInfo.data.memberEmail ? memberInfo.data.memberEmail : "--" : memberInfo.data.memberMobile
             }}</span
           >
           <div class="sms_code_con">
             <el-input
               v-model="sms_code"
-              :placeholder="L['请输入邮件验证码']"
+              :placeholder="L[contactType === 'email' ? '请输入邮件验证码' : '请输入短信验证码']"
             ></el-input>
             <div class="get_sms pointer" @click="getSmsCode">
               {{ countDownM ? countDownM + L["s后获取"] : L["获取验证码"] }}
@@ -87,6 +90,9 @@ import { getCurrentInstance, reactive, ref, watch } from "vue";
 // import { lang_zn } from "@/assets/language/zh";
 import { getCurLanguage } from "@/composables/common.js";
 import { useFiltersStore } from "@/store/filter.js";
+import { getContactType } from "@/utils/common";
+
+const contactType = getContactType();
 const filtersStore = useFiltersStore();
 // const L = lang_zn;
 const L = getCurLanguage();