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