货无忧
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

251 lines
5.9 KiB

<template>
<u-navbar title="工作台" placeholder border=true leftIcon=''></u-navbar>
<view class="mabox" v-for="item in tablist">
<view class="boxtitl">
{{item.name}}
</view>
<view class="minboxlist">
<view @click="gopathpage(ite.router)" v-for="ite in item.minilist">
<image mode="widthFix" :src="ite.icon"></image>
<view>{{ite.name}}</view>
</view>
</view>
</view>
<!-- #ifdef APP -->
<saomiao></saomiao>
<saomiao1></saomiao1>
<saomiao2></saomiao2>
<saomiao3></saomiao3>
<saomiao4></saomiao4>
<!-- #endif -->
<!-- <tiplist></tiplist> -->
<!-- <Tabber checkstate='home'></Tabber> -->
</template>
<script lang="ts" setup>
import {
onLoad,
onShow,
onHide,
onUnload
} from '@dcloudio/uni-app'
import {
appMenuroutes,
appbuttons
} from "@/api/user.js"
import { getImageCache } from '@/utils/cacheimg.js'
import { listtype } from '@/interfaces/home/index'
// import Tabber from '@/compoment/Tabber/Tabber.vue'
import { inject, reactive, toRefs, watchEffect } from "vue";
let details = reactive<listtype>({
tablist: [
// {
// type:1,
// name:'库内',
// minilist:[
// {
// icon:'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png',
// name:'下架扫描',
// router:'/pagesHome/pages/DownScan/DownScan',
// },
// ]
// },
// {
// type: 1,
// name: '出库',
// minilist: [
// {
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png',
// name: '拣货扫描',
// router: '/pagesHome/pages/pickingScan/pickingScan',
// },
// {
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png',
// name: '自提扫描',
// router: '/pagesHome/pages/SelfPickupScan/SelfPickupScan',
// },
// ]
// },
// {
// type: 1,
// name: '配送',
// minilist: [
// {
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png',
// name: '装车扫描',
// router: '/pagesHome/pages/LoadingScan/LoadingScan',
// },
// {
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png',
// name: '签收扫描',
// router: '/pagesHome/pages/signinScan/signinScan',
// },
// ]
// },
// {
// type: 1,
// name: '离线上传',
// minilist: [
// {
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png',
// name: '离线上传',
// router: '/pagesHome/pages/OfflineUpload/OfflineUpload',
// },
// ]
// },
]
})
function gopathpage(path : string) {
uni.navigateTo({
url: path
})
}
async function init(){
let tabber=uni.getStorageSync('homerouter')
if(tabber){
details.tablist=tabber
return
}
let res=await appMenuroutes({})
console.log(res,'-------------');
if(res.code==200){
getimgcache(res.data[0])
}else{
uni.showToast({
title:res.msg,
icon:'none'
})
}
}
async function initbuts(){
let authbut=uni.getStorageSync('authbuts')
if(authbut){
return
}
let butres=await appbuttons({})
console.log(butres.data);
let qxan=[]
butres.data.map(item=>{
item.children.map(ite=>{
qxan.push(ite.name)
})
})
uni.setStorageSync('authbuts',qxan)
}
onShow(()=>{
init()
initbuts()
})
watchEffect(()=>{
if(details.tablist.length>0){
uni.setStorageSync('homerouter',details.tablist)
}
})
function getimgcache(list) {
let maxarr=[]
list.children.map(async item=>{
let arr={
type:1,
name:item.name,
minilist:[]
}
await item.children.map(async ite=>{
let result = await getImageCache('http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png')
console.log("image cache", result);
let obj={
icon:result,
name:ite.name,
router:ite.path
}
arr.minilist.push(obj)
})
maxarr.push(arr)
})
details.tablist=maxarr
// details.tablist.map((item,index)=>{
// item.minilist.map(async (ite,inde)=>{
// let result = await getImageCache('http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png')
// console.log("image cache", result);
// if (result) {
// details.tablist[index].minilist[inde].icon=result
// } else {
// details.tablist[index].minilist[inde].icon=ite.icon
// }
// })
// })
// setTimeout(()=>{
// console.log(details.tablist);
// },3500)
}
// #ifdef APP
// const util=(inject('utils') as any)
// let text='! 0 200 200 500 1\r\n'
// text+='SETBOLD 2\r\n'
// text+=`T 56 0 200 0 日期:${'2023-01-12'}\r\n`
// text+=`T 5 3 145 15 ${1}\r\n`
// text+='LINE 5 110 360 110 4\r\n'
// text+=`T 56 3 5 120 件数:${1+'-'+15}\r\n`
// text+=`T 56 0 5 170 ${1231}\r\n`
// // text+='FORM\r\n'
// text+='PRINT\r\n'
// let sylist=util.initbl()
// console.log(sylist);
// sylist.map(item=>{
// console.log(item);
// if(item.uuids){
// util.getbl(item,text)
// }
// })
// #endif
const { tablist } = toRefs(details)
</script>
<style lang="scss">
.mabox {
display: flex;
flex-direction: column;
padding: 20upx 0;
box-sizing: border-box;
width: 686upx;
margin: auto;
background-color: #ffffff;
margin-bottom: 20upx;
margin-top: 10upx;
border-radius: 10upx;
box-shadow: 0rpx 2rpx 10rpx 0rpx #e2e2e380;
.boxtitl {
font-size: 34upx;
font-weight: 500;
margin-bottom: 10upx;
// margin-left: 10upx;
border-bottom: 1upx solid #EEEEEE;
padding: 0upx 20upx;
padding-bottom: 20upx;
color: #092C4D;
}
.minboxlist {
display: grid;
grid-template-columns: 25% 25% 25% 25%;
padding-top: 10upx;
>view {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 10upx;
>image {
width: 60upx;
}
>view {
font-size: 26upx;
}
}
}
}
</style>