Merge branch 'main' of ssh://18.167.251.121:10002/aidlab/lanecarford_front
All checks were successful
git提交控制 AiDA WEB-Node.js main 分支构建部署 / build (20.19.0) (push) Has been skipped

This commit is contained in:
X1627315083
2025-12-29 14:43:03 +08:00
16 changed files with 225 additions and 92 deletions

View File

@@ -268,7 +268,12 @@
</div>
</div>
<div class="list">
<my-list v-model:loading="loading" v-model:finish="finish" @load="onLoad">
<my-list
v-model:loading="loading"
v-model:finish="finish"
@load="onLoad"
:empty="list.length === 0"
>
<div
class="item"
v-for="(v, i) in list"

View File

@@ -121,7 +121,9 @@
</script>
<template>
<div class="loading" v-if="loading"><generate-loading /></div>
<div class="loading" v-if="loading">
<generate-loading title="Generating Results..." />
</div>
<div class="customize" v-else>
<div class="title">Customize your Look!</div>
<p class="tip">Refine your Look</p>

View File

@@ -47,7 +47,7 @@
cancelButtonText: 'Cancel'
}).catch(() => 0)
if (res === 0) return
console.log(obj,i)
console.log(obj, i)
deleteCustomerPhoto(obj.visitRecordId)
.then(() => {
list.splice(i, 1)
@@ -68,7 +68,12 @@
<div class="library">
<div class="title">Library</div>
<div class="list">
<my-list v-model:loading="loading" v-model:finish="finish" @load="onLoad">
<my-list
v-model:loading="loading"
v-model:finish="finish"
:empty="list.length === 0"
@load="onLoad"
>
<div class="item" v-for="(v, i) in list" :key="v.visitRecordId">
<div class="image">
<img v-lazy="v.defaultImageUrl" />
@@ -115,18 +120,18 @@
}
> .title {
font-family: satoshiRegular;
font-size: 9rem;
font-family: satoshiBold;
font-size: 8.9rem;
text-align: left;
line-height: 124%;
margin: 5rem;
margin: 5rem 9.1rem;
}
> .list {
flex: 1;
overflow: hidden;
margin: 0 3rem;
margin: 0 4.5rem;
> .my-list {
padding: 0 3.8rem;
padding: 0 4.5rem;
--my-list-footer-margin: 2rem 0;
> .item {
position: relative;

View File

@@ -1,11 +1,13 @@
<script setup lang="ts">
import { ref, reactive, onMounted, inject } from 'vue'
import router from '@/router'
import { showConfirmDialog } from 'vant'
import { showConfirmDialog, showToast } from 'vant'
import { useUserInfoStore, useOverallStore } from '@/stores'
import { LogOut } from '@/api/login'
import { getCustomerList, type CustomerListParams,customerCheckin } from '@/api/workshop'
import { getCustomerList, type CustomerListParams, customerCheckin } from '@/api/workshop'
import MyEvent from '@/utils/myEvent'
import { encryptPassword } from '@/utils/tools'
import { updateUserInfo } from '@/api/login'
const props = defineProps<{
isCustomer?: boolean
@@ -17,11 +19,14 @@ const emit = defineEmits(['selected-customer'])
const show = ref(false)
const isEdit = ref(false)
const form = reactive({
name: { msg: '', value: userInfoStore.state.userInfo.username },
email: { msg: '', value: userInfoStore.state.userInfo.email },
password: { show: false, msg: '', value: userInfoStore.state.userInfo.password }
name: { msg: '', value: '' },
email: { msg: '', value: '' },
password: { show: true, msg: '', value: '' }
})
const open = () => {
form.name.value = userInfoStore.state.userInfo.username
form.email.value = userInfoStore.state.userInfo.email
form.password.value = ''
isEdit.value = false
show.value = true
}
@@ -41,14 +46,38 @@ const switchCustomer = () => {
handleShowPopup(true)
}
const edit = () => {
form.password.value = ''
isEdit.value = true
}
const confirm = () => {
if (!isEdit.value) return
const password = form.password.value
const params = {
username: form.name.value,
email: form.email.value,
password
}
if (password) {
if (password.length < 6) {
return showToast('Password must be at least 6 characters')
} else {
params.password = encryptPassword(password)
}
} else {
params.password = userInfoStore.state.userInfo.password
}
overallStore.setLoading(true)
setTimeout(() => {
updateUserInfo(params).then((res) => {
overallStore.setLoading(false)
showToast('Update success')
userInfoStore.setUserInfo({
...userInfoStore.state.userInfo,
...params
})
form.password.value = ''
isEdit.value = false
}, 1000)
})
}
const logout = () => {
showConfirmDialog({
@@ -137,6 +166,7 @@ const onScroll = (e: Event) => {
// 打开customer选择时关闭profile弹窗 如果不是点击confirem关闭则重新打开profile弹窗
const handleShowPopup = (flag: boolean) => {
showSwitchCustomerPopup.value = flag
if (props.isCustomer) return
show.value = !flag
if (flag) {
loadCustomers(true)
@@ -152,7 +182,7 @@ const handleSelectCustomer = () => {
if (selectedCustomer) {
emit('selected-customer', selectedCustomer)
}
if(!props.isCustomer){
if (!props.isCustomer) {
// show.value = true
customerCheckin({ nickname: selectedCustomer.name }).then((res) => {
useUserInfoStore().resetGenerateParams()
@@ -168,15 +198,15 @@ const handleFetchCustomerList = () => {
}
MyEvent.add('update-customer-list', handleFetchCustomerList)
const openSwitchCustomerPopup = (flag = true) => {
showSwitchCustomerPopup.value = flag
}
// const openSwitchCustomerPopup = (flag = true) => {
// showSwitchCustomerPopup.value = flag
// }
onMounted(() => {
handleFetchCustomerList()
})
defineExpose({ open, close, openSwitchCustomerPopup })
defineExpose({ open, close, handleShowPopup })
</script>
<template>
@@ -186,7 +216,7 @@ defineExpose({ open, close, openSwitchCustomerPopup })
<span class="title">Profile</span>
<van-icon name="cross" class="close" @click="close" />
</div>
<div class="box">
<form class="box" @submit.prevent.stop="confirm">
<div class="form-item">
<div class="label">Your Name</div>
<label class="input">
@@ -196,6 +226,7 @@ defineExpose({ open, close, openSwitchCustomerPopup })
placeholder="Enter your name"
v-model="form.name.value"
:readonly="!isEdit"
required
/>
<!-- <div class="icon" v-if="isEdit" @click.stop="onSaveItem('name')">
<SvgIcon name="confirmation" size="37" />
@@ -226,7 +257,7 @@ defineExpose({ open, close, openSwitchCustomerPopup })
</label>
<p class="error" v-show="form.email.msg">{{ form.email.msg }}</p>
</div>
<div class="form-item">
<div class="form-item" v-if="isEdit">
<div class="label">Password</div>
<label class="input">
<div class="icon" @click="form.password.show = !form.password.show">
@@ -249,7 +280,7 @@ defineExpose({ open, close, openSwitchCustomerPopup })
</div>
<template v-if="isEdit">
<button class="confirm" @click="confirm">Confirm</button>
<button type="submit" class="confirm">Confirm</button>
<p class="tip">Powered by AiDLab for Lane Crawford</p>
</template>
<template v-else>
@@ -257,7 +288,7 @@ defineExpose({ open, close, openSwitchCustomerPopup })
<button class="edit" @click="edit">Edit Profile</button>
<button class="logout" @click="logout">Log out</button>
</template>
</div>
</form>
</div>
</van-popup>
<van-popup
@@ -289,12 +320,13 @@ defineExpose({ open, close, openSwitchCustomerPopup })
<img v-show="item.checked" class="checked-icon" src="@/assets/images/checked.png" />
</div>
</div>
</div>
<div class="list-footer">
<div v-if="pager.loading">Loading...</div>
<div v-else-if="pager.noMore">No more</div>
<div class="list-footer">
<div v-if="pager.loading">Loading...</div>
<div v-else-if="pager.noMore">No more</div>
</div>
</div>
<div class="confirm-btn" @click="handleSelectCustomer">Confirm</div>
<div class="van-safe-area-bottom"></div>
</van-popup>
</template>

View File

@@ -55,6 +55,7 @@ const goToLogin = () => {
.title {
font-family: 'satoshiMedium';
line-height: 120%;
font-size: 11rem;
// letter-spacing: -0.02em;
}
.subtitle {

View File

@@ -5,7 +5,11 @@
>
<div class="setting flex flex-between">
<SvgIcon name="left" size="70" @click.stop="handleBack" />
<SvgIcon name="profile_white" size="55" @click="handleOpenProfile" />
<SvgIcon
:name="profileVisible ? 'profileFilledWhite' : 'profile_white'"
size="55"
@click="handleOpenProfile"
/>
</div>
<template v-if="pageMode === 'entry'">
<div class="content flex-1 flex flex-center flex-column">
@@ -58,14 +62,19 @@
</div>
</template>
<Profile ref="profileRef" @selected-customer="handleSelectCustomer" is-customer />
<Profile
ref="profileRef"
@change-visible="handleChangeVisible"
@selected-customer="handleSelectCustomer"
is-customer
/>
</div>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue'
import { useRouter } from 'vue-router'
import { useGenerateStore, useUserInfoStore } from '@/stores'
import { showToast } from 'vant'
import { showToast, closeToast } from 'vant'
import { customerCheckin, createCustomer, type CreateCustomerParams } from '@/api/workshop'
import Profile from '../Workshop/profile.vue'
import MyEvent from '@/utils/myEvent'
@@ -77,11 +86,12 @@ const handleOpenProfile = () => {
const router = useRouter()
const generateStore = useGenerateStore()
const loading = ref(false)
type PageMode = 'form' | 'entry' | 'create'
const pageMode = ref<PageMode>('entry')
const formTitle = computed(() => {
return pageMode.value === 'entry' ? 'Customer ID' : 'Create Profile'
return pageMode.value === 'entry' || pageMode.value === 'form' ? 'Customer ID' : 'Create Profile'
})
const handleChangeMode = (mode: PageMode) => {
@@ -95,50 +105,45 @@ const customerData = ref({
})
const handleConfirm = async () => {
if (pageMode.value === 'form') {
if (customerData.value.nickname === '') {
showToast({
message: 'please input the nickname'
})
return
}
if (loading.value) return
const nickname = (customerData.value.nickname || '').trim()
const vipId = (customerData.value.vipId || '').trim()
customerCheckin({ nickname: customerData.value.nickname }).then((res) => {
useUserInfoStore().resetGenerateParams()
generateStore.setCustomerInfo(res)
MyEvent.emit('clear-generate-state')
router.push('/workshop/home')
})
} else {
if (customerData.value.vipId === '') {
showToast({
message: 'please input the VIP ID'
})
return
}
if (customerData.value.nickname === '') {
showToast({
message: 'please input the nickname'
})
return
}
if (!nickname) {
showToast({ message: 'please input the nickname' })
return
}
createCustomer({
nickname: customerData.value.nickname,
vipId: customerData.value.vipId
} as CreateCustomerParams).then((res) => {
showToast({
message: 'Customer created successfully'
})
handleBack()
if (pageMode.value === 'create' && !vipId) {
showToast({ message: 'please input the VIP ID' })
return
}
loading.value = true
showToast({ message: 'Processing...', duration: 0, type: 'loading' })
try {
if (pageMode.value === 'create') {
await createCustomer({ nickname, vipId } as CreateCustomerParams)
showToast({ message: 'Customer created successfully' })
MyEvent.emit('update-customer-list')
})
}
const res = await customerCheckin({ nickname })
useUserInfoStore().resetGenerateParams()
generateStore.setCustomerInfo(res)
MyEvent.emit('clear-generate-state')
router.push('/workshop/home')
} catch (err: any) {
showToast({ message: err?.message || 'Operation failed' })
} finally {
loading.value = false
closeToast()
}
}
const handleShowPopup = (flag: Boolean) => {
// showPopup.value = flag
profileRef.value.openSwitchCustomerPopup(flag)
profileRef.value.handleShowPopup(flag)
}
const handleSelectCustomer = (value) => {
@@ -147,6 +152,11 @@ const handleSelectCustomer = (value) => {
}
}
const profileVisible = ref(false)
const handleChangeVisible = (visible: boolean) => {
profileVisible.value = visible
}
const handleBack = (e?: Event) => {
if (e) {
e.stopPropagation()

View File

@@ -220,7 +220,7 @@ onUnmounted(() => {
background-size: cover;
background-position: center;
background-repeat: no-repeat;
padding: 6rem 0 0 0;
padding: 15.9rem 0 0 0;
.content {
.loading-container {
:deep(.loading-image) {
@@ -229,10 +229,11 @@ onUnmounted(() => {
animation: none;
}
:deep(.loading-shadow) {
background-color: #000;
width: 9.2rem;
height: 2.4rem;
filter: blur(6px);
opacity: 0.5;
opacity: 0.2;
margin: 2.4rem 0 0;
// background-color: #d9d9d9;
}
@@ -247,8 +248,10 @@ onUnmounted(() => {
font-weight: 700;
line-height: 1.12;
background: #b3b3b3;
background: linear-gradient(120deg, #b3b3b3 1%, rgba(0, 0, 0, 0) 48%),
linear-gradient(344deg, #b3b3b2 16%, #000000 66%);
background: radial-gradient(80.79% 50% at 50% 50%, #d1c7c2 0%, rgba(255, 255, 255, 0) 100%),
radial-gradient(99.56% 93.08% at 99.56% 93.08%, #e6e6e6 0%, #000000 100%)
/* warning: gradient uses a rotation that is not supported by CSS and may not behave as expected */,
linear-gradient(120.09deg, #b3b3b3 0%, rgba(255, 255, 255, 0) 35.41%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
@@ -325,7 +328,7 @@ onUnmounted(() => {
text-align: center;
border-radius: 4.6rem;
padding: 0 2.15rem;
&.active{
&.active {
background-color: #f5f5f5;
}
}

View File

@@ -166,7 +166,7 @@ const handleContinue = () => {
display: flex;
flex-direction: column;
padding: 2rem;
padding-top: 6rem;
padding-top: 10rem;
}
.header {
@@ -178,6 +178,8 @@ const handleContinue = () => {
color: white;
line-height: 96%;
font-family: 'satoshiBold';
letter-spacing: -0.04rem;
margin-bottom: 3.2rem;
}
.sub-title{
font-family: 'satoshiRegular';

View File

@@ -59,11 +59,14 @@ const handleSelect = (value: string) => {
font-weight: 700;
font-size: 11rem;
line-height: 106%;
letter-spacing: -0.02rem;
margin-bottom: 4.6rem;
}
.desc {
font-family: 'satoshiRegular';
font-size: 4rem;
font-size: 6rem;
line-height: 132%;
letter-spacing: 0.02rem;
}
.select-list {
display: flex;