Files
im-uniapp/pages/workbench/index/index.vue

146 lines
3.3 KiB
Vue

<template>
<view class="workbench-container">
<custom-nav-bar>
<view class="workbench-title" slot="left">
<text>工作台</text>
</view>
</custom-nav-bar>
<view class="entry-list">
<view
v-for="item in entryList"
:key="item.text"
class="entry-item"
@click="handleEntryClick(item)"
>
<image class="entry-icon" :src="item.icon" mode="aspectFit" />
<text class="entry-text">{{ item.text }}</text>
</view>
</view>
</view>
</template>
<script>
import CustomNavBar from '@/components/CustomNavBar/index.vue';
import { getUserProfile } from '@/api/oa/user.js';
export default {
name: "WorkbenchIndex",
components: {
CustomNavBar,
},
onShow() {
console.log('页面onLoad被调用');
// 页面加载时调用getUserProfile
this.fetchUserProfile();
},
data() {
return {
entryList: [
{
text: '每日报工',
icon: '/static/images/baogong.png',
url: '/pages/workbench/reportWork/reportWork',
},
{
text: '施工进度',
icon: '/static/images/shigong.png',
url: '/pages/workbench/construction/construction',
},
{
text: '任务中心',
icon: '/static/images/task.png',
url: '/pages/workbench/task/task',
},
{
text: '项目排产',
icon: '/static/images/paichan.png',
url: '/pages/workbench/reportSchedule/reportSchedule',
},
{
text: '快递信息',
icon: '/static/images/express.svg',
url: '/pages/workbench/express/express',
},
{
text: '项目中心',
icon: '/static/images/project.png',
url: '/pages/workbench/project/project',
},
{
text: '库存盘点',
icon: '/static/images/stock.png',
url: '/pages/workbench/wms/wms',
},
{
text: '线上营销',
icon: '/static/images/yingxiao.png',
url: '/pages/workbench/sales/sales',
},
],
};
},
methods: {
// 获取用户个人信息
async fetchUserProfile() {
console.log('fetchUserProfile方法开始执行');
try {
console.log('开始调用getUserProfile API');
const response = await getUserProfile();
console.log('用户个人信息:', response);
// 这里可以根据需要处理返回的用户信息
} catch (error) {
console.error('获取用户个人信息失败:', error);
}
},
handleEntryClick(item) {
if (item.url) {
uni.navigateTo({ url: item.url });
}
},
},
};
</script>
<style lang="scss" scoped>
.workbench-container {
min-height: 100vh;
background: #fff;
display: flex;
flex-direction: column;
}
.workbench-title {
padding-left: 44rpx;
font-size: 40rpx;
font-weight: 600;
color: #0c1c33;
}
.entry-list {
display: flex;
flex-direction: column;
margin-top: 40rpx;
}
.entry-item {
display: flex;
flex-direction: row;
align-items: center;
padding: 32rpx 44rpx;
background: #fff;
}
.entry-icon {
width: 56rpx;
height: 56rpx;
margin-right: 32rpx;
}
.entry-text {
color: #333;
font-size: 32rpx;
}
.divider {
height: 1px;
background: #f0f0f0;
margin-left: 44rpx;
margin-right: 44rpx;
}
</style>