|
@@ -1,18 +1,18 @@
|
|
import List from "@/components/AssetsList";
|
|
import List from "@/components/AssetsList";
|
|
|
|
+import { useResource } from "@/modules/resource";
|
|
import { PromotionController } from "@/modules/resource/controllers/PromotionController";
|
|
import { PromotionController } from "@/modules/resource/controllers/PromotionController";
|
|
|
|
+import { useAuth } from "@queenjs-modules/auth";
|
|
import { defineUI } from "queenjs";
|
|
import { defineUI } from "queenjs";
|
|
-import { onMounted } from "vue";
|
|
|
|
|
|
+import { computed, onMounted, reactive } from "vue";
|
|
import { any } from "vue-types";
|
|
import { any } from "vue-types";
|
|
-import Header from "./Header";
|
|
|
|
import Filter from "./CategoryFilter";
|
|
import Filter from "./CategoryFilter";
|
|
|
|
+import Header from "./Header";
|
|
import PromotionItem from "./PromotionItem";
|
|
import PromotionItem from "./PromotionItem";
|
|
-import { useAuth } from "@queenjs-modules/auth";
|
|
|
|
|
|
|
|
export default defineUI({
|
|
export default defineUI({
|
|
props: {
|
|
props: {
|
|
Controller: any<PromotionController>().isRequired,
|
|
Controller: any<PromotionController>().isRequired,
|
|
},
|
|
},
|
|
-
|
|
|
|
slots: {
|
|
slots: {
|
|
Header,
|
|
Header,
|
|
Filter,
|
|
Filter,
|
|
@@ -20,6 +20,23 @@ export default defineUI({
|
|
},
|
|
},
|
|
setup(props, { slots }) {
|
|
setup(props, { slots }) {
|
|
const auth = useAuth();
|
|
const auth = useAuth();
|
|
|
|
+ const resource = useResource();
|
|
|
|
+
|
|
|
|
+ const state = reactive({
|
|
|
|
+ categoryList: computed(() => {
|
|
|
|
+ const categories = resource.controls.categoryCtrl.state.categories;
|
|
|
|
+ const currCate: any = categories.find((e: any) => {
|
|
|
|
+ return e.value == "template";
|
|
|
|
+ });
|
|
|
|
+ if (!currCate) return [];
|
|
|
|
+ const r = currCate.children.find((e: any) => e.name == "平台");
|
|
|
|
+ return r?.children || [];
|
|
|
|
+ }),
|
|
|
|
+ pcCategoryId: computed(() => {
|
|
|
|
+ const item: any = state.categoryList.find((e: any) => e.value == "PC");
|
|
|
|
+ return item.id;
|
|
|
|
+ }),
|
|
|
|
+ });
|
|
|
|
|
|
const FilterChange = (query: any) => {
|
|
const FilterChange = (query: any) => {
|
|
const ctrlQuery = props.Controller.ListCtrl.state.query || {};
|
|
const ctrlQuery = props.Controller.ListCtrl.state.query || {};
|
|
@@ -29,6 +46,14 @@ export default defineUI({
|
|
};
|
|
};
|
|
props.Controller.ListCtrl.loadPage(1);
|
|
props.Controller.ListCtrl.loadPage(1);
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+ function isPcDesign(record: any) {
|
|
|
|
+ let res = false;
|
|
|
|
+ const categories: any[] = record.categories || [];
|
|
|
|
+ if (categories.includes(state.pcCategoryId)) res = true;
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
+
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
props.Controller.ListCtrl.state.query = {};
|
|
props.Controller.ListCtrl.state.query = {};
|
|
props.Controller.ListCtrl.loadPage(1);
|
|
props.Controller.ListCtrl.loadPage(1);
|
|
@@ -37,6 +62,7 @@ export default defineUI({
|
|
return () => {
|
|
return () => {
|
|
//@ts-ignore
|
|
//@ts-ignore
|
|
const isSys = (auth.store.userInfo.roles || []).indexOf("system") > -1;
|
|
const isSys = (auth.store.userInfo.roles || []).indexOf("system") > -1;
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<div>
|
|
<div>
|
|
<slots.Header onAdd={props.Controller.createPromotion} />
|
|
<slots.Header onAdd={props.Controller.createPromotion} />
|
|
@@ -50,15 +76,19 @@ export default defineUI({
|
|
class="my-30px"
|
|
class="my-30px"
|
|
columns={5}
|
|
columns={5}
|
|
control={props.Controller.ListCtrl}
|
|
control={props.Controller.ListCtrl}
|
|
- item={(record: any) => (
|
|
|
|
- <PromotionItem
|
|
|
|
- record={record}
|
|
|
|
- onMenu={(name) => {
|
|
|
|
- props.Controller.onMenuClick(name, record, isSys);
|
|
|
|
- }}
|
|
|
|
- onEdit={(record) => props.Controller.onEdit(record)}
|
|
|
|
- />
|
|
|
|
- )}
|
|
|
|
|
|
+ item={(record: any) => {
|
|
|
|
+ const isPc = isPcDesign(record);
|
|
|
|
+ return (
|
|
|
|
+ <PromotionItem
|
|
|
|
+ isPc={isPc}
|
|
|
|
+ record={record}
|
|
|
|
+ onMenu={(name) => {
|
|
|
|
+ props.Controller.onMenuClick(name, record, isSys);
|
|
|
|
+ }}
|
|
|
|
+ onEdit={(record) => props.Controller.onEdit(record)}
|
|
|
|
+ />
|
|
|
|
+ );
|
|
|
|
+ }}
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|