Files
SmartParks_uniapp/pages/sys/workbench/unitManagement/unitManagement.vue

370 lines
7.9 KiB
Vue
Raw Normal View History

2025-09-02 17:36:22 +08:00
<template>
<view class="unit-management">
<!-- 顶部单位信息栏 -->
<view class="unit-header-container">
<view class="unit-header">
2025-09-04 09:53:48 +08:00
<image class="header-icon" src="/static/ic_enterprise.png" mode="aspectFit"/>
2025-09-02 17:36:22 +08:00
<view class="unit-title">南川区******单位共189人</view>
</view>
</view>
<!-- 功能模块卡片区 -->
<view class="function-container">
<!-- 左侧列员工审核+员工管理 -->
<view class="left-column">
<!-- 员工审核卡片 -->
<view class="function-card" @click="goToEmployeeReview">
<view class="card-content">
<view class="card-text">
<view class="card-title">员工审核</view>
<view class="card-subtitle">入职/审核</view>
</view>
<view class="card-icon">
2025-09-04 09:53:48 +08:00
<image src="/static/ic_review.png" mode="aspectFit"/>
2025-09-02 17:36:22 +08:00
</view>
</view>
</view>
<!-- 员工管理卡片 -->
<view class="function-card" @click="goToEmployeeManagement">
<view class="card-content">
<view class="card-text">
<view class="card-title">员工管理</view>
<view class="card-subtitle">权限/离职</view>
</view>
<view class="card-icon">
2025-09-04 09:53:48 +08:00
<image src="/static/ic_resign.png" mode="aspectFit"/>
2025-09-02 17:36:22 +08:00
</view>
</view>
</view>
</view>
<!-- 右侧邀请新员工卡片 -->
<view class="right-card" @click="showInviteDialog">
2025-09-04 09:53:48 +08:00
<image class="card-bg" src="/static/ic_unitBg.png" mode="aspectFill"/>
2025-09-02 17:36:22 +08:00
<view class="card-content">
<view class="card-text">
<view class="card-title">邀请新员工</view>
<view class="card-subtitle">入职/邀请</view>
</view>
<view class="card-icon">
2025-09-04 09:53:48 +08:00
<image src="/static/ic_Invite_employees.png" mode="aspectFit"/>
2025-09-02 17:36:22 +08:00
</view>
</view>
</view>
</view>
<!-- 邀请新员工弹窗 -->
<view class="invite-dialog" v-if="showDialog">
<view class="dialog-content">
<!-- 盾牌背景图 -->
2025-09-04 09:53:48 +08:00
<image class="shield-bg" src="/static/ic_shield.png" mode="aspectFit"/>
2025-09-02 17:36:22 +08:00
<!-- 手机插画部分 -->
<view class="phone-illustration">
2025-09-04 09:53:48 +08:00
<image class="phone-image" src="/static/121221.png" mode="aspectFit"/>
2025-09-02 17:36:22 +08:00
</view>
2025-09-04 09:53:48 +08:00
<!-- 二维码部分修改为动态生成 -->
<view class="qr-code-container" :style="{'--qr-size': qrSize + 'rpx'}">
<canvas id="qrcode" canvas-id="qrcode" style="width: 200px;height: 200px;"></canvas>
2025-09-02 17:36:22 +08:00
</view>
<!-- 关闭按钮 -->
2025-09-04 18:05:06 +08:00
<view class="close-circle-btn" @click.stop="hideInviteDialog">
<view class="close-x"></view>
2025-09-02 17:36:22 +08:00
</view>
</view>
2025-09-04 18:05:06 +08:00
2025-09-02 17:36:22 +08:00
</view>
</view>
</template>
<script>
2025-09-04 09:53:48 +08:00
// 引入二维码生成库
import uQRCode from 'uqrcodejs';
2025-09-02 17:36:22 +08:00
export default {
data() {
return {
2025-09-04 09:53:48 +08:00
showDialog: false,
qrSize: 400, // 与CSS中保持一致
2025-09-02 17:36:22 +08:00
}
},
methods: {
goToEmployeeReview() {
uni.navigateTo({
2025-09-04 18:05:06 +08:00
url: '/pages/sys/workbench/unitManagement/employeeAudits'
2025-09-02 17:36:22 +08:00
});
},
goToEmployeeManagement() {
uni.navigateTo({
2025-09-04 18:05:06 +08:00
url: '/pages/sys/workbench/unitManagement/employeeManagement'
2025-09-02 17:36:22 +08:00
});
},
showInviteDialog() {
this.showDialog = true;
2025-09-04 09:53:48 +08:00
this.$nextTick( () => {
this.makeQRCode();
});
2025-09-02 17:36:22 +08:00
},
hideInviteDialog() {
this.showDialog = false;
2025-09-04 09:53:48 +08:00
},
// 修改后的makeQRCode方法
makeQRCode() {
// 获取uQRCode实例
var qr = new uQRCode();
// 设置二维码内容
2025-09-06 23:06:58 +08:00
qr.data = `/pages/sys/workbench/unitManagement/employeeAdd?unitId=${uni.getStorageSync('lifeData').vuex_user.unitId}`;
2025-09-04 09:53:48 +08:00
// 设置二维码大小必须与canvas设置的宽高一致
qr.size = 200;
// 调用制作二维码方法
qr.make();
// 获取canvas上下文
var canvasContext = uni.createCanvasContext('qrcode', this); // 如果是组件this必须传入
// 设置uQRCode实例的canvas上下文
qr.canvasContext = canvasContext;
// 调用绘制方法将二维码图案绘制到canvas上
qr.drawCanvas();
2025-09-02 17:36:22 +08:00
}
}
}
</script>
<style scoped>
.unit-management {
display: flex;
flex-direction: column;
2025-09-12 09:44:44 +08:00
height: 100vh;
2025-09-02 17:36:22 +08:00
background-color: #f5f5f5;
padding: 20rpx;
}
.unit-header-container {
display: flex;
justify-content: center;
margin-bottom: 20rpx;
}
.unit-header {
background-color: #2186FF;
padding: 20rpx 30rpx;
color: white;
border-radius: 16rpx;
width: 100%;
max-width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.header-icon {
width: 40rpx;
height: 40rpx;
margin: 0 40rpx;
}
.unit-title {
font-size: 36rpx;
font-weight: bold;
}
.function-container {
flex: 1;
display: flex;
flex-direction: row;
justify-content: space-between;
}
.left-column {
width: 48%;
height: 24%;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.right-card {
width: 48%;
height: 24%;
background-color: white;
border-radius: 16rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
display: flex;
flex-direction: column;
justify-content: center;
position: relative;
overflow: hidden;
}
.function-card {
width: 100%;
height: 46%;
background-color: white;
border-radius: 16rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
display: flex;
flex-direction: column;
justify-content: center;
}
.card-content {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 0 38rpx;
}
.card-text {
display: flex;
flex-direction: column;
}
.card-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 8rpx;
}
.card-subtitle {
font-size: 24rpx;
color: #ADADAD;
}
.card-icon {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
display: flex;
align-items: flex-end;
justify-content: center;
}
.card-icon image {
width: 60rpx;
height: 60rpx;
}
.card-bg {
padding-bottom: 24rpx;
width: 90%;
height: 50%;
top: 0;
left: 5%;
z-index: 0;
display: flex;
}
/* 邀请弹窗样式 */
.invite-dialog {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
}
.dialog-content {
2025-09-04 18:05:06 +08:00
width: 77%;
2025-09-02 17:36:22 +08:00
border-radius: 20rpx;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
overflow: hidden;
}
.shield-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
}
.phone-illustration {
position: relative;
width: 200rpx;
height: 200rpx;
margin-bottom: 40rpx;
z-index: 1;
}
.phone-image {
width: 100%;
height: 100%;
}
2025-09-04 09:53:48 +08:00
/* 修复:统一用动态尺寸,移除固定宽高,优化居中 */
2025-09-02 17:36:22 +08:00
.qr-code-container {
2025-09-04 09:53:48 +08:00
/* 容器尺寸略大于二维码,留出白边 */
width:380rpx;
height: 380rpx;
2025-09-02 17:36:22 +08:00
background-color: white;
border-radius: 10rpx;
2025-09-04 09:53:48 +08:00
margin-top: 50rpx;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
position: relative;
2025-09-04 18:05:06 +08:00
top: 30rpx;
2025-09-02 17:36:22 +08:00
z-index: 1;
}
2025-09-04 18:05:06 +08:00
/* 新增圆形关闭按钮样式 */
.close-circle-btn {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
background-color: white;
2025-09-02 17:36:22 +08:00
display: flex;
justify-content: center;
align-items: center;
2025-09-04 18:05:06 +08:00
margin-top: 40rpx;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
position: relative;
2025-09-02 17:36:22 +08:00
z-index: 1;
2025-09-04 18:05:06 +08:00
cursor: pointer;
2025-09-02 17:36:22 +08:00
}
2025-09-04 18:05:06 +08:00
/* 创建X形状 */
.close-x {
position: relative;
2025-09-02 17:36:22 +08:00
width: 40rpx;
height: 40rpx;
}
2025-09-04 18:05:06 +08:00
.close-x::before,
.close-x::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 40rpx;
height: 4rpx;
background-color: #999;
border-radius: 2rpx;
}
.close-x::before {
transform: translate(-50%, -50%) rotate(45deg);
}
.close-x::after {
transform: translate(-50%, -50%) rotate(-45deg);
}
2025-09-02 17:36:22 +08:00
</style>