import { Tag } from "ant-design-vue"; import dayjs from "dayjs"; import { Container, Draggable } from "vue-dndrop"; import { any, bool } from "vue-types"; import Empty from "@/components/Empty"; import { useEditor } from "@/modules/editor"; import { ICompKeys } from "@/modules/editor/typings"; import { useResource } from "@/modules/resource"; import { useAuth } from "@queenjs-modules/auth"; import { Image, Loadmore } from "@queenjs/ui"; import { useReactive } from "@queenjs/use"; import { defineUI, queenApi } from "queenjs"; import { CompList } from "./CompList"; import Menu from "./Menu"; const compList = [ // "Card2", // "Card3", // "Card5", // "CardList", // "Cards11", // "Cards12", // "Cards13", // "Cards14", // "Cards15", "Cover", "Cover2", // "Text1", // "Title1", // "Title2", // "Title3", ]; export default defineUI({ setup() { const editor = useEditor(); const resource = useResource(); const { sysCompListCtrl } = resource.controls; 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)); }, })); return () => { const dataSource = sysCompListCtrl.state.list; return (
{dataSource.length == 0 ? null : ( )}
); }; }, }); 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; if (props.components.length == 0) return ; return ( { return props.components[index].compKey; }} > {props.components.map((item) => { const items = ["删除"]; if (isSys) { item.published ? items.push("取消发布") : items.push("发布平台"); } return (
editor.actions.clickCompToDesign(item.compKey as ICompKeys) } > {isSys && props.taggable && ( {item.published ? "已发布" : "未发布"} )} {props.taggable && ( )}
); })}
); }; }, });