feat: 表单回显时禁止操作
This commit is contained in:
@@ -437,8 +437,8 @@ const routes: Array<RouteRecordRaw> = [
|
||||
component:()=>import('@/views/AwardPage/index.vue')
|
||||
},
|
||||
{
|
||||
path:'apply',
|
||||
name:'Apply',
|
||||
path:'contestants',
|
||||
name:'Contestants',
|
||||
component:()=>import('@/views/AwardPage/apply.vue')
|
||||
}
|
||||
]
|
||||
|
||||
@@ -75,10 +75,12 @@
|
||||
>
|
||||
<a-input
|
||||
v-if="item.type === 'input'"
|
||||
:disabled="readOnly"
|
||||
v-model:value="form[item.key]"
|
||||
/>
|
||||
<a-select
|
||||
v-if="item.type === 'select'"
|
||||
:disabled="readOnly"
|
||||
v-model:value="form[item.key]"
|
||||
:options="genderOptions"
|
||||
>
|
||||
@@ -102,7 +104,10 @@
|
||||
label="Design Title"
|
||||
required
|
||||
>
|
||||
<a-input v-model:value="form.designTitle" />
|
||||
<a-input
|
||||
v-model:value="form.designTitle"
|
||||
:disabled="readOnly"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
class="full-row design-desc"
|
||||
@@ -112,6 +117,7 @@
|
||||
>
|
||||
<a-textarea
|
||||
class="textarea"
|
||||
:disabled="readOnly"
|
||||
v-model:value="form.designDescription"
|
||||
placeholder="Briefly describe your design concept, inspiration, and creative direction..."
|
||||
/>
|
||||
@@ -158,6 +164,7 @@
|
||||
>
|
||||
<a-upload-dragger
|
||||
v-model:fileList="pdfList"
|
||||
:disabled="readOnly"
|
||||
:showUploadList="false"
|
||||
@change="info => handleFileChange(info, 'pdf')"
|
||||
:customRequest="handleUploadPdf"
|
||||
@@ -209,6 +216,7 @@
|
||||
<a-upload-dragger
|
||||
v-model:fileList="videoList"
|
||||
:showUploadList="false"
|
||||
:disabled="readOnly"
|
||||
@change="info => handleFileChange(info, 'video')"
|
||||
:customRequest="handleUploadVideo"
|
||||
:beforeUpload="beforeUploadVideo"
|
||||
@@ -329,7 +337,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onUnmounted, onMounted } from 'vue'
|
||||
import { ref, onUnmounted, onMounted, computed } from 'vue'
|
||||
import { debounce } from 'lodash-es'
|
||||
import type { Rule } from 'ant-design-vue/es/form'
|
||||
import { message } from 'ant-design-vue'
|
||||
@@ -341,10 +349,15 @@
|
||||
import Success from './components/Success.vue'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const isCompleted = ref(false)
|
||||
|
||||
const hasValidEmail = ref(false)
|
||||
const readOnly = computed(() => {
|
||||
if (route.query.id && !hasValidEmail.value) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
})
|
||||
const formRef = ref(null)
|
||||
const form = ref({
|
||||
email: '',
|
||||
@@ -568,6 +581,7 @@
|
||||
console.log('coderes', res)
|
||||
|
||||
form.value.secureToken = res.data.secureToken
|
||||
hasValidEmail.value = true
|
||||
|
||||
message.success('Verification successful!')
|
||||
showModal.value = false
|
||||
@@ -575,6 +589,10 @@
|
||||
}
|
||||
|
||||
const handleSubmitForm = () => {
|
||||
if (!hasValidEmail.value) {
|
||||
message.error('Please verify your email first')
|
||||
return
|
||||
}
|
||||
const validCondition = conditionsList.value.filter(
|
||||
item => item.required && !item.check
|
||||
)
|
||||
@@ -770,8 +788,9 @@
|
||||
? Https.httpUrls.uploadPDFComplete
|
||||
: Https.httpUrls.uploadVideoComplete
|
||||
|
||||
await Https.axiosPost(endpoint, {
|
||||
return Https.axiosPost(endpoint, {
|
||||
uploadId: chunkUploadState[type].uploadId,
|
||||
email: form.value.email,
|
||||
fileName: file.name,
|
||||
totalSize: file.size,
|
||||
secureToken: form.value.secureToken
|
||||
@@ -910,7 +929,6 @@
|
||||
|
||||
const handleEchoForm = () => {
|
||||
Https.axiosGet(Https.httpUrls.getContestantByID + route.query.id).then(res => {
|
||||
console.log('获取到的值---', res)
|
||||
Object.assign(form.value, res)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -117,14 +117,11 @@
|
||||
watch(
|
||||
() => route.path,
|
||||
val => {
|
||||
console.log('val', val)
|
||||
|
||||
if (val.includes('apply')) {
|
||||
if (val.includes('contestants')) {
|
||||
btnType.value = 'form'
|
||||
} else {
|
||||
btnType.value = 'index'
|
||||
}
|
||||
console.log('btnType', btnType.value)
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
@@ -132,7 +129,7 @@
|
||||
)
|
||||
const handleBtnClick = () => {
|
||||
if (btnType.value === 'index') {
|
||||
router.push('/award/apply')
|
||||
router.push('/award/contestants')
|
||||
} else {
|
||||
router.push('/award/index')
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
const router = useRouter()
|
||||
|
||||
const handleSubmitApplication = () => {
|
||||
router.push('/award/apply')
|
||||
router.push('/award/contestants')
|
||||
}
|
||||
|
||||
const blocksList = ref([
|
||||
|
||||
Reference in New Issue
Block a user