bianjiang 10 mesi fa
parent
commit
c84d73b02c

+ 1 - 1
scripts/deployHtmlToServer.js

@@ -23,7 +23,7 @@ fs.writeFileSync(nativePath + path.sep + 'share.html', shareHtml);
 // var consoleHtml = fs.readFileSync('dist/console.html');
 // fs.writeFileSync(nativePath + path.sep + 'console.html', consoleHtml);
 
-var serverPath = `/var/www/queenshow`;
+var serverPath = `/var/www/projects/queenshow`;
 
 var ftpUtils = new sftp({
     remotePath: serverPath,

+ 6 - 1
src/dict/apis.ts

@@ -21,5 +21,10 @@ const Dict_Apis = {
   promotion: `${baseURL}${baseVersion}/promotionv1`,
   // promotion: `${localURL}/promotion`,
 };
+function getPathname() {
+  let pathname = location.pathname;
+  pathname = pathname.replace(/(\S+\/)\S+\.html/g, "$1");
+  return pathname;
+}
 
-export { Dict_Apis };
+export { Dict_Apis, getPathname };

+ 9 - 12
src/modules/editor/components/Viewport/Header/ShareBox.tsx

@@ -1,3 +1,4 @@
+import { getPathname } from "@/dict";
 import { useEditor } from "@/modules/editor";
 import { clipboard } from "@/utils";
 import { useAuth } from "@queenjs-modules/auth";
@@ -7,25 +8,21 @@ import { defineComponent } from "vue";
 
 export const ShareBox = defineComponent({
   setup() {
-    const { store , controls} = useEditor();
+    const { store, controls } = useEditor();
     const auth = useAuth();
     const userInfo: any = auth.store.userInfo;
     const isSys = userInfo.roles?.includes("system") ? true : false;
     const isWk = store.isWk;
     const page = controls.pageCtrl;
 
-    let shareLink =
-      location.origin +
-      "/share.html?id=" +
-      page.designData._id +
-      "&isSys=" +
-      isSys;
+    let shareLink = `${location.origin}${getPathname()}/share.html?id=${
+      page.designData._id
+    }&isSys=${isSys}`;
+
     if (isWk) {
-      shareLink =
-        location.origin +
-        "/share.html?id=" +
-        page.designData._id +
-        "&isWk=true";
+      shareLink = `${location.origin}${getPathname()}/share.html?id=${
+        page.designData._id
+      }&isWk=true`;
     }
     // if (location.host == "www.infish.cn") {
     //   shareLink =

+ 2 - 1
src/modules/editor/components/Viewport/Slider/SliderLeft/Templates/PreviewTplModal.tsx

@@ -1,3 +1,4 @@
+import { getPathname } from "@/dict";
 import { Button } from "ant-design-vue";
 import dayjs from "dayjs";
 import { defineUI } from "queenjs";
@@ -9,7 +10,7 @@ export default defineUI({
   },
   emits: ["click"],
   setup(props, { emit }) {
-    const shareLink = `${location.origin}/share.html?id=${props.data._id}&isSys=true`;
+    const shareLink = `${location.origin}${getPathname()}/share.html?id=${props.data._id}&isSys=true`;
 
     return () => {
       const { data } = props;

+ 3 - 3
src/modules/editor/module/index.ts

@@ -1,4 +1,4 @@
-import { Dict_Apis } from "@/dict";
+import { Dict_Apis, getPathname } from "@/dict";
 import { UploadController } from "@queenjs/controllers";
 import { ModuleRoot } from "queenjs";
 import components from "../components";
@@ -88,9 +88,9 @@ export class EditorModule extends ModuleRoot {
   jumpIndexHtml(route = "#/") {
     const _params = new URLSearchParams(decodeURIComponent(location.search));
     const host = _params.get("host");
-    let link = `${location.origin}/index.html?host=${host}${route}`;
+    let link = `${location.origin}${getPathname()}/index.html?host=${host}${route}`;
     // if (location.host == "www.infish.cn") {
-    //   link = `${location.origin}/projects/queenshowv1/index.html?host=${host}${route}`;
+    //   link = `${location.origin}${location.pathname}/projects/queenshowv1/index.html?host=${host}${route}`;
     // }
     location.href = link;
   }

+ 3 - 2
src/modules/resource/actions/material.ts

@@ -2,6 +2,7 @@ import { TimeController } from "@/controllers/TimeController";
 import { queenApi } from "queenjs";
 import Modal from "queenjs/adapter/vue/components/modal";
 import { ResourceModule } from "..";
+import { getPathname } from "@/dict";
 
 export const materialActions = ResourceModule.action({
   async createMaterial() {
@@ -61,12 +62,12 @@ export const materialActions = ResourceModule.action({
     const host = _params.get("host");
 
     // if (location.host == "www.infish.cn") {
-    //   const url = `${location.origin}/projects/queenshowv1/index.html?host=${host}#/create/${record._id}`;
+    //   const url = `${location.origin}${location.pathname}/projects/queenshowv1/index.html?host=${host}#/create/${record._id}`;
     //   location.href = url;
     //   return;
     // }
 
-    const url = `${location.origin}/index.html?host=${host}#/create/${record._id}`;
+    const url = `${location.origin}${getPathname()}/index.html?host=${host}#/create/${record._id}`;
     location.href = url;
   },
 });

+ 5 - 4
src/modules/resource/actions/promotion.tsx

@@ -1,5 +1,6 @@
 import { queenApi } from "queenjs";
 import { ResourceModule } from "..";
+import { getPathname } from "@/dict";
 
 export const promotionAction = ResourceModule.action({
   async renamePromotion(record: any) {
@@ -86,12 +87,12 @@ export const promotionAction = ResourceModule.action({
     const res = await this.https.createPromotion(data);
     //console.log(location.host, location.host == "www.infish.cn");
     // if (location.host == "www.infish.cn") {
-    //   const url = `${location.origin}/projects/queenshowv1/editor.html#/?id=${res.result}`;
+    //   const url = `${location.origin}${location.pathname}/projects/queenshowv1/editor.html#/?id=${res.result}`;
     //   location.href = url;
     //   return;
     // }
 
-    const url = `${location.origin}/editor.html#/?id=${res.result}`;
+    const url = `${location.origin}${getPathname()}/editor.html#/?id=${res.result}`;
     location.href = url;
   },
 
@@ -103,12 +104,12 @@ export const promotionAction = ResourceModule.action({
     const res = await this.https.createComp({ title });
     // console.log(location.host, location.host == "www.infish.cn");
     // if (location.host == "www.infish.cn") {
-    //   const url = `${location.origin}/projects/queenshowv1/editor.html#/?id=${res.result}&mode=editComp`;
+    //   const url = `${location.origin}${location.pathname}/projects/queenshowv1/editor.html#/?id=${res.result}&mode=editComp`;
     //   location.href = url;
     //   return;
     // }
 
-    const url = `${location.origin}/editor.html#/?id=${res.result}&mode=editComp`;
+    const url = `${location.origin}${getPathname()}/editor.html#/?id=${res.result}&mode=editComp`;
     location.href = url;
   },
 

+ 4 - 2
src/modules/resource/components/Collection/CollectionShare.tsx

@@ -9,6 +9,7 @@ import { defineComponent, reactive } from "vue";
 import { any } from "vue-types";
 import { useResource } from "../..";
 import { SelectOneImage } from "@/pages/website/Material2/modal";
+import { getPathname } from "@/dict";
 
 export default defineComponent({
   props: {
@@ -16,8 +17,9 @@ export default defineComponent({
     controller: any<CollectionController>().isRequired,
   },
   setup(props, { slots }) {
-    let shareLink =
-      location.origin + "/share.html?id=" + props.record._id + "&isWk=true";
+    let shareLink = `${location.origin}${getPathname()}/share.html?id=${
+      props.record._id
+    }&isWk=true`;
 
     const qrUrl = useQRCode(shareLink, { margin: 2 });
 

+ 2 - 1
src/modules/resource/components/Collection/innerListController.tsx

@@ -4,6 +4,7 @@ import { CollectionController } from "@/modules/resource/controllers/CollectionC
 import { PageListController } from "@queenjs/controllers";
 import CollectionShare from "./CollectionShare";
 import { queenApi } from "queenjs";
+import { getPathname } from "@/dict";
 
 export function InnerListController(
   resource: ResourceModule,
@@ -53,7 +54,7 @@ export function InnerListController(
   ctrl.onEdit = async (id: string) => {
     const _params = new URLSearchParams(decodeURIComponent(location.search));
     const host = _params.get("host");
-    const url = `${location.origin}/editor.html?host=${host}#/?id=${id}&isWk=ture`;
+    const url = `${location.origin}${getPathname()}/editor.html?host=${host}#/?id=${id}&isWk=ture`;
     location.href = url;
   };
 

+ 3 - 2
src/modules/resource/components/PromotionItem.tsx

@@ -6,6 +6,7 @@ import dayjs from "dayjs";
 import { defineComponent } from "vue";
 import { any } from "vue-types";
 import { useResource } from "..";
+import { getPathname } from "@/dict";
 
 export default defineComponent({
   props: {
@@ -17,11 +18,11 @@ export default defineComponent({
 
     const goEdit = () => {
       // if (location.host == "www.infish.cn") {
-      //   const url = `${location.origin}/projects/queenshowv1/editor.html#/?id=${props.record._id}`;
+      //   const url = `${location.origin}${location.pathname}/projects/queenshowv1/editor.html#/?id=${props.record._id}`;
       //   location.href = url;
       //   return;
       // }
-      const url = `${location.origin}/editor.html#/?id=${props.record._id}`;
+      const url = `${location.origin}${getPathname()}/editor.html#/?id=${props.record._id}`;
       location.href = url;
     };
 

+ 2 - 1
src/modules/resource/controllers/MaterialController.ts

@@ -1,3 +1,4 @@
+import { getPathname } from "@/dict";
 import { PageListController } from "@queenjs/controllers";
 import { reactive } from "vue";
 
@@ -22,7 +23,7 @@ export class MaterialController {
     ctrl.loadPage(1);
     const record: any = await this.onShowDialog(ctrl, type);
     if (record && record._id) {
-      const url = `${location.origin}/index.html#/create/${record._id}`;
+      const url = `${location.origin}${getPathname()}/index.html#/create/${record._id}`;
       location.href = url;
     }
   }

+ 5 - 4
src/modules/resource/controllers/PromotionController.ts

@@ -1,3 +1,4 @@
+import { getPathname } from "@/dict";
 import { PageListController } from "@queenjs/controllers";
 
 export class PromotionController {
@@ -13,21 +14,21 @@ export class PromotionController {
     const host = _params.get("host");
 
     // if (location.host == "www.infish.cn") {
-    //   const url = `${location.origin}/projects/queenshowv1/editor.html?host=${host}#/?id=${item._id}`;
+    //   const url = `${location.origin}${location.pathname}/projects/queenshowv1/editor.html?host=${host}#/?id=${item._id}`;
     //   location.href = url;
     //   return;
     // }
 
-    const url = `${location.origin}/editor.html?host=${host}#/?id=${item._id}`;
+    const url = `${location.origin}${getPathname()}/editor.html?host=${host}#/?id=${item._id}`;
     location.href = url;
   }
   onPreview(item: any) {
     // if (location.host == "www.infish.cn") {
-    //   const url = `${location.origin}/projects/queenshowv1/share.html#/?id=${item._id}`;
+    //   const url = `${location.origin}${location.pathname}/projects/queenshowv1/share.html#/?id=${item._id}`;
     //   location.href = url;
     //   return;
     // }
-    const url = `${location.origin}/share.html#/?id=${item._id}`;
+    const url = `${location.origin}${getPathname()}/share.html#/?id=${item._id}`;
     location.href = url;
   }
 

+ 5 - 6
src/pages/website/Promotion2/components/ShareModal.tsx

@@ -1,4 +1,5 @@
 import { IconWechat } from "@/assets/icons";
+import { getPathname } from "@/dict";
 import { PromotionController } from "@/modules/resource/controllers/PromotionController";
 import { clipboard } from "@/utils";
 import { useAuth } from "@queenjs-modules/auth";
@@ -17,12 +18,10 @@ export default defineComponent({
     const auth = useAuth();
     const userInfo: any = auth.store.userInfo;
     const isSys = userInfo.roles?.includes("system") ? true : false;
-    let shareLink =
-      location.origin +
-      "/share.html?id=" +
-      props.record._id +
-      "&isSys=" +
-      isSys;
+    let shareLink = `${location.origin}${getPathname()}/share.html?id=${
+      props.record._id
+    }&isSys=${isSys}`;
+
     // if (location.host == "www.infish.cn") {
     //   shareLink =
     //     location.origin +

+ 8 - 3
src/pages/website/Promotion2/controller.tsx

@@ -8,6 +8,7 @@ import { sendPromotion } from "./components/SendPromotion";
 import { AuthModule } from "@queenjs-modules/auth";
 import { SelectOneImage } from "../Material2/modal";
 import { clipboard } from "@/utils";
+import { getPathname } from "@/dict";
 
 export function createPromotinController(
   auth: AuthModule,
@@ -46,14 +47,18 @@ export function createPromotinController(
   }
   let url = "";
   ctrl.onMenuClick = async (name, record, isSys) => {
-    const shareLink =
-      location.origin + "/share.html?id=" + record._id + "&isSys=" + isSys;
+    const shareLink = `${location.origin}${getPathname()}/share.html?id=${
+      record._id
+    }&isSys=${isSys}`;
+
     switch (name) {
       case "copyLink":
         clipboard.copy(shareLink);
         break;
       case "stat":
-        window.open("https://show.3dqueen.cloud/stat/#/count?id=" + record._id);
+        window.open(
+          `${location.origin}${getPathname()}/stat/#/count?id=${record._id}`
+        );
         break;
       case "delete":
         await resource.actions.deletePromotion(record);