<template> <view class="content"> <view v-for="(item,index) in list" :key="index"> <p class="btn" @click="gotoLink(item)" v-if="item.name">{{ item.name }}</p> </view> </view> </template> <script setup lang="ts"> import { onMounted, ref } from 'vue' import { getAction } from '../../common/http'; import { showFailToast } from 'vant'; const ListData =ref([ { path: '../whiteEmbryo/listSearch', name: '白胚库存列表', type:'rawFabric', }, { path: '../maintenance/processOldzmd', name: '工艺维护', type:'flowBind', }, { path:'../maintenance/m-flow', name:'工艺流程维护', type:'craftFlow' }, { path: '../maintenance/m-process', name: '工序项维护', type:'process', }, { path: '../maintenance/m-requirements', name: '工艺要求维护', type:'craftRequire', }, { path: '../maintenance/m-factory', name: '工厂维护', type:'factory', }, { path: '../maintenance/m-other', name: '其他要求项维护', type:'extraOption', }, { path: '../whiteEmbryo/w-warehousing', name: '白胚入库', type:'rawFabric', }, { path: '../whiteEmbryo/w-level', name: '白胚等级维护', type:'rawFabricLevel', }, { path: '../whiteEmbryo/w-suppliers', name: '供应商维护', type:'supplier', }, { path: '../whiteEmbryo/w-scanCode', name: '白胚扫码放货架', type:'rawFabric', }, { path: '../whiteEmbryo/w-warehouse', name: '仓库维护', type:'warehouse', }, { path: '../whiteEmbryo/w-libraryLocation', name: '库位号维护', type:'shelves', }, { path: '../whiteEmbryo/w-list', name: '白胚列表', type:'rawFabric', }, { path:'../spot/list', name:'需求单列表', type:'interOrder', }, { path:'../customOrder/list', name:'定做单列表', type:'customOrder', }, { path:'../distribution/distribution', name:'待配货列表', type:'tribute', }, { path:'../documentary/documentary', name:'跟单列表', type:'tracking', }, { path:'../colorBlank/colorBlank', name:'色胚质检列表', type:'testing', }, { path:'../colorBlank/defect', name:'色胚质检瑕疵维护', type:'blemish', }, { path:'../colorBlank/quality', name:'色胚质检项维护', type:'testItem', }, { path:'../colorBlank/physical', name:'理化报告选项维护', type:'extraOption', }, { path:'../colorBlank/resultsQuery', name:'质检结果查询', type:'testing', }, { path:'../colorBlank/ScanCodeStorage', name:'扫码暂存', type:'testing', }, { path:'../orderStatus/orderStatus', name:'订单状态查询', type:'testing', }, // { // path:'../colorBlank/chemical', // name:'理化报告', // type:'blemish', // } ] as any[]) const list = ref([] as any[]) onMounted(() => { getAction('/v1/auth/info').then((res : any) => { if (res.code === 200) { localStorage.setItem("info", JSON.stringify(res.data)); res.data.permissions.forEach((l:any)=>{ ListData.value.forEach((m:any)=>{ if(l.includes(m.type)){ let a=list.value.find(k=>k.path==m.path) if(!a){ list.value.push(m) } } }) }) } else { uni.reLaunch({ url:'/pages/login/login' }) showFailToast(res.msg) } }) uni.getStorage({ key:'token', success: function (res) { if(!res.data){ uni.reLaunch({ url:'/pages/login/login' }) } }, fail:function(error){ uni.reLaunch({ url:'/pages/login/login' }) } }) }) const gotoLink = (item: any) => { uni.navigateTo({ url:item.path }) } </script> <style scoped lang="scss"> .btn { padding: 15px 0; margin: 10px; background-color: #35a5f7; color: #fff; text-align: center; border-radius: 20px; } input[type='number'] { -moz-appearance: textfield; } input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; } </style>