Merge branch 'dev-sws'
commit
801f5c9f89
|
|
@ -1,5 +1,4 @@
|
|||
import request from '@/utils/request';
|
||||
import { AxiosRequestConfig } from 'axios';
|
||||
|
||||
class UploadAPI {
|
||||
/** 分类查询接口*/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<el-image :src="image?.url || ''" class="flex align-c jc-c">
|
||||
<el-image :src="image?.url || ''" class="flex align-c jc-c" @load="on_load">
|
||||
<template #error>
|
||||
<div class="image-slot" :style="errorStyle">
|
||||
<img :src="error_image" :style="errorImgStyle" />
|
||||
|
|
@ -20,6 +20,11 @@ const props = defineProps({
|
|||
});
|
||||
const image = defineModel({ type: Object, default: () => {} });
|
||||
const error_image = ref(new URL(`../../../assets/images/empty.png`, import.meta.url).href);
|
||||
const emit = defineEmits(['load']);
|
||||
const on_load = (e: any) => {
|
||||
const { width, height } = e.target;
|
||||
emit('load', width, height);
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.image-slot {
|
||||
|
|
|
|||
|
|
@ -49,11 +49,11 @@
|
|||
<el-button @click="mult_del_event">删除{{ upload_type_name }}</el-button>
|
||||
<!-- <el-cascader :show-all-levels="false" clearable></el-cascader> -->
|
||||
<div class="right-classify ml-12">
|
||||
<transform-category :data="type_data_list" :check-img-ids="check_img_ids" :placeholder="upload_type_name + '移动至'"></transform-category>
|
||||
<transform-category :data="type_data_list" :check-img-ids="check_img_ids" :placeholder="upload_type_name + '移动至'" @call-back="transform_category_event"></transform-category>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right-search">
|
||||
<el-input v-model="search_name" :placeholder="'请输入' + upload_type_name + '名称'" @input="get_attachment_list('1')">
|
||||
<el-input v-model="search_name" :placeholder="'请输入' + upload_type_name + '名称'" @change="get_attachment_list('1')">
|
||||
<template #suffix>
|
||||
<icon name="search" size="18"></icon>
|
||||
</template>
|
||||
|
|
@ -187,8 +187,8 @@
|
|||
<script lang="ts" setup>
|
||||
import { ext_img_name_list, ext_video_name_list, ext_file_name_list, ext_file_name_list_map } from './index';
|
||||
import UploadAPI, { Tree } from '@/api/upload';
|
||||
import { uploadrStore } from '@/store';
|
||||
const upload_store = uploadrStore();
|
||||
import { uploadStore } from '@/store';
|
||||
const upload_store = uploadStore();
|
||||
const app = getCurrentInstance();
|
||||
/**
|
||||
* @description: 图片上传
|
||||
|
|
@ -309,6 +309,7 @@ const get_tree = () => {
|
|||
type_data.value = [all_tree, ...res.data.category_list];
|
||||
type_data_list.value = res.data.category_list;
|
||||
upload_store.set_category(type_data_list.value);
|
||||
upload_store.set_is_upload_api(true);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -496,15 +497,19 @@ const mult_del_event = () => {
|
|||
ElMessage.success('删除成功!');
|
||||
// 调用查询接口
|
||||
get_attachment_list();
|
||||
check_img_ids.value = '';
|
||||
});
|
||||
});
|
||||
} else {
|
||||
ElMessage.warning('请先选择图片!');
|
||||
}
|
||||
};
|
||||
const transform_category_event = () => {
|
||||
check_img_ids.value = '';
|
||||
get_attachment_list();
|
||||
};
|
||||
|
||||
//#endregion 附件 ----------------------------------------------------------end
|
||||
|
||||
// 确认
|
||||
const confirm_event = () => {
|
||||
dialog_visible.value = false;
|
||||
|
|
@ -584,7 +589,6 @@ onMounted(() => {
|
|||
// 监听点击事件
|
||||
document.addEventListener('click', video_show);
|
||||
if (!upload_store.is_upload_api) {
|
||||
upload_store.set_is_upload_api(true);
|
||||
get_tree();
|
||||
} else {
|
||||
type_data.value = upload_store.category;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ watch(
|
|||
}
|
||||
}
|
||||
);
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
const clear_model_value = () => {
|
||||
label.value = '';
|
||||
temp_label.value = '';
|
||||
|
|
@ -100,6 +99,7 @@ const get_label = (item: any, val: any) => {
|
|||
}
|
||||
});
|
||||
};
|
||||
const emit = defineEmits(['call-back']);
|
||||
// 确定提交事件
|
||||
const confirm = () => {
|
||||
console.log(props.checkImgIds);
|
||||
|
|
@ -113,6 +113,7 @@ const confirm = () => {
|
|||
UploadAPI.moveTree(new_data).then((res) => {
|
||||
visible_dialog.value = false;
|
||||
label.value = cloneDeep(temp_label.value);
|
||||
emit('call-back');
|
||||
ElMessage.success('转移成功!');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -157,8 +157,8 @@
|
|||
</template>
|
||||
<script lang="ts" setup>
|
||||
import UploadAPI, { Tree } from '@/api/upload';
|
||||
import { uploadrStore } from '@/store';
|
||||
const upload_store = uploadrStore();
|
||||
import { uploadStore } from '@/store';
|
||||
const upload_store = uploadStore();
|
||||
import type { UploadFile, UploadFiles, UploadUserFile, FormRules, FormInstance } from 'element-plus';
|
||||
import { annex_size_to_unit, ext_name, get_math } from '@/utils';
|
||||
import { ext_img_name_list, ext_video_name_list, ext_file_name_list, ext_file_name_list_map } from './index';
|
||||
|
|
|
|||
|
|
@ -0,0 +1,230 @@
|
|||
<!-- 上传组件 -->
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" class="radius-lg" width="1168" append-to-body @close="close_event">
|
||||
<template #header>
|
||||
<div class="title center re">
|
||||
<div class="tc size-16 fw">选择链接</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="url-value-content pa-20 flex-row">
|
||||
<div class="left-content">
|
||||
<el-menu :default-active="link_select" class="w br-none" @select="handle_select">
|
||||
<el-menu-item v-for="item in base_data" :key="item.type" :index="item.type" :disabled="!(custom_link_type.length == 0 || custom_link_type.includes(item.type))">
|
||||
<span>{{ item.name }}</span>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</div>
|
||||
<div class="right-content flex-1">
|
||||
<template v-if="link_select == 'shop'">
|
||||
<link-list v-model="link_value" :reset="reset_compontent"></link-list>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'goods-category'">
|
||||
<link-goods-category v-model="link_value" :reset="reset_compontent"></link-goods-category>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'goods-search'">
|
||||
<link-goods-search :reset="reset_compontent" :status="component_status" @update:link="goods_category_link" @type="goods_category_type_change" @required="required_tips"></link-goods-search>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'goods'">
|
||||
<link-goods v-model="link_value" :reset="reset_compontent"></link-goods>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'articles'">
|
||||
<link-articles v-model="link_value" :reset="reset_compontent"></link-articles>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'diy'">
|
||||
<link-table v-model="link_value" :reset="reset_compontent"></link-table>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'design'">
|
||||
<link-table v-model="link_value" :reset="reset_compontent"></link-table>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'custom-view'">
|
||||
<link-table v-model="link_value" :reset="reset_compontent"></link-table>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'custom'">
|
||||
<link-custom :reset="reset_compontent" :status="component_status" @update:link="custom_link" @required="required_tips"></link-custom>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'plugins'">
|
||||
<link-list v-model="link_value" :reset="reset_compontent"></link-list>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button class="plr-28 ptb-10" @click="close_event">取消</el-button>
|
||||
<el-button class="plr-28 ptb-10" type="primary" @click="confirm_event">确定</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<div class="flex-row align-c gap-10 br-d radius-sm plr-11 url-value-input" @click="dialogVisible = true">
|
||||
<div class="flex-1 flex-width size-12 text-line-1">
|
||||
<text v-if="!is_obj_empty(modelValue)">{{ modelValue.name }}</text>
|
||||
<text v-else class="cr-9">{{ placeholder }}</text>
|
||||
</div>
|
||||
<div class="value-input-icon">
|
||||
<template v-if="is_obj_empty(modelValue)">
|
||||
<icon name="arrow-right" size="12" color="9"></icon>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div @click.stop="clear_model_value">
|
||||
<icon name="close-o" size="12" color="c"></icon>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { MenuItemClicked } from 'element-plus/es/components/menu/src/types';
|
||||
import { is_obj_empty } from '@/utils';
|
||||
import { PropType } from 'vue';
|
||||
|
||||
const app = getCurrentInstance();
|
||||
/**
|
||||
* @description: 页面链接
|
||||
* @param modelValue{Object} 默认值
|
||||
* @param dialogVisible {Boolean} 弹窗显示
|
||||
* @param type{String} 链接类型为空数组则表示无限制,全部可用,传过来则表示传的值可用
|
||||
* @param placeholder{String} 提示文字
|
||||
* @return {*} update:modelValue
|
||||
*/
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: Array as PropType<string[]>,
|
||||
default: () => [],
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '请选择链接',
|
||||
},
|
||||
});
|
||||
const modelValue = defineModel({ type: Object, default: {} });
|
||||
const dialogVisible = defineModel('visibleDialog', { type: Boolean, default: false });
|
||||
const link_value = ref({});
|
||||
const reset_compontent = ref(false);
|
||||
const custom_link_type = ref(props.type);
|
||||
const base_data = reactive([
|
||||
{
|
||||
name: '商城页面',
|
||||
type: 'shop',
|
||||
data: [{ name: '基础链接', data: [{ name: '', page: '' }] }],
|
||||
},
|
||||
{
|
||||
name: '商品分类',
|
||||
type: 'goods-category',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '商品搜索',
|
||||
type: 'goods-search',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '商品页面',
|
||||
type: 'goods',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '文章页面',
|
||||
type: 'articles',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: 'DIY页面',
|
||||
type: 'diy',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '页面设计',
|
||||
type: 'design',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '自定义页面',
|
||||
type: 'custom-view',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '自定义链接',
|
||||
type: 'custom',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '插件',
|
||||
type: 'plugins',
|
||||
data: [{ name: '多商户', data: [{ name: '1', page: '2' }] }],
|
||||
},
|
||||
]);
|
||||
// 弹窗显示
|
||||
|
||||
//#region 链接回调 -----------------------------------------------start
|
||||
// 菜单选中回调
|
||||
const link_select = ref(props.type.length == 0 ? 'shop' : props.type[0]);
|
||||
const handle_select = (index: string, indexPath: string[], item: MenuItemClicked, routeResult: any) => {
|
||||
// console.log(index, indexPath, item, routeResult);
|
||||
link_select.value = index;
|
||||
};
|
||||
//#endregion 链接回调 -----------------------------------------------end
|
||||
|
||||
//@region 子组件回调 -----------------------------------------------start
|
||||
const component_status = ref(false);
|
||||
// 商品分类选中回调
|
||||
const goods_category_type = ref(0);
|
||||
const goods_category_type_change = (type: number) => {
|
||||
goods_category_type.value = type;
|
||||
};
|
||||
const goods_category_link = (data: object, type: number) => {
|
||||
if (type == 2) {
|
||||
modelValue.value = data;
|
||||
close_event();
|
||||
} else {
|
||||
link_value.value = data;
|
||||
}
|
||||
};
|
||||
// 自定义地址回调
|
||||
const custom_link = (data: object) => {
|
||||
modelValue.value = data;
|
||||
close_event();
|
||||
};
|
||||
// 错误回调
|
||||
const required_tips = () => {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
message: '必填项不能为空',
|
||||
});
|
||||
};
|
||||
//#endregion 子组件回调 -----------------------------------------------end
|
||||
|
||||
//#region 链接确认回调 -----------------------------------------------start
|
||||
// 取消回调
|
||||
const close_event = () => {
|
||||
link_select.value = props.type.length == 0 ? 'shop' : props.type[0];
|
||||
dialogVisible.value = false;
|
||||
link_value.value = {};
|
||||
reset_compontent.value = !reset_compontent.value;
|
||||
};
|
||||
// 确认回调
|
||||
const confirm_event = () => {
|
||||
// 判断是否是自定义页面和商品查询
|
||||
if (link_select.value == 'custom' || (link_select.value == 'goods-search' && goods_category_type.value == 2)) {
|
||||
component_status.value = !component_status.value;
|
||||
} else {
|
||||
if (is_obj_empty(link_value.value)) {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
message: '请先选择链接',
|
||||
});
|
||||
} else {
|
||||
modelValue.value = link_value.value;
|
||||
close_event();
|
||||
}
|
||||
}
|
||||
};
|
||||
//#endregion 链接确认回调 -----------------------------------------------end
|
||||
|
||||
//#endregion 链接清空-------------------------------------------------start
|
||||
const clear_model_value = () => {
|
||||
modelValue.value = {};
|
||||
};
|
||||
//#endregion 链接清空-------------------------------------------------end
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import 'index.scss';
|
||||
</style>
|
||||
|
|
@ -1,59 +1,5 @@
|
|||
<!-- 上传组件 -->
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" class="radius-lg" width="1168" append-to-body @close="close_event">
|
||||
<template #header>
|
||||
<div class="title center re">
|
||||
<div class="tc size-16 fw">选择链接</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="url-value-content pa-20 flex-row">
|
||||
<div class="left-content">
|
||||
<el-menu :default-active="link_select" class="w br-none" @select="handle_select">
|
||||
<el-menu-item v-for="item in base_data" :key="item.type" :index="item.type" :disabled="!(custom_link_type.length == 0 || custom_link_type.includes(item.type))">
|
||||
<span>{{ item.name }}</span>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</div>
|
||||
<div class="right-content flex-1">
|
||||
<template v-if="link_select == 'shop'">
|
||||
<link-list v-model="link_value" :reset="reset_compontent"></link-list>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'goods-category'">
|
||||
<link-goods-category v-model="link_value" :reset="reset_compontent"></link-goods-category>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'goods-search'">
|
||||
<link-goods-search :reset="reset_compontent" :status="component_status" @update:link="goods_category_link" @type="goods_category_type_change" @required="required_tips"></link-goods-search>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'goods'">
|
||||
<link-goods v-model="link_value" :reset="reset_compontent"></link-goods>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'articles'">
|
||||
<link-articles v-model="link_value" :reset="reset_compontent"></link-articles>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'diy'">
|
||||
<link-table v-model="link_value" :reset="reset_compontent"></link-table>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'design'">
|
||||
<link-table v-model="link_value" :reset="reset_compontent"></link-table>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'custom-view'">
|
||||
<link-table v-model="link_value" :reset="reset_compontent"></link-table>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'custom'">
|
||||
<link-custom :reset="reset_compontent" :status="component_status" @update:link="custom_link" @required="required_tips"></link-custom>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'plugins'">
|
||||
<link-list v-model="link_value" :reset="reset_compontent"></link-list>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button class="plr-28 ptb-10" @click="close_event">取消</el-button>
|
||||
<el-button class="plr-28 ptb-10" type="primary" @click="confirm_event">确定</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<div class="flex-row align-c gap-10 br-d radius-sm plr-11 url-value-input" @click="dialogVisible = true">
|
||||
<div class="flex-1 flex-width size-12 text-line-1">
|
||||
<text v-if="!is_obj_empty(modelValue)">{{ modelValue.name }}</text>
|
||||
|
|
@ -70,11 +16,10 @@
|
|||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<url-value-dialog v-model:modelValue="modelValue" v-model:dialogVisible="dialogVisible" :type="type"></url-value-dialog>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { MenuItemClicked } from 'element-plus/es/components/menu/src/types';
|
||||
import { is_obj_empty } from '@/utils';
|
||||
import { PropType } from 'vue';
|
||||
|
||||
const app = getCurrentInstance();
|
||||
/**
|
||||
|
|
@ -97,128 +42,6 @@ const props = defineProps({
|
|||
});
|
||||
const modelValue = defineModel({ type: Object, default: {} });
|
||||
const dialogVisible = defineModel('visibleDialog', { type: Boolean, default: false });
|
||||
const link_value = ref({});
|
||||
const reset_compontent = ref(false);
|
||||
const custom_link_type = ref(props.type);
|
||||
const base_data = reactive([
|
||||
{
|
||||
name: '商城页面',
|
||||
type: 'shop',
|
||||
data: [{ name: '基础链接', data: [{ name: '', page: '' }] }],
|
||||
},
|
||||
{
|
||||
name: '商品分类',
|
||||
type: 'goods-category',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '商品搜索',
|
||||
type: 'goods-search',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '商品页面',
|
||||
type: 'goods',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '文章页面',
|
||||
type: 'articles',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: 'DIY页面',
|
||||
type: 'diy',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '页面设计',
|
||||
type: 'design',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '自定义页面',
|
||||
type: 'custom-view',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '自定义链接',
|
||||
type: 'custom',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '插件',
|
||||
type: 'plugins',
|
||||
data: [{ name: '多商户', data: [{ name: '1', page: '2' }] }],
|
||||
},
|
||||
]);
|
||||
// 弹窗显示
|
||||
|
||||
//#region 链接回调 -----------------------------------------------start
|
||||
// 菜单选中回调
|
||||
const link_select = ref(props.type.length == 0 ? 'shop' : props.type[0]);
|
||||
const handle_select = (index: string, indexPath: string[], item: MenuItemClicked, routeResult: any) => {
|
||||
// console.log(index, indexPath, item, routeResult);
|
||||
link_select.value = index;
|
||||
};
|
||||
//#endregion 链接回调 -----------------------------------------------end
|
||||
|
||||
//@region 子组件回调 -----------------------------------------------start
|
||||
const component_status = ref(false);
|
||||
// 商品分类选中回调
|
||||
const goods_category_type = ref(0);
|
||||
const goods_category_type_change = (type: number) => {
|
||||
goods_category_type.value = type;
|
||||
};
|
||||
const goods_category_link = (data: object, type: number) => {
|
||||
if (type == 2) {
|
||||
modelValue.value = data;
|
||||
close_event();
|
||||
} else {
|
||||
link_value.value = data;
|
||||
}
|
||||
};
|
||||
// 自定义地址回调
|
||||
const custom_link = (data: object) => {
|
||||
modelValue.value = data;
|
||||
close_event();
|
||||
};
|
||||
// 错误回调
|
||||
const required_tips = () => {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
message: '必填项不能为空',
|
||||
});
|
||||
};
|
||||
//#endregion 子组件回调 -----------------------------------------------end
|
||||
|
||||
//#region 链接确认回调 -----------------------------------------------start
|
||||
// 取消回调
|
||||
const close_event = () => {
|
||||
link_select.value = props.type.length == 0 ? 'shop' : props.type[0];
|
||||
dialogVisible.value = false;
|
||||
link_value.value = {};
|
||||
reset_compontent.value = !reset_compontent.value;
|
||||
};
|
||||
// 确认回调
|
||||
const confirm_event = () => {
|
||||
// 判断是否是自定义页面和商品查询
|
||||
if (link_select.value == 'custom' || (link_select.value == 'goods-search' && goods_category_type.value == 2)) {
|
||||
component_status.value = !component_status.value;
|
||||
} else {
|
||||
if (is_obj_empty(link_value.value)) {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
message: '请先选择链接',
|
||||
});
|
||||
} else {
|
||||
modelValue.value = link_value.value;
|
||||
close_event();
|
||||
}
|
||||
}
|
||||
};
|
||||
//#endregion 链接确认回调 -----------------------------------------------end
|
||||
|
||||
//#endregion 链接清空-------------------------------------------------start
|
||||
const clear_model_value = () => {
|
||||
modelValue.value = {};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,204 @@
|
|||
<template>
|
||||
<el-dialog v-model="dialogVisible" class="radius-lg" width="1168" append-to-body @close="close_event">
|
||||
<template #header>
|
||||
<div class="title center re">
|
||||
<div class="tc size-16 fw">选择链接</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="url-value-content pa-20 flex-row">
|
||||
<div class="left-content">
|
||||
<el-menu :default-active="link_select" class="w br-none" @select="handle_select">
|
||||
<el-menu-item v-for="item in base_data" :key="item.type" :index="item.type" :disabled="!(custom_link_type.length == 0 || custom_link_type.includes(item.type))">
|
||||
<span>{{ item.name }}</span>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</div>
|
||||
<div class="right-content flex-1">
|
||||
<template v-if="link_select == 'shop'">
|
||||
<link-list v-model="link_value" :reset="reset_compontent"></link-list>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'goods-category'">
|
||||
<link-goods-category v-model="link_value" :reset="reset_compontent"></link-goods-category>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'goods-search'">
|
||||
<link-goods-search :reset="reset_compontent" :status="component_status" @update:link="goods_category_link" @type="goods_category_type_change" @required="required_tips"></link-goods-search>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'goods'">
|
||||
<link-goods v-model="link_value" :reset="reset_compontent"></link-goods>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'articles'">
|
||||
<link-articles v-model="link_value" :reset="reset_compontent"></link-articles>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'diy'">
|
||||
<link-table v-model="link_value" :reset="reset_compontent"></link-table>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'design'">
|
||||
<link-table v-model="link_value" :reset="reset_compontent"></link-table>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'custom-view'">
|
||||
<link-table v-model="link_value" :reset="reset_compontent"></link-table>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'custom'">
|
||||
<link-custom :reset="reset_compontent" :status="component_status" @update:link="custom_link" @required="required_tips"></link-custom>
|
||||
</template>
|
||||
<template v-else-if="link_select == 'plugins'">
|
||||
<link-list v-model="link_value" :reset="reset_compontent"></link-list>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button class="plr-28 ptb-10" @click="close_event">取消</el-button>
|
||||
<el-button class="plr-28 ptb-10" type="primary" @click="confirm_event">确定</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { MenuItemClicked } from 'element-plus/es/components/menu/src/types';
|
||||
import { is_obj_empty } from '@/utils';
|
||||
import { PropType } from 'vue';
|
||||
|
||||
const app = getCurrentInstance();
|
||||
/**
|
||||
* @description: 页面链接
|
||||
* @param modelValue{Object} 默认值
|
||||
* @param dialogVisible {Boolean} 弹窗显示
|
||||
* @param type{String} 链接类型为空数组则表示无限制,全部可用,传过来则表示传的值可用
|
||||
* @param placeholder{String} 提示文字
|
||||
* @return {*} update:modelValue
|
||||
*/
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: Array as PropType<string[]>,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
const modelValue = defineModel({ type: Object, default: {} });
|
||||
const dialogVisible = defineModel('visibleDialog', { type: Boolean, default: false });
|
||||
const link_value = ref({});
|
||||
const reset_compontent = ref(false);
|
||||
const custom_link_type = ref(props.type);
|
||||
const base_data = reactive([
|
||||
{
|
||||
name: '商城页面',
|
||||
type: 'shop',
|
||||
data: [{ name: '基础链接', data: [{ name: '', page: '' }] }],
|
||||
},
|
||||
{
|
||||
name: '商品分类',
|
||||
type: 'goods-category',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '商品搜索',
|
||||
type: 'goods-search',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '商品页面',
|
||||
type: 'goods',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '文章页面',
|
||||
type: 'articles',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: 'DIY页面',
|
||||
type: 'diy',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '页面设计',
|
||||
type: 'design',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '自定义页面',
|
||||
type: 'custom-view',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '自定义链接',
|
||||
type: 'custom',
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
name: '插件',
|
||||
type: 'plugins',
|
||||
data: [{ name: '多商户', data: [{ name: '1', page: '2' }] }],
|
||||
},
|
||||
]);
|
||||
// 弹窗显示
|
||||
|
||||
//#region 链接回调 -----------------------------------------------start
|
||||
// 菜单选中回调
|
||||
const link_select = ref(props.type.length == 0 ? 'shop' : props.type[0]);
|
||||
const handle_select = (index: string, indexPath: string[], item: MenuItemClicked, routeResult: any) => {
|
||||
// console.log(index, indexPath, item, routeResult);
|
||||
link_select.value = index;
|
||||
};
|
||||
//#endregion 链接回调 -----------------------------------------------end
|
||||
|
||||
//@region 子组件回调 -----------------------------------------------start
|
||||
const component_status = ref(false);
|
||||
// 商品分类选中回调
|
||||
const goods_category_type = ref(0);
|
||||
const goods_category_type_change = (type: number) => {
|
||||
goods_category_type.value = type;
|
||||
};
|
||||
const goods_category_link = (data: object, type: number) => {
|
||||
if (type == 2) {
|
||||
modelValue.value = data;
|
||||
close_event();
|
||||
} else {
|
||||
link_value.value = data;
|
||||
}
|
||||
};
|
||||
// 自定义地址回调
|
||||
const custom_link = (data: object) => {
|
||||
modelValue.value = data;
|
||||
close_event();
|
||||
};
|
||||
// 错误回调
|
||||
const required_tips = () => {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
message: '必填项不能为空',
|
||||
});
|
||||
};
|
||||
//#endregion 子组件回调 -----------------------------------------------end
|
||||
|
||||
//#region 链接确认回调 -----------------------------------------------start
|
||||
// 取消回调
|
||||
const close_event = () => {
|
||||
link_select.value = props.type.length == 0 ? 'shop' : props.type[0];
|
||||
dialogVisible.value = false;
|
||||
link_value.value = {};
|
||||
reset_compontent.value = !reset_compontent.value;
|
||||
};
|
||||
// 确认回调
|
||||
const confirm_event = () => {
|
||||
// 判断是否是自定义页面和商品查询
|
||||
if (link_select.value == 'custom' || (link_select.value == 'goods-search' && goods_category_type.value == 2)) {
|
||||
component_status.value = !component_status.value;
|
||||
} else {
|
||||
if (is_obj_empty(link_value.value)) {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
message: '请先选择链接',
|
||||
});
|
||||
} else {
|
||||
modelValue.value = link_value.value;
|
||||
close_event();
|
||||
}
|
||||
}
|
||||
};
|
||||
//#endregion 链接确认回调 -----------------------------------------------end
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import 'index.scss';
|
||||
</style>
|
||||
|
|
@ -17,7 +17,6 @@ const style_container = ref('');
|
|||
watch(
|
||||
props.value,
|
||||
(newVal, oldValue) => {
|
||||
console.log(1);
|
||||
const new_content = newVal?.content || {};
|
||||
const new_style = newVal?.style || {};
|
||||
let border_content = `border-bottom-style: ${new_content?.styles || 'solid'};`;
|
||||
|
|
|
|||
|
|
@ -1,87 +0,0 @@
|
|||
<template>
|
||||
<div ref="containerRef" class="oh" :style="style_container">
|
||||
<div ref="hotRef" class="hot re" :style="style">
|
||||
<image-empty v-model="img" class="w" error-img-style="width:10rem;height:10rem;" error-style="padding:15rem 0;"></image-empty>
|
||||
<div v-for="(item, index) in hot_data" :key="index" class="hot_box" :style="rect_style(item.drag_start, item.drag_end)"></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { common_styles_computer } from '@/utils';
|
||||
const props = defineProps({
|
||||
value: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
const containerRef = ref<HTMLElement | null>(null);
|
||||
const hotRef = ref<HTMLElement | null>(null);
|
||||
const style = ref('');
|
||||
const style_container = ref('');
|
||||
const img = ref('');
|
||||
const hot_data = ref<hotListData[]>([]);
|
||||
// 热区组件图片的宽高
|
||||
const img_width = ref(1);
|
||||
const img_height = ref(1);
|
||||
|
||||
const container_ref_h = ref(0);
|
||||
const container_ref_w = ref(0);
|
||||
const hot_ref_w = ref(0);
|
||||
const hot_ref_h = ref(0);
|
||||
watch(
|
||||
props.value,
|
||||
(newVal, oldValue) => {
|
||||
const new_content = newVal?.content || {};
|
||||
const new_style = newVal?.style || {};
|
||||
img.value = new_content?.img[0];
|
||||
img_width.value = new_content?.hot.img_width || 1;
|
||||
img_height.value = new_content?.hot.img_height || 1;
|
||||
style_container.value = common_styles_computer(new_style.common_style);
|
||||
hot_data.value = new_content?.hot?.data || [];
|
||||
console.log(1);
|
||||
},
|
||||
{ immediate: true, deep: true }
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
console.log(2);
|
||||
container_ref_h.value = containerRef.value?.clientHeight || 0;
|
||||
container_ref_w.value = containerRef.value?.clientWidth || 0;
|
||||
hot_ref_w.value = hotRef.value?.clientWidth || 0;
|
||||
hot_ref_h.value = hotRef.value?.clientHeight || 0;
|
||||
console.log(container_ref_h.value, container_ref_w.value, hot_ref_w.value, hot_ref_h.value);
|
||||
});
|
||||
});
|
||||
// containerRef的宽高
|
||||
const w_scale1 = computed(() => {
|
||||
return container_ref_h.value / img_width.value;
|
||||
});
|
||||
const h_scale1 = computed(() => {
|
||||
return container_ref_h.value / img_height.value;
|
||||
});
|
||||
// hotRef的宽高
|
||||
const w_scale2 = computed(() => {
|
||||
return hot_ref_w.value / container_ref_h.value;
|
||||
});
|
||||
const h_scale2 = computed(() => {
|
||||
return hot_ref_h.value / container_ref_h.value;
|
||||
});
|
||||
|
||||
const rect_style = computed(() => {
|
||||
return (start: rectCoords, end: rectCoords) => {
|
||||
return `left: ${start.x * w_scale1.value * w_scale2.value}px;top: ${start.y * h_scale1.value * h_scale2.value}px;width: ${Math.max(end.width * w_scale1.value * w_scale2.value, 1)}px;height: ${Math.max(end.height * h_scale1.value * h_scale2.value, 1)}px;display: flex;`;
|
||||
};
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.hot {
|
||||
min-height: 1rem;
|
||||
.hot_box {
|
||||
background: rgba(42, 148, 255, 0.25);
|
||||
border: 1px dashed #8ec6ff;
|
||||
position: absolute;
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div ref="containerRef" class="oh" :style="style_container">
|
||||
<div ref="hotRef" class="hot re" :style="style">
|
||||
<image-empty v-model="img" class="w" error-img-style="width:10rem;height:10rem;" error-style="padding:15rem 0;"></image-empty>
|
||||
<image-empty v-model="img" class="w" error-img-style="width:10rem;height:10rem;" error-style="padding:15rem 0;" @load="on_load_img"></image-empty>
|
||||
<div v-for="(item, index) in hot_data" :key="index" class="hot_box" :style="rect_style(item.drag_start, item.drag_end)"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -23,12 +23,11 @@ const hot_data = ref<hotListData[]>([]);
|
|||
// 热区组件图片的宽高
|
||||
const img_width = ref(1);
|
||||
const img_height = ref(1);
|
||||
// containerRef的宽高
|
||||
const w_scale1 = ref(1);
|
||||
const h_scale1 = ref(1);
|
||||
// hotRef的宽高
|
||||
const w_scale2 = ref(1);
|
||||
const h_scale2 = ref(1);
|
||||
|
||||
const container_ref_h = ref(0);
|
||||
const container_ref_w = ref(0);
|
||||
const hot_ref_w = ref(0);
|
||||
const hot_ref_h = ref(0);
|
||||
watch(
|
||||
props.value,
|
||||
(newVal, oldValue) => {
|
||||
|
|
@ -38,22 +37,32 @@ watch(
|
|||
img_width.value = new_content?.hot.img_width || 1;
|
||||
img_height.value = new_content?.hot.img_height || 1;
|
||||
style_container.value = common_styles_computer(new_style.common_style);
|
||||
setTimeout(() => {
|
||||
hot_data.value = new_content?.hot?.data || [];
|
||||
if (containerRef.value && hotRef.value) {
|
||||
// 原图片的宽和高和实际展示的图片宽和高的比例
|
||||
w_scale1.value = containerRef.value?.clientWidth / img_width.value;
|
||||
h_scale1.value = containerRef.value?.clientHeight / img_height.value;
|
||||
|
||||
// 坐标缩小比例 containerRef的宽高除以hotRef的宽高
|
||||
w_scale2.value = hotRef.value?.clientWidth / containerRef.value?.clientWidth;
|
||||
h_scale2.value = hotRef.value?.clientHeight / containerRef.value?.clientHeight;
|
||||
}
|
||||
}, 200);
|
||||
hot_data.value = new_content?.hot?.data || [];
|
||||
},
|
||||
{ immediate: true, deep: true }
|
||||
);
|
||||
|
||||
const on_load_img = () => {
|
||||
container_ref_h.value = containerRef.value?.clientHeight || 0;
|
||||
container_ref_w.value = containerRef.value?.clientWidth || 0;
|
||||
hot_ref_w.value = hotRef.value?.clientWidth || 0;
|
||||
hot_ref_h.value = hotRef.value?.clientHeight || 0;
|
||||
};
|
||||
// containerRef的宽高
|
||||
const w_scale1 = computed(() => {
|
||||
return container_ref_h.value / img_width.value;
|
||||
});
|
||||
const h_scale1 = computed(() => {
|
||||
return container_ref_h.value / img_height.value;
|
||||
});
|
||||
// hotRef的宽高
|
||||
const w_scale2 = computed(() => {
|
||||
return hot_ref_w.value / container_ref_h.value;
|
||||
});
|
||||
const h_scale2 = computed(() => {
|
||||
return hot_ref_h.value / container_ref_h.value;
|
||||
});
|
||||
|
||||
const rect_style = computed(() => {
|
||||
return (start: rectCoords, end: rectCoords) => {
|
||||
return `left: ${start.x * w_scale1.value * w_scale2.value}px;top: ${start.y * h_scale1.value * h_scale2.value}px;width: ${Math.max(end.width * w_scale1.value * w_scale2.value, 1)}px;height: ${Math.max(end.height * h_scale1.value * h_scale2.value, 1)}px;display: flex;`;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="显示数量">
|
||||
<el-input v-model="form.number" placeholder="Please input" clearable />
|
||||
<el-input v-model="form.number" placeholder="请输入显示数量" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序类型">
|
||||
<el-radio-group v-model="form.sort">
|
||||
|
|
|
|||
|
|
@ -9,4 +9,5 @@ export function setupStore(app: App<Element>) {
|
|||
}
|
||||
export * from './modules/footer-nav-content';
|
||||
export * from './modules/upload';
|
||||
export * from './modules/url-value';
|
||||
export { store };
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { ref, computed } from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
export const uploadrStore = defineStore('upload', () => {
|
||||
export const uploadStore = defineStore('upload', () => {
|
||||
// 上传是否需要调接口判断
|
||||
const is_upload_api = ref(false);
|
||||
// 上传分类列表
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
import { ref, computed } from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
export const urlValueStore = defineStore('urlValue', () => {
|
||||
// 链接是否需要调接口判断
|
||||
const is_urlValue_api = ref(false);
|
||||
// 链接数据
|
||||
const category = ref<any[]>([]);
|
||||
// 存储链接数据
|
||||
const set_category = (data: any[]) => {
|
||||
category.value = data;
|
||||
is_urlValue_api.value = true;
|
||||
};
|
||||
// 如果为false 则转为true
|
||||
const set_is_urlValue_api = (bool: boolean) => {
|
||||
is_urlValue_api.value = bool;
|
||||
};
|
||||
|
||||
return {
|
||||
category,
|
||||
is_urlValue_api,
|
||||
set_category,
|
||||
set_is_urlValue_api,
|
||||
};
|
||||
});
|
||||
|
|
@ -2,14 +2,13 @@ import axios, { InternalAxiosRequestConfig, AxiosResponse } from 'axios';
|
|||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { get_cookie } from './index';
|
||||
// 创建 axios 实例
|
||||
const index = window.location.href.lastIndexOf('?');
|
||||
const index = window.location.href.lastIndexOf('?s=');
|
||||
const pro_url = window.location.href.substring(0, index);
|
||||
const service = axios.create({
|
||||
baseURL: import.meta.env.VITE_APP_BASE_API == '/dev-api' ? import.meta.env.VITE_APP_BASE_API : pro_url,
|
||||
baseURL: import.meta.env.VITE_APP_BASE_API == '/dev-api' ? import.meta.env.VITE_APP_BASE_API : pro_url + '?s=',
|
||||
timeout: 50000,
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||
});
|
||||
|
||||
// 请求拦截器
|
||||
service.interceptors.request.use(
|
||||
(config: InternalAxiosRequestConfig) => {
|
||||
|
|
@ -19,7 +18,7 @@ service.interceptors.request.use(
|
|||
config.url = config.url + '?token=' + 'f714594929c39071f21856b885f91556';
|
||||
} else {
|
||||
if (cookie) {
|
||||
config.url = config.url + '?token=' + JSON.parse(cookie).token;
|
||||
config.url = config.url + '&token=' + JSON.parse(cookie).token;
|
||||
}
|
||||
}
|
||||
return config;
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
|||
terserOptions: {
|
||||
compress: {
|
||||
// 移除console
|
||||
drop_console: true,
|
||||
drop_console: false,
|
||||
// 移除debugger
|
||||
drop_debugger: true,
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue