|
@@ -132,10 +132,6 @@ export const getDownloadList = (meta2dData: any, path: string = 'v') => {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- lists.add({
|
|
|
- url: 'https://assets.le5lecdn.com/2d/js/arrows.js',
|
|
|
- path: '/view/js/arrows.js',
|
|
|
- });
|
|
|
//数据
|
|
|
// const data: any = meta2d.data();
|
|
|
if (meta2dData._id) delete meta2dData._id;
|
|
@@ -193,7 +189,7 @@ export const getPayList = (meta2dData: any) => {
|
|
|
path.indexOf('2.85ZM') !== -1 ||
|
|
|
path.indexOf('-1-2.39.3') !== -1
|
|
|
) {
|
|
|
- keys.push(keys);
|
|
|
+ keys.push(key);
|
|
|
}
|
|
|
}
|
|
|
let flag = meta2dData.pens.some(
|
|
@@ -249,7 +245,7 @@ export const getComponentPurchased = async (list: any) => {
|
|
|
if(!_list.length){
|
|
|
return [];
|
|
|
}
|
|
|
- const res: any = await axios.post('/api/paid/2d/component', {
|
|
|
+ const res: any = await axios.post('/api/paid/2d/component?pageSize=1000', {
|
|
|
list: _list,
|
|
|
});
|
|
|
|
|
@@ -320,143 +316,143 @@ export enum Frame {
|
|
|
|
|
|
let frameFlag = -1;
|
|
|
|
|
|
-export const _preFrameDownload = async (type: Frame) => {
|
|
|
- frameFlag = type;
|
|
|
- // MessagePlugin.info('正在下载打包中,可能需要几分钟,请耐心等待...');
|
|
|
- zip3D(
|
|
|
- type === Frame.vue3 ? 'toVue3' : type === Frame.vue2 ? 'toVue2' : 'toReact'
|
|
|
- );
|
|
|
- zip2D(
|
|
|
- type === Frame.vue3
|
|
|
- ? 'downloadVue3'
|
|
|
- : type === Frame.vue2
|
|
|
- ? 'downloadVue2'
|
|
|
- : 'downloadReact'
|
|
|
- );
|
|
|
- const data: any = meta2d.data();
|
|
|
- if (data._id) delete data._id;
|
|
|
- if (data.id) delete data.id;
|
|
|
- if (data.image) delete data.image;
|
|
|
- data.userId = user.id;
|
|
|
- checkData(data);
|
|
|
- const [{ default: JSZip }, { saveAs }] = await Promise.all([
|
|
|
- import('jszip'),
|
|
|
- import('file-saver'),
|
|
|
- ]);
|
|
|
- const zip = new JSZip();
|
|
|
- let _fileName =
|
|
|
- (data.name && data.name.replace(/\//g, '_').replace(/:/g, '_')) ||
|
|
|
- 'le5le.meta2d';
|
|
|
- //处理付费svg
|
|
|
- if (Object.keys(data.paths).length >= 3) {
|
|
|
- //简单判断有无svg图元
|
|
|
- const res: any = await axios.post('/api/paid/2d/component?pageSize=1000', {
|
|
|
- type: 'SVG线性图元',
|
|
|
- });
|
|
|
- if (res.list.length === 1 && !res.list[0].name) {
|
|
|
- //已经购买全部
|
|
|
- for (let key of Object.keys(data.paths)) {
|
|
|
- let path = data.paths[key];
|
|
|
- if (
|
|
|
- path.indexOf('-1.18Zm4-1') !== -1 ||
|
|
|
- path.indexOf('-1.19Zm4-1') !== -1 ||
|
|
|
- path.indexOf('2.85ZM') !== -1 ||
|
|
|
- path.indexOf('-1-2.39.3') !== -1
|
|
|
- ) {
|
|
|
- data.paths[key] = '';
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- //购买部分
|
|
|
- let purchasedList = res.list.map((i) => i.name);
|
|
|
- data.pens.forEach((pen) => {
|
|
|
- if (pen.name === 'svgPath' && pen.svgUrl) {
|
|
|
- if (purchasedList.includes(pen.svgUrl.replace(img_cdn, ''))) {
|
|
|
- pen.pathId = null;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- const _zip: any = zip.folder(`${_fileName}`);
|
|
|
- _zip.file(
|
|
|
- `${
|
|
|
- type === Frame.vue3
|
|
|
- ? 'meta2d-vue3'
|
|
|
- : type === Frame.vue2
|
|
|
- ? 'meta2d-vue2'
|
|
|
- : 'meta2d-react'
|
|
|
- }/public/json/data.json`,
|
|
|
- JSON.stringify(data).replaceAll(img_cdn, '').replaceAll(img_upCdn, '')
|
|
|
- );
|
|
|
- await Promise.all([
|
|
|
- zipJs(_zip),
|
|
|
- zipBkImg(_zip),
|
|
|
- zipImages(_zip, meta2d.store.data.pens),
|
|
|
- type === Frame.vue3
|
|
|
- ? zipVue3Files(_zip)
|
|
|
- : type === Frame.vue2
|
|
|
- ? zipVue2Files(_zip)
|
|
|
- : zipReactFiles(_zip),
|
|
|
- zipIotPens(_zip),
|
|
|
- ]);
|
|
|
- const blob = await zip.generateAsync({ type: 'blob' });
|
|
|
- saveAs(blob, `${_fileName}.zip`);
|
|
|
- frameFlag = -1;
|
|
|
-};
|
|
|
-
|
|
|
-async function zipIotPens(zip: JSZip) {
|
|
|
- //处理控件
|
|
|
- const js = await get2dComponentJs();
|
|
|
- zip.file(
|
|
|
- `${
|
|
|
- frameFlag === Frame.vue3
|
|
|
- ? 'meta2d-vue3'
|
|
|
- : frameFlag === Frame.vue2
|
|
|
- ? 'meta2d-vue2'
|
|
|
- : 'meta2d-react'
|
|
|
- }/public/js/2d-components.js`,
|
|
|
- js,
|
|
|
- { createFolders: true }
|
|
|
- );
|
|
|
- const res: Blob = await axios.get( cdn+'/view/js/r.js', {
|
|
|
- responseType: 'blob',
|
|
|
- });
|
|
|
- zip.file(
|
|
|
- `${
|
|
|
- frameFlag === Frame.vue3
|
|
|
- ? 'meta2d-vue3'
|
|
|
- : frameFlag === Frame.vue2
|
|
|
- ? 'meta2d-vue2'
|
|
|
- : 'meta2d-react'
|
|
|
- }/public/js/r.js`,
|
|
|
- res,
|
|
|
- { createFolders: true }
|
|
|
- );
|
|
|
-}
|
|
|
-
|
|
|
-async function zipJs(zip: JSZip) {
|
|
|
- const files = ['/view/js/marked.min.js', '/view/js/lcjs.iife.js'];
|
|
|
- await Promise.all(
|
|
|
- files.map(async (filePath) => {
|
|
|
- const res: Blob = await axios.get(cdn+filePath, {
|
|
|
- responseType: 'blob',
|
|
|
- });
|
|
|
- zip.file(
|
|
|
- `${
|
|
|
- frameFlag === Frame.vue3
|
|
|
- ? 'meta2d-vue3'
|
|
|
- : frameFlag === Frame.vue2
|
|
|
- ? 'meta2d-vue2'
|
|
|
- : 'meta2d-react'
|
|
|
- }/public` + filePath.replace('/view', ''),
|
|
|
- res,
|
|
|
- { createFolders: true }
|
|
|
- );
|
|
|
- })
|
|
|
- );
|
|
|
-}
|
|
|
+// export const _preFrameDownload = async (type: Frame) => {
|
|
|
+// frameFlag = type;
|
|
|
+// // MessagePlugin.info('正在下载打包中,可能需要几分钟,请耐心等待...');
|
|
|
+// zip3D(
|
|
|
+// type === Frame.vue3 ? 'toVue3' : type === Frame.vue2 ? 'toVue2' : 'toReact'
|
|
|
+// );
|
|
|
+// zip2D(
|
|
|
+// type === Frame.vue3
|
|
|
+// ? 'downloadVue3'
|
|
|
+// : type === Frame.vue2
|
|
|
+// ? 'downloadVue2'
|
|
|
+// : 'downloadReact'
|
|
|
+// );
|
|
|
+// const data: any = meta2d.data();
|
|
|
+// if (data._id) delete data._id;
|
|
|
+// if (data.id) delete data.id;
|
|
|
+// if (data.image) delete data.image;
|
|
|
+// data.userId = user.id;
|
|
|
+// checkData(data);
|
|
|
+// const [{ default: JSZip }, { saveAs }] = await Promise.all([
|
|
|
+// import('jszip'),
|
|
|
+// import('file-saver'),
|
|
|
+// ]);
|
|
|
+// const zip = new JSZip();
|
|
|
+// let _fileName =
|
|
|
+// (data.name && data.name.replace(/\//g, '_').replace(/:/g, '_')) ||
|
|
|
+// 'le5le.meta2d';
|
|
|
+// //处理付费svg
|
|
|
+// if (Object.keys(data.paths).length >= 3) {
|
|
|
+// //简单判断有无svg图元
|
|
|
+// const res: any = await axios.post('/api/paid/2d/component?pageSize=1000', {
|
|
|
+// type: 'SVG线性图元',
|
|
|
+// });
|
|
|
+// if (res.list.length === 1 && !res.list[0].name) {
|
|
|
+// //已经购买全部
|
|
|
+// for (let key of Object.keys(data.paths)) {
|
|
|
+// let path = data.paths[key];
|
|
|
+// if (
|
|
|
+// path.indexOf('-1.18Zm4-1') !== -1 ||
|
|
|
+// path.indexOf('-1.19Zm4-1') !== -1 ||
|
|
|
+// path.indexOf('2.85ZM') !== -1 ||
|
|
|
+// path.indexOf('-1-2.39.3') !== -1
|
|
|
+// ) {
|
|
|
+// data.paths[key] = '';
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// //购买部分
|
|
|
+// let purchasedList = res.list.map((i) => i.name);
|
|
|
+// data.pens.forEach((pen) => {
|
|
|
+// if (pen.name === 'svgPath' && pen.svgUrl) {
|
|
|
+// if (purchasedList.includes(pen.svgUrl.replace(img_cdn, ''))) {
|
|
|
+// pen.pathId = null;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+// const _zip: any = zip.folder(`${_fileName}`);
|
|
|
+// _zip.file(
|
|
|
+// `${
|
|
|
+// type === Frame.vue3
|
|
|
+// ? 'meta2d-vue3'
|
|
|
+// : type === Frame.vue2
|
|
|
+// ? 'meta2d-vue2'
|
|
|
+// : 'meta2d-react'
|
|
|
+// }/public/json/data.json`,
|
|
|
+// JSON.stringify(data).replaceAll(img_cdn, '').replaceAll(img_upCdn, '')
|
|
|
+// );
|
|
|
+// await Promise.all([
|
|
|
+// zipJs(_zip),
|
|
|
+// zipBkImg(_zip),
|
|
|
+// zipImages(_zip, meta2d.store.data.pens),
|
|
|
+// type === Frame.vue3
|
|
|
+// ? zipVue3Files(_zip)
|
|
|
+// : type === Frame.vue2
|
|
|
+// ? zipVue2Files(_zip)
|
|
|
+// : zipReactFiles(_zip),
|
|
|
+// zipIotPens(_zip),
|
|
|
+// ]);
|
|
|
+// const blob = await zip.generateAsync({ type: 'blob' });
|
|
|
+// saveAs(blob, `${_fileName}.zip`);
|
|
|
+// frameFlag = -1;
|
|
|
+// };
|
|
|
+
|
|
|
+// async function zipIotPens(zip: JSZip) {
|
|
|
+// //处理控件
|
|
|
+// const js = await get2dComponentJs();
|
|
|
+// zip.file(
|
|
|
+// `${
|
|
|
+// frameFlag === Frame.vue3
|
|
|
+// ? 'meta2d-vue3'
|
|
|
+// : frameFlag === Frame.vue2
|
|
|
+// ? 'meta2d-vue2'
|
|
|
+// : 'meta2d-react'
|
|
|
+// }/public/js/2d-components.js`,
|
|
|
+// js,
|
|
|
+// { createFolders: true }
|
|
|
+// );
|
|
|
+// const res: Blob = await axios.get( cdn+'/view/js/r.js', {
|
|
|
+// responseType: 'blob',
|
|
|
+// });
|
|
|
+// zip.file(
|
|
|
+// `${
|
|
|
+// frameFlag === Frame.vue3
|
|
|
+// ? 'meta2d-vue3'
|
|
|
+// : frameFlag === Frame.vue2
|
|
|
+// ? 'meta2d-vue2'
|
|
|
+// : 'meta2d-react'
|
|
|
+// }/public/js/r.js`,
|
|
|
+// res,
|
|
|
+// { createFolders: true }
|
|
|
+// );
|
|
|
+// }
|
|
|
+
|
|
|
+// async function zipJs(zip: JSZip) {
|
|
|
+// const files = ['/view/js/marked.min.js', '/view/js/lcjs.iife.js'];
|
|
|
+// await Promise.all(
|
|
|
+// files.map(async (filePath) => {
|
|
|
+// const res: Blob = await axios.get(cdn+filePath, {
|
|
|
+// responseType: 'blob',
|
|
|
+// });
|
|
|
+// zip.file(
|
|
|
+// `${
|
|
|
+// frameFlag === Frame.vue3
|
|
|
+// ? 'meta2d-vue3'
|
|
|
+// : frameFlag === Frame.vue2
|
|
|
+// ? 'meta2d-vue2'
|
|
|
+// : 'meta2d-react'
|
|
|
+// }/public` + filePath.replace('/view', ''),
|
|
|
+// res,
|
|
|
+// { createFolders: true }
|
|
|
+// );
|
|
|
+// })
|
|
|
+// );
|
|
|
+// }
|
|
|
|
|
|
export async function zipBkImg(zip: JSZip) {
|
|
|
let img = meta2d.store.data.bkImage;
|
|
@@ -492,58 +488,58 @@ async function zipImage(zip: JSZip, image: string, temImage?: string) {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
-const zip3D = (name: string) => {
|
|
|
- const pen_3d = meta2d.store.data.pens.filter(
|
|
|
- (pen) =>
|
|
|
- pen.name === 'iframe' &&
|
|
|
- (pen.tags.includes('meta3d') || pen.iframe.indexOf('/3d') !== -1)
|
|
|
- );
|
|
|
- if (pen_3d && pen_3d.length) {
|
|
|
- //存在3d场景
|
|
|
- pen_3d.forEach((pen) => {
|
|
|
- //发送消息
|
|
|
- // let params = queryURLParams(pen.iframe.split('?')[1]);
|
|
|
- (
|
|
|
- pen.calculative.singleton.div.children[0] as HTMLIFrameElement
|
|
|
- ).contentWindow.postMessage(
|
|
|
- JSON.stringify({
|
|
|
- type: 1,
|
|
|
- name,
|
|
|
- // id: params.id,
|
|
|
- }),
|
|
|
- '*'
|
|
|
- );
|
|
|
- });
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-const zip2D = (name: string) => {
|
|
|
- const pen_2d = meta2d.store.data.pens.filter(
|
|
|
- (pen) =>
|
|
|
- pen.name === 'iframe' &&
|
|
|
- (pen.iframe.indexOf('2d.le5le.com') !== -1 ||
|
|
|
- pen.iframe.indexOf('/2d') !== -1 || pen.iframe.indexOf('data=2d') !== -1 ||
|
|
|
- pen.iframe.indexOf('v.le5le.com') !== -1 ||
|
|
|
- pen.iframe.indexOf('/view/v') !== -1 ||pen.iframe.indexOf('data=v') !== -1||
|
|
|
- pen.iframe.indexOf('/preview') !== -1)
|
|
|
- );
|
|
|
- if (pen_2d && pen_2d.length) {
|
|
|
- //存在3d场景
|
|
|
- pen_2d.forEach((pen) => {
|
|
|
- //发送消息
|
|
|
- // let params = queryURLParams(pen.iframe.split('?')[1]);
|
|
|
- (
|
|
|
- pen.calculative.singleton.div.children[0] as HTMLIFrameElement
|
|
|
- ).contentWindow.postMessage(
|
|
|
- JSON.stringify({
|
|
|
- name,
|
|
|
- type: 1,
|
|
|
- }),
|
|
|
- '*'
|
|
|
- );
|
|
|
- });
|
|
|
- }
|
|
|
-};
|
|
|
+// const zip3D = (name: string) => {
|
|
|
+// const pen_3d = meta2d.store.data.pens.filter(
|
|
|
+// (pen) =>
|
|
|
+// pen.name === 'iframe' &&
|
|
|
+// (pen.tags.includes('meta3d') || pen.iframe.indexOf('/3d') !== -1)
|
|
|
+// );
|
|
|
+// if (pen_3d && pen_3d.length) {
|
|
|
+// //存在3d场景
|
|
|
+// pen_3d.forEach((pen) => {
|
|
|
+// //发送消息
|
|
|
+// // let params = queryURLParams(pen.iframe.split('?')[1]);
|
|
|
+// (
|
|
|
+// pen.calculative.singleton.div.children[0] as HTMLIFrameElement
|
|
|
+// ).contentWindow.postMessage(
|
|
|
+// JSON.stringify({
|
|
|
+// type: 1,
|
|
|
+// name,
|
|
|
+// // id: params.id,
|
|
|
+// }),
|
|
|
+// '*'
|
|
|
+// );
|
|
|
+// });
|
|
|
+// }
|
|
|
+// };
|
|
|
+
|
|
|
+// const zip2D = (name: string) => {
|
|
|
+// const pen_2d = meta2d.store.data.pens.filter(
|
|
|
+// (pen) =>
|
|
|
+// pen.name === 'iframe' &&
|
|
|
+// (pen.iframe.indexOf('2d.le5le.com') !== -1 ||
|
|
|
+// pen.iframe.indexOf('/2d') !== -1 || pen.iframe.indexOf('data=2d') !== -1 ||
|
|
|
+// pen.iframe.indexOf('v.le5le.com') !== -1 ||
|
|
|
+// pen.iframe.indexOf('/view/v') !== -1 ||pen.iframe.indexOf('data=v') !== -1||
|
|
|
+// pen.iframe.indexOf('/preview') !== -1)
|
|
|
+// );
|
|
|
+// if (pen_2d && pen_2d.length) {
|
|
|
+// //存在3d场景
|
|
|
+// pen_2d.forEach((pen) => {
|
|
|
+// //发送消息
|
|
|
+// // let params = queryURLParams(pen.iframe.split('?')[1]);
|
|
|
+// (
|
|
|
+// pen.calculative.singleton.div.children[0] as HTMLIFrameElement
|
|
|
+// ).contentWindow.postMessage(
|
|
|
+// JSON.stringify({
|
|
|
+// name,
|
|
|
+// type: 1,
|
|
|
+// }),
|
|
|
+// '*'
|
|
|
+// );
|
|
|
+// });
|
|
|
+// }
|
|
|
+// };
|
|
|
|
|
|
/**
|
|
|
* 图片放到 zip 里
|
|
@@ -594,59 +590,59 @@ export async function zipImages(zip: JSZip, pens: Pen[]) {
|
|
|
}
|
|
|
|
|
|
//新
|
|
|
-async function zipVue3Files(zip: JSZip) {
|
|
|
- const files = [
|
|
|
- '/view/meta2d-vue3/src/components/Meta2d.vue',
|
|
|
- '/view/meta2d-vue3/src/App.vue',
|
|
|
- '/view/meta2d-vue3/src/main.js',
|
|
|
- '/view/meta2d-vue3/src/style.css',
|
|
|
- '/view/meta2d-vue3/index.html',
|
|
|
- '/view/meta2d-vue3/package.json',
|
|
|
- '/view/meta2d-vue3/README.md',
|
|
|
- '/view/meta2d-vue3/vite.config.js',
|
|
|
- ] as const;
|
|
|
- // 文件同时加载
|
|
|
- await Promise.all(files.map((filePath) => zipFile(zip, filePath)));
|
|
|
-}
|
|
|
-
|
|
|
-async function zipVue2Files(zip: JSZip) {
|
|
|
- const files = [
|
|
|
- '/view/meta2d-vue2/src/components/Meta2d.vue',
|
|
|
- '/view/meta2d-vue2/src/App.vue',
|
|
|
- '/view/meta2d-vue2/src/main.js',
|
|
|
- // '/view/meta2d-vue2/src/style.css',
|
|
|
- '/view/meta2d-vue2/public/index.html',
|
|
|
- '/view/meta2d-vue2/package.json',
|
|
|
- '/view/meta2d-vue2/README.md',
|
|
|
- // '/view/meta2d-vue3/vite.config.js',
|
|
|
- ] as const;
|
|
|
- // 文件同时加载
|
|
|
- await Promise.all(files.map((filePath) => zipFile(zip, filePath)));
|
|
|
-}
|
|
|
-
|
|
|
-async function zipReactFiles(zip: JSZip) {
|
|
|
- const files = [
|
|
|
- '/view/meta2d-react/src/index.css',
|
|
|
- '/view/meta2d-react/src/index.js',
|
|
|
- '/view/meta2d-react/src/Meta2d.css',
|
|
|
- '/view/meta2d-react/src/Meta2d.jsx',
|
|
|
- '/view/meta2d-react/package.json',
|
|
|
- '/view/meta2d-react/README.md',
|
|
|
- '/view/meta2d-react/public/index.html',
|
|
|
- ] as const;
|
|
|
- // 文件同时加载
|
|
|
- await Promise.all(files.map((filePath) => zipFile(zip, filePath)));
|
|
|
-}
|
|
|
-
|
|
|
-async function zipFile(zip: JSZip, filePath: string) {
|
|
|
- const res: Blob = await axios.get(
|
|
|
- (cdn ? cdn + '/v' : import.meta.env.BASE_URL.slice(0, -1)) + filePath,
|
|
|
- {
|
|
|
- responseType: 'blob',
|
|
|
- }
|
|
|
- );
|
|
|
- zip.file(filePath.replace('/view', ''), res, { createFolders: true });
|
|
|
-}
|
|
|
+// async function zipVue3Files(zip: JSZip) {
|
|
|
+// const files = [
|
|
|
+// '/view/meta2d-vue3/src/components/Meta2d.vue',
|
|
|
+// '/view/meta2d-vue3/src/App.vue',
|
|
|
+// '/view/meta2d-vue3/src/main.js',
|
|
|
+// '/view/meta2d-vue3/src/style.css',
|
|
|
+// '/view/meta2d-vue3/index.html',
|
|
|
+// '/view/meta2d-vue3/package.json',
|
|
|
+// '/view/meta2d-vue3/README.md',
|
|
|
+// '/view/meta2d-vue3/vite.config.js',
|
|
|
+// ] as const;
|
|
|
+// // 文件同时加载
|
|
|
+// await Promise.all(files.map((filePath) => zipFile(zip, filePath)));
|
|
|
+// }
|
|
|
+
|
|
|
+// async function zipVue2Files(zip: JSZip) {
|
|
|
+// const files = [
|
|
|
+// '/view/meta2d-vue2/src/components/Meta2d.vue',
|
|
|
+// '/view/meta2d-vue2/src/App.vue',
|
|
|
+// '/view/meta2d-vue2/src/main.js',
|
|
|
+// // '/view/meta2d-vue2/src/style.css',
|
|
|
+// '/view/meta2d-vue2/public/index.html',
|
|
|
+// '/view/meta2d-vue2/package.json',
|
|
|
+// '/view/meta2d-vue2/README.md',
|
|
|
+// // '/view/meta2d-vue3/vite.config.js',
|
|
|
+// ] as const;
|
|
|
+// // 文件同时加载
|
|
|
+// await Promise.all(files.map((filePath) => zipFile(zip, filePath)));
|
|
|
+// }
|
|
|
+
|
|
|
+// async function zipReactFiles(zip: JSZip) {
|
|
|
+// const files = [
|
|
|
+// '/view/meta2d-react/src/index.css',
|
|
|
+// '/view/meta2d-react/src/index.js',
|
|
|
+// '/view/meta2d-react/src/Meta2d.css',
|
|
|
+// '/view/meta2d-react/src/Meta2d.jsx',
|
|
|
+// '/view/meta2d-react/package.json',
|
|
|
+// '/view/meta2d-react/README.md',
|
|
|
+// '/view/meta2d-react/public/index.html',
|
|
|
+// ] as const;
|
|
|
+// // 文件同时加载
|
|
|
+// await Promise.all(files.map((filePath) => zipFile(zip, filePath)));
|
|
|
+// }
|
|
|
+
|
|
|
+// async function zipFile(zip: JSZip, filePath: string) {
|
|
|
+// const res: Blob = await axios.get(
|
|
|
+// (cdn ? cdn + '/v' : import.meta.env.BASE_URL.slice(0, -1)) + filePath,
|
|
|
+// {
|
|
|
+// responseType: 'blob',
|
|
|
+// }
|
|
|
+// );
|
|
|
+// zip.file(filePath.replace('/view', ''), res, { createFolders: true });
|
|
|
+// }
|
|
|
|
|
|
export const getFrameDownloadList = async (meta2dData: any, path: string = 'v',type:Frame,flag_3d=false) => {
|
|
|
const lists = new Set();
|
|
@@ -822,45 +818,41 @@ export const getFrameDownloadList = async (meta2dData: any, path: string = 'v',t
|
|
|
url: (cdn ? cdn + '/v' : import.meta.env.BASE_URL.slice(0, -1))+ file,
|
|
|
path:`/${folderName}/public${file.replace('/view', '')}`,
|
|
|
});
|
|
|
- });
|
|
|
-
|
|
|
- lists.add({
|
|
|
- url: 'https://assets.le5lecdn.com/2d/js/arrows.js',
|
|
|
- path: `/${folderName}/public/js/arrows.js`,
|
|
|
- });
|
|
|
-
|
|
|
- const res: any = await axios.post('/api/paid/2d/component?pageSize=1000', {
|
|
|
- type: 'JS线性图元',
|
|
|
- });
|
|
|
- let purchased = res.list.map((item) => item.name);
|
|
|
- let arr = [];
|
|
|
- for (const pen of meta2dData.pens) {
|
|
|
- if (pen.subClassName && purchased.includes(pen.name)) {
|
|
|
- if (!arr.includes(pen.name)) {
|
|
|
- arr.push(pen.name);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (arr.length) {
|
|
|
- const res_list: Blob = await axios.post(
|
|
|
- '/api/2d/tools',
|
|
|
- {
|
|
|
- list: arr.map((item) => {
|
|
|
- return {
|
|
|
- type: 'JS线性图元',
|
|
|
- name: item,
|
|
|
- };
|
|
|
- }),
|
|
|
- },
|
|
|
- {
|
|
|
- responseType: 'blob',
|
|
|
- }
|
|
|
- );
|
|
|
- lists.add({
|
|
|
- data: res_list,
|
|
|
- path:`/${folderName}/public/js/1.js`,
|
|
|
- });
|
|
|
- }
|
|
|
+ });
|
|
|
+ // const res: any = await axios.post('/api/paid/2d/component?pageSize=1000', {
|
|
|
+ // type: 'JS线性图元',
|
|
|
+ // });
|
|
|
+ // let purchased = res.list.map((item) => item.name);
|
|
|
+ // let arr = [];
|
|
|
+ // for (const pen of meta2dData.pens) {
|
|
|
+ // if (pen.subClassName && purchased.includes(pen.name)) {
|
|
|
+ // if(!['箭头','拓扑图未分类'].includes(pen.subClassName)){
|
|
|
+ // if (!arr.includes(pen.name)) {
|
|
|
+ // arr.push(pen.name);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // // if (arr.length) {
|
|
|
+ // const res_list: Blob = await axios.post(
|
|
|
+ // '/api/2d/tools',
|
|
|
+ // {
|
|
|
+ // list: arr.map((item) => {
|
|
|
+ // return {
|
|
|
+ // type: 'JS线性图元',
|
|
|
+ // name: item,
|
|
|
+ // };
|
|
|
+ // }),
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // responseType: 'blob',
|
|
|
+ // }
|
|
|
+ // );
|
|
|
+ // lists.add({
|
|
|
+ // data: res_list,
|
|
|
+ // path:`/${folderName}/public/js/1.js`,
|
|
|
+ // });
|
|
|
+ // // }
|
|
|
}
|
|
|
//图纸数据
|
|
|
if (meta2dData._id) delete meta2dData._id;
|