diff --git a/src/components/common/template-import/index.vue b/src/components/common/template-import/index.vue index 04a75a69..043ee5ab 100644 --- a/src/components/common/template-import/index.vue +++ b/src/components/common/template-import/index.vue @@ -3,7 +3,7 @@ @@ -183,9 +183,6 @@ watch( } ); -const init = () => { - get_import_list('1'); -}; const data_list = ref([]); const form = ref({ keywords: '', @@ -195,11 +192,16 @@ const form = ref({ data_total: 0, }); const loading = ref(false); +const is_disabled = ref(false); const Loading_text = ref(' '); const get_import_list = (type?: string) => { - if (type) { + // 如果type为空则重置页码 + if (!type) { form.value.page = 1; + } else { + form.value.page = Number(type); } + // 加载中 loading.value = true; const new_data = { ...form.value, @@ -211,21 +213,29 @@ const get_import_list = (type?: string) => { form.value.data_total = data.data_total; data_list.value = data.data_list; loading.value = false; + // 解除禁用效果 + is_disabled.value = false; }) .catch(() => { form.value.data_total = 0; data_list.value = []; + // 解除禁用效果 loading.value = false; + is_disabled.value = false; }); }; const status_change = (val: any) => { - get_import_list('1'); + get_interface('1'); }; // 分页查询 const current_page_change = (val: number) => { - form.value.page = val; - init(); + get_interface(val.toString()); }; +// 除了初始化调用的时候,其他情况都会执行禁用效果 +const get_interface = (val: string) => { + is_disabled.value = true; + get_import_list(val); +} // 购买事件 const buy_event = (item: any, status: number) => { if (status == 0) { @@ -240,6 +250,8 @@ const buy_event = (item: any, status: number) => { key: '', }; loading.value = true; + // 导入时禁用切换 + is_disabled.value = true; Loading_text.value = '正在获取中...'; install(new_data); } @@ -272,6 +284,8 @@ const install = async (item: install_data) => { history.pushState({}, '', '?s=diy/saveinfo/id/' + res.data + '.html'); Loading_text.value = ''; loading.value = false; + // 解除禁用效果 + is_disabled.value = false; close_event(); emit('confirm'); break; @@ -279,6 +293,8 @@ const install = async (item: install_data) => { }) .catch((err) => { loading.value = false; + // 解除禁用效果 + is_disabled.value = false; Loading_text.value = ''; }); }; diff --git a/src/config/const/article-list.ts b/src/config/const/article-list.ts index 757feb87..38add585 100644 --- a/src/config/const/article-list.ts +++ b/src/config/const/article-list.ts @@ -42,8 +42,8 @@ interface DefaultArticleList { article_spacing: number; content_spacing: number; article_height: number; - content_img_width: number; - content_img_height: number; + content_img_width: number | undefined; + content_img_height: number | undefined; interval_time: number; //滚动时间 is_roll: number; common_style: object; @@ -104,8 +104,8 @@ const defaultArticleList: DefaultArticleList = { content_spacing: 10, // 内容间距 article_spacing: 10, // 文章间距 article_height: 155, // 文章高度 - content_img_width: 110, - content_img_height: 83, + content_img_width: undefined, + content_img_height: undefined, interval_time: 3, //滚动时间 is_roll: 1, // 是否轮播 common_style: { ...defaultCommon, padding: 10, padding_top: 10, padding_bottom: 10, padding_left: 10, padding_right: 10 }, diff --git a/src/config/const/article-tabs.ts b/src/config/const/article-tabs.ts index 78d183fd..f856760c 100644 --- a/src/config/const/article-tabs.ts +++ b/src/config/const/article-tabs.ts @@ -59,8 +59,8 @@ interface DefaultArticleTabs { article_spacing: number; content_spacing: number; article_height: number; - content_img_width: number; - content_img_height: number; + content_img_width: number | undefined; + content_img_height: number | undefined; interval_time: number; //滚动时间 is_roll: number; common_style: object; @@ -136,8 +136,8 @@ const defaultArticleTabs: DefaultArticleTabs = { content_spacing: 10, // 内容间距 article_spacing: 10, // 文章间距 article_height: 155, // 文章高度 - content_img_width: 110, - content_img_height: 83, + content_img_width: undefined, + content_img_height: undefined, interval_time: 3, //滚动时间 is_roll: 1, // 是否轮播 common_style: { ...defaultCommon, padding: 10, padding_top: 10, padding_left: 10, padding_right: 10, padding_bottom: 10 }, diff --git a/src/config/const/goods-list.ts b/src/config/const/goods-list.ts index 8c632832..bb9c4ecb 100644 --- a/src/config/const/goods-list.ts +++ b/src/config/const/goods-list.ts @@ -31,8 +31,8 @@ interface DefaultProductList { shop_radius: radiusStyle; content_outer_spacing: number; content_outer_height: number; - content_img_width: number; - content_img_height: number; + content_img_width: number | undefined; + content_img_height: number | undefined; is_roll: string, interval_time: number, content_spacing: number; @@ -127,8 +127,8 @@ const defaultProductList: DefaultProductList = { content_spacing: 10, // 商品高度 content_outer_height: 232, - content_img_width: 110, - content_img_height: 120, + content_img_width: undefined, + content_img_height: undefined, // 是否滚动 is_roll: '1', interval_time: 3, diff --git a/src/config/const/goods-tabs.ts b/src/config/const/goods-tabs.ts index 79f910a5..7ea5d2ed 100644 --- a/src/config/const/goods-tabs.ts +++ b/src/config/const/goods-tabs.ts @@ -50,8 +50,8 @@ interface DefaultProductList { shop_radius: radiusStyle; content_outer_spacing: number; content_outer_height: number; - content_img_width: number; - content_img_height: number; + content_img_width: number | undefined; + content_img_height: number | undefined; is_roll: string; interval_time: number; content_spacing: number; @@ -159,9 +159,9 @@ const defaultProductList: DefaultProductList = { content_spacing: 10, // 商品高度 content_outer_height: 232, - // 商品图片宽度和高度 - content_img_width: 110, - content_img_height: 120, + // 商品图片宽度和高度, 为了确保历史数据显示正常,这里设置为undefined + content_img_width: undefined, + content_img_height: undefined, // 轮播处理 is_roll: '1', interval_time: 3,