|
@@ -3,7 +3,7 @@ import { initEditor } from "@/modules/editor";
|
|
|
import { Design_Page_Size } from "@/modules/editor/dicts/CompOptions";
|
|
|
import { initResource } from "@/modules/resource";
|
|
|
import { isPc } from "@queenjs/utils";
|
|
|
-import { defineComponent, provide } from "vue";
|
|
|
+import { defineComponent, provide, reactive } from "vue";
|
|
|
|
|
|
export default defineComponent(() => {
|
|
|
const editor = initEditor();
|
|
@@ -12,11 +12,14 @@ export default defineComponent(() => {
|
|
|
const id = params.get("id");
|
|
|
const isSys = params.get("isSys");
|
|
|
const isWk = params.get("isWk");
|
|
|
+ const state = reactive({useForPc: false})
|
|
|
|
|
|
provide("isPreview", true);
|
|
|
|
|
|
editor.actions.switchMode("display");
|
|
|
|
|
|
+ const { helper, store, controls } = editor;
|
|
|
+
|
|
|
if (id) {
|
|
|
if (isWk) {
|
|
|
editor.actions.initWkDesign(id);
|
|
@@ -35,6 +38,8 @@ export default defineComponent(() => {
|
|
|
imgUrl: data.thumbnail || "",
|
|
|
desc: data.desc,
|
|
|
};
|
|
|
+ state.useForPc = editor.controls.pageCtrl.rootPage.value.useFor == "pc";
|
|
|
+ alert(1);
|
|
|
editor.controls.wxCtrl.setShareData(shareData);
|
|
|
editor.controls.wxCtrl.setShare(shareData);
|
|
|
|
|
@@ -46,9 +51,9 @@ export default defineComponent(() => {
|
|
|
// }).then(data=>{
|
|
|
// console.log(data);
|
|
|
// })
|
|
|
- if (!isPc()) {
|
|
|
- return () => <editor.components.Preview />;
|
|
|
- }
|
|
|
+ // if (!isPc()) {
|
|
|
+ // return () => <editor.components.Preview />;
|
|
|
+ // }
|
|
|
|
|
|
function getPageH() {
|
|
|
const rootPage = editor.controls.pageCtrl.rootPage;
|
|
@@ -60,11 +65,9 @@ export default defineComponent(() => {
|
|
|
|
|
|
return () => {
|
|
|
const rootPage = editor.controls.pageCtrl.rootPage;
|
|
|
- const isPcDesign = rootPage?.value.useFor == "pc";
|
|
|
-
|
|
|
- // pc in mobile
|
|
|
- if (isPcDesign && !isPc()) return <Empty />;
|
|
|
-
|
|
|
+ const isPcDesign = state.useForPc;
|
|
|
+ // const isShort = rootPage?.value.pageMode == "short";
|
|
|
+
|
|
|
// mobile in pc
|
|
|
if (!isPcDesign && isPc()) {
|
|
|
const pegeH = getPageH();
|
|
@@ -82,7 +85,23 @@ export default defineComponent(() => {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- // mobile in mobile
|
|
|
+ // mobile in mobile or pc in pc
|
|
|
+ if (isPcDesign) {
|
|
|
+ const docW = editor.controls.screenCtrl.state.docWidth;
|
|
|
+ const dw = helper.designSizeToPx(rootPage.layout.size[0])
|
|
|
+ const dh = helper.designSizeToPx(rootPage.layout.size[1]);
|
|
|
+ let wrapH = 0;
|
|
|
+ const style= {"height": "auto"}
|
|
|
+ if (docW < dw) {
|
|
|
+ const s = docW / dw;
|
|
|
+ wrapH = Math.ceil(dh*s);
|
|
|
+ style["height"] = wrapH + "px"
|
|
|
+ }
|
|
|
+ return <div class="pc-web" style={style}>
|
|
|
+ <editor.components.Preview />
|
|
|
+ </div>;
|
|
|
+ }
|
|
|
+
|
|
|
return <editor.components.Preview />;
|
|
|
};
|
|
|
});
|