增加应用中心子页面
This commit is contained in:
@@ -1,17 +1,76 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view class="u-p-30 bg-gray min-page">
|
||||||
|
<view class=" border-r-16 bg-fff u-p-30 " >
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<up-grid :border="false" col="2">
|
||||||
|
<up-grid-item @click="toPage(listItem,listIndex)" v-for="(listItem,listIndex) in computedMenus"
|
||||||
|
:key="listIndex">
|
||||||
|
<image style="width: 120rpx;height: 120rpx;" :src="listItem.miniIcon" mode="scaleToFill" />
|
||||||
|
<text class="u-m-t-16 color-333 u-font-28 u-p-b-32">{{listItem.title}}</text>
|
||||||
|
</up-grid-item>
|
||||||
|
</up-grid>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
export default {
|
import {
|
||||||
data() {
|
computed
|
||||||
return {
|
} from 'vue';
|
||||||
|
import go from '@/commons/utils/go.js';
|
||||||
};
|
import {
|
||||||
}
|
useMenusStore
|
||||||
|
} from '@/store/menus.js';
|
||||||
|
const menusStore = useMenusStore()
|
||||||
|
async function init() {
|
||||||
|
const res = await menusStore.getMenus()
|
||||||
}
|
}
|
||||||
|
init()
|
||||||
|
|
||||||
|
function toPage(item, index) {
|
||||||
|
console.log(item);
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/' + item.miniPath.replace(/^\/+|\/+$/g, ''),
|
||||||
|
fail(err) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '无该页面路径或无权限访问该页面'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const navList = [{
|
||||||
|
title: '存酒',
|
||||||
|
icon: '/static/indexImg/icon-order.svg',
|
||||||
|
pageUrl: 'PAGES_ORDER_INDEX'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '点歌',
|
||||||
|
icon: '/static/indexImg/icon-order.svg',
|
||||||
|
pageUrl: 'PAGES_ORDER_INDEX'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '广告',
|
||||||
|
icon: '/static/indexImg/icon-order.svg',
|
||||||
|
pageUrl: 'PAGES_ORDER_INDEX'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '叫号',
|
||||||
|
icon: '/static/indexImg/icon-order.svg',
|
||||||
|
pageUrl: 'PAGES_ORDER_INDEX'
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const computedMenus = computed(() => {
|
||||||
|
const arr= menusStore.adminPages.filter(v=>{
|
||||||
|
return navList.find(navItem=>navItem.title==v.title)
|
||||||
|
})
|
||||||
|
console.log(arr);
|
||||||
|
return arr
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
@@ -1,17 +1,76 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view class="u-p-30 bg-gray min-page">
|
||||||
|
<view class=" border-r-16 bg-fff u-p-30 ">
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<up-grid :border="false" col="2">
|
||||||
|
<up-grid-item @click="toPage(listItem,listIndex)" v-for="(listItem,listIndex) in computedMenus"
|
||||||
|
:key="listIndex">
|
||||||
|
<image style="width: 120rpx;height: 120rpx;" :src="listItem.miniIcon" mode="scaleToFill" />
|
||||||
|
<text class="u-m-t-16 color-333 u-font-28 u-p-b-32">{{listItem.title}}</text>
|
||||||
|
</up-grid-item>
|
||||||
|
</up-grid>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
export default {
|
import {
|
||||||
data() {
|
computed
|
||||||
return {
|
} from 'vue';
|
||||||
|
import go from '@/commons/utils/go.js';
|
||||||
};
|
import {
|
||||||
}
|
useMenusStore
|
||||||
|
} from '@/store/menus.js';
|
||||||
|
const menusStore = useMenusStore()
|
||||||
|
async function init() {
|
||||||
|
const res = await menusStore.getMenus()
|
||||||
}
|
}
|
||||||
|
init()
|
||||||
|
|
||||||
|
function toPage(item, index) {
|
||||||
|
console.log(item);
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/' + item.miniPath.replace(/^\/+|\/+$/g, ''),
|
||||||
|
fail(err) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '无该页面路径或无权限访问该页面'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const navList = [{
|
||||||
|
title: '优惠券',
|
||||||
|
icon: '/static/indexImg/icon-order.svg',
|
||||||
|
pageUrl: 'PAGES_ORDER_INDEX'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '霸王餐',
|
||||||
|
icon: '/static/indexImg/icon-order.svg',
|
||||||
|
pageUrl: 'PAGES_ORDER_INDEX'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '邀请裂变',
|
||||||
|
icon: '/static/indexImg/icon-order.svg',
|
||||||
|
pageUrl: 'PAGES_ORDER_INDEX'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '积分锁客',
|
||||||
|
icon: '/static/indexImg/icon-order.svg',
|
||||||
|
pageUrl: 'PAGES_ORDER_INDEX'
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const computedMenus = computed(() => {
|
||||||
|
const arr = menusStore.adminPages.filter(v => {
|
||||||
|
return navList.find(navItem => navItem.title == v.title)
|
||||||
|
})
|
||||||
|
console.log(arr);
|
||||||
|
return arr
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ export const useMenusStore = defineStore('menus', {
|
|||||||
return {
|
return {
|
||||||
originMenus: [],
|
originMenus: [],
|
||||||
menuList: [],
|
menuList: [],
|
||||||
allPages: allPages
|
allPages: allPages,//小程序全部页面
|
||||||
|
adminPages:[]//后台返回的全部页面
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
@@ -51,6 +52,7 @@ export const useMenusStore = defineStore('menus', {
|
|||||||
const data = await menusApi.getMenus()
|
const data = await menusApi.getMenus()
|
||||||
this.originMenus = data;
|
this.originMenus = data;
|
||||||
const arr = flattenNestedChildren(data).filter(v => v.miniPath)
|
const arr = flattenNestedChildren(data).filter(v => v.miniPath)
|
||||||
|
this.adminPages=arr;
|
||||||
this.menuList = this.allPages.filter(v => {
|
this.menuList = this.allPages.filter(v => {
|
||||||
const findItem = arr.find(item => item.miniPath == v.pageId || item.miniPath
|
const findItem = arr.find(item => item.miniPath == v.pageId || item.miniPath
|
||||||
.replace(/^\/+|\/+$/g, '') == v.allPath)
|
.replace(/^\/+|\/+$/g, '') == v.allPath)
|
||||||
|
|||||||
Reference in New Issue
Block a user