Merge branch 'dev-sws' into dev-yxl
commit
3e6eabcaac
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
<template>
|
||||
<el-dialog v-model="dialog_visible" class="radius-lg dialog-center oh" width="1168" :close-on-click-modal="false" append-to-body>
|
||||
<el-dialog v-model="dialog_visible" class="radius-lg dialog-center oh" width="1168" :close-on-click-modal="false" destroy-on-close append-to-body>
|
||||
<template #header>
|
||||
<div class="title re">
|
||||
<div class="middle size-16 fw">预览</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="flex-row iframe-content oh">
|
||||
<iframe :src="new_link" width="100%" height="100%" frameborder="0"></iframe>
|
||||
<iframe :key="key" :src="new_link + '&key=' + key" width="100%" height="100%" frameborder="0"></iframe>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { get_cookie, get_math } from '@/utils';
|
||||
import { get_cookie, set_cookie, get_math } from '@/utils';
|
||||
const props = defineProps({
|
||||
dataId: {
|
||||
type: String,
|
||||
|
|
@ -23,14 +23,15 @@ const new_link = ref('');
|
|||
const index = window.location.href.lastIndexOf('?s=');
|
||||
const pro_url = window.location.href.substring(0, index);
|
||||
// 如果是本地则使用静态tonken如果是线上则使用cookie的token
|
||||
const cookie = get_cookie('admin_info');
|
||||
const cookie = get_cookie('admin_info') || '';
|
||||
const token = ref('');
|
||||
const key = ref(0);
|
||||
onMounted(async () => {
|
||||
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.ts' : '../../../../temp_pro.d');
|
||||
token.value = '&token=' + temp_data.default.temp_token;
|
||||
} else {
|
||||
if (cookie) {
|
||||
if (cookie && cookie !== null && cookie !== 'null') {
|
||||
token.value = '&token=' + JSON.parse(cookie).token;
|
||||
}
|
||||
}
|
||||
|
|
@ -39,8 +40,17 @@ onMounted(async () => {
|
|||
watch(
|
||||
() => dialog_visible.value,
|
||||
(newVal) => {
|
||||
key.value = new Date().getTime();
|
||||
if (newVal) {
|
||||
new_link.value = (import.meta.env.VITE_APP_BASE_API == '/dev-api' ? import.meta.env.VITE_APP_BASE_API_URL : pro_url) + '?s=diy/preview/id/' + props.dataId + '&system_type=default' + token.value + '&uid=' + get_math();
|
||||
let uid_val = '';
|
||||
if (get_cookie('uid_name')) {
|
||||
uid_val = get_cookie('uid_name');
|
||||
} else {
|
||||
uid_val = get_math();
|
||||
set_cookie('uid_name', uid_val);
|
||||
console.log(get_cookie('uid_name'));
|
||||
}
|
||||
new_link.value = (import.meta.env.VITE_APP_BASE_API == '/dev-api' ? import.meta.env.VITE_APP_BASE_API_URL : pro_url) + '?s=diy/preview/id/' + props.dataId + '&system_type=default' + token.value + '&uid=' + uid_val;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { common_img_computer, common_styles_computer, gradient_computer, online_url } from '@/utils';
|
||||
import { common_img_computer, common_styles_computer, gradient_computer } from '@/utils';
|
||||
import { isEmpty, cloneDeep } from 'lodash';
|
||||
import CouponAPI from '@/api/coupon';
|
||||
import { commonStore } from '@/store';
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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' },
|
||||
|
|
|
|||
|
|
@ -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'] },
|
||||
],
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ const defaultSetting: DefaultSetting = {
|
|||
order_by_type: '0',
|
||||
order_by_rule: '0',
|
||||
// 文章封面
|
||||
is_cover: '1',
|
||||
is_cover: '0',
|
||||
// 分类id
|
||||
category_ids: [],
|
||||
// 品牌分类id
|
||||
|
|
|
|||
|
|
@ -1,12 +1,4 @@
|
|||
import { createApp } from 'vue';
|
||||
import { createPinia } from 'pinia';
|
||||
import { commonStore } from '@/store';
|
||||
import App from '@/App.vue';
|
||||
import { isEmpty } from 'element-plus/es/utils';
|
||||
const app = createApp(App);
|
||||
const pinia = createPinia();
|
||||
app.use(pinia);
|
||||
const { common, set_common } = commonStore();
|
||||
import CommonAPI from '@/api/common';
|
||||
// 定义一组预定义的颜色数组,用于在各种场景中轻松引用这些颜色
|
||||
// 这些颜色包括从白色到黑色的不同灰度,以及一些鲜艳的颜色,格式有十六进制、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'];
|
||||
|
|
@ -161,7 +153,7 @@ export function padding_computer(new_style: newPaddingStyle, scale: number = 1)
|
|||
if (typeof new_style.padding_top_safe_value == 'number') {
|
||||
top += new_style.padding_top_safe_value;
|
||||
}
|
||||
return `padding: ${ top * scale || 0}px ${new_style.padding_right * scale || 0}px ${new_style.padding_bottom * scale || 0}px ${new_style.padding_left * scale || 0}px;`;
|
||||
return `padding: ${top * scale || 0}px ${new_style.padding_right * scale || 0}px ${new_style.padding_bottom * scale || 0}px ${new_style.padding_left * scale || 0}px;`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -386,6 +378,9 @@ export const set_cookie = (name: string, value: string, expire_time?: number) =>
|
|||
cookie_str += ';expires=' + expire_date.toUTCString();
|
||||
// 将新增的cookie储存到cookie中,可以存储多个而不是替换
|
||||
document.cookie = cookie_str;
|
||||
} else {
|
||||
// 将新增的cookie储存到cookie中,可以存储多个而不是替换
|
||||
document.cookie = cookie_str;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -418,7 +413,16 @@ export const online_url = async (directory: string = '') => {
|
|||
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') : '';
|
||||
if (attachemnt_host.length <= 0) {
|
||||
await CommonAPI.getInit().then((res: any) => {
|
||||
set_cookie('attachment_host', res.data.config.attachment_host);
|
||||
attachemnt_host = res.data.config.attachment_host;
|
||||
// 将数据存到localStorage中
|
||||
localStorage.setItem('diy_init_common', res.data);
|
||||
});
|
||||
}
|
||||
return attachemnt_host + directory;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -33,14 +33,14 @@ const service = axios.create({
|
|||
service.interceptors.request.use(
|
||||
async (config: InternalAxiosRequestConfig) => {
|
||||
// 如果是本地则使用静态tonken如果是线上则使用cookie的token
|
||||
const cookie = get_cookie('admin_info');
|
||||
const cookie = get_cookie('admin_info') || '';
|
||||
const symbol = config.url?.includes('?') ? '&' : '?';
|
||||
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');
|
||||
config.url = config.url + symbol + 'token=' + temp_data.default.temp_token;
|
||||
} else {
|
||||
if (cookie) {
|
||||
config.url = config.url + '&token=' + JSON.parse(cookie).token;
|
||||
if (cookie && cookie !== null && cookie !== 'null') {
|
||||
config.url = config.url + '&token=' + (JSON.parse(cookie) !== 'null' ? JSON.parse(cookie)?.token : '');
|
||||
}
|
||||
}
|
||||
return config;
|
||||
|
|
|
|||
|
|
@ -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(() => {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { is_obj } from '@/utils';
|
||||
import { is_obj, set_cookie, get_cookie } from '@/utils';
|
||||
import { Settings, AppMain } from './components/index';
|
||||
import defaultSettings from './components/main/index';
|
||||
import defaultConfigSetting from '@/config/setting';
|
||||
|
|
@ -182,10 +182,23 @@ const default_merge = (data: any, key: string) => {
|
|||
|
||||
// 初始化公共数据
|
||||
const common_init = () => {
|
||||
CommonAPI.getInit().then((res: any) => {
|
||||
common_store.set_common(res.data);
|
||||
init();
|
||||
});
|
||||
if (get_cookie('attachment_host') || get_cookie('attachment_host') !== 'null' || get_cookie('attachment_host') !== null) {
|
||||
CommonAPI.getInit().then((res: any) => {
|
||||
common_store.set_common(res.data);
|
||||
set_cookie('attachment_host', res.data.config.attachment_host);
|
||||
init();
|
||||
});
|
||||
} else {
|
||||
// 将localStorage中的数据读取出
|
||||
// 判断localStorage中是否有数据
|
||||
if (localStorage.getItem('diy_init_common')) {
|
||||
const data = JSON.parse(localStorage.getItem('diy_init_common') || '');
|
||||
common_store.set_common(data);
|
||||
// 清除缓存
|
||||
localStorage.removeItem('diy_init_common');
|
||||
init();
|
||||
}
|
||||
}
|
||||
};
|
||||
// 加载动画
|
||||
const loading = ref(true);
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue