fix: some
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 7m3s

This commit is contained in:
luo
2026-09-18 10:31:14 +08:00
parent ac541b17af
commit 5e7f5eaba4
19 changed files with 463 additions and 128 deletions

View File

@@ -64,27 +64,21 @@
<ElFormItem label="店铺名称" prop="shop_name">
<ElInput
v-model="form.shop_name"
:disabled="lockedShopName"
placeholder="请输入店铺名称"
maxlength="50"
clearable
/>
</ElFormItem>
<ElFormItem label="店铺编号" prop="shop_code">
<ElFormItem label="用户名" prop="username">
<ElInput
v-model="form.shop_code"
:disabled="lockedShopCode"
placeholder="请输入店铺编号"
v-model="form.username"
placeholder="请输入登录用户名"
maxlength="50"
clearable
/>
</ElFormItem>
</div>
<ElFormItem label="用户名" prop="username">
<ElInput v-model="form.username" placeholder="请输入登录用户名" maxlength="50" clearable />
</ElFormItem>
<div class="form-grid">
<ElFormItem label="联系人" prop="contact_name">
<ElInput v-model="form.contact_name" placeholder="选填" maxlength="50" clearable />
@@ -102,7 +96,12 @@
</div>
<ElFormItem label="详细地址" prop="address">
<ElInput v-model="form.address" placeholder="选填,请输入详细地址" maxlength="200" clearable />
<ElInput
v-model="form.address"
placeholder="选填,请输入详细地址"
maxlength="200"
clearable
/>
</ElFormItem>
<ElButton
@@ -120,7 +119,7 @@
</template>
<script setup lang="ts">
import { computed, onBeforeUnmount, reactive, ref } from 'vue'
import { computed, onBeforeUnmount, onMounted, reactive, ref } from 'vue'
import { useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
import type { CascaderOption, CascaderValue, FormInstance, FormRules } from 'element-plus'
@@ -140,7 +139,6 @@
code: string
password: string
shop_name: string
shop_code: string
username: string
contact_name: string
province: string
@@ -155,8 +153,7 @@
phone: '',
code: '',
password: '',
shop_name: (route.query.shop_name as string) || '',
shop_code: (route.query.shop_code as string) || '',
shop_name: '',
username: '',
contact_name: '',
province: '',
@@ -185,13 +182,13 @@
{ min: 8, max: 32, message: '密码长度为 8-32 位', trigger: 'blur' }
],
shop_name: [{ required: true, message: '请输入店铺名称', trigger: 'blur' }],
shop_code: [{ required: true, message: '请输入店铺编号', trigger: 'blur' }],
username: [{ required: true, message: '请输入用户名', trigger: 'blur' }]
username: [
{ required: true, message: '请输入用户名', trigger: 'blur' },
{ min: 3, message: '用户名长度必须大于 2 个字符', trigger: 'blur' }
]
}
const lockedDistributionCode = computed(() => !!route.query.distribution_code)
const lockedShopName = computed(() => !!route.query.shop_name)
const lockedShopCode = computed(() => !!route.query.shop_code)
const canSendCode = computed(() => countdown.value <= 0 && !sending.value)
@@ -258,6 +255,16 @@
form.district = parts[2] || ''
}
const generateShopCode = (): string => {
const now = new Date()
const pad = (value: number) => String(value).padStart(2, '0')
const datePart = `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}${pad(
now.getHours()
)}${pad(now.getMinutes())}${pad(now.getSeconds())}`
const randomPart = Math.floor(100 + Math.random() * 900)
return `S${datePart}${randomPart}`
}
const handleSubmit = () => {
if (!formRef.value) return
formRef.value.validate(async (valid) => {
@@ -270,7 +277,7 @@
code: form.code.trim(),
password: form.password,
shop_name: form.shop_name.trim(),
shop_code: form.shop_code.trim(),
shop_code: generateShopCode(),
username: form.username.trim()
}
if (form.contact_name.trim()) params.contact_name = form.contact_name.trim()
@@ -297,17 +304,28 @@
submitted.value = false
formRef.value?.resetFields()
form.distribution_code = (route.query.distribution_code as string) || form.distribution_code
form.shop_name = (route.query.shop_name as string) || form.shop_name
form.shop_code = (route.query.shop_code as string) || form.shop_code
form.code = ''
}
onMounted(() => {
document.documentElement.classList.add('allow-touch-scroll')
document.body.classList.add('allow-touch-scroll')
})
onBeforeUnmount(() => {
if (timer) clearInterval(timer)
document.documentElement.classList.remove('allow-touch-scroll')
document.body.classList.remove('allow-touch-scroll')
})
</script>
<style scoped lang="scss">
:global(html.allow-touch-scroll),
:global(body.allow-touch-scroll) {
touch-action: pan-y;
overflow-y: auto;
}
.agent-registration-page {
display: flex;
align-items: flex-start;
@@ -422,4 +440,4 @@
}
}
}
</style>
</style>