fix:修复bug
This commit is contained in:
Vendored
+2
-2
@@ -5,7 +5,7 @@ VITE_DELETE_CONSOLE=false
|
||||
|
||||
#本地环境
|
||||
#VITE_SERVER_BASEURL=http://liuyao.nat100.top/meiguowaimai
|
||||
#VITE_SERVER_BASEURL=http://192.168.5.64:8080
|
||||
VITE_SERVER_BASEURL=https://howhowfresh.com/prod-api
|
||||
VITE_SERVER_BASEURL=http://192.168.5.58:8080
|
||||
#VITE_SERVER_BASEURL=https://howhowfresh.com/prod-api
|
||||
#VITE_SERVER_BASEURL=http://192.168.1.8:8811
|
||||
#VITE_SERVER_BASEURL=http://mifengchuantou.natapp1.cc/meiguowaimai
|
||||
|
||||
@@ -204,6 +204,7 @@
|
||||
"login-successfully": "Login successful",
|
||||
"prompt": {
|
||||
"confirm-email": "Please enter your confirmation email address",
|
||||
"confirm-password": "Please enter confirmation password",
|
||||
"email": "Please enter your email address",
|
||||
"email-verify": "Please enter the correct email address",
|
||||
"first-name": "Please enter a name",
|
||||
@@ -212,10 +213,12 @@
|
||||
"password-verify": "Please enter a 6-20 digit password",
|
||||
"phone-number": "Please enter your mobile phone number",
|
||||
"phone-number-verify": "Please enter the correct mobile phone number",
|
||||
"two-passwords-inconsistent": "The password is inconsistent when entered twice",
|
||||
"reset-success": "Reset successfully"
|
||||
},
|
||||
"sign-up": {
|
||||
"confirm-email": "Confirm email",
|
||||
"confirm-password": "Confirm password",
|
||||
"first-name": "First name",
|
||||
"last-name": "Last name",
|
||||
"password": "Password",
|
||||
|
||||
@@ -198,6 +198,7 @@
|
||||
"login-successfully": "登录成功",
|
||||
"prompt": {
|
||||
"confirm-email": "请输入确认邮箱",
|
||||
"confirm-password": "请输入确认密码",
|
||||
"email": "请输入邮箱",
|
||||
"email-verify": "请输入正确的邮箱",
|
||||
"first-name": "请输入名",
|
||||
@@ -206,10 +207,12 @@
|
||||
"password-verify": "请输入6-20位密码",
|
||||
"phone-number": "请输入手机号",
|
||||
"phone-number-verify": "请输入正确的手机号",
|
||||
"two-passwords-inconsistent": "两次输入的密码不一致",
|
||||
"reset-success": "重置成功"
|
||||
},
|
||||
"sign-up": {
|
||||
"confirm-email": "确认邮箱",
|
||||
"confirm-password": "确认密码",
|
||||
"first-name": "名",
|
||||
"last-name": "姓",
|
||||
"password": "密码",
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
"name" : "CHEFLINK Merchant",
|
||||
"appid" : "__UNI__BB8E3C9",
|
||||
"description" : "美国外卖商户端",
|
||||
"versionName" : "1.0.16",
|
||||
"versionCode" : 116,
|
||||
"versionName" : "1.0.17",
|
||||
"versionCode" : 117,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
|
||||
@@ -68,7 +68,7 @@ function handleSubmit() {
|
||||
email,
|
||||
userPort: 2, // 登录端口2 商户端
|
||||
},
|
||||
options: {}
|
||||
options: {} as any
|
||||
}).then(res => {
|
||||
console.log('email', res)
|
||||
if (res.data) {
|
||||
@@ -82,7 +82,7 @@ function handleSubmit() {
|
||||
// 用户没注册
|
||||
logicStore.registerForm.type = type;
|
||||
logicStore.registerForm.confirmEmail = email;
|
||||
uni.navigateTo({url: '/pages-login/pages/sign-up/index'})
|
||||
uni.navigateTo({url: `/pages-login/pages/sign-up/index?type=${type}`})
|
||||
}
|
||||
}).finally(() => {
|
||||
btnLoading.value = false
|
||||
@@ -95,7 +95,7 @@ function handleSubmit() {
|
||||
phone: email,
|
||||
userPort: 2, // 登录端口2 商户端
|
||||
},
|
||||
options: {}
|
||||
options: {} as any
|
||||
}).then(res => {
|
||||
type = 'phone';
|
||||
if (res.data) {
|
||||
@@ -109,7 +109,7 @@ function handleSubmit() {
|
||||
logicStore.registerForm.phone = email;
|
||||
logicStore.registerForm.email = '';
|
||||
logicStore.registerForm.confirmEmail = '';
|
||||
uni.navigateTo({url: '/pages-login/pages/sign-up/index'})
|
||||
uni.navigateTo({url: `/pages-login/pages/sign-up/index?type=${type}`})
|
||||
}
|
||||
}).finally(() => {
|
||||
btnLoading.value = false
|
||||
|
||||
@@ -5,7 +5,6 @@ import {useLogicStore} from "@/pages-login/store/module/logic";
|
||||
import {Agreement} from "@/constant/enums";
|
||||
import {debounce} from "throttle-debounce";
|
||||
import Config from "@/config";
|
||||
import VerificationCode from "../../components/verification-code.vue";
|
||||
import {appUserRegisterPost} from "@/service";
|
||||
import {useUserStore} from "@/store";
|
||||
|
||||
@@ -20,17 +19,39 @@ const logicStore = useLogicStore()
|
||||
const isAgreed = ref(false)
|
||||
|
||||
|
||||
const FormSchema = z.object({
|
||||
function getFormSchema(type: string) {
|
||||
const base = z.object({
|
||||
firstName: z.string().min(1, {message: t('pages-login.prompt.first-name')}),
|
||||
surname: z.string().min(1, {message: t('pages-login.prompt.last-name')}),
|
||||
phone: z.string().min(1, {message: t('pages-login.prompt.phone-number')}).regex(/^\d{6,11}$/, {message: t('pages-login.prompt.phone-number-verify')}),
|
||||
loginPwd: z.string().min(1, {message: t('pages-login.prompt.password')}),
|
||||
newPwd: z.string().min(1, {message: t('pages-login.prompt.confirm-password')}),
|
||||
})
|
||||
|
||||
if (type === 'phone') {
|
||||
return base.extend({
|
||||
phone: z.string().min(1, {message: t('pages-login.prompt.phone-number')}).regex(/^\d{6,11}$/, {message: t('pages-login.prompt.phone-number-verify')}),
|
||||
})
|
||||
.refine((v: any) => v.loginPwd === v.newPwd, {
|
||||
message: t('pages-login.prompt.two-passwords-inconsistent'),
|
||||
path: ['newPwd'],
|
||||
})
|
||||
}
|
||||
|
||||
return base.extend({
|
||||
email: z.string().email({message: t('pages-login.prompt.email-verify')}),
|
||||
confirmEmail: z.string().email({message: t('pages-login.prompt.email-verify')}),
|
||||
})
|
||||
}).refine((v) => v.email === v.confirmEmail, {
|
||||
message: t('pages-login.prompt.confirm-email'),
|
||||
path: ['confirmEmail'],
|
||||
})
|
||||
.refine((v: any) => v.loginPwd === v.newPwd, {
|
||||
message: t('pages-login.prompt.two-passwords-inconsistent'),
|
||||
path: ['newPwd'],
|
||||
})
|
||||
}
|
||||
|
||||
function checkForm(): boolean {
|
||||
const validateFormField = FormSchema.safeParse(logicStore.registerForm)
|
||||
const validateFormField = getFormSchema(logicStore.registerForm.type).safeParse(logicStore.registerForm)
|
||||
if (!validateFormField.success) {
|
||||
const fieldErrorMessage = validateFormField.error.flatten().fieldErrors
|
||||
const errorMessage: string | undefined = R.path([0, 0], R.values(fieldErrorMessage))
|
||||
@@ -69,7 +90,7 @@ function codeSubmit() {
|
||||
userPort: 2, // 登录端口2 商户端
|
||||
}
|
||||
}).then((res) => {
|
||||
userStore.token = res.data.token;
|
||||
;(userStore as any).token = (res as any).data?.token;
|
||||
logicStore.reset()
|
||||
uni.showToast({
|
||||
title: t('pages-login.sign-up.register-success'),
|
||||
@@ -98,6 +119,15 @@ function navigateTo(url: string) {
|
||||
|
||||
const emailIsReadonly = ref(false)
|
||||
const phoneIsReadonly = ref(false)
|
||||
const showEmail = computed(() => logicStore.registerForm.type !== 'phone')
|
||||
const showPhone = computed(() => logicStore.registerForm.type === 'phone')
|
||||
|
||||
onLoad((options: any) => {
|
||||
const type = options?.type
|
||||
if (type === 'phone' || type === 'email') {
|
||||
logicStore.registerForm.type = type
|
||||
}
|
||||
})
|
||||
onMounted(() => {
|
||||
const {email, type} = logicStore.registerForm
|
||||
if (type === 'phone') {
|
||||
@@ -118,7 +148,7 @@ onMounted(() => {
|
||||
</view>
|
||||
<view class="">
|
||||
<!-- 邮箱 -->
|
||||
<view class="">
|
||||
<view v-if="showEmail" class="">
|
||||
<view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{ t("common.email") }}</view>
|
||||
<view class="border-color px-30rpx flex items-center bg-#EFEFEF">
|
||||
<wd-input
|
||||
@@ -137,7 +167,7 @@ onMounted(() => {
|
||||
</view>
|
||||
</view>
|
||||
<!-- Confirm email -->
|
||||
<view class="mt-36rpx">
|
||||
<view v-if="showEmail" class="mt-36rpx">
|
||||
<view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{
|
||||
t("pages-login.sign-up.confirm-email")
|
||||
}}
|
||||
@@ -177,6 +207,25 @@ onMounted(() => {
|
||||
</wd-input>
|
||||
</view>
|
||||
</view>
|
||||
<!-- Confirm Password -->
|
||||
<view class="mt-36rpx ">
|
||||
<view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{ t("pages-login.sign-up.confirm-password") }}</view>
|
||||
<view class="border-color px-30rpx flex items-center bg-#EFEFEF">
|
||||
<wd-input
|
||||
v-model.trim="logicStore.registerForm.newPwd"
|
||||
:cursorSpacing="20"
|
||||
:focus-when-clear="false"
|
||||
:maxlength="40"
|
||||
:placeholder="t('common.enterPassword')"
|
||||
clearable
|
||||
custom-class="flex-1 !bg-transparent"
|
||||
no-border
|
||||
placeholderClass="!text-#999 !text-32rpx"
|
||||
showPassword
|
||||
>
|
||||
</wd-input>
|
||||
</view>
|
||||
</view>
|
||||
<!-- First name -->
|
||||
<view class="mt-36rpx ">
|
||||
<view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{ t("pages-login.sign-up.first-name") }}</view>
|
||||
@@ -214,7 +263,7 @@ onMounted(() => {
|
||||
</view>
|
||||
</view>
|
||||
<!-- Phone number -->
|
||||
<view class="mt-36rpx ">
|
||||
<view v-if="showPhone" class="mt-36rpx ">
|
||||
<view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{
|
||||
t("pages-login.sign-up.phone-number")
|
||||
}}
|
||||
|
||||
@@ -16,6 +16,7 @@ export const useLogicStore = defineStore('login-logic', () => {
|
||||
surname: '',
|
||||
phone: '',
|
||||
loginPwd: '',
|
||||
newPwd: '',
|
||||
areaCode: defaultAreaCode.value,
|
||||
captcha: "",
|
||||
})
|
||||
@@ -53,6 +54,7 @@ export const useLogicStore = defineStore('login-logic', () => {
|
||||
surname: '',
|
||||
phone: '',
|
||||
loginPwd: '',
|
||||
newPwd: '',
|
||||
areaCode: defaultAreaCode.value,
|
||||
captcha: "",
|
||||
}
|
||||
@@ -83,6 +85,7 @@ export const useLogicStore = defineStore('login-logic', () => {
|
||||
surname: '',
|
||||
phone: '',
|
||||
loginPwd: '',
|
||||
newPwd: '',
|
||||
areaCode: defaultAreaCode.value,
|
||||
captcha: "",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user