Files
SmartParks_uniapp/pages/sys/workbench/unitManagement/unitManagement.vue
2025-09-04 18:05:06 +08:00

370 lines
7.9 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="unit-management">
<!-- 顶部单位信息栏 -->
<view class="unit-header-container">
<view class="unit-header">
<image class="header-icon" src="/static/ic_enterprise.png" mode="aspectFit"/>
<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">
<image src="/static/ic_review.png" mode="aspectFit"/>
</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">
<image src="/static/ic_resign.png" mode="aspectFit"/>
</view>
</view>
</view>
</view>
<!-- 右侧邀请新员工卡片 -->
<view class="right-card" @click="showInviteDialog">
<image class="card-bg" src="/static/ic_unitBg.png" mode="aspectFill"/>
<view class="card-content">
<view class="card-text">
<view class="card-title">邀请新员工</view>
<view class="card-subtitle">入职/邀请</view>
</view>
<view class="card-icon">
<image src="/static/ic_Invite_employees.png" mode="aspectFit"/>
</view>
</view>
</view>
</view>
<!-- 邀请新员工弹窗 -->
<view class="invite-dialog" v-if="showDialog">
<view class="dialog-content">
<!-- 盾牌背景图 -->
<image class="shield-bg" src="/static/ic_shield.png" mode="aspectFit"/>
<!-- 手机插画部分 -->
<view class="phone-illustration">
<image class="phone-image" src="/static/121221.png" mode="aspectFit"/>
</view>
<!-- 二维码部分修改为动态生成 -->
<view class="qr-code-container" :style="{'--qr-size': qrSize + 'rpx'}">
<canvas id="qrcode" canvas-id="qrcode" style="width: 200px;height: 200px;"></canvas>
</view>
<!-- 关闭按钮 -->
<view class="close-circle-btn" @click.stop="hideInviteDialog">
<view class="close-x"></view>
</view>
</view>
</view>
</view>
</template>
<script>
// 引入二维码生成库
import uQRCode from 'uqrcodejs';
export default {
data() {
return {
showDialog: false,
qrSize: 400, // 与CSS中保持一致
}
},
methods: {
goToEmployeeReview() {
uni.navigateTo({
url: '/pages/sys/workbench/unitManagement/employeeAudits'
});
},
goToEmployeeManagement() {
uni.navigateTo({
url: '/pages/sys/workbench/unitManagement/employeeManagement'
});
},
showInviteDialog() {
this.showDialog = true;
this.$nextTick( () => {
this.makeQRCode();
});
},
hideInviteDialog() {
this.showDialog = false;
},
// 修改后的makeQRCode方法
makeQRCode() {
// 获取uQRCode实例
var qr = new uQRCode();
// 设置二维码内容
qr.data = "https://uqrcode.cn/doc";
// 设置二维码大小必须与canvas设置的宽高一致
qr.size = 200;
// 调用制作二维码方法
qr.make();
// 获取canvas上下文
var canvasContext = uni.createCanvasContext('qrcode', this); // 如果是组件this必须传入
// 设置uQRCode实例的canvas上下文
qr.canvasContext = canvasContext;
// 调用绘制方法将二维码图案绘制到canvas上
qr.drawCanvas();
}
}
}
</script>
<style scoped>
.unit-management {
display: flex;
flex-direction: column;
height: 95vh;
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 {
width: 77%;
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%;
}
/* 修复:统一用动态尺寸,移除固定宽高,优化居中 */
.qr-code-container {
/* 容器尺寸略大于二维码,留出白边 */
width:380rpx;
height: 380rpx;
background-color: white;
border-radius: 10rpx;
margin-top: 50rpx;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
position: relative;
top: 30rpx;
z-index: 1;
}
/* 新增圆形关闭按钮样式 */
.close-circle-btn {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
background-color: white;
display: flex;
justify-content: center;
align-items: center;
margin-top: 40rpx;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
position: relative;
z-index: 1;
cursor: pointer;
}
/* 创建X形状 */
.close-x {
position: relative;
width: 40rpx;
height: 40rpx;
}
.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);
}
</style>