Browse Source

feat:注释

ananzhusen 7 months ago
parent
commit
5aa3d7a905
1 changed files with 217 additions and 220 deletions
  1. 217 220
      src/views/components/Header.vue

+ 217 - 220
src/views/components/Header.vue

@@ -311,7 +311,7 @@
       </a>
     </div>
   </div>
-  <t-dialog
+  <!-- <t-dialog
     v-if="payListDialog.show"
     v-model:visible="payListDialog.show"
     class="pay-dialog"
@@ -335,8 +335,6 @@
   <template #header>
         <div>
           <span style="vertical-align: middle">{{ payListDialog.title }}</span>
-          <!-- <t-tooltip  content="这是Tooltip内容"> -->
-          <!-- @vue-ignore -->
           <a
             :href="payListDialog.href"
             target="_blank"
@@ -344,7 +342,6 @@
           >
             <HelpCircleIcon class="hover" style="margin-left:12px;" />
           </a>
-        <!-- </t-tooltip> -->
         </div>
    </template>
    <div class="pay-box">
@@ -388,7 +385,7 @@
        <p>{{ data.deploy.price+(data.payDiagram.checked?data.payDiagram.price:0) }}</p>
      </div>
    </div>
-</t-dialog>
+</t-dialog> -->
 <!-- <t-dialog
     v-if="downloadZipDialog.show"
     v-model:visible="downloadZipDialog.show"
@@ -463,7 +460,7 @@
      </div>
    </div>
 </t-dialog> -->
-  <t-dialog
+  <!-- <t-dialog
     v-if="wechatPayDialog.show"
     v-model:visible="wechatPayDialog.show"
     class="pay-dialog"
@@ -482,7 +479,7 @@
       :code-url="data.order.codeUrl"
       @success="onSuccess"
     />
-  </t-dialog>
+  </t-dialog> -->
   <t-dialog
     v-model:visible="newFileDialog.show"
     header="提示"
@@ -715,7 +712,7 @@ const dealWithMessage = async (e) => {
 
           comparePayListNum += 1;
           if (comparePayListNum >= payListNum) {
-              await showPayListDialog();
+              // await showPayListDialog();
           }
         }
         // else if(data.name==='saveas'){
@@ -1300,19 +1297,19 @@ const preDownloadZip =async () =>{
   }
 }
 
-const prePayDownloadZip = async ()=>{
-  if(downloadZipDialog.checked){
-    const res: any = await axios.post('/api/order/deployment/submit', {
-     goods:{},
-    '2ds':downloadZipDialog.list.map((item)=>{return { type: '图片图元', name: item}}),
-    });
-    wechatPayDialog.show = true;
-    wechatPayDialog.isZip = true;
-    data.order = res;
-  }else {
-    doDownloadZip();
-  }
-}
+// const prePayDownloadZip = async ()=>{
+//   if(downloadZipDialog.checked){
+//     const res: any = await axios.post('/api/order/deployment/submit', {
+//      goods:{},
+//     '2ds':downloadZipDialog.list.map((item)=>{return { type: '图片图元', name: item}}),
+//     });
+//     wechatPayDialog.show = true;
+//     wechatPayDialog.isZip = true;
+//     data.order = res;
+//   }else {
+//     doDownloadZip();
+//   }
+// }
 const preDoDownloadZip = async ()=>{
   const meta2dData:any = meta2d.data();
   const pen_3d = meta2dData.pens.filter(
@@ -1484,208 +1481,208 @@ const downloadHtml = async () => {
   preDownload();
 };
 
-const preGetPayList = async () => {
-  //图形库需要购买
-  const meta2dData = meta2d.data();
-  if(!meta2dData.pens.length){
-    MessagePlugin.info('画布没有画笔!');
-    return;
-  }
-  let list = getPayList(meta2dData);
-  prePayList.pngs = new Set(list.pngs);
-  prePayList.jsPens = new Set(list.jsPens);
-  prePayList.iotPens = new Set(list.iotPens);
-  prePayList.svgPens = new Set(list.svgPens);
-  downloadList = new Set();
-  //向iframe发送消息
-  payListNum = 0;
-  comparePayListNum = 0;
-  const pen_pay = meta2dData.pens.filter(
-    (pen) =>
-      pen.name === 'iframe' &&
-      (pen.iframe.indexOf(`2d${rootDomain}`) !== -1 ||
-        pen.iframe.indexOf('/2d') !== -1 || pen.iframe.indexOf('data=2d') !== -1 ||
-        pen.iframe.indexOf(`v${rootDomain}`) !== -1 ||
-        pen.iframe.indexOf(`view${rootDomain}/v`) !== -1 ||pen.iframe.indexOf('data=v') !== -1 ||
-        pen.iframe.indexOf('/preview') !== -1)
-  );
-  if (pen_pay && pen_pay.length) {
-    pen_pay.forEach((pen) => {
-      //发送消息
-      (
-        meta2d.store.pens[pen.id].calculative.singleton.div
-          .children[0] as HTMLIFrameElement
-      ).contentWindow.postMessage(
-        JSON.stringify({
-          name: 'prePayList',
-          type: 1,
-        }),
-        '*'
-      );
-      payListNum += 1;
-    });
-  }
-  if (payListNum === 0) {
-      await showPayListDialog();
-  }
-};
+// const preGetPayList = async () => {
+//   //图形库需要购买
+//   const meta2dData = meta2d.data();
+//   if(!meta2dData.pens.length){
+//     MessagePlugin.info('画布没有画笔!');
+//     return;
+//   }
+//   let list = getPayList(meta2dData);
+//   prePayList.pngs = new Set(list.pngs);
+//   prePayList.jsPens = new Set(list.jsPens);
+//   prePayList.iotPens = new Set(list.iotPens);
+//   prePayList.svgPens = new Set(list.svgPens);
+//   downloadList = new Set();
+//   //向iframe发送消息
+//   payListNum = 0;
+//   comparePayListNum = 0;
+//   const pen_pay = meta2dData.pens.filter(
+//     (pen) =>
+//       pen.name === 'iframe' &&
+//       (pen.iframe.indexOf(`2d${rootDomain}`) !== -1 ||
+//         pen.iframe.indexOf('/2d') !== -1 || pen.iframe.indexOf('data=2d') !== -1 ||
+//         pen.iframe.indexOf(`v${rootDomain}`) !== -1 ||
+//         pen.iframe.indexOf(`view${rootDomain}/v`) !== -1 ||pen.iframe.indexOf('data=v') !== -1 ||
+//         pen.iframe.indexOf('/preview') !== -1)
+//   );
+//   if (pen_pay && pen_pay.length) {
+//     pen_pay.forEach((pen) => {
+//       //发送消息
+//       (
+//         meta2d.store.pens[pen.id].calculative.singleton.div
+//           .children[0] as HTMLIFrameElement
+//       ).contentWindow.postMessage(
+//         JSON.stringify({
+//           name: 'prePayList',
+//           type: 1,
+//         }),
+//         '*'
+//       );
+//       payListNum += 1;
+//     });
+//   }
+//   if (payListNum === 0) {
+//       await showPayListDialog();
+//   }
+// };
 
-const showPayListDialog = async () => {
-  //下载离线部署包
-  const deploys =await getDeployGoods();
-  const pen_3d = meta2d.store.data.pens.filter(
-    (pen) =>
-      pen.name === 'iframe' &&
-      (pen.iframe.indexOf(`3d${rootDomain}`) !== -1 ||
-        pen.iframe.indexOf(`view${rootDomain}/3d`) !== -1)
-  );
-  const pen_2d = meta2d.store.data.pens.filter(
-    (pen) =>
-      pen.name === 'iframe' &&
-      (pen.iframe.indexOf(`2d${rootDomain}`) !== -1 ||
-        pen.iframe.indexOf(`view${rootDomain}/2d`) !== -1)
-  );
-  const pen_v = meta2d.store.data.pens.filter(
-    (pen) =>
-      pen.name === 'iframe' &&
-      (pen.iframe.indexOf(`v${rootDomain}`) !== -1 ||
-        pen.iframe.indexOf(`view${rootDomain}/v`) !== -1||pen.iframe.indexOf('data=v') !== -1)
-  );
-  let price = 0;
-  data.payDiagram.checked = true;
-  data.payDiagram.expend = false;
-  data.payGoods ={}
-  deploys.forEach((item) => {
-   if(item.name==="3D离线部署下载"){
-     price+=item.price*pen_3d.length;
-     if(pen_3d.length){
-        data.payGoods[item.id]=pen_3d.length;
-     }
-   }else if(item.name==="2D离线部署下载"){
-     price+=item.price*pen_2d.length;
-     if(pen_2d.length){
-        data.payGoods[item.id]=pen_2d.length;
-     }
-   }else if(item.name==="大屏离线部署下载"){
-     price+=item.price*(pen_v.length+1);
-     data.payGoods[item.id]=pen_v.length+1;
-   }
-  });
-  data.deploy.price = price;
-  //图形库
-  data.goods = await getGoods();
-  data.purchasedList = await getComponentPurchased(prePayList);
-  data.payDiagram.list =[];
-  data.payDiagram.payAll = false;
-  data.goods.forEach((goods)=>{
-    let purchased = data.purchasedList?.filter(
-      (_item) => _item.type === goods.type
-    );
-    let names = purchased.map((item) => item.name);
-    let list = [];
-    if(goods.type==='图片图元'){
-      list = [...prePayList.pngs];
-    }else if(goods.type==='JS线性图元'){
-      list = [...prePayList.jsPens];
-    }else if(goods.type==='SVG线性图元'){
-      list = [...prePayList.svgPens];
-    }else if(goods.type==='控件'){
-      list = [...prePayList.iotPens];
-    }
-    let num =0;
-    if (goods.type==='SVG线性图元'&&[...prePayList.svgPens].includes('*')) {
-      //需要购买全部
-        num = goods.count-names.length;
-        data.payDiagram.payAll = true;
-    }else{
-    list.forEach((item)=>{
-      if(!names.includes(item)){
-        if(goods.type==='控件'){
-          data.payDiagram.list.push({
-            name:item
-          });
-        }else if(goods.type==='JS线性图元'){
-          data.payDiagram.list.push({
-            svg:globalThis.jsPensMap?globalThis.jsPensMap[item]:item
-          });
-        }else{
-          data.payDiagram.list.push({
-            img:item
-          });
-        }
-        num+=1;
-      }
-    })};
-    goods.num = num;
-  })
-   price = 0;
-  data.goods.forEach((item, index) => {
-      price += item.num * item.unitPrice;
-  });
-  data.payDiagram.price = price;
-  // data.goods.forEach((item, index) => {
-  //   item.checked = true;
-  //   let purchased = data.purchasedList?.filter(
-  //     (_item) => _item.type === item.type
-  //   );
-  //   if (index === 0) {
-  //     item.total = [...prePayList.pngs].length;
-  //     item.unPurchased = item.total - purchased.length;
-  //   } else if (index === 1) {
-  //     item.total = [...prePayList.iotPens].length;
-  //     item.unPurchased = item.total - purchased.length;
-  //   } else if (index === 3) {
-  //     item.total = [...prePayList.jsPens].length;
-  //     item.unPurchased = item.total - purchased.length;
-  //   } else if (index === 2) {
-  //     if (purchased.length === 1 && !purchased[0].name) {
-  //       //说明已经购买全部 //TODO
-  //       item.total = item.count;
-  //       item.unPurchased = 0;
-  //     } else {
-  //       //需要购买全部
-  //       if ([...prePayList.svgPens].includes('*')) {
-  //         item.total = item.count;
-  //         item.unPurchased = item.total;
-  //       } else {
-  //         item.total = [...prePayList.svgPens].length;
-  //         item.unPurchased = item.total - purchased.length;
-  //       }
-  //     }
-  //   }
-  // });
-  payListDialog.show = true;
-  switch (downloadType) {
-    case Frame.html:
-      payListDialog.title = '下载离线部署包';
-      payListDialog.href = `https://doc${rootDomain}/document/155692631#%E4%B8%8B%E8%BD%BD%E7%A6%BB%E7%BA%BF%E9%83%A8%E7%BD%B2%E5%8C%85`;
-      payListDialog.downloadUrl =img_cdn+ '/deployment/大厦电力管理系统(html).zip';
-      break;
-      case Frame.vue2:
-      payListDialog.title = '下载vue2组件包';
-      payListDialog.href = `https://doc${rootDomain}/document/155692631#%E4%B8%8B%E8%BD%BDVue2%E7%BB%84%E4%BB%B6%E5%8C%85`;
-      payListDialog.downloadUrl = img_cdn+ '/deployment/大厦电力管理系统(vue2).zip';
-      break;
-      case Frame.vue3:
-      payListDialog.title = '下载vue3组件包';
-      payListDialog.href = `https://doc${rootDomain}/document/155692631#%E4%B8%8B%E8%BD%BDVue3%E7%BB%84%E4%BB%B6%E5%8C%85`;
-      payListDialog.downloadUrl = img_cdn+ '/deployment/大厦电力管理系统(vue3).zip';
-      break;
-      case Frame.react:
-      payListDialog.title = '下载react组件包';
-      payListDialog.href = `https://doc${rootDomain}/document/155692631#%E4%B8%8B%E8%BD%BDReact%E7%BB%84%E4%BB%B6%E5%8C%85`;
-      payListDialog.downloadUrl = img_cdn+ '/deployment/大厦电力管理系统(react).zip';
-      break;
-  }
-  // let price = 0;
+// const showPayListDialog = async () => {
+//   //下载离线部署包
+//   const deploys =await getDeployGoods();
+//   const pen_3d = meta2d.store.data.pens.filter(
+//     (pen) =>
+//       pen.name === 'iframe' &&
+//       (pen.iframe.indexOf(`3d${rootDomain}`) !== -1 ||
+//         pen.iframe.indexOf(`view${rootDomain}/3d`) !== -1)
+//   );
+//   const pen_2d = meta2d.store.data.pens.filter(
+//     (pen) =>
+//       pen.name === 'iframe' &&
+//       (pen.iframe.indexOf(`2d${rootDomain}`) !== -1 ||
+//         pen.iframe.indexOf(`view${rootDomain}/2d`) !== -1)
+//   );
+//   const pen_v = meta2d.store.data.pens.filter(
+//     (pen) =>
+//       pen.name === 'iframe' &&
+//       (pen.iframe.indexOf(`v${rootDomain}`) !== -1 ||
+//         pen.iframe.indexOf(`view${rootDomain}/v`) !== -1||pen.iframe.indexOf('data=v') !== -1)
+//   );
+//   let price = 0;
+//   data.payDiagram.checked = true;
+//   data.payDiagram.expend = false;
+//   data.payGoods ={}
+//   deploys.forEach((item) => {
+//    if(item.name==="3D离线部署下载"){
+//      price+=item.price*pen_3d.length;
+//      if(pen_3d.length){
+//         data.payGoods[item.id]=pen_3d.length;
+//      }
+//    }else if(item.name==="2D离线部署下载"){
+//      price+=item.price*pen_2d.length;
+//      if(pen_2d.length){
+//         data.payGoods[item.id]=pen_2d.length;
+//      }
+//    }else if(item.name==="大屏离线部署下载"){
+//      price+=item.price*(pen_v.length+1);
+//      data.payGoods[item.id]=pen_v.length+1;
+//    }
+//   });
+//   data.deploy.price = price;
+//   //图形库
+//   data.goods = await getGoods();
+//   data.purchasedList = await getComponentPurchased(prePayList);
+//   data.payDiagram.list =[];
+//   data.payDiagram.payAll = false;
+//   data.goods.forEach((goods)=>{
+//     let purchased = data.purchasedList?.filter(
+//       (_item) => _item.type === goods.type
+//     );
+//     let names = purchased.map((item) => item.name);
+//     let list = [];
+//     if(goods.type==='图片图元'){
+//       list = [...prePayList.pngs];
+//     }else if(goods.type==='JS线性图元'){
+//       list = [...prePayList.jsPens];
+//     }else if(goods.type==='SVG线性图元'){
+//       list = [...prePayList.svgPens];
+//     }else if(goods.type==='控件'){
+//       list = [...prePayList.iotPens];
+//     }
+//     let num =0;
+//     if (goods.type==='SVG线性图元'&&[...prePayList.svgPens].includes('*')) {
+//       //需要购买全部
+//         num = goods.count-names.length;
+//         data.payDiagram.payAll = true;
+//     }else{
+//     list.forEach((item)=>{
+//       if(!names.includes(item)){
+//         if(goods.type==='控件'){
+//           data.payDiagram.list.push({
+//             name:item
+//           });
+//         }else if(goods.type==='JS线性图元'){
+//           data.payDiagram.list.push({
+//             svg:globalThis.jsPensMap?globalThis.jsPensMap[item]:item
+//           });
+//         }else{
+//           data.payDiagram.list.push({
+//             img:item
+//           });
+//         }
+//         num+=1;
+//       }
+//     })};
+//     goods.num = num;
+//   })
+//    price = 0;
+//   data.goods.forEach((item, index) => {
+//       price += item.num * item.unitPrice;
+//   });
+//   data.payDiagram.price = price;
+//   // data.goods.forEach((item, index) => {
+//   //   item.checked = true;
+//   //   let purchased = data.purchasedList?.filter(
+//   //     (_item) => _item.type === item.type
+//   //   );
+//   //   if (index === 0) {
+//   //     item.total = [...prePayList.pngs].length;
+//   //     item.unPurchased = item.total - purchased.length;
+//   //   } else if (index === 1) {
+//   //     item.total = [...prePayList.iotPens].length;
+//   //     item.unPurchased = item.total - purchased.length;
+//   //   } else if (index === 3) {
+//   //     item.total = [...prePayList.jsPens].length;
+//   //     item.unPurchased = item.total - purchased.length;
+//   //   } else if (index === 2) {
+//   //     if (purchased.length === 1 && !purchased[0].name) {
+//   //       //说明已经购买全部 //TODO
+//   //       item.total = item.count;
+//   //       item.unPurchased = 0;
+//   //     } else {
+//   //       //需要购买全部
+//   //       if ([...prePayList.svgPens].includes('*')) {
+//   //         item.total = item.count;
+//   //         item.unPurchased = item.total;
+//   //       } else {
+//   //         item.total = [...prePayList.svgPens].length;
+//   //         item.unPurchased = item.total - purchased.length;
+//   //       }
+//   //     }
+//   //   }
+//   // });
+//   payListDialog.show = true;
+//   switch (downloadType) {
+//     case Frame.html:
+//       payListDialog.title = '下载离线部署包';
+//       payListDialog.href = `https://doc${rootDomain}/document/155692631#%E4%B8%8B%E8%BD%BD%E7%A6%BB%E7%BA%BF%E9%83%A8%E7%BD%B2%E5%8C%85`;
+//       payListDialog.downloadUrl =img_cdn+ '/deployment/大厦电力管理系统(html).zip';
+//       break;
+//       case Frame.vue2:
+//       payListDialog.title = '下载vue2组件包';
+//       payListDialog.href = `https://doc${rootDomain}/document/155692631#%E4%B8%8B%E8%BD%BDVue2%E7%BB%84%E4%BB%B6%E5%8C%85`;
+//       payListDialog.downloadUrl = img_cdn+ '/deployment/大厦电力管理系统(vue2).zip';
+//       break;
+//       case Frame.vue3:
+//       payListDialog.title = '下载vue3组件包';
+//       payListDialog.href = `https://doc${rootDomain}/document/155692631#%E4%B8%8B%E8%BD%BDVue3%E7%BB%84%E4%BB%B6%E5%8C%85`;
+//       payListDialog.downloadUrl = img_cdn+ '/deployment/大厦电力管理系统(vue3).zip';
+//       break;
+//       case Frame.react:
+//       payListDialog.title = '下载react组件包';
+//       payListDialog.href = `https://doc${rootDomain}/document/155692631#%E4%B8%8B%E8%BD%BDReact%E7%BB%84%E4%BB%B6%E5%8C%85`;
+//       payListDialog.downloadUrl = img_cdn+ '/deployment/大厦电力管理系统(react).zip';
+//       break;
+//   }
+//   // let price = 0;
 
-  // if (price === 0) {
-  //   skipPay(); //如果计算价格为0,直接下载
-  // } else {
-  //   payListDialog.show = true;
+//   // if (price === 0) {
+//   //   skipPay(); //如果计算价格为0,直接下载
+//   // } else {
+//   //   payListDialog.show = true;
 
-  // }
-};
+//   // }
+// };
 
 const preDownload =() => {
   iframeNum = 0;