1.静态地址优化

v1.0.0
sws 2024-10-23 16:30:48 +08:00
parent e6634ea6ff
commit 50f65db813
10 changed files with 51 additions and 42 deletions

View File

@ -10,6 +10,8 @@
<script setup lang="ts">
import { is_obj } from '@/utils';
import type { ImageProps } from 'element-plus';
import { commonStore } from '@/store';
const common_store = commonStore();
const props = defineProps({
errorImgStyle: {
type: String,
@ -25,7 +27,7 @@ const props = defineProps({
},
});
const image = defineModel({ type: [Object, String], default: () => {} });
const error_image = ref(new URL(`../../../assets/images/empty.png`, import.meta.url).href);
const error_image = ref(common_store.common.config.attachment_host + `/static/diy/images/empty.png`);
const emit = defineEmits(['load']);
const on_load = (e: any) => {
const { width, height } = e.target;

View File

@ -6,6 +6,8 @@
</template>
<script setup lang="ts">
import { commonStore } from '@/store';
const common_store = commonStore();
interface Props {
imgWidth?: string;
height?: string;
@ -18,7 +20,7 @@ const props = withDefaults(defineProps<Props>(), {
size: '14px',
text: '暂无数据',
});
const noData_image = ref(new URL(`../../../assets/images/noData.png`, import.meta.url).href);
const noData_image = ref(common_store.common.config.attachment_host + `/static/diy/images/noData.png`);
const style = computed(() => {
return {
width: props.imgWidth,

View File

@ -112,6 +112,8 @@ import { cloneDeep, isEmpty } from 'lodash';
import { get_math } from '@/utils';
import { text_com_data, img_com_data, line_com_data, icon_com_data, panel_com_data, isRectangleIntersecting } from "./index-default";
import { SortableEvent, VueDraggable } from 'vue-draggable-plus';
import { commonStore } from '@/store';
const common_store = commonStore();
//
const app = getCurrentInstance();
//#region
@ -163,7 +165,7 @@ const components = reactive([
},
]);
const url_computer = (name: string) => {
const new_url = ref(new URL(`../../../assets/images/custom/${name}.png`, import.meta.url).href).value;
const new_url = ref(common_store.common.config.attachment_host + `/static/diy/images/custom/${name}.png`).value;
return new_url;
};
//#endregion

View File

@ -95,8 +95,8 @@
</div>
</template>
<script setup lang="ts">
import { get_math } from '@/utils';
import { commonStore } from '@/store';
const common_store = commonStore();
const props = defineProps({
value: {
type: Object,
@ -125,10 +125,10 @@ watchEffect(() => {
const base_list = {
themeList: [
{ id: '1', name: '风格1', url: new URL(`../../assets/images/components/model-seckill/theme-1.png`, import.meta.url).href },
{ id: '2', name: '风格2', url: new URL(`../../assets/images/components/model-seckill/theme-2.png`, import.meta.url).href },
{ id: '3', name: '风格3', url: new URL(`../../assets/images/components/model-seckill/theme-3.png`, import.meta.url).href },
{ id: '4', name: '风格4', url: new URL(`../../assets/images/components/model-seckill/theme-4.png`, import.meta.url).href },
{ id: '1', name: '风格1', url: common_store.common.config.attachment_host + `/static/diy/images/components/model-seckill/theme-1.png` },
{ id: '2', name: '风格2', url: common_store.common.config.attachment_host + `/static/diy/images/components/model-seckill/theme-2.png` },
{ id: '3', name: '风格3', url: common_store.common.config.attachment_host + `/static/diy/images/components/model-seckill/theme-3.png` },
{ id: '4', name: '风格4', url: common_store.common.config.attachment_host + `/static/diy/images/components/model-seckill/theme-4.png` },
],
shop_style_type_list: [
{ name: '单列', value: '1' },
@ -136,9 +136,9 @@ const base_list = {
{ name: '横向滑动', value: '3' },
],
list_show_list: [
{ name: '商品名称', value: 'title'},
{ name: '商品简述', value: 'simple_desc'},
{ name: '商品售价', value: 'price'},
{ name: '商品名称', value: 'title' },
{ name: '商品简述', value: 'simple_desc' },
{ name: '商品售价', value: 'price' },
{ name: '商品原价', value: 'original_price' },
{ name: '售价单位', value: 'price_unit' },
{ name: '原价单位', value: 'original_price_unit' },

View File

@ -47,7 +47,7 @@
</template>
<el-form-item label="数据换行">
<el-checkbox-group v-model="form.data_alone_row_value">
<el-checkbox v-for="item in base_list.list_show_list.filter(item => item.type.includes(form.theme))" :key="item.value" :value="item.value">{{ item.name }}</el-checkbox>
<el-checkbox v-for="item in base_list.list_show_list.filter((item) => item.type.includes(form.theme))" :key="item.value" :value="item.value">{{ item.name }}</el-checkbox>
</el-checkbox-group>
</el-form-item>
</card-container>
@ -102,6 +102,8 @@
</template>
<script setup lang="ts">
import { get_math } from '@/utils';
import { commonStore } from '@/store';
const common_store = commonStore();
const props = defineProps({
value: {
type: Object,
@ -116,15 +118,15 @@ watchEffect(() => {
const base_list = reactive({
themeList: [
{ id: '1', name: '风格1', url: new URL(`../../assets/images/components/page-settings/theme-1.png`, import.meta.url).href },
{ id: '2', name: '风格2', url: new URL(`../../assets/images/components/page-settings/theme-2.png`, import.meta.url).href },
{ id: '3', name: '风格3', url: new URL(`../../assets/images/components/page-settings/theme-3.png`, import.meta.url).href },
{ id: '4', name: '风格4', url: new URL(`../../assets/images/components/page-settings/theme-4.png`, import.meta.url).href },
{ id: '5', name: '风格5', url: new URL(`../../assets/images/components/page-settings/theme-5.png`, import.meta.url).href },
{ id: '1', name: '风格1', url: common_store.common.config.attachment_host + `/static/diy/images/components/page-settings/theme-1.png` },
{ id: '2', name: '风格2', url: common_store.common.config.attachment_host + `/static/diy/images/components/page-settings/theme-2.png` },
{ id: '3', name: '风格3', url: common_store.common.config.attachment_host + `/static/diy/images/components/page-settings/theme-3.png` },
{ id: '4', name: '风格4', url: common_store.common.config.attachment_host + `/static/diy/images/components/page-settings/theme-4.png` },
{ id: '5', name: '风格5', url: common_store.common.config.attachment_host + `/static/diy/images/components/page-settings/theme-5.png` },
],
list_show_list: [
{ name: '搜索', value: 'search', type: ['3', '5'] },
{ name: '右侧图标', value: 'icon', type: ['1', '2', '3', '4', '5' ] },
{ name: '右侧图标', value: 'icon', type: ['1', '2', '3', '4', '5'] },
],
});

View File

@ -1,7 +1,13 @@
import { createApp } from 'vue';
import { createPinia } from 'pinia';
import { commonStore } from '@/store';
import App from '@/App.vue';
const app = createApp(App);
const pinia = createPinia();
app.use(pinia);
import { get_math } from '@/utils';
import defaultCommon from './index';
import { isEmpty } from 'lodash';
import { commonStore } from '@/store';
const common_store = commonStore();
interface hot_word_list {
id: string;
@ -19,12 +25,12 @@ interface DefaultFooterNav {
bottom_navigation_show: string;
positioning_name: string;
icon_setting: { id: string; img: uploadList[]; link: object; icon: string }[];
is_location_left_icon_show: string,
location_left_img: uploadList[],
location_left_icon: string,
is_location_right_icon_show: string,
location_right_img: uploadList[],
location_right_icon: string,
is_location_left_icon_show: string;
location_left_img: uploadList[];
location_left_icon: string;
is_location_right_icon_show: string;
location_right_img: uploadList[];
location_right_icon: string;
is_center: string;
is_icon_show: string;
icon_link: object;

View File

@ -1,11 +1,3 @@
import { createApp } from 'vue';
import { createPinia } from 'pinia';
import { commonStore } from '@/store';
import App from '@/App.vue';
const app = createApp(App);
const pinia = createPinia();
app.use(pinia);
const { common, set_common } = commonStore();
// 定义一组预定义的颜色数组,用于在各种场景中轻松引用这些颜色
// 这些颜色包括从白色到黑色的不同灰度以及一些鲜艳的颜色格式有十六进制、RGB、RGBA、HSV、HSL等
export const predefine_colors = ['#fff', '#ddd', '#ccc', '#999', '#666', '#333', '#000', '#ff4500', '#ff8c00', '#ffd700', '#90ee90', '#00ced1', '#c71585', 'rgba(255, 69, 0, 0.68)', 'rgb(255, 120, 0)', 'hsv(51, 100, 98)', 'hsva(120, 40, 94, 0.5)', 'hsl(181, 100%, 37%)', '#1F93FF', '#c7158577'];
@ -416,12 +408,12 @@ export const tabs_style = (color: string, style: string | number | boolean | und
* @returns {Promise<string>} PromiseURL
*/
export const online_url = async (directory: string = '') => {
console.log(2);
if (import.meta.env.VITE_APP_BASE_API == '/dev-api') {
let temp_data = await import(import.meta.env.VITE_APP_BASE_API == '/dev-api' ? '../../temp.d' : '../../temp_pro.d');
return temp_data.default.temp_attachment_host + directory;
} else {
let attachemnt_host = common.config.attachment_host;
// let attachemnt_host = common.config.attachment_host;
let attachemnt_host = get_cookie('attachment_host') && get_cookie('attachment_host') !== 'null' && get_cookie('attachment_host') !== null ? get_cookie('attachment_host') : '';
return attachemnt_host + directory;
}
};

View File

@ -88,7 +88,7 @@
</div>
</template>
<script setup lang="ts">
import { background_computer, get_math, gradient_computer, padding_computer } from '@/utils';
import { background_computer, get_math, gradient_computer, padding_computer, online_url } from '@/utils';
import { cloneDeep, isEmpty } from 'lodash';
import { SortableEvent, VueDraggable } from 'vue-draggable-plus';
import defaultSettings from './index';
@ -245,7 +245,7 @@ interface componentsData {
}
const components = ref<componentsData[]>([]);
const url_computer = (name: string) => {
const new_url = ref(new URL(`../../../../assets/images/layout/siderbar/${name}.png`, import.meta.url).href).value;
const new_url = common_store.common.config.attachment_host + `/static/diy/images/layout/siderbar/${name}.png`;
return new_url;
};
@ -485,7 +485,7 @@ const on_scroll_event = (e: any) => {
//#endregion
//#region
//
onMounted(() => {
onMounted(async () => {
page_settings();
nextTick(() => {
const interval = setInterval(() => {

View File

@ -18,7 +18,7 @@
</template>
<script setup lang="ts">
import { is_obj } from '@/utils';
import { is_obj, set_cookie } from '@/utils';
import { Settings, AppMain } from './components/index';
import defaultSettings from './components/main/index';
import defaultConfigSetting from '@/config/setting';
@ -184,6 +184,7 @@ const default_merge = (data: any, key: string) => {
const common_init = () => {
CommonAPI.getInit().then((res: any) => {
common_store.set_common(res.data);
set_cookie('attachment_host', res.data.config.attachment_host);
init();
});
};

View File

@ -18,6 +18,8 @@
</div>
</template>
<script setup lang="ts">
import { commonStore } from '@/store';
const common_store = commonStore();
const props = defineProps({
footer: {
type: Object,
@ -25,8 +27,8 @@ const props = defineProps({
},
});
const footer_nav = ref(props.footer);
const header_image = ref(new URL(`../../../../assets/images/components/page-settings/theme-1.png`, import.meta.url).href);
const content_image = ref(new URL(`../../../../assets/images/tabbar/phone-temp-bg.jpg`, import.meta.url).href);
const header_image = ref(common_store.common.config.attachment_host + `/static/diy/images/components/page-settings/theme-1.png`);
const content_image = ref(common_store.common.config.attachment_host + `/static/diy/images/tabbar/phone-temp-bg.jpg`);
watch(
() => props.footer,
(newValue) => {