修复bug
This commit is contained in:
Vendored
+2
-2
@@ -4,7 +4,7 @@ NODE_ENV=development
|
|||||||
VITE_DELETE_CONSOLE=false
|
VITE_DELETE_CONSOLE=false
|
||||||
|
|
||||||
#本地环境
|
#本地环境
|
||||||
VITE_SERVER_BASEURL=https://howhowfresh.com/prod-api
|
#VITE_SERVER_BASEURL=https://howhowfresh.com/prod-api
|
||||||
#VITE_SERVER_BASEURL=http://192.168.5.200:8080
|
VITE_SERVER_BASEURL=http://192.168.5.23:8080
|
||||||
#VITE_SERVER_BASEURL=http://192.168.0.148:8888
|
#VITE_SERVER_BASEURL=http://192.168.0.148:8888
|
||||||
#VITE_SERVER_BASEURL=http://liuyao.nat100.top/meiguowaimai
|
#VITE_SERVER_BASEURL=http://liuyao.nat100.top/meiguowaimai
|
||||||
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
"name" : "CHEFLINK delivery",
|
"name" : "CHEFLINK delivery",
|
||||||
"appid" : "__UNI__06509BE",
|
"appid" : "__UNI__06509BE",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "1.0.29",
|
"versionName" : "2.0.1",
|
||||||
"versionCode" : 129,
|
"versionCode" : 201,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
|
|||||||
@@ -1,92 +1,91 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import * as R from 'ramda'
|
import * as R from 'ramda'
|
||||||
import {z} from "zod";
|
import {z} from "zod";
|
||||||
import {useLogicStore} from "@/pages-login/store/module/logic";
|
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 VerificationCode from "../../components/verification-code.vue";
|
||||||
import {appUserRegisterPost} from "@/service";
|
import {appUserRegisterPost} from "@/service";
|
||||||
import {useConfigStore, useUserStore} from "@/store";
|
import {useConfigStore, useUserStore} from "@/store";
|
||||||
|
|
||||||
const {t} = useI18n()
|
const {t} = useI18n()
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const configStore = useConfigStore()
|
const configStore = useConfigStore()
|
||||||
const logicStore = useLogicStore()
|
const logicStore = useLogicStore()
|
||||||
|
|
||||||
const areaCode = ref<string>(logicStore.registerForm.areaCode || '+1');
|
const areaCode = ref<string>(logicStore.registerForm.areaCode || '+1');
|
||||||
const columns = ref<string[]>(Config.phoneCodeList);
|
const columns = ref<string[]>(Config.phoneCodeList);
|
||||||
|
|
||||||
const isAgreed = ref(false)
|
const isAgreed = ref(false)
|
||||||
|
|
||||||
const EmailRegisterSchema = z.object({
|
const EmailRegisterSchema = z.object({
|
||||||
firstName: z.string().min(1, {message: t('pages-login.index.prompt.first-name')}),
|
firstName: z.string().min(1, {message: t('pages-login.index.prompt.first-name')}),
|
||||||
surname: z.string().min(1, {message: t('pages-login.index.prompt.last-name')}),
|
surname: z.string().min(1, {message: t('pages-login.index.prompt.last-name')}),
|
||||||
email: z.string().min(1, {message: t('pages-login.index.prompt.email-address-verify')}).email({message: t('pages-login.index.prompt.email-address-verify')}),
|
email: z.string().min(1, {message: t('pages-login.index.prompt.email-address-verify')}).email({message: t('pages-login.index.prompt.email-address-verify')}),
|
||||||
confirmEmail: z.string().min(1, {message: t('pages-login.index.prompt.email-address-verify')}).email({message: t('pages-login.index.prompt.email-address-verify')}),
|
confirmEmail: z.string().min(1, {message: t('pages-login.index.prompt.email-address-verify')}).email({message: t('pages-login.index.prompt.email-address-verify')}),
|
||||||
loginPwd: z.string().min(1, {message: t('pages-login.index.prompt.password')}),
|
loginPwd: z.string().min(1, {message: t('pages-login.index.prompt.password')}),
|
||||||
confirmLoginPwd: z.string().min(1, {message: t('pages-login.index.prompt.password')}),
|
confirmLoginPwd: z.string().min(1, {message: t('pages-login.index.prompt.password')}),
|
||||||
})
|
|
||||||
.refine((data) => data.email === data.confirmEmail, {
|
|
||||||
path: ['confirmEmail'],
|
|
||||||
message: t('pages-login.index.prompt.confirm-email-verify')
|
|
||||||
})
|
})
|
||||||
.refine((data) => data.loginPwd === data.confirmLoginPwd, {
|
.refine((data) => data.email === data.confirmEmail, {
|
||||||
|
path: ['confirmEmail'],
|
||||||
|
message: t('pages-login.index.prompt.confirm-email-verify')
|
||||||
|
})
|
||||||
|
.refine((data) => data.loginPwd === data.confirmLoginPwd, {
|
||||||
|
path: ['confirmLoginPwd'],
|
||||||
|
message: t('pages-login.index.prompt.confirm-password-verify')
|
||||||
|
})
|
||||||
|
|
||||||
|
const PhoneRegisterSchema = z.object({
|
||||||
|
firstName: z.string().min(1, {message: t('pages-login.index.prompt.first-name')}),
|
||||||
|
surname: z.string().min(1, {message: t('pages-login.index.prompt.last-name')}),
|
||||||
|
phone: z.string().min(1, {message: t('pages-login.index.prompt.phone-number')}).regex(/^\d{6,11}$/, {message: t('pages-login.index.prompt.phone-number-verify')}),
|
||||||
|
loginPwd: z.string().min(1, {message: t('pages-login.index.prompt.password')}),
|
||||||
|
confirmLoginPwd: z.string().min(1, {message: t('pages-login.index.prompt.password')}),
|
||||||
|
}).refine((data) => data.loginPwd === data.confirmLoginPwd, {
|
||||||
path: ['confirmLoginPwd'],
|
path: ['confirmLoginPwd'],
|
||||||
message: t('pages-login.index.prompt.confirm-password-verify')
|
message: t('pages-login.index.prompt.confirm-password-verify')
|
||||||
})
|
})
|
||||||
|
|
||||||
const PhoneRegisterSchema = z.object({
|
function checkForm(): boolean {
|
||||||
firstName: z.string().min(1, {message: t('pages-login.index.prompt.first-name')}),
|
const type = logicStore.registerForm.type
|
||||||
surname: z.string().min(1, {message: t('pages-login.index.prompt.last-name')}),
|
const schema = type === 'phone' ? PhoneRegisterSchema : EmailRegisterSchema
|
||||||
phone: z.string().min(1, {message: t('pages-login.index.prompt.phone-number')}).regex(/^\d{6,11}$/, {message: t('pages-login.index.prompt.phone-number-verify')}),
|
const validateFormField = schema.safeParse(logicStore.registerForm)
|
||||||
loginPwd: z.string().min(1, {message: t('pages-login.index.prompt.password')}),
|
if (!validateFormField.success) {
|
||||||
confirmLoginPwd: z.string().min(1, {message: t('pages-login.index.prompt.password')}),
|
const fieldErrorMessage = validateFormField.error.flatten().fieldErrors
|
||||||
}).refine((data) => data.loginPwd === data.confirmLoginPwd, {
|
const errorMessage: string | undefined = R.path([0, 0], R.values(fieldErrorMessage))
|
||||||
path: ['confirmLoginPwd'],
|
errorMessage &&
|
||||||
message: t('pages-login.index.prompt.confirm-password-verify')
|
uni.showToast({
|
||||||
})
|
title: errorMessage,
|
||||||
|
icon: 'none',
|
||||||
function checkForm(): boolean {
|
})
|
||||||
const type = logicStore.registerForm.type
|
} else if (!isAgreed.value) {
|
||||||
const schema = type === 'phone' ? PhoneRegisterSchema : EmailRegisterSchema
|
uni.showToast({
|
||||||
const validateFormField = schema.safeParse(logicStore.registerForm)
|
title: `${t('common.prompt.please-carefully-read-and-agree')} ${t('agreement.user-terms-conditions')}${t('pages-login.and')}${t('agreement.privacy-policy')}`,
|
||||||
if (!validateFormField.success) {
|
icon: 'none'
|
||||||
const fieldErrorMessage = validateFormField.error.flatten().fieldErrors
|
})
|
||||||
const errorMessage: string | undefined = R.path([0, 0], R.values(fieldErrorMessage))
|
}
|
||||||
errorMessage &&
|
return validateFormField.success && isAgreed.value
|
||||||
uni.showToast({
|
|
||||||
title: errorMessage,
|
|
||||||
icon: 'none',
|
|
||||||
})
|
|
||||||
} else if (!isAgreed.value) {
|
|
||||||
uni.showToast({
|
|
||||||
title: `${t('common.prompt.please-carefully-read-and-agree')} ${t('agreement.user-terms-conditions')}${t('pages-login.and')}${t('agreement.privacy-policy')}`,
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
return validateFormField.success && isAgreed.value
|
|
||||||
}
|
|
||||||
|
|
||||||
const verificationCodeRef = ref()
|
const verificationCodeRef = ref()
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
// verificationCodeRef.value.onOpen()
|
// verificationCodeRef.value.onOpen()
|
||||||
codeSubmit()
|
codeSubmit()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证码提交
|
// 验证码提交
|
||||||
const btnLoading = ref(false)
|
const btnLoading = ref(false)
|
||||||
function codeSubmit() {
|
function codeSubmit() {
|
||||||
btnLoading.value = true
|
btnLoading.value = true
|
||||||
// console.log(data)
|
// console.log(data)
|
||||||
const {
|
const {
|
||||||
confirmEmail,
|
confirmEmail,
|
||||||
confirmLoginPwd,
|
confirmLoginPwd,
|
||||||
...rest
|
...rest
|
||||||
} = logicStore.registerForm as any
|
} = logicStore.registerForm as any
|
||||||
appUserRegisterPost({
|
const requestBody: Record<string, any> = {
|
||||||
body: {
|
|
||||||
...rest,
|
...rest,
|
||||||
// 后端接收“确认密码”字段名为 newPwd
|
// 后端接收“确认密码”字段名为 newPwd
|
||||||
newPwd: confirmLoginPwd,
|
newPwd: confirmLoginPwd,
|
||||||
@@ -94,283 +93,298 @@ function codeSubmit() {
|
|||||||
// captcha: data.code,
|
// captcha: data.code,
|
||||||
// uuid: data.uuid,
|
// uuid: data.uuid,
|
||||||
userPort: Config.userPort, // 登录端口2 商户端
|
userPort: Config.userPort, // 登录端口2 商户端
|
||||||
} as any
|
}
|
||||||
}).then((res) => {
|
if (requestBody.email == null || requestBody.email === '') {
|
||||||
userStore.token = res.data.token;
|
delete requestBody.email
|
||||||
logicStore.reset()
|
}
|
||||||
uni.showToast({
|
const phoneVal = requestBody.phone
|
||||||
title: t('pages-login.sign-up.register-success'),
|
if (
|
||||||
icon: 'none',
|
phoneVal == null ||
|
||||||
})
|
phoneVal === '' ||
|
||||||
nextTick(() => {
|
(typeof phoneVal === 'string' && phoneVal.trim() === '')
|
||||||
userStore.getUserInfo();
|
) {
|
||||||
uni.navigateTo({
|
delete requestBody.phone
|
||||||
url: Config.guidePath
|
delete requestBody.areaCode
|
||||||
|
}
|
||||||
|
appUserRegisterPost({
|
||||||
|
body: requestBody as any
|
||||||
|
}).then((res) => {
|
||||||
|
userStore.token = res.data.token;
|
||||||
|
logicStore.reset()
|
||||||
|
uni.showToast({
|
||||||
|
title: t('pages-login.sign-up.register-success'),
|
||||||
|
icon: 'none',
|
||||||
})
|
})
|
||||||
// uni.redirectTo({
|
nextTick(() => {
|
||||||
// url: '/pages-login/pages/guide-page/location'
|
userStore.getUserInfo();
|
||||||
// })
|
uni.navigateTo({
|
||||||
// const pages = getCurrentPages()
|
url: Config.guidePath
|
||||||
// if(configStore.isShowedGuidePage) {
|
})
|
||||||
// if(pages.length > 2) {
|
// uni.redirectTo({
|
||||||
// uni.navigateBack({delta: 2})
|
// url: '/pages-login/pages/guide-page/location'
|
||||||
// } else {
|
// })
|
||||||
// uni.switchTab({
|
// const pages = getCurrentPages()
|
||||||
// url: Config.indexPath
|
// if(configStore.isShowedGuidePage) {
|
||||||
// })
|
// if(pages.length > 2) {
|
||||||
// }
|
// uni.navigateBack({delta: 2})
|
||||||
// } else {
|
// } else {
|
||||||
// uni.navigateTo({
|
// uni.switchTab({
|
||||||
// url: Config.guidePath
|
// url: Config.indexPath
|
||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
|
// } else {
|
||||||
|
// uni.navigateTo({
|
||||||
|
// url: Config.guidePath
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
})
|
||||||
|
}).finally(() => {
|
||||||
|
btnLoading.value = false
|
||||||
})
|
})
|
||||||
}).finally(() => {
|
|
||||||
btnLoading.value = false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 提交
|
|
||||||
const handleSubmit = R.when(checkForm, debounce(Config.debounceLongTime, submit, {
|
|
||||||
atBegin: true
|
|
||||||
}))
|
|
||||||
|
|
||||||
|
|
||||||
function navigateTo(url: string) {
|
|
||||||
uni.navigateTo({url});
|
|
||||||
}
|
|
||||||
|
|
||||||
const emailIsReadonly = ref(false)
|
|
||||||
const phoneIsReadonly = ref(false)
|
|
||||||
onMounted(() => {
|
|
||||||
const {email, confirmEmail, phone, type} = logicStore.registerForm
|
|
||||||
if (type === 'phone') {
|
|
||||||
phoneIsReadonly.value = !!phone
|
|
||||||
emailIsReadonly.value = false
|
|
||||||
}
|
}
|
||||||
if (type === 'email') {
|
|
||||||
emailIsReadonly.value = !!(email || confirmEmail)
|
// 提交
|
||||||
phoneIsReadonly.value = false
|
const handleSubmit = R.when(checkForm, debounce(Config.debounceLongTime, submit, {
|
||||||
if (!logicStore.registerForm.email && logicStore.registerForm.confirmEmail) {
|
atBegin: true
|
||||||
logicStore.registerForm.email = logicStore.registerForm.confirmEmail
|
}))
|
||||||
|
|
||||||
|
|
||||||
|
function navigateTo(url: string) {
|
||||||
|
uni.navigateTo({url});
|
||||||
|
}
|
||||||
|
|
||||||
|
const emailIsReadonly = ref(false)
|
||||||
|
const phoneIsReadonly = ref(false)
|
||||||
|
onMounted(() => {
|
||||||
|
const {email, confirmEmail, phone, type} = logicStore.registerForm
|
||||||
|
if (type === 'phone') {
|
||||||
|
phoneIsReadonly.value = !!phone
|
||||||
|
emailIsReadonly.value = false
|
||||||
|
}
|
||||||
|
if (type === 'email') {
|
||||||
|
emailIsReadonly.value = !!(email || confirmEmail)
|
||||||
|
phoneIsReadonly.value = false
|
||||||
|
if (!logicStore.registerForm.email && logicStore.registerForm.confirmEmail) {
|
||||||
|
logicStore.registerForm.email = logicStore.registerForm.confirmEmail
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<navbar/>
|
||||||
|
<view class="pt-60rpx px-27rpx pb-80rpx">
|
||||||
|
<view class="mb-60rpx text-50rpx leading-50rpx font-bold text-#14181B">
|
||||||
|
{{ t('pages-login.sign-up.title') }}
|
||||||
|
</view>
|
||||||
|
<view class="">
|
||||||
|
<!-- 邮箱 -->
|
||||||
|
<view v-if="logicStore.registerForm.type !== 'phone'" 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
|
||||||
|
v-model.trim="logicStore.registerForm.email"
|
||||||
|
:cursorSpacing="20"
|
||||||
|
:focus-when-clear="false"
|
||||||
|
:maxlength="40"
|
||||||
|
:placeholder="t('common.enter')"
|
||||||
|
:readonly="emailIsReadonly"
|
||||||
|
clearable
|
||||||
|
custom-class="flex-1 !bg-transparent"
|
||||||
|
no-border
|
||||||
|
placeholderClass="!text-#999 !text-32rpx"
|
||||||
|
>
|
||||||
|
</wd-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- Confirm email -->
|
||||||
|
<view v-if="logicStore.registerForm.type !== 'phone'" class="mt-36rpx">
|
||||||
|
<view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{
|
||||||
|
t("pages-login.sign-up.confirm-email")
|
||||||
|
}}
|
||||||
|
</view>
|
||||||
|
<view class="border-color px-30rpx flex items-center bg-#EFEFEF">
|
||||||
|
<wd-input
|
||||||
|
v-model.trim="logicStore.registerForm.confirmEmail"
|
||||||
|
:cursorSpacing="20"
|
||||||
|
:focus-when-clear="false"
|
||||||
|
:maxlength="40"
|
||||||
|
:placeholder="t('common.enter')"
|
||||||
|
:readonly="emailIsReadonly"
|
||||||
|
clearable
|
||||||
|
custom-class="flex-1 !bg-transparent"
|
||||||
|
no-border
|
||||||
|
placeholderClass="!text-#999 !text-32rpx"
|
||||||
|
>
|
||||||
|
</wd-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- Password -->
|
||||||
|
<view class="mt-36rpx ">
|
||||||
|
<view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{ t("pages-login.sign-up.password") }}</view>
|
||||||
|
<view class="border-color px-30rpx flex items-center bg-#EFEFEF">
|
||||||
|
<wd-input
|
||||||
|
v-model.trim="logicStore.registerForm.loginPwd"
|
||||||
|
:cursorSpacing="20"
|
||||||
|
:focus-when-clear="false"
|
||||||
|
:maxlength="20"
|
||||||
|
:placeholder="t('common.enterPassword')"
|
||||||
|
clearable
|
||||||
|
custom-class="flex-1 !bg-transparent"
|
||||||
|
no-border
|
||||||
|
placeholderClass="!text-#999 !text-32rpx"
|
||||||
|
showPassword
|
||||||
|
>
|
||||||
|
</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.confirmLoginPwd"
|
||||||
|
:cursorSpacing="20"
|
||||||
|
:focus-when-clear="false"
|
||||||
|
:maxlength="20"
|
||||||
|
: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>
|
||||||
|
<view class="border-color px-30rpx flex items-center bg-#EFEFEF">
|
||||||
|
<wd-input
|
||||||
|
v-model.trim="logicStore.registerForm.firstName"
|
||||||
|
:cursorSpacing="20"
|
||||||
|
:focus-when-clear="false"
|
||||||
|
:maxlength="40"
|
||||||
|
:placeholder="t('common.enter')"
|
||||||
|
clearable
|
||||||
|
custom-class="flex-1 !bg-transparent"
|
||||||
|
no-border
|
||||||
|
placeholderClass="!text-#999 !text-32rpx"
|
||||||
|
>
|
||||||
|
</wd-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- Last name -->
|
||||||
|
<view class="mt-36rpx ">
|
||||||
|
<view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{ t("pages-login.sign-up.last-name") }}</view>
|
||||||
|
<view class="border-color px-30rpx flex items-center bg-#EFEFEF">
|
||||||
|
<wd-input
|
||||||
|
v-model.trim="logicStore.registerForm.surname"
|
||||||
|
:cursorSpacing="20"
|
||||||
|
:focus-when-clear="false"
|
||||||
|
:maxlength="40"
|
||||||
|
:placeholder="t('common.enter')"
|
||||||
|
clearable
|
||||||
|
custom-class="flex-1 !bg-transparent"
|
||||||
|
no-border
|
||||||
|
placeholderClass="!text-#999 !text-32rpx"
|
||||||
|
>
|
||||||
|
</wd-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- Phone number -->
|
||||||
|
<view v-if="logicStore.registerForm.type !== 'email'" class="mt-36rpx ">
|
||||||
|
<view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{
|
||||||
|
t("pages-login.sign-up.phone-number")
|
||||||
|
}}
|
||||||
|
</view>
|
||||||
|
<view class="border-color px-30rpx flex items-center bg-#EFEFEF">
|
||||||
|
<view class="pr-14rpx text-28rpx">
|
||||||
|
<wd-picker v-model="areaCode" :columns="columns"/>
|
||||||
|
</view>
|
||||||
|
<wd-input
|
||||||
|
v-model.trim="logicStore.registerForm.phone"
|
||||||
|
:cursorSpacing="20"
|
||||||
|
:focus-when-clear="false"
|
||||||
|
:maxlength="40"
|
||||||
|
:placeholder="t('common.enter')"
|
||||||
|
:readonly="phoneIsReadonly"
|
||||||
|
clearable
|
||||||
|
custom-class="flex-1 !bg-transparent"
|
||||||
|
no-border
|
||||||
|
placeholderClass="!text-#999 !text-32rpx"
|
||||||
|
>
|
||||||
|
</wd-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="mt-54rpx">
|
||||||
|
<wd-button block custom-class="!h-108rpx !text-36rpx text-#fff font-bold !rounded-16rpx"
|
||||||
|
@click="handleSubmit" :loading="btnLoading" loading-color="#000">
|
||||||
|
{{ t('pages-login.sign-up.title') }}
|
||||||
|
</wd-button>
|
||||||
|
</view>
|
||||||
|
<view class="mt-36rpx flex items-start text-28rpx text-primary lh-42rpx" @click="isAgreed = !isAgreed">
|
||||||
|
<view class="shrink-0 center py-5rpx px-10rpx">
|
||||||
|
<image v-show="isAgreed" class=" w-28rpx h-28rpx"
|
||||||
|
src="@img-login/101.png"></image>
|
||||||
|
<image v-show="!isAgreed" class=" w-28rpx h-28rpx"
|
||||||
|
src="@img-login/100.png"></image>
|
||||||
|
</view>
|
||||||
|
<view class="">
|
||||||
|
<text class="">{{ t('pages-login.continuing-agree') }}</text>
|
||||||
|
<text class="text-#00A76D"
|
||||||
|
@click.stop="navigateTo(`/pages/agreement/index?code=${Agreement.USER_AGREEMENT}`)">
|
||||||
|
{{ t('agreement.user-terms-conditions') }}、
|
||||||
|
</text>
|
||||||
|
<text class="text-#00A76D"
|
||||||
|
@click.stop="navigateTo(`/pages/agreement/index?code=${Agreement.PRIVACY_POLICY}`)">
|
||||||
|
{{ t('agreement.privacy-policy') }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
<verification-code ref="verificationCodeRef" @submit="codeSubmit"/>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.border-color {
|
||||||
|
height: 98rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
border: 2rpx solid #D4D4D4;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.wd-input__clear) {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.wd-input__icon) {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.wd-picker__cell) {
|
||||||
|
background-color: transparent !important;
|
||||||
|
|
||||||
|
.wd-picker__value {
|
||||||
|
margin-right: 8rpx !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
:deep(.wd-picker-view-column__item) {
|
||||||
<view>
|
line-height: 94rpx !important;
|
||||||
<navbar/>
|
|
||||||
<view class="pt-60rpx px-27rpx pb-80rpx">
|
|
||||||
<view class="mb-60rpx text-50rpx leading-50rpx font-bold text-#14181B">
|
|
||||||
{{ t('pages-login.sign-up.title') }}
|
|
||||||
</view>
|
|
||||||
<view class="">
|
|
||||||
<!-- 邮箱 -->
|
|
||||||
<view v-if="logicStore.registerForm.type !== 'phone'" 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
|
|
||||||
v-model.trim="logicStore.registerForm.email"
|
|
||||||
:cursorSpacing="20"
|
|
||||||
:focus-when-clear="false"
|
|
||||||
:maxlength="40"
|
|
||||||
:placeholder="t('common.enter')"
|
|
||||||
:readonly="emailIsReadonly"
|
|
||||||
clearable
|
|
||||||
custom-class="flex-1 !bg-transparent"
|
|
||||||
no-border
|
|
||||||
placeholderClass="!text-#999 !text-32rpx"
|
|
||||||
>
|
|
||||||
</wd-input>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- Confirm email -->
|
|
||||||
<view v-if="logicStore.registerForm.type !== 'phone'" class="mt-36rpx">
|
|
||||||
<view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{
|
|
||||||
t("pages-login.sign-up.confirm-email")
|
|
||||||
}}
|
|
||||||
</view>
|
|
||||||
<view class="border-color px-30rpx flex items-center bg-#EFEFEF">
|
|
||||||
<wd-input
|
|
||||||
v-model.trim="logicStore.registerForm.confirmEmail"
|
|
||||||
:cursorSpacing="20"
|
|
||||||
:focus-when-clear="false"
|
|
||||||
:maxlength="40"
|
|
||||||
:placeholder="t('common.enter')"
|
|
||||||
:readonly="emailIsReadonly"
|
|
||||||
clearable
|
|
||||||
custom-class="flex-1 !bg-transparent"
|
|
||||||
no-border
|
|
||||||
placeholderClass="!text-#999 !text-32rpx"
|
|
||||||
>
|
|
||||||
</wd-input>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- Password -->
|
|
||||||
<view class="mt-36rpx ">
|
|
||||||
<view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{ t("pages-login.sign-up.password") }}</view>
|
|
||||||
<view class="border-color px-30rpx flex items-center bg-#EFEFEF">
|
|
||||||
<wd-input
|
|
||||||
v-model.trim="logicStore.registerForm.loginPwd"
|
|
||||||
:cursorSpacing="20"
|
|
||||||
:focus-when-clear="false"
|
|
||||||
:maxlength="20"
|
|
||||||
:placeholder="t('common.enterPassword')"
|
|
||||||
clearable
|
|
||||||
custom-class="flex-1 !bg-transparent"
|
|
||||||
no-border
|
|
||||||
placeholderClass="!text-#999 !text-32rpx"
|
|
||||||
showPassword
|
|
||||||
>
|
|
||||||
</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.confirmLoginPwd"
|
|
||||||
:cursorSpacing="20"
|
|
||||||
:focus-when-clear="false"
|
|
||||||
:maxlength="20"
|
|
||||||
: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>
|
|
||||||
<view class="border-color px-30rpx flex items-center bg-#EFEFEF">
|
|
||||||
<wd-input
|
|
||||||
v-model.trim="logicStore.registerForm.firstName"
|
|
||||||
:cursorSpacing="20"
|
|
||||||
:focus-when-clear="false"
|
|
||||||
:maxlength="40"
|
|
||||||
:placeholder="t('common.enter')"
|
|
||||||
clearable
|
|
||||||
custom-class="flex-1 !bg-transparent"
|
|
||||||
no-border
|
|
||||||
placeholderClass="!text-#999 !text-32rpx"
|
|
||||||
>
|
|
||||||
</wd-input>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- Last name -->
|
|
||||||
<view class="mt-36rpx ">
|
|
||||||
<view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{ t("pages-login.sign-up.last-name") }}</view>
|
|
||||||
<view class="border-color px-30rpx flex items-center bg-#EFEFEF">
|
|
||||||
<wd-input
|
|
||||||
v-model.trim="logicStore.registerForm.surname"
|
|
||||||
:cursorSpacing="20"
|
|
||||||
:focus-when-clear="false"
|
|
||||||
:maxlength="40"
|
|
||||||
:placeholder="t('common.enter')"
|
|
||||||
clearable
|
|
||||||
custom-class="flex-1 !bg-transparent"
|
|
||||||
no-border
|
|
||||||
placeholderClass="!text-#999 !text-32rpx"
|
|
||||||
>
|
|
||||||
</wd-input>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- Phone number -->
|
|
||||||
<view v-if="logicStore.registerForm.type !== 'email'" class="mt-36rpx ">
|
|
||||||
<view class="text-32rpx leading-32rpx text-#14181B mb-24rpx">{{
|
|
||||||
t("pages-login.sign-up.phone-number")
|
|
||||||
}}
|
|
||||||
</view>
|
|
||||||
<view class="border-color px-30rpx flex items-center bg-#EFEFEF">
|
|
||||||
<view class="pr-14rpx text-28rpx">
|
|
||||||
<wd-picker v-model="areaCode" :columns="columns"/>
|
|
||||||
</view>
|
|
||||||
<wd-input
|
|
||||||
v-model.trim="logicStore.registerForm.phone"
|
|
||||||
:cursorSpacing="20"
|
|
||||||
:focus-when-clear="false"
|
|
||||||
:maxlength="40"
|
|
||||||
:placeholder="t('common.enter')"
|
|
||||||
:readonly="phoneIsReadonly"
|
|
||||||
clearable
|
|
||||||
custom-class="flex-1 !bg-transparent"
|
|
||||||
no-border
|
|
||||||
placeholderClass="!text-#999 !text-32rpx"
|
|
||||||
>
|
|
||||||
</wd-input>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="mt-54rpx">
|
|
||||||
<wd-button block custom-class="!h-108rpx !text-36rpx text-#fff font-bold !rounded-16rpx"
|
|
||||||
@click="handleSubmit" :loading="btnLoading" loading-color="#000">
|
|
||||||
{{ t('pages-login.sign-up.title') }}
|
|
||||||
</wd-button>
|
|
||||||
</view>
|
|
||||||
<view class="mt-36rpx flex items-start text-28rpx text-primary lh-42rpx" @click="isAgreed = !isAgreed">
|
|
||||||
<view class="shrink-0 center py-5rpx px-10rpx">
|
|
||||||
<image v-show="isAgreed" class=" w-28rpx h-28rpx"
|
|
||||||
src="@img-login/101.png"></image>
|
|
||||||
<image v-show="!isAgreed" class=" w-28rpx h-28rpx"
|
|
||||||
src="@img-login/100.png"></image>
|
|
||||||
</view>
|
|
||||||
<view class="">
|
|
||||||
<text class="">{{ t('pages-login.continuing-agree') }}</text>
|
|
||||||
<text class="text-#00A76D"
|
|
||||||
@click.stop="navigateTo(`/pages/agreement/index?code=${Agreement.USER_AGREEMENT}`)">
|
|
||||||
{{ t('agreement.user-terms-conditions') }}、
|
|
||||||
</text>
|
|
||||||
<text class="text-#00A76D"
|
|
||||||
@click.stop="navigateTo(`/pages/agreement/index?code=${Agreement.PRIVACY_POLICY}`)">
|
|
||||||
{{ t('agreement.privacy-policy') }}
|
|
||||||
</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<verification-code ref="verificationCodeRef" @submit="codeSubmit"/>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
page {
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.border-color {
|
|
||||||
height: 98rpx;
|
|
||||||
border-radius: 16rpx;
|
|
||||||
border: 2rpx solid #D4D4D4;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.wd-input__clear) {
|
|
||||||
background-color: transparent !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.wd-input__icon) {
|
|
||||||
background-color: transparent !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.wd-picker__cell) {
|
|
||||||
background-color: transparent !important;
|
|
||||||
|
|
||||||
.wd-picker__value {
|
|
||||||
margin-right: 8rpx !important;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.wd-picker-view-column__item) {
|
:deep(.uni-picker-view-indicator) {
|
||||||
line-height: 94rpx !important;
|
height: 94rpx !important;
|
||||||
}
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
:deep(.uni-picker-view-indicator) {
|
|
||||||
height: 94rpx !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -165,6 +165,20 @@ function getStoreDetail() {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 用详情中的首屏菜品初始化列表,并让下一次触底从第 2 页开始,避免仍请求第 1 页导致与详情数据重复
|
||||||
|
const firstRecords = res.data?.dishPage?.records
|
||||||
|
if (firstRecords && firstRecords.length > 0) {
|
||||||
|
dishListByQuery.value = [...firstRecords]
|
||||||
|
const gotFullPage = firstRecords.length >= pageSize.value
|
||||||
|
hasMore.value = gotFullPage
|
||||||
|
pageNum.value = gotFullPage ? 2 : 1
|
||||||
|
} else if (tabs.value.length > 0) {
|
||||||
|
dishListByQuery.value = []
|
||||||
|
hasMore.value = true
|
||||||
|
pageNum.value = 1
|
||||||
|
nextTick(() => loadDishList(false))
|
||||||
|
}
|
||||||
|
|
||||||
// 商户的经纬度存在,并且用户的经纬度也存在
|
// 商户的经纬度存在,并且用户的经纬度也存在
|
||||||
if(res.data.latitude && res.data.longitude && userStore.userLocation.latitude && userStore.userLocation.longitude) {
|
if(res.data.latitude && res.data.longitude && userStore.userLocation.latitude && userStore.userLocation.longitude) {
|
||||||
let distance = getDistanceInMiles(res.data.latitude, res.data.longitude, userStore.userLocation.latitude, userStore.userLocation.longitude)
|
let distance = getDistanceInMiles(res.data.latitude, res.data.longitude, userStore.userLocation.latitude, userStore.userLocation.longitude)
|
||||||
@@ -309,15 +323,8 @@ const hasMore = ref(true);
|
|||||||
const isLoadingMore = ref(false);
|
const isLoadingMore = ref(false);
|
||||||
const dishListByQuery = ref<any[]>([]);
|
const dishListByQuery = ref<any[]>([]);
|
||||||
|
|
||||||
// 计算当前显示的商品列表
|
// 计算当前显示的商品列表(统一走 dishListByQuery,避免「全部」首屏用详情、加载更多再拼第 1 页造成重复)
|
||||||
const currentDishList = computed(() => {
|
const currentDishList = computed(() => dishListByQuery.value || [])
|
||||||
if(tabs.value[activeTab.value].key==''&&pageNum.value===1){
|
|
||||||
return storeDetail.value?.dishPage?.records
|
|
||||||
}
|
|
||||||
console.log(tabs.value[activeTab.value].key=='');
|
|
||||||
// 使用 dishListByQuery 作为数据源
|
|
||||||
return dishListByQuery.value || []
|
|
||||||
})
|
|
||||||
|
|
||||||
// 加载菜品列表
|
// 加载菜品列表
|
||||||
async function loadDishList(isLoadMore = false) {
|
async function loadDishList(isLoadMore = false) {
|
||||||
@@ -352,11 +359,10 @@ async function loadDishList(isLoadMore = false) {
|
|||||||
|
|
||||||
if (res.data && res.data.rows) {
|
if (res.data && res.data.rows) {
|
||||||
if (isLoadMore) {
|
if (isLoadMore) {
|
||||||
// 加载更多,追加数据
|
// 加载更多:按 id 去重,防止接口分页重叠或重复请求时的重复项
|
||||||
dishListByQuery.value = [
|
const existingIds = new Set(dishListByQuery.value.map((r: any) => r.id))
|
||||||
...dishListByQuery.value,
|
const nextRows = res.data.rows.filter((r: any) => r != null && !existingIds.has(r.id))
|
||||||
...res.data.rows
|
dishListByQuery.value = [...dishListByQuery.value, ...nextRows]
|
||||||
];
|
|
||||||
} else {
|
} else {
|
||||||
// 首次加载或刷新
|
// 首次加载或刷新
|
||||||
dishListByQuery.value = res.data.rows;
|
dishListByQuery.value = res.data.rows;
|
||||||
|
|||||||
Reference in New Issue
Block a user