|
@@ -96,7 +96,7 @@
|
|
|
directory:
|
|
|
activedGroup === '图片'
|
|
|
? `/大屏/${item.name}`
|
|
|
- : '/大屏/未分类',
|
|
|
+ : '/大屏/默认',
|
|
|
}"
|
|
|
:auto-upload="true"
|
|
|
:upload-all-files-in-one-request="false"
|
|
@@ -292,7 +292,7 @@ import { useUser } from '@/services/user';
|
|
|
import { iframeCustom } from '@/services/defaults';
|
|
|
|
|
|
const { user } = useUser();
|
|
|
-const { setFolder } = useFolder();
|
|
|
+const { setFolder, getFolder } = useFolder();
|
|
|
const router = useRouter();
|
|
|
|
|
|
const activedGroup = ref('');
|
|
@@ -393,7 +393,7 @@ const loading = ref(false);
|
|
|
const headers = {
|
|
|
Authorization: 'Bearer ' + (localStorage.token || getCookie('token') || ''),
|
|
|
};
|
|
|
-const updataData = { directory: '/大屏/未分类' };
|
|
|
+const updataData = { directory: '/大屏/默认' };
|
|
|
let lastName = '方案';
|
|
|
let userLastName = '方案';
|
|
|
const assetsChange = (value) => {
|
|
@@ -575,7 +575,7 @@ const getImageList = async () => {
|
|
|
return {
|
|
|
name: secondDir[2],
|
|
|
_id: item._id,
|
|
|
- canEdited: secondDir[2] !== '未分类',
|
|
|
+ canEdited: secondDir[2] !== '默认',
|
|
|
list: list,
|
|
|
};
|
|
|
})
|
|
@@ -661,7 +661,7 @@ const getCaseProjects = async (name: string, current = 1, pageSize = 1000) => {
|
|
|
const getPrivateGroups = async () => {
|
|
|
const list = [
|
|
|
{
|
|
|
- name: '我的组件',
|
|
|
+ name: '默认',
|
|
|
list: [],
|
|
|
},
|
|
|
];
|
|
@@ -707,7 +707,7 @@ const getPrivateGroups = async () => {
|
|
|
const getUserComponents = async () => {
|
|
|
const list = [
|
|
|
{
|
|
|
- name: '我的组件',
|
|
|
+ name: '默认',
|
|
|
list: [],
|
|
|
},
|
|
|
];
|
|
@@ -747,7 +747,7 @@ const getUserComponents = async () => {
|
|
|
const getUserProjects = async (type: string) => {
|
|
|
const list = [
|
|
|
{
|
|
|
- name: '未分类',
|
|
|
+ name: '默认',
|
|
|
list: [],
|
|
|
},
|
|
|
];
|
|
@@ -788,17 +788,17 @@ const getPrivateProjects = async (type: string) => {
|
|
|
if (!item.list.length) {
|
|
|
item.loading = true;
|
|
|
//TODO 方案/模板分类
|
|
|
- if (item.name === '未分类') {
|
|
|
+ if (item.name === '默认') {
|
|
|
const data = {
|
|
|
query: {
|
|
|
folder: '',
|
|
|
- isTemplate: type === 'le5leV-template' ? true : undefined,
|
|
|
+ tags: type === 'le5leV-template' ? '模板' : '方案',
|
|
|
},
|
|
|
projection: {
|
|
|
image: 1,
|
|
|
_id: 1,
|
|
|
name: 1,
|
|
|
- isTemplate: 1,
|
|
|
+ tags: 1,
|
|
|
},
|
|
|
};
|
|
|
const config = {
|
|
@@ -813,10 +813,10 @@ const getPrivateProjects = async (type: string) => {
|
|
|
// item.draggable = false;
|
|
|
// })
|
|
|
item.list = res.list;
|
|
|
- if (type === 'le5leV') {
|
|
|
- //过滤模板
|
|
|
- item.list = res.list.filter((item) => !item.isTemplate);
|
|
|
- }
|
|
|
+ // if (type === 'le5leV') {
|
|
|
+ // //过滤模板
|
|
|
+ // // item.list = res.list.filter((item) => !item.isTemplate);
|
|
|
+ // }
|
|
|
}
|
|
|
}
|
|
|
item.loading = false;
|
|
@@ -867,7 +867,7 @@ const dragStart = async (event: DragEvent | MouseEvent, item: any) => {
|
|
|
iframe: 'https://view3d.le5le.com/?id=' + (item._id || item.id),
|
|
|
};
|
|
|
} else if (item.component) {
|
|
|
- // 我的组件
|
|
|
+ // 默认
|
|
|
if (!item.componentDatas && !item.componentData) {
|
|
|
isAsync = true;
|
|
|
const ret: any = await axios.post(`/api/data/le5leV-components/get`, {
|
|
@@ -973,7 +973,7 @@ const getPrivateGraphics = async () => {
|
|
|
for (const item of subGroups.value) {
|
|
|
if (!item.list.length) {
|
|
|
item.loading = true;
|
|
|
- if (item.name === '我的组件') {
|
|
|
+ if (item.name === '默认') {
|
|
|
const data = {
|
|
|
query: { folder: '' },
|
|
|
projection: {
|
|
@@ -1122,14 +1122,27 @@ const onEditHeader = (item: any) => {
|
|
|
|
|
|
const onAdd = (item: any) => {
|
|
|
blank();
|
|
|
+ if (activedGroup.value === '方案') {
|
|
|
+ item.vType = 'le5leV';
|
|
|
+ } else if (activedGroup.value === '模板') {
|
|
|
+ item.vType = 'le5leV-template';
|
|
|
+ }
|
|
|
setFolder(item);
|
|
|
router.push({
|
|
|
path: '/',
|
|
|
query: {
|
|
|
r: Date.now() + '',
|
|
|
folder: item.name,
|
|
|
+ tags: activedGroup.value,
|
|
|
},
|
|
|
});
|
|
|
+ // meta2d.open({
|
|
|
+ // name: '新建项目',
|
|
|
+ // pens: [],
|
|
|
+ // enableMock: true,
|
|
|
+ // tags: activedGroup.value,
|
|
|
+ // folder: item.name,
|
|
|
+ // } as any);
|
|
|
};
|
|
|
|
|
|
const onKeyHeader = (text: string, event: any) => {
|
|
@@ -1138,7 +1151,7 @@ const onKeyHeader = (text: string, event: any) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-// 我的组件右键菜单
|
|
|
+// 默认右键菜单
|
|
|
const contextmenu = reactive<any>({
|
|
|
visible: false,
|
|
|
style: {},
|
|
@@ -1154,11 +1167,7 @@ const onContextMenu = async (e: MouseEvent, group: any, item: any) => {
|
|
|
e.preventDefault();
|
|
|
e.stopPropagation();
|
|
|
|
|
|
- if (
|
|
|
- activedGroup.value !== '组件' &&
|
|
|
- activedGroup.value !== '图片' &&
|
|
|
- activedGroup.value !== '3D'
|
|
|
- ) {
|
|
|
+ if (activeAssets.value === 'system') {
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -1220,6 +1229,19 @@ const onMenu = async (val: string) => {
|
|
|
url = window.url3D;
|
|
|
}
|
|
|
window.open(url + id, '_blank');
|
|
|
+ } else {
|
|
|
+ if (contextmenu.group._id && contextmenu.group.name !== '默认') {
|
|
|
+ setFolder(contextmenu.group);
|
|
|
+ }
|
|
|
+ autoSave();
|
|
|
+ //文件夹
|
|
|
+ router.push({
|
|
|
+ path: '/',
|
|
|
+ query: {
|
|
|
+ id,
|
|
|
+ r: Date.now() + '',
|
|
|
+ },
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
break;
|
|
@@ -1247,18 +1269,20 @@ const onMenu = async (val: string) => {
|
|
|
arr.splice(index, 1);
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+ let collection = contextmenu.component.component
|
|
|
+ ? 'le5leV-components'
|
|
|
+ : 'le5leV';
|
|
|
// 更新后端组件信息
|
|
|
- let ret = await updateCollection('le5leV-components', {
|
|
|
+ let ret = await updateCollection(collection, {
|
|
|
_id: id,
|
|
|
- folder: val === '我的组件' ? '' : val,
|
|
|
+ folder: val === '默认' ? '' : val,
|
|
|
});
|
|
|
if (!ret) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
// 更新后端源文件夹列表
|
|
|
- if (contextmenu.group.name !== '我的组件') {
|
|
|
+ if (contextmenu.group.name !== '默认') {
|
|
|
await axios.post('/api/data/folders/update', {
|
|
|
_id: contextmenu.group._id || contextmenu.group.id,
|
|
|
list: contextmenu.group.list,
|
|
@@ -1266,7 +1290,7 @@ const onMenu = async (val: string) => {
|
|
|
}
|
|
|
|
|
|
// 更新后端目标文件夹列表
|
|
|
- if (group.name !== '我的组件') {
|
|
|
+ if (group.name !== '默认') {
|
|
|
await axios.post('/api/data/folders/update', {
|
|
|
_id: group._id || group.id,
|
|
|
list: group.list,
|
|
@@ -1283,18 +1307,26 @@ const hideContextmenu = () => {
|
|
|
|
|
|
const delComponent = async () => {
|
|
|
// const id = contextmenu.component._id || contextmenu.component.id;
|
|
|
- if (activedGroup.value === '组件') {
|
|
|
+ if (['组件', '方案', '模板'].includes(activedGroup.value)) {
|
|
|
+ let collection = delDialog.contextmenuObj.component.component
|
|
|
+ ? 'le5leV-components'
|
|
|
+ : 'le5leV';
|
|
|
const id =
|
|
|
delDialog.contextmenuObj.component._id ||
|
|
|
delDialog.contextmenuObj.component.id;
|
|
|
try {
|
|
|
- await axios.post(`/api/data/le5leV-components/delete`, {
|
|
|
+ await axios.post(`/api/data/${collection}/delete`, {
|
|
|
id,
|
|
|
});
|
|
|
} catch (e) {
|
|
|
console.error(e);
|
|
|
return;
|
|
|
}
|
|
|
+ //删除缩略图
|
|
|
+ if (delDialog.contextmenuObj.component.image) {
|
|
|
+ await delImage(delDialog.contextmenuObj.component.image);
|
|
|
+ }
|
|
|
+
|
|
|
// 前端:从源文件夹移出组件
|
|
|
delDialog.contextmenuObj.group.list.forEach(
|
|
|
(item: any, index: number, arr: any[]) => {
|
|
@@ -1305,7 +1337,7 @@ const delComponent = async () => {
|
|
|
);
|
|
|
|
|
|
// 更新后端源文件夹列表
|
|
|
- if (delDialog.contextmenuObj.group.name !== '我的组件') {
|
|
|
+ if (delDialog.contextmenuObj.group.name !== '默认') {
|
|
|
await axios.post('/api/data/folders/update', {
|
|
|
_id:
|
|
|
delDialog.contextmenuObj.group._id ||
|
|
@@ -1465,7 +1497,7 @@ const fileSuccessed = async (content: any) => {
|
|
|
const c: any = {
|
|
|
name: filename(content.file.name),
|
|
|
image: content.response.url,
|
|
|
- folder: uploadGroup.name === '我的组件' ? '' : uploadGroup.name,
|
|
|
+ folder: uploadGroup.name === '默认' ? '' : uploadGroup.name,
|
|
|
};
|
|
|
let rst = await processFileObj(
|
|
|
{ raw: content.file.raw, name: content.file.name },
|
|
@@ -1473,7 +1505,7 @@ const fileSuccessed = async (content: any) => {
|
|
|
);
|
|
|
const ret: any = await addCollection('le5leV-components', rst);
|
|
|
c._id = ret._id || ret.id;
|
|
|
- if (ret && uploadGroup.name !== '我的组件') {
|
|
|
+ if (ret && uploadGroup.name !== '默认') {
|
|
|
if (!uploadGroup.list) {
|
|
|
uploadGroup.list = [];
|
|
|
}
|