|
@@ -1,14 +1,24 @@
|
|
|
+import { useCtx } from "@/comm/ctx";
|
|
|
import { useList } from "@/modules/list";
|
|
|
import { css } from "@linaria/core";
|
|
|
-import { setQueentreeExplorer } from "@queenjs-modules/queentree-explorer";
|
|
|
import { Image } from "@queenjs/ui";
|
|
|
-import { Button, Space, Table } from "ant-design-vue";
|
|
|
-import { defineComponent } from "vue";
|
|
|
+import { Button, Select, Space, Table } from "ant-design-vue";
|
|
|
+
|
|
|
+import { defineComponent, reactive } from "vue";
|
|
|
+import CategoryModal from "./categoryModal";
|
|
|
|
|
|
export default defineComponent({
|
|
|
setup() {
|
|
|
const { store, showModal, actions } = useList();
|
|
|
- setQueentreeExplorer({});
|
|
|
+ const state = reactive({
|
|
|
+ select: "default",
|
|
|
+ optsions: [
|
|
|
+ {
|
|
|
+ label: "默认",
|
|
|
+ value: "default",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ });
|
|
|
const columns = [
|
|
|
{
|
|
|
title: "封面图",
|
|
@@ -19,62 +29,70 @@ export default defineComponent({
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
- title: "模型名称",
|
|
|
+ title: "名称",
|
|
|
dataIndex: "name",
|
|
|
key: "name",
|
|
|
},
|
|
|
];
|
|
|
-
|
|
|
- const showFiles = async () => {
|
|
|
- // showModal(
|
|
|
- // <PickNodeSteps
|
|
|
- // onSubmit={(branchArr: any) => {
|
|
|
- // const branch = branchArr[0][0];
|
|
|
- // const dbId = branch.parent?.state.id;
|
|
|
- // const defineId = branch.state.id;
|
|
|
- // localStorage.setItem("dbId", dbId);
|
|
|
- // localStorage.setItem("defineId", defineId);
|
|
|
- // console.log("xxxxxxxxxxxxxxxxx", dbId, defineId);
|
|
|
- // actions.getAssetList(dbId, defineId);
|
|
|
- // Modal.clear();
|
|
|
- // }}
|
|
|
- // lastStepText="选择"
|
|
|
- // steps={[
|
|
|
- // {
|
|
|
- // title: "选择模型库",
|
|
|
- // content: () => {
|
|
|
- // return (
|
|
|
- // <PickNodeSteps.PickNodeStep
|
|
|
- // options={{
|
|
|
- // nodeType: "branch",
|
|
|
- // childNodeType: "pack",
|
|
|
- // }}
|
|
|
- // />
|
|
|
- // );
|
|
|
- // },
|
|
|
- // },
|
|
|
- // ]}
|
|
|
- // expConfig={{ showNodeToolbar: false, nodeListColumns: 6 }}
|
|
|
- // />,
|
|
|
- // {
|
|
|
- // width: "600px",
|
|
|
- // }
|
|
|
- // );
|
|
|
+ const initShowCategory = async () => {
|
|
|
+ const { deviceCtrl } = useCtx();
|
|
|
+ const appDataDir = deviceCtrl.appDataDir;
|
|
|
+ const category = await deviceCtrl.ReadFileText(
|
|
|
+ `${appDataDir}/screen/category.json`
|
|
|
+ );
|
|
|
+ const currentCategory = localStorage.getItem("category") || "default";
|
|
|
+ state.select = currentCategory;
|
|
|
+ if (!category.error && category.text) {
|
|
|
+ const assets = JSON.parse(category.text);
|
|
|
+ state.optsions = assets;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ initShowCategory();
|
|
|
+ const setShowCategory = (value: any) => {
|
|
|
+ localStorage.setItem("category", value || "default");
|
|
|
+ state.select = value;
|
|
|
+ actions.getAssetList();
|
|
|
+ };
|
|
|
+ const createShowCategory = async () => {
|
|
|
+ const { deviceCtrl } = useCtx();
|
|
|
+ const res: any = await showModal(<CategoryModal />, {
|
|
|
+ title: "新建分类",
|
|
|
+ });
|
|
|
+ const options = [...state.optsions];
|
|
|
+ const optionItem = options.find((e) => {
|
|
|
+ return e.value == res.value;
|
|
|
+ });
|
|
|
+ if (optionItem) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ options.push(res);
|
|
|
+ state.optsions = options;
|
|
|
+ const appDataDir = deviceCtrl.appDataDir;
|
|
|
+ await deviceCtrl.WriteFileText(
|
|
|
+ `${appDataDir}/screen/category.json`,
|
|
|
+ JSON.stringify(options)
|
|
|
+ );
|
|
|
};
|
|
|
return () => (
|
|
|
<div class={ViewStyle}>
|
|
|
<div class="table_header">
|
|
|
- <div class="title">模型列表</div>
|
|
|
+ <div class="title">展示列表</div>
|
|
|
<div>
|
|
|
<Space>
|
|
|
+ <Select
|
|
|
+ class={"select"}
|
|
|
+ value={state.select}
|
|
|
+ options={state.optsions}
|
|
|
+ onChange={setShowCategory}
|
|
|
+ ></Select>
|
|
|
<Button
|
|
|
type="primary"
|
|
|
ghost
|
|
|
onClick={() => {
|
|
|
- showFiles();
|
|
|
+ createShowCategory();
|
|
|
}}
|
|
|
>
|
|
|
- 导入模型
|
|
|
+ 新建展示分类
|
|
|
</Button>
|
|
|
</Space>
|
|
|
</div>
|
|
@@ -101,6 +119,9 @@ const ViewStyle = css`
|
|
|
font-size: 18px;
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
+ .select {
|
|
|
+ width: 150px;
|
|
|
+ }
|
|
|
}
|
|
|
.ant-table-thead > tr > th,
|
|
|
.ant-table-tbody > tr > td {
|