Files
pasd_app/pages/index2.vue
2025-07-28 14:57:35 +08:00

219 lines
4.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="index">
<!-- 头部个人信息 -->
<view class="header">
<view class="left">
<image :src="avater" mode=""></image>
</view>
<view class="right">
<text>账号{{username}}</text>
<text>姓名{{nickName}}</text>
<!-- <text>班级{{studentClass}}</text> -->
</view>
</view>
<uni-notice-bar show-icon scrollable :text="noticeText" />
<!-- 个人信息结束 -->
<!-- 工作台 -->
<view class="workbench">
<view class="workbench-grid" v-for="(item,index) in iconBoxList">
<view class="title">
{{item.meta.title}}
</view>
<view class="list">
<view class="item" v-for="(child,index) in item.children" :key="index"
@click="gotopage(child.component)">
<image :src="getImgUrl(child.path)" mode="aspectFit"></image>
<text> {{child.meta.title}}</text>
<text class="num" v-show="child.meta.title=='任务管理'&&total">{{total}}</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
getOwnInfo,
getInfo
} from "@/api/person/person.js";
import {
getUserProfile
} from "@/api/system/user.js";
import { getRouters } from '@/api/login'
import {
todoList
} from "@/api/task.js";
export default {
data() {
return {
total: "",
avater: require('../../static/avatar2.png'),
nickName: '',
username: '',
studentId: "",
studentClass: "",
noticeText: "你好, ",
// 图标列表
iconBoxList:[],
}
},
onShow() {
this.getUserInfo();
this.getUndo();
this.getUserRouters();
},
methods: {
getUserRouters(){
let params={
menuUseful:1
}
getRouters(params).then(res=>{
this.iconBoxList=res.data[0].children;
});
},
getUndo() {
let sdata = {
pageNum: 1,
pageSize: 10
};
todoList(sdata).then(res => {
this.total = res.data.total;
console.log(this.total);
// this.iconBoxList[11].num = this.total;
})
},
// 页面调转
gotopage(path) {
uni.navigateTo({
url: path
})
},
// 获取个人信息
getUserInfo() {
getUserProfile().then(res => {
if (res.code == 200) {
let data = {
...res.data
};
uni.setStorageSync('stuName', data.nickName);
uni.setStorageSync('stuId', data.userId);
uni.setStorageSync("stuNo", data.userName)
uni.setStorageSync("deptName", data.dept.deptName)
uni.setStorageSync("roles", res.roleGroup)
console.log(res);
this.nickName = data.nickName
this.username = data.userName
this.noticeText = "你好 " + this.nickName;
}
});
},
//组装图片路径
getImgUrl(name){
return require('../../static/images/workbench/'+name+'.png');
}
}
}
</script>
<style lang="less" scoped>
.index {
background-color: #F3F4F6;
padding-bottom: 10rpx;
min-height:95vh;
}
.header {
display: flex;
align-items: center;
width: 100%;
height: 300rpx;
background: url("../../static/top.png");
padding: 0rpx 40rpx;
.left {
padding-top: 20rpx;
width: 170rpx;
height: 170rpx;
border-radius: 50%;
image {
width: 160rpx;
height: 160rpx;
}
}
.right {
display: flex;
flex-direction: column;
justify-content: space-around;
margin-left: 20rpx;
width: 65%;
height: 160rpx;
color: #fff;
text {
padding-top: 10rpx;
}
}
}
.workbench {
width: 100%;
padding: 5px 15px 0px;
.workbench-grid {
background-color: white;
margin-bottom: 10px;
padding: 20px 0;
border-radius: 10px;
.title {
color: gray;
font-size: 36rpx;
margin: 0 0 25px 15px;
}
.list {
display: flex;
flex-wrap: wrap;
.item {
position: relative;
width:25%;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom:50rpx;
color: #202020;
font-size:27rpx;
image {
width:80rpx;
height: 80rpx;
margin-bottom: 10rpx;
}
.num {
position: absolute;
background-color: red;
color: white;
right: 8px;
top: 0;
width: 50rpx;
height: 50rpx;
line-height: 50rpx;
border-radius: 50%;
text-align: center;
font-size: 30rpx;
}
}
}
}
}
</style>