This commit is contained in:
李志鹏
2026-04-09 13:48:46 +08:00
parent 3a7ba636f2
commit 5e1d43b5a0
4 changed files with 159 additions and 100 deletions

View File

@@ -1,26 +1,33 @@
<template> <template>
<div class="brand-info"> <div class="brand-info">
<a-form :model="formData" :rules="formRules" layout="vertical" ref="formRef"> <a-form :model="formData" :rules="isEdit ? formRules : {}" layout="vertical" ref="formRef">
<div class="form-group">
<a-form-item label="Store Name" name="storeName"> <a-form-item label="Store Name" name="storeName">
<a-input <a-input
v-model:value="formData.storeName" v-model:value="formData.storeName"
placeholder="Enter the store name" placeholder="Enter the store name"
:maxlength="80" :maxlength="80"
:readonly="!isEdit"
/> />
<span class="tip-length">{{ formData.storeName.length }}/80</span> <span v-show="isEdit" class="tip-length"
>{{ formData.storeName.length }}/80</span
>
</a-form-item> </a-form-item>
<a-form-item label="Owners Full Name" name="fullName"> <a-form-item label="Owners Full Name" name="fullName">
<a-input <a-input
v-model:value="formData.fullName" v-model:value="formData.fullName"
placeholder="Enter store owner's full name" placeholder="Enter store owner's full name"
:readonly="!isEdit"
/> />
</a-form-item> </a-form-item>
</div>
<div class="form-group"> <div class="form-group">
<a-form-item label="Email" name="email"> <a-form-item label="Email" name="email">
<a-input <a-input
type="email" type="email"
v-model:value="formData.email" v-model:value="formData.email"
placeholder="Enter email" placeholder="Enter email"
:readonly="!isEdit"
/> />
</a-form-item> </a-form-item>
<a-form-item label="Phone Number" name="phoneNumber"> <a-form-item label="Phone Number" name="phoneNumber">
@@ -28,23 +35,18 @@
type="tel" type="tel"
v-model:value="formData.phoneNumber" v-model:value="formData.phoneNumber"
placeholder="Enter phone number" placeholder="Enter phone number"
:readonly="!isEdit"
/> />
</a-form-item> </a-form-item>
</div> </div>
<a-form-item label="Store Description" name="description"> <div class="form-group">
<a-textarea
v-model:value="formData.description"
placeholder="Briefly describe your design style and store features..."
:maxlength="500"
/>
<span class="tip-length">{{ formData.description.length }}/500</span>
</a-form-item>
<a-form-item label="Portfoilo/Social Media Links"> <a-form-item label="Portfoilo/Social Media Links">
<a-input <a-input
placeholder="https://" placeholder="https://"
v-for="(v, i) in formData.links" v-for="(v, i) in formData.links"
:key="i" :key="i"
v-model:value="formData.links[i]" v-model:value="formData.links[i]"
:readonly="!isEdit"
> >
<template #prefix>Link {{ i + 1 }}</template> <template #prefix>Link {{ i + 1 }}</template>
</a-input> </a-input>
@@ -52,6 +54,7 @@
placeholder="https://" placeholder="https://"
v-model:value="newLink" v-model:value="newLink"
@keyup.enter.prevent="addLink" @keyup.enter.prevent="addLink"
v-if="isEdit"
> >
<template #prefix> <template #prefix>
<span @click="addLink" style="cursor: pointer"> <span @click="addLink" style="cursor: pointer">
@@ -60,23 +63,33 @@
</template> </template>
</a-input> </a-input>
</a-form-item> </a-form-item>
</a-form> <a-form-item label="Store Description" name="description">
<a-textarea
<div class="btns"> v-model:value="formData.description"
<button class="cancel" @click="onCancel">Cancel</button> placeholder="Briefly describe your design style and store features..."
<button class="submit" :disabled="!isAgreement" @click="onSubmit"> :maxlength="500"
Submit Application :readonly="!isEdit"
</button> />
<span v-show="isEdit" class="tip-length"
>{{ formData.description.length }}/500</span
>
</a-form-item>
</div> </div>
</a-form>
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, reactive } from "vue" import { ref, reactive, watch } from "vue"
import { useRoute, useRouter } from "vue-router" import { useRoute, useRouter } from "vue-router"
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const emit = defineEmits(["submit"]) const props = defineProps({
isEdit: {
type: Boolean,
default: false
}
})
const formRules = { const formRules = {
storeName: [{ required: true, message: "Enter the store name" }], storeName: [{ required: true, message: "Enter the store name" }],
fullName: [{ required: true, message: "Enter store owner's full name" }], fullName: [{ required: true, message: "Enter store owner's full name" }],
@@ -84,6 +97,7 @@
phoneNumber: [{ required: true, message: "Enter phone number" }], phoneNumber: [{ required: true, message: "Enter phone number" }],
description: [{ required: true, message: "Enter store description" }] description: [{ required: true, message: "Enter store description" }]
} }
const formRef = ref(null) const formRef = ref(null)
const formData = reactive({ const formData = reactive({
storeName: "", storeName: "",
@@ -93,26 +107,26 @@
description: "", description: "",
links: ["", ""] links: ["", ""]
}) })
const isAgreement = ref(false)
const newLink = ref("") const newLink = ref("")
const addLink = () => { const addLink = () => {
formData.links.push(newLink.value) formData.links.push(newLink.value)
newLink.value = "" newLink.value = ""
} }
const onCancel = () => { watch(
router.back() () => props.isEdit,
(v) => (v ? edit() : cancel())
)
const edit = () => {}
const cancel = () => {}
const submit = async () => {
const valid = await formRef.value.validate()
if (!valid) return Promise.reject(false)
console.log(valid)
return valid
} }
const onSubmit = () => { defineExpose({
formRef.value submit
.validate()
.then(() => {
console.log(formData)
emit("submit")
}) })
.catch(() => {
console.log("validate failed")
})
}
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
@import "@/assets/style/ant-from-style.less"; @import "@/assets/style/ant-from-style.less";
@@ -121,34 +135,5 @@
// height: 100%; // height: 100%;
// overflow: hidden; // overflow: hidden;
// padding: 0 10rem; // padding: 0 10rem;
> .btns {
margin-top: 3.9rem;
display: flex;
justify-content: flex-end;
gap: 1.6rem;
> button {
height: 6rem;
border-radius: 6rem;
padding: 0 4rem;
background-color: #000;
color: #fff;
font-size: 1.6rem;
border: none;
cursor: pointer;
&:active:not(:disabled) {
opacity: 0.8;
}
&:disabled {
opacity: 0.5;
cursor: not-allowed;
}
}
> .cancel {
background-color: #fff;
color: #000;
border: 0.15rem solid #000;
}
}
} }
</style> </style>

View File

@@ -20,7 +20,22 @@
</span> </span>
</div> </div>
</div> </div>
<brand-info /> <brand-info :is-edit="isEdit" ref="brandInfoRef" />
</div>
<div class="and-profile-footer">
<template v-if="isEdit">
<div class="btns">
<button class="cancel" @click="onCancel">Cancel</button>
<button class="submit" @click="onSubmit">Save Change</button>
</div>
<p class="tip">Changes will be reflected on your Stylish Parade brand page.</p>
</template>
<template v-else>
<div class="btns">
<button class="edit" @click="onEdit">Edit</button>
</div>
<p class="tip">&nbsp;</p>
</template>
</div> </div>
</template> </template>
@@ -29,6 +44,22 @@
import BrandInfo from "./brand-info.vue" import BrandInfo from "./brand-info.vue"
const banner = ref("http://118.31.39.42:3000/falls/5bd8065cbb396eb5a8ef0a142605139358734e57.png") const banner = ref("http://118.31.39.42:3000/falls/5bd8065cbb396eb5a8ef0a142605139358734e57.png")
const avatar = ref("http://118.31.39.42:3000/falls/20251024140128_10355_1.jpg") const avatar = ref("http://118.31.39.42:3000/falls/20251024140128_10355_1.jpg")
const isEdit = ref(false)
const brandInfoRef = ref(null)
const onEdit = () => {
isEdit.value = true
}
const onCancel = () => {
isEdit.value = false
}
const onSubmit = () => {
brandInfoRef.value
.submit()
.then(() => {
isEdit.value = false
})
.catch(() => {})
}
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.brand-profile-index { .brand-profile-index {
@@ -109,4 +140,44 @@
} }
} }
} }
.and-profile-footer {
margin: 0 15rem;
> .btns {
margin-top: 3rem;
display: flex;
justify-content: flex-end;
padding-right: 1.6rem;
gap: 1.3rem;
> button {
height: 6rem;
border-radius: 6rem;
padding: 0 4rem;
background-color: #000;
color: #fff;
font-size: 1.6rem;
border: none;
cursor: pointer;
&:active:not(:disabled) {
opacity: 0.8;
}
&:disabled {
opacity: 0.5;
cursor: not-allowed;
}
}
> .cancel {
background-color: #fff;
color: #000;
border: 0.15rem solid #000;
}
}
> .tip {
padding-right: 1.6rem;
margin-top: 0.7rem;
font-family: pingfang_regular;
font-size: 1.4rem;
text-align: right;
color: #999;
}
}
</style> </style>

View File

@@ -115,14 +115,17 @@ const { showDrafts } = toRefs(data);
</template> </template>
<style lang="less" scoped> <style lang="less" scoped>
.listings{ .listings{
flex: 1; position: absolute;
position: relative; width: 100%;
height: 100%;
display: flex; display: flex;
gap: 2rem; gap: 2rem;
.listingsBox{ .listingsBox{
background-color: #f9fafa; background-color: #f9fafa;
border-radius: 2rem; border-radius: 2rem;
flex: 1;
position: relative; position: relative;
// overflow: hidden;
display: flex; display: flex;
.box{ .box{
width: 100%; width: 100%;

View File

@@ -73,7 +73,7 @@ const {} = toRefs(data);
> .content { > .content {
margin-top: 2rem; margin-top: 2rem;
flex: 1; flex: 1;
display: flex; position: relative;
} }
} }
</style> </style>