|
@@ -15,23 +15,23 @@ import { CompList } from "./CompList";
|
|
|
import Menu from "./Menu";
|
|
|
import ListFilter from "./ListFilter";
|
|
|
|
|
|
-const compList = [
|
|
|
- // "Card2",
|
|
|
- // "Card3",
|
|
|
- // "Card5",
|
|
|
- // "CardList",
|
|
|
- // "Cards11",
|
|
|
- // "Cards12",
|
|
|
- // "Cards13",
|
|
|
- // "Cards14",
|
|
|
- // "Cards15",
|
|
|
- "Cover",
|
|
|
- "Cover2",
|
|
|
- // "Text1",
|
|
|
- // "Title1",
|
|
|
- // "Title2",
|
|
|
- // "Title3",
|
|
|
-];
|
|
|
+// const compList = [
|
|
|
+// "Card2",
|
|
|
+// "Card3",
|
|
|
+// "Card5",
|
|
|
+// "CardList",
|
|
|
+// "Cards11",
|
|
|
+// "Cards12",
|
|
|
+// "Cards13",
|
|
|
+// "Cards14",
|
|
|
+// "Cards15",
|
|
|
+// "Cover",
|
|
|
+// "Cover2",
|
|
|
+// "Text1",
|
|
|
+// "Title1",
|
|
|
+// "Title2",
|
|
|
+// "Title3",
|
|
|
+// ];
|
|
|
|
|
|
export default defineUI({
|
|
|
setup() {
|
|
@@ -41,16 +41,16 @@ export default defineUI({
|
|
|
const { compUICtrl } = editor.controls;
|
|
|
sysCompListCtrl.loadPage(1);
|
|
|
|
|
|
- const state = useReactive(() => ({
|
|
|
- currComps() {
|
|
|
- return Array.from(compUICtrl.state.components.values()).filter(
|
|
|
- (item) => "senior" === item.compType
|
|
|
- );
|
|
|
- },
|
|
|
- cusComps() {
|
|
|
- return state.currComps.filter((d) => compList.includes(d.compKey));
|
|
|
- },
|
|
|
- }));
|
|
|
+ // const state = useReactive(() => ({
|
|
|
+ // currComps() {
|
|
|
+ // return Array.from(compUICtrl.state.components.values()).filter(
|
|
|
+ // (item) => "senior" === item.compType
|
|
|
+ // );
|
|
|
+ // },
|
|
|
+ // cusComps() {
|
|
|
+ // return state.currComps.filter((d) => compList.includes(d.compKey));
|
|
|
+ // },
|
|
|
+ // }));
|
|
|
const filterChange = (v: any) => {
|
|
|
const query = sysCompListCtrl.state.query || {};
|
|
|
sysCompListCtrl.state.query = {
|
|
@@ -70,7 +70,7 @@ export default defineUI({
|
|
|
onChange={filterChange}
|
|
|
/>
|
|
|
<CompList dataSource={dataSource} isSys={true} />
|
|
|
- <Comp components={state.cusComps} taggable={false} class="mt-10px" />
|
|
|
+ {/* <Comp components={state.cusComps} taggable={false} class="mt-10px" /> */}
|
|
|
{dataSource.length == 0 ? null : (
|
|
|
<Loadmore
|
|
|
class="mt-20px"
|
|
@@ -85,103 +85,103 @@ export default defineUI({
|
|
|
},
|
|
|
});
|
|
|
|
|
|
-const Comp = defineUI({
|
|
|
- props: {
|
|
|
- components: any<
|
|
|
- {
|
|
|
- compKey: string;
|
|
|
- name: string;
|
|
|
- thumbnail: string;
|
|
|
- published?: boolean;
|
|
|
- createTime?: string;
|
|
|
- }[]
|
|
|
- >().isRequired,
|
|
|
+// const Comp = defineUI({
|
|
|
+// props: {
|
|
|
+// components: any<
|
|
|
+// {
|
|
|
+// compKey: string;
|
|
|
+// name: string;
|
|
|
+// thumbnail: string;
|
|
|
+// published?: boolean;
|
|
|
+// createTime?: string;
|
|
|
+// }[]
|
|
|
+// >().isRequired,
|
|
|
|
|
|
- taggable: bool().def(false),
|
|
|
- },
|
|
|
- setup(props) {
|
|
|
- const editor = useEditor();
|
|
|
- const auth = useAuth();
|
|
|
- const resource = useResource();
|
|
|
- return () => {
|
|
|
- //@ts-ignore
|
|
|
- const isSys = (auth.store.userInfo.roles || []).indexOf("system") > -1;
|
|
|
+// taggable: bool().def(false),
|
|
|
+// },
|
|
|
+// setup(props) {
|
|
|
+// const editor = useEditor();
|
|
|
+// const auth = useAuth();
|
|
|
+// const resource = useResource();
|
|
|
+// return () => {
|
|
|
+// //@ts-ignore
|
|
|
+// const isSys = (auth.store.userInfo.roles || []).indexOf("system") > -1;
|
|
|
|
|
|
- if (props.components.length == 0) return <Empty class="pt-150px" />;
|
|
|
- return (
|
|
|
- <Container
|
|
|
- class="space-y-10px scrollbar"
|
|
|
- behaviour="copy"
|
|
|
- group-name="canvas"
|
|
|
- animation-duration={0}
|
|
|
- get-child-payload={(index: number) => {
|
|
|
- return props.components[index].compKey;
|
|
|
- }}
|
|
|
- >
|
|
|
- {props.components.map((item) => {
|
|
|
- const items = ["删除"];
|
|
|
+// if (props.components.length == 0) return <Empty class="pt-150px" />;
|
|
|
+// return (
|
|
|
+// <Container
|
|
|
+// class="space-y-10px scrollbar"
|
|
|
+// behaviour="copy"
|
|
|
+// group-name="canvas"
|
|
|
+// animation-duration={0}
|
|
|
+// get-child-payload={(index: number) => {
|
|
|
+// return props.components[index].compKey;
|
|
|
+// }}
|
|
|
+// >
|
|
|
+// {props.components.map((item) => {
|
|
|
+// const items = ["删除"];
|
|
|
|
|
|
- if (isSys) {
|
|
|
- item.published ? items.push("取消发布") : items.push("发布平台");
|
|
|
- }
|
|
|
+// if (isSys) {
|
|
|
+// item.published ? items.push("取消发布") : items.push("发布平台");
|
|
|
+// }
|
|
|
|
|
|
- return (
|
|
|
- <Draggable>
|
|
|
- <div
|
|
|
- class="text-center leading-50px bg-dark-50 rounded draggable-item relative"
|
|
|
- key={item.compKey}
|
|
|
- title={item.name}
|
|
|
- onClick={() =>
|
|
|
- editor.actions.clickCompToDesign(item.compKey as ICompKeys)
|
|
|
- }
|
|
|
- >
|
|
|
- <Image
|
|
|
- class="w-full rounded pointer-events-none"
|
|
|
- src={item.thumbnail}
|
|
|
- size={240}
|
|
|
- />
|
|
|
+// return (
|
|
|
+// <Draggable>
|
|
|
+// <div
|
|
|
+// class="text-center leading-50px bg-dark-50 rounded draggable-item relative"
|
|
|
+// key={item.compKey}
|
|
|
+// title={item.name}
|
|
|
+// onClick={() =>
|
|
|
+// editor.actions.clickCompToDesign(item.compKey as ICompKeys)
|
|
|
+// }
|
|
|
+// >
|
|
|
+// <Image
|
|
|
+// class="w-full rounded pointer-events-none"
|
|
|
+// src={item.thumbnail}
|
|
|
+// size={240}
|
|
|
+// />
|
|
|
|
|
|
- {isSys && props.taggable && (
|
|
|
- <Tag
|
|
|
- color={item.published ? "green" : "#E88B00"}
|
|
|
- // color="rgba(0, 0, 0, 0.4)"
|
|
|
- class="absolute top-0 left-0 z-1 !rounded-none"
|
|
|
- >
|
|
|
- {item.published ? "已发布" : "未发布"}
|
|
|
- </Tag>
|
|
|
- )}
|
|
|
+// {isSys && props.taggable && (
|
|
|
+// <Tag
|
|
|
+// color={item.published ? "green" : "#E88B00"}
|
|
|
+// // color="rgba(0, 0, 0, 0.4)"
|
|
|
+// class="absolute top-0 left-0 z-1 !rounded-none"
|
|
|
+// >
|
|
|
+// {item.published ? "已发布" : "未发布"}
|
|
|
+// </Tag>
|
|
|
+// )}
|
|
|
|
|
|
- {props.taggable && (
|
|
|
- <div class="item_footer rounded-b-4px flex items-center justify-between p-4px">
|
|
|
- <div class="flex-1 w-0">
|
|
|
- {/* <div class="text-white text-bold truncate">{record.title}</div> */}
|
|
|
- <div class="flex items-center text-opacity-60 text-white text-12px">
|
|
|
- {dayjs(item.createTime).format("YYYY.MM.DD")}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <Menu
|
|
|
- items={items}
|
|
|
- onMenu={async (name) => {
|
|
|
- console.log("name", name);
|
|
|
- if (name == "删除") {
|
|
|
- await resource.actions.deleteCustomComp(item);
|
|
|
- // editor.controls.compUICtrl.
|
|
|
- queenApi.messageSuccess("删除成功!");
|
|
|
- return;
|
|
|
- }
|
|
|
- const pub = name == "发布平台";
|
|
|
- await resource.actions.publishFrame(item, pub);
|
|
|
- item.published = pub;
|
|
|
- }}
|
|
|
- />
|
|
|
- </div>
|
|
|
- )}
|
|
|
- </div>
|
|
|
- </Draggable>
|
|
|
- );
|
|
|
- })}
|
|
|
- </Container>
|
|
|
- );
|
|
|
- };
|
|
|
- },
|
|
|
-});
|
|
|
+// {props.taggable && (
|
|
|
+// <div class="item_footer rounded-b-4px flex items-center justify-between p-4px">
|
|
|
+// <div class="flex-1 w-0">
|
|
|
+// {/* <div class="text-white text-bold truncate">{record.title}</div> */}
|
|
|
+// <div class="flex items-center text-opacity-60 text-white text-12px">
|
|
|
+// {dayjs(item.createTime).format("YYYY.MM.DD")}
|
|
|
+// </div>
|
|
|
+// </div>
|
|
|
+// <Menu
|
|
|
+// items={items}
|
|
|
+// onMenu={async (name) => {
|
|
|
+// console.log("name", name);
|
|
|
+// if (name == "删除") {
|
|
|
+// await resource.actions.deleteCustomComp(item);
|
|
|
+// // editor.controls.compUICtrl.
|
|
|
+// queenApi.messageSuccess("删除成功!");
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// const pub = name == "发布平台";
|
|
|
+// await resource.actions.publishFrame(item, pub);
|
|
|
+// item.published = pub;
|
|
|
+// }}
|
|
|
+// />
|
|
|
+// </div>
|
|
|
+// )}
|
|
|
+// </div>
|
|
|
+// </Draggable>
|
|
|
+// );
|
|
|
+// })}
|
|
|
+// </Container>
|
|
|
+// );
|
|
|
+// };
|
|
|
+// },
|
|
|
+// });
|