Explorar el Código

Merge branch 'dev' of http://124.70.149.18:10880/lianghj/queenshow into dev

lianghongjie hace 1 año
padre
commit
87d34362cd

BIN
src/assets/comps/card/thumbnail.png


BIN
src/assets/comps/cardList/2.png


BIN
src/assets/comps/cover/1.png


+ 1 - 1
src/controllers/natsController.ts

@@ -18,7 +18,7 @@ export class BusController {
     
     queenApi.showLoading("服务连接中...");
     const wsHost = host ? host : this.getQuery("host");
-
+    
     console.log("ws host=>", wsHost)
     
     let ret = false;

+ 2 - 2
src/dict/apis.ts

@@ -14,8 +14,8 @@ const Dict_Apis = {
   queentreeLocal: base,
   auth: `${baseURL}${baseVersion}/usercenter`,
   queentree: `${baseURL}${treeVersion}/assetcenter`,
-  promotion: `${baseURL}${baseVersion}/promotion`,
-  // promotion: `${localURL}/promotion`,
+  // promotion: `${baseURL}${baseVersion}/promotion`,
+  promotion: `${localURL}/promotion`,
 };
 
 export { Dict_Apis };

+ 1 - 1
src/hooks/initAuthDef.ts

@@ -9,7 +9,7 @@ export function initAuthDef() {
       },
       key: "queentreesku3d",
       loginPath: "/login",
-      loginJumpPath: "/",
+      loginJumpPath: "/workbench",
       logoutJumpPath: "/login",
 
       needCompanyLogin: false,

+ 4 - 4
src/modules/editor/components/CompUI/customUI/Cards/Card/component.tsx

@@ -10,8 +10,8 @@ export const Component = createUIComp({
   },
   setup(props) {
     const { designToNaturalSize } = useEditor().helper;
-    const { value } = useCompData(props.compId);
-
+    const { value , children} = useCompData(props.compId);
+  
     return () => (
       <div class="flex">
         <Image.Component
@@ -19,9 +19,9 @@ export const Component = createUIComp({
             width: designToNaturalSize(value.imgSize[0]),
             height: designToNaturalSize(value.imgSize[1]),
           }}
-          v-model={[value.img, "value"]}
+          compId={children.img}
         />
-        <Text.Component class="flex-1 ml-0.1rem" v-model={[value.desc, "value"]} />
+        <Text.Component class="flex-1 ml-0.1rem" compId={children.desc} />
       </div>
     );
   },

+ 8 - 3
src/modules/editor/components/CompUI/customUI/Cards/Card/index.tsx

@@ -2,20 +2,25 @@ import { Dict_Imgs } from "@/dict";
 import { createAttrsForm } from "../../../defines/createAttrsForm";
 import { createCompHooks } from "../../../defines/createCompHooks";
 import { GroupNumber } from "../../../formItems/GroupNumber";
+import { createCompId } from "../../../defines/createCompId";
 
 export { Component } from "./component";
 
+const thumb = require("@/assets/comps/card/thumbnail.png");
+
 export const options = {
   name: "卡片",
-  thumbnail: Dict_Imgs.Default,
+  thumbnail: thumb,
 };
 
 export const { createComp, useCompData } = createCompHooks({
   value: {
-    img: { url: Dict_Imgs.Default },
     imgSize: [240, 240],
-    desc: "描述",
   },
+  children: {
+     img: ()=>createCompId("Image", {value: {url:thumb, x: 25.50, y: 7.00, s: 3.80}}),
+     desc: ()=>createCompId("Text", {value: `<p><span style="font-size:16px;">名称 &nbsp; p190 (注塑)</span></p><p><span style="font-size:16px;">规格 &nbsp; 52英寸</span></p><p><span style="font-size:16px;">厚度 &nbsp;1.0mm+0.05mm</span></p><p><span style="font-size:16px;">底材 &nbsp;鹿皮绒</span></p><p><span style="font-size:16px;">用途 &nbsp;凉鞋、跟鞋、高更鞋、</span><br><span style="font-size:16px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 时尚休闲鞋等</span></p>`})
+  }
 });
 
 export const Form = createAttrsForm([

+ 26 - 13
src/modules/editor/components/CompUI/customUI/Cards/CardList/index.tsx

@@ -6,9 +6,10 @@ import { createCompId } from "../../../defines/createCompId";
 
 export { Component } from "./component";
 
+const thumb  = require("@/assets/comps/cardList/thumnail.png")
 export const options = {
   name: "卡片列表",
-  thumbnail: Dict_Imgs.Default,
+  thumbnail: thumb,
 };
 
 export const { createComp, useCompData, useCreateChild } = createCompHooks({
@@ -16,21 +17,33 @@ export const { createComp, useCompData, useCreateChild } = createCompHooks({
     gap: 10,
     columns: 3,
     total: 3,
-    imgHeight: 120,
+    imgHeight: 300,
     showDesc: true,
   },
   children: {
-    list: (length = 3) =>
-      Array.from({ length }, () => ({
-        img: createCompId("Image", {
-          value: {
-            url: Dict_Imgs.Default,
-          },
-        }),
-        desc: createCompId("Text", {
-          value: "描述",
-        }),
-      })),
+    list: (defaultOpts:any, length = 3)=> {
+      let i = 0;
+      return Array.from({ length }, () => {
+        const offsets = [{x:32.50, y:3.00, s:3.60}, {x:0.50, y: 3.00, s: 3.50}, {x:-32.00, y:2.50, s:3.55}]
+        let offset = {x: 0, y: 0, s:1}
+        if (defaultOpts.value.columns == 3) {
+            offset = offsets[i%3]
+        }
+        i = i + 1;
+        return {
+          img: createCompId("Image", {
+            value: {
+              url: thumb,
+              ...offset
+            },
+          }),
+          desc: createCompId("Text", {
+            value: `<p style="text-align:center;">这是一个小标题</p>`,
+          }),
+        };
+      });
+    },
+
     img1: () =>
       createCompId("Image", {
         value: {

+ 1 - 1
src/modules/editor/components/CompUI/customUI/Covers/Cover/index.ts

@@ -7,7 +7,7 @@ export { Component } from "./component";
 
 export const options = {
   name: "封面",
-  thumbnail: Dict_Imgs.Default,
+  thumbnail: require("@/assets/comps/cover/1.png"),
 };
 
 export const { createComp, useCompData } = createCompHooks({

+ 6 - 4
src/modules/editor/components/CompUI/defines/createCompHooks.ts

@@ -1,7 +1,7 @@
 import { useEditor } from "@/modules/editor";
 import { DesignComp } from "@/modules/editor/defines/DesignTemp/DesignComp";
 import { Background, Layout } from "@/modules/editor/typings";
-import { cloneDeep } from "lodash";
+import { cloneDeep, defaultsDeep } from "lodash";
 import { AnyFun } from "queenjs/typing";
 import { addCacheToMap } from "./createCompId";
 
@@ -15,14 +15,16 @@ type IOptions<T, C> = {
 export function createCompHooks<T, C extends { [name: string]: AnyFun }>(
   defaultOpts: IOptions<T, C>
 ) {
+
   function createComp(opts: any) {
     const defData: any = cloneDeep(defaultOpts);
     if (defData.children) {
       Object.entries(defData.children).forEach(([key, fn]: any) => {
-        defData.children[key] = fn();
+        defData.children[key] = fn(defData);
       });
     }
-    const options = Object.assign(defData, opts);
+    const options = defaultsDeep(opts, defData)
+
     return new DesignComp(options);
   }
 
@@ -38,7 +40,7 @@ export function createCompHooks<T, C extends { [name: string]: AnyFun }>(
   function useCreateChild<T extends keyof C>(key: T) {
     const editor = useEditor();
     const createChild: any = (...args: any) => {
-      const result = (defaultOpts as any).children[key](...args);
+      const result = (defaultOpts as any).children[key](defaultOpts, ...args);
       addCacheToMap(editor.store.designData.compMap);
       return result;
     };

+ 8 - 1
src/modules/editor/components/Viewport/Slider/SliderLeft.tsx

@@ -6,14 +6,21 @@ import { Container, Draggable } from "vue-dndrop";
 import { css } from "@linaria/core";
 import * as basicUI from "../../CompUI/basicUI";
 import * as customUI from "../../CompUI/customUI";
+import { useRoute } from "vue-router";
 
 export default defineUI({
   setup() {
     const editor = useEditor();
+    const r = useRoute();
 
     return () => (
       <div class="h-full flex flex-col">
-        <div class="p-16px border-bottom !border-2px">资源中心</div>
+      
+        <div class="p-16px border-bottom !border-2px" onClick={()=>{
+            editor.jumpIndexHtml();
+        }}>资源中心</div>
+        
+
         <div class="m-16px flex-1 flex flex-col h-0">
           <Radio.Group>
             <Radio.Button>模板</Radio.Button>

+ 11 - 0
src/modules/editor/index.ts

@@ -10,6 +10,7 @@ import { ImagePickController } from "./controllers/ImagePickerController";
 import { helpers } from "./helpers";
 import { https } from "./https";
 import { store } from "./stores";
+import { useRoute } from "vue-router";
 
 export class EditorModule extends ModuleRoot {
   config = this.setConfig({
@@ -37,6 +38,16 @@ export class EditorModule extends ModuleRoot {
   onReady() {
     this.actions.init();
   }
+
+  jumpIndexHtml(route = "#/") {
+    const _params = new URLSearchParams(decodeURIComponent(location.search));
+    const host = _params.get("host")
+    let link = `${location.origin}/index.html?host=${host}${route}`;
+    if (location.host == "www.infish.cn") {
+      link = `${location.origin}/projects/queenshow/index.html?host=${host}${route}`;
+    }
+    location.href = link;
+  }
 }
 
 export const { useEditor, initEditor } = EditorModule.hook("Editor");

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

@@ -9,16 +9,22 @@ export class PromotionController {
     console.log("onMenuClick", menu, item);
   }
   onEdit(item: any) {
+
+    const _params = new URLSearchParams(decodeURIComponent(location.search));
+    const host = _params.get("host")
+
     if (location.host == "www.infish.cn") {
-      const url = `${location.origin}/projects/queenshow/editor.html#/?id=${item._id}`;
+      const url = `${location.origin}/projects/queenshow/editor.html?host=${host}#/?id=${item._id}`;
       location.href = url;
       return;
     }
 
-    const url = `${location.origin}/editor.html#/?id=${item._id}`;
+    const url = `${location.origin}/editor.html?host=${host}#/?id=${item._id}`;
     location.href = url;
   }
   onPreview(item: any) {
+    const _params = new URLSearchParams(decodeURIComponent(location.search));
+    
     if (location.host == "www.infish.cn") {
       const url = `${location.origin}/projects/queenshow/share.html#/?id=${item._id}`;
       location.href = url;
@@ -26,7 +32,5 @@ export class PromotionController {
     }
     const url = `${location.origin}/share.html#/?id=${item._id}`;
     location.href = url;
-
-    
   }
 }

+ 9 - 9
src/pages/website/router.ts

@@ -2,14 +2,14 @@ import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
 import ProfileLayout from "./layout";
 
 const routes: Array<RouteRecordRaw> = [
-  {
-    path: "/",
-    name: "homePage",
-    meta: {
-      needAuth: true,
-    },
-    component: () => import("./Home"),
-  },
+  // {
+  //   path: "/",
+  //   name: "homePage",
+  //   meta: {
+  //     needAuth: true,
+  //   },
+  //   component: () => import("./Home"),
+  // },
   {
     path: "/create/:id",
     name: "create",
@@ -19,7 +19,7 @@ const routes: Array<RouteRecordRaw> = [
     component: () => import("./CreateMat"),
   },
   {
-    path: "/workbench",
+    path: "/",
     name: "workbench",
     meta: {
       needAuth: true,