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