fix bug of add banner
This commit is contained in:
Vendored
-3
@@ -10,7 +10,6 @@ export {}
|
|||||||
declare module '@vue/runtime-core' {
|
declare module '@vue/runtime-core' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
_index: typeof import('./src/core/components/_sample/_index.vue')['default']
|
_index: typeof import('./src/core/components/_sample/_index.vue')['default']
|
||||||
AAlert: typeof import('ant-design-vue/es')['Alert']
|
|
||||||
AAvatar: typeof import('ant-design-vue/es')['Avatar']
|
AAvatar: typeof import('ant-design-vue/es')['Avatar']
|
||||||
ABadge: typeof import('ant-design-vue/es')['Badge']
|
ABadge: typeof import('ant-design-vue/es')['Badge']
|
||||||
AButton: typeof import('ant-design-vue/es')['Button']
|
AButton: typeof import('ant-design-vue/es')['Button']
|
||||||
@@ -38,9 +37,7 @@ declare module '@vue/runtime-core' {
|
|||||||
AMenuItem: typeof import('ant-design-vue/es')['MenuItem']
|
AMenuItem: typeof import('ant-design-vue/es')['MenuItem']
|
||||||
AModal: typeof import('ant-design-vue/es')['Modal']
|
AModal: typeof import('ant-design-vue/es')['Modal']
|
||||||
APagination: typeof import('ant-design-vue/es')['Pagination']
|
APagination: typeof import('ant-design-vue/es')['Pagination']
|
||||||
APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
|
|
||||||
APopover: typeof import('ant-design-vue/es')['Popover']
|
APopover: typeof import('ant-design-vue/es')['Popover']
|
||||||
ARadio: typeof import('ant-design-vue/es')['Radio']
|
|
||||||
ARadioButton: typeof import('ant-design-vue/es')['RadioButton']
|
ARadioButton: typeof import('ant-design-vue/es')['RadioButton']
|
||||||
ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
|
ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
|
||||||
ARow: typeof import('ant-design-vue/es')['Row']
|
ARow: typeof import('ant-design-vue/es')['Row']
|
||||||
|
|||||||
@@ -79,10 +79,21 @@ const typeList = ref([
|
|||||||
{lable: 'بدون رویداد', value: null},
|
{lable: 'بدون رویداد', value: null},
|
||||||
|
|
||||||
])
|
])
|
||||||
let content = ''
|
function parseBannerList(value: string | null | undefined): IBenefits[] {
|
||||||
|
if (!value) return []
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(value)
|
||||||
|
return Array.isArray(parsed) ? parsed : []
|
||||||
|
} catch {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function addRow() {
|
function addRow() {
|
||||||
benefitsList.value.push({icon: null, show: true, caption: null, link: null, typeClick: null ,modalText:null})
|
if (!Array.isArray(benefitsList.value)) {
|
||||||
|
benefitsList.value = []
|
||||||
|
}
|
||||||
|
benefitsList.value.push({icon: null, show: true, caption: null, link: null, typeClick: null, modalText: null})
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeRow(index: number) {
|
function removeRow(index: number) {
|
||||||
@@ -116,17 +127,9 @@ onMounted(async () => {
|
|||||||
try {
|
try {
|
||||||
const res = await getHeaderBannerConst()
|
const res = await getHeaderBannerConst()
|
||||||
|
|
||||||
if (res) {
|
if (res?.length > 0) {
|
||||||
if (res.length > 0) {
|
id = res[0].id || res[0].const_id || null
|
||||||
id = res[0].id || res[0].const_id || null
|
benefitsList.value = parseBannerList(res[0].value)
|
||||||
if (res[0].value) {
|
|
||||||
benefitsList.value = JSON.parse(res[0].value)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
benefitsList.value = JSON.parse(res.value)
|
|
||||||
}
|
|
||||||
console.log(benefitsList.value)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('خطا در دریافت بنرها:', error)
|
console.error('خطا در دریافت بنرها:', error)
|
||||||
|
|||||||
Reference in New Issue
Block a user