1.代码测试优化

sws 2024-08-27
v1.0.0
sws 2024-08-27 17:19:07 +08:00
parent 65aca0f8df
commit b723103cdc
10 changed files with 104 additions and 34 deletions

View File

@ -297,9 +297,7 @@ watch(
get_tree();
//
get_attachment_list();
icon_value.value = '';
temp_icon_value.value = '';
icon_index.value = -1;
}
}

View File

@ -14,7 +14,12 @@
<div class="title" :class="article_theme == '3' ? 'text-line-1 flex-1 flex-width' : 'text-line-2'" :style="article_name">{{ !isEmpty(item.new_title) ? item.new_title : item.data.title }}</div>
<div class="flex-row jc-sb gap-8" :class="article_theme == '3' ? 'ml-10' : 'align-e mt-10'">
<div :style="article_date">{{ field_show.includes('0') ? (!is_obj_empty(item.data) ? item.data.add_time : '2020-06-05 15:20') : '' }}</div>
<icon v-show="field_show.includes('1')" name="eye" :style="article_page_view">{{ item.data.access_count ? item.data.access_count : '16' }}</icon>
<div class="flex-row align-c gap-3" :style="article_page_view">
<icon v-show="field_show.includes('1')" name="eye"></icon>
<div>
{{ item.data.access_count ? item.data.access_count : '16' }}
</div>
</div>
</div>
</div>
</div>
@ -89,7 +94,6 @@ const default_data_list: ArticleList = {
watch(
props.value,
(newVal, oldValue) => {
console.log(newVal);
const new_content = newVal?.content;
const new_style = newVal?.style;
//

View File

@ -70,8 +70,26 @@ const props = defineProps({
type: Object,
default: () => ({}),
},
styles: {
type: Object,
default: () => ({}),
},
defaultConfig: {
type: Object,
default: () => ({
//
img_radius_0: 4,
img_radius_1: 0,
}),
},
});
const form = reactive(props.value);
//
const state = reactive({
form: props.value,
data: props.styles,
});
// 使toRefs
const { form, data } = toRefs(state);
const base_list = reactive({
theme_list: [
{ name: '单列展示', value: '0' },
@ -121,17 +139,34 @@ const init = () => {
};
const theme_change = (val: any) => {
if (val == '3' || val == '4') {
form.field_show = ['1'];
form.value.field_show = ['1'];
} else {
form.field_show = ['0', '1'];
form.value.field_show = ['0', '1'];
}
if (val == '0') {
if (data.value.img_radius.radius == props.defaultConfig.img_radius_0 || (data.value.img_radius.radius_bottom_left == props.defaultConfig.img_radius_1 && data.value.img_radius.radius_bottom_right == props.defaultConfig.img_radius_1 && data.value.img_radius.radius_top_left == props.defaultConfig.img_radius_1 && data.value.img_radius.radius_top_right == props.defaultConfig.img_radius_1)) {
data.value.img_radius.radius = props.defaultConfig.img_radius_0;
data.value.img_radius.radius_bottom_left = props.defaultConfig.img_radius_0;
data.value.img_radius.radius_bottom_right = props.defaultConfig.img_radius_0;
data.value.img_radius.radius_top_left = props.defaultConfig.img_radius_0;
data.value.img_radius.radius_top_right = props.defaultConfig.img_radius_0;
}
} else {
if (data.value.img_radius.radius == props.defaultConfig.img_radius_0 || (data.value.img_radius.radius_bottom_left == props.defaultConfig.img_radius_1 && data.value.img_radius.radius_bottom_right == props.defaultConfig.img_radius_1 && data.value.img_radius.radius_top_left == props.defaultConfig.img_radius_1 && data.value.img_radius.radius_top_right == props.defaultConfig.img_radius_1)) {
data.value.img_radius.radius = props.defaultConfig.img_radius_1;
data.value.img_radius.radius_bottom_left = props.defaultConfig.img_radius_1;
data.value.img_radius.radius_bottom_right = props.defaultConfig.img_radius_1;
data.value.img_radius.radius_top_left = props.defaultConfig.img_radius_1;
data.value.img_radius.radius_top_right = props.defaultConfig.img_radius_1;
}
}
};
const data_list_remove = (index: number) => {
form.data_list.splice(index, 1);
form.value.data_list.splice(index, 1);
};
const data_list_sort = (item: any) => {
form.data_list = item;
form.value.data_list = item;
};
const add = () => {
url_value_dialog_visible.value = true;
@ -140,7 +175,7 @@ const add = () => {
const url_value_dialog_visible = ref(false);
const url_value_dialog_call_back = (item: any[]) => {
item.forEach((child: any) => {
form.data_list.push({
form.value.data_list.push({
id: get_math(),
new_title: '',
new_cover: [],

View File

@ -1,10 +1,10 @@
<template>
<div class="setting-content">
<template v-if="type == '1'">
<model-article-list-content :value="value.content"></model-article-list-content>
<model-article-list-content :value="value.content" :styles="value.style" :default-config="data_config"></model-article-list-content>
</template>
<template v-else-if="type == '2'">
<model-article-list-styles :value="value.style" :content="value.content"></model-article-list-styles>
<model-article-list-styles :value="value.style" :content="value.content" :default-config="data_config"></model-article-list-styles>
</template>
</div>
</template>
@ -19,4 +19,9 @@ const props = defineProps({
default: () => ({}),
},
});
const data_config = reactive({
//
img_radius_0: 4,
img_radius_1: 0,
});
</script>

View File

@ -57,6 +57,14 @@ const props = defineProps({
type: Object,
default: () => ({}),
},
defaultConfig: {
type: Object,
default: () => ({
//
img_radius_0: 4,
img_radius_1: 0,
}),
},
});
//
const state = reactive({
@ -66,11 +74,24 @@ const state = reactive({
// 使toRefs
const { form, data } = toRefs(state);
const theme = computed(() => data.value.theme);
if (theme.value == '0') {
if (form.value.img_radius.radius == props.defaultConfig.img_radius_0 || (form.value.img_radius.radius_bottom_left == props.defaultConfig.img_radius_1 && form.value.img_radius.radius_bottom_right == props.defaultConfig.img_radius_1 && form.value.img_radius.radius_top_left == props.defaultConfig.img_radius_1 && form.value.img_radius.radius_top_right == props.defaultConfig.img_radius_1)) {
form.value.img_radius.radius = props.defaultConfig.img_radius_0;
form.value.img_radius.radius_bottom_left = props.defaultConfig.img_radius_0;
form.value.img_radius.radius_bottom_right = props.defaultConfig.img_radius_0;
form.value.img_radius.radius_top_left = props.defaultConfig.img_radius_0;
form.value.img_radius.radius_top_right = props.defaultConfig.img_radius_0;
}
} else {
if (form.value.img_radius.radius == props.defaultConfig.img_radius_0 || (form.value.img_radius.radius_bottom_left == props.defaultConfig.img_radius_1 && form.value.img_radius.radius_bottom_right == props.defaultConfig.img_radius_1 && form.value.img_radius.radius_top_left == props.defaultConfig.img_radius_1 && form.value.img_radius.radius_top_right == props.defaultConfig.img_radius_1)) {
form.value.img_radius.radius = props.defaultConfig.img_radius_1;
form.value.img_radius.radius_bottom_left = props.defaultConfig.img_radius_1;
form.value.img_radius.radius_bottom_right = props.defaultConfig.img_radius_1;
form.value.img_radius.radius_top_left = props.defaultConfig.img_radius_1;
form.value.img_radius.radius_top_right = props.defaultConfig.img_radius_1;
}
}
const emit = defineEmits(['update:value']);
const font_weight = reactive([
{ name: '加粗', value: '500' },
{ name: '正常', value: '400' },
]);
const common_style_update = (value: any) => {
form.value.common_style = value;
};

View File

@ -73,10 +73,10 @@ const rect_style = computed(() => {
.hot {
min-height: 1rem;
.hot_box {
background: rgba(42, 148, 255, 0.25);
border: 1px dashed #8ec6ff;
background: rgba(42, 148, 255, 0.15);
border: 1px dashed rgba(142, 198, 255, 0.5);
position: absolute;
opacity: 0.6;
opacity: 0.4;
}
}
</style>

View File

@ -42,7 +42,7 @@ interface DefaultArticleList {
}
const defaultArticleList: DefaultArticleList = {
content: {
theme: '1',
theme: '0',
data_type: '0',
category: [],
data_list: [],
@ -73,11 +73,11 @@ const defaultArticleList: DefaultArticleList = {
},
// 图片圆角
img_radius: {
radius: 0,
radius_top_left: 0,
radius_top_right: 0,
radius_bottom_left: 0,
radius_bottom_right: 0,
radius: 4,
radius_top_left: 4,
radius_top_right: 4,
radius_bottom_left: 4,
radius_bottom_right: 4,
},
// 内间距
padding: {

View File

@ -99,11 +99,11 @@ const defaultArticleTabs: DefaultArticleTabs = {
},
// 图片圆角
img_radius: {
radius: 0,
radius_top_left: 0,
radius_top_right: 0,
radius_bottom_left: 0,
radius_bottom_right: 0,
radius: 4,
radius_top_left: 4,
radius_top_right: 4,
radius_bottom_left: 4,
radius_bottom_right: 4,
},
// 内间距
padding: {
@ -117,7 +117,7 @@ const defaultArticleTabs: DefaultArticleTabs = {
article_spacing: 10, // 文章间距
article_width: 155, // 文章宽度
article_height: 155, // 文章宽度
common_style: { ...defaultCommon, padding:10, padding_top:10, padding_left: 10, padding_right: 10, padding_bottom: 10 },
common_style: { ...defaultCommon, padding: 10, padding_top: 10, padding_left: 10, padding_right: 10, padding_bottom: 10 },
},
};

View File

@ -172,7 +172,6 @@ watch(
() => props.diyData,
(newValue) => {
diy_data.value = newValue;
console.log(newValue);
}
);
//

View File

@ -315,7 +315,15 @@ export const tabs_style = (color: string, style: string | number | boolean | und
return color;
}
};
// 在线地址
/**
* 线URL
* URL
* VITE_APP_BASE_API'/dev-api'
* cookie
* URL
*
* @returns {Promise<string>} PromiseURL
*/
export const online_url = async () => {
if (import.meta.env.VITE_APP_BASE_API == '/dev-api') {
let temp_value = await import('../../temp.d');