fix: 优化类型校验
This commit is contained in:
parent
206f91d766
commit
4bc8fbc557
@ -34,7 +34,7 @@ import skinPresets from '@/management/config/skinPresets.js'
|
||||
const editStore = useEditStore()
|
||||
const { changeThemePreset } = editStore
|
||||
const groupName = ref<string>('temp')
|
||||
let bannerList = ref([])
|
||||
let bannerList = ref<string[]>([])
|
||||
|
||||
onMounted(async () => {
|
||||
const res = await getBannerData()
|
||||
@ -43,14 +43,14 @@ onMounted(async () => {
|
||||
|
||||
const groupList = computed(() =>
|
||||
Object.keys(bannerList.value).map((key) => ({
|
||||
label: bannerList.value[key].name,
|
||||
label: (bannerList.value as any)[key].name,
|
||||
value: key
|
||||
}))
|
||||
)
|
||||
const currentBannerList = computed(() => {
|
||||
const arr = Object.keys(bannerList.value)
|
||||
.map((key) => {
|
||||
return bannerList.value[key]
|
||||
return (bannerList.value as any)[key]
|
||||
})
|
||||
.map((data) => {
|
||||
return data.list.map((item: any) => {
|
||||
|
@ -10,14 +10,14 @@ export default function useInitializeSchema(
|
||||
) {
|
||||
const schema = reactive({
|
||||
metaData: null,
|
||||
bannerConf: {},
|
||||
bottomConf: {},
|
||||
skinConf: {},
|
||||
baseConf: {},
|
||||
submitConf: {},
|
||||
pageConf: [],
|
||||
logicConf: {},
|
||||
questionDataList: [],
|
||||
bannerConf: {} as any,
|
||||
bottomConf: {} as any,
|
||||
skinConf: {} as any,
|
||||
baseConf: {} as any,
|
||||
submitConf: {} as any,
|
||||
pageConf: [] as any,
|
||||
logicConf: {} as any,
|
||||
questionDataList: [] as any,
|
||||
pageEditOne: 1
|
||||
})
|
||||
const { showLogicEngine, initShowLogicEngine, jumpLogicEngine, initJumpLogicEngine } =
|
||||
|
@ -33,7 +33,7 @@ export const getEncryptInfo = () => {
|
||||
return axios.get('/clientEncrypt/getEncryptInfo')
|
||||
}
|
||||
|
||||
export const validate = ({ surveyPath, password, whitelist }) => {
|
||||
export const validate = ({ surveyPath, password = '', whitelist = '' }) => {
|
||||
return axios.post(`/responseSchema/${surveyPath}/validate`, {
|
||||
password,
|
||||
whitelist
|
||||
|
@ -51,7 +51,7 @@ interface Props {
|
||||
}
|
||||
|
||||
interface Emit {
|
||||
(ev: 'confirm', data, callback: () => void): void
|
||||
(ev: 'confirm', data: any, callback: () => void): void
|
||||
(ev: 'close'): void
|
||||
}
|
||||
|
||||
@ -71,7 +71,9 @@ const isVisible = ref(props.visible)
|
||||
const formValues = reactive(props.bodyContent || [])
|
||||
|
||||
const handleConfirm = () => {
|
||||
const data = {}
|
||||
const data: {
|
||||
[key: string]: any
|
||||
} = {}
|
||||
formValues.forEach((item) => {
|
||||
data[item.key] = item.value
|
||||
})
|
||||
|
@ -10,6 +10,7 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
import { validate } from '../../api/survey'
|
||||
import { useSurveyStore } from '../../stores/survey'
|
||||
@ -22,7 +23,7 @@ interface Emit {
|
||||
const emit = defineEmits<Emit>()
|
||||
|
||||
const surveyStore = useSurveyStore()
|
||||
const { passwordSwitch, whitelistType, memberType, whitelistTip } = surveyStore.baseConf || {}
|
||||
const { passwordSwitch, whitelistType, memberType, whitelistTip }: any = surveyStore.baseConf || {}
|
||||
|
||||
const bodyContent = computed(() => {
|
||||
const content = []
|
||||
@ -55,8 +56,11 @@ const bodyContent = computed(() => {
|
||||
return content
|
||||
})
|
||||
|
||||
const handleSubmit = async (data, close) => {
|
||||
const params = {
|
||||
const handleSubmit = async (data: { whitelist: string; password: string }, close: Function) => {
|
||||
const params: {
|
||||
surveyPath: string
|
||||
[key: string]: string
|
||||
} = {
|
||||
surveyPath: surveyStore.surveyPath
|
||||
}
|
||||
if (data.whitelist) {
|
||||
@ -65,7 +69,7 @@ const handleSubmit = async (data, close) => {
|
||||
if (data.password) {
|
||||
params.password = data.password
|
||||
}
|
||||
const res = await validate(params)
|
||||
const res: any = await validate(params)
|
||||
|
||||
if (res.code != 200) {
|
||||
ElMessage.error(res.errmsg || '验证失败')
|
||||
|
@ -19,7 +19,7 @@ import WhiteListDialog from './WhiteListDialog.vue'
|
||||
import FillDataDialog from './FillDataDialog.vue'
|
||||
|
||||
const surveyStore = useSurveyStore()
|
||||
const baseConf = computed(() => surveyStore?.baseConf || {})
|
||||
const baseConf: any = computed(() => surveyStore?.baseConf)
|
||||
|
||||
const showWhiteList = ref(false)
|
||||
const showFillData = ref(false)
|
||||
@ -27,7 +27,7 @@ const showFillData = ref(false)
|
||||
watch(
|
||||
() => baseConf.value,
|
||||
() => {
|
||||
const { passwordSwitch, whitelistType } = baseConf.value || {}
|
||||
const { passwordSwitch, whitelistType } = baseConf.value
|
||||
|
||||
// 密码 or 白名单
|
||||
if ((whitelistType && whitelistType != 'ALL') || passwordSwitch) {
|
||||
|
@ -84,9 +84,9 @@ const validate = (callback: (v: boolean) => void) => {
|
||||
|
||||
const normalizationRequestBody = () => {
|
||||
const enterTime = surveyStore.enterTime
|
||||
const encryptInfo = surveyStore.encryptInfo as any
|
||||
const encryptInfo: any = surveyStore.encryptInfo
|
||||
const formValues = surveyStore.formValues
|
||||
const baseConf = surveyStore.baseConf
|
||||
const baseConf: any = surveyStore.baseConf
|
||||
|
||||
const result: any = {
|
||||
surveyPath: surveyPath.value,
|
||||
|
Loading…
Reference in New Issue
Block a user