增加单位管理的接口
This commit is contained in:
@@ -12,7 +12,7 @@ const install = (Vue, vm) => {
|
||||
|
||||
|
||||
login: (params = {}) => vm.$u.post(config.adminPath+'/auth/login', params),
|
||||
getUserInfo: (params = {}) => vm.$u.get(config.adminPath+'/system/user/profile', params),
|
||||
getUserInfo: (params = {}) => vm.$u.get(config.adminPath+'/property/xcx/person/getInfo', params),
|
||||
//工作台列表
|
||||
getFunList:(params = {})=>vm.$u.get(config.adminPath+'/system/funList/list', params),
|
||||
//我的访客列表
|
||||
@@ -112,7 +112,13 @@ const install = (Vue, vm) => {
|
||||
office: {
|
||||
treeData: (params = {}) => vm.$u.get(config.adminPath+'/sys/office/treeData', params),
|
||||
},
|
||||
|
||||
// 单位管理
|
||||
unit:{
|
||||
addEmployee:(params = {}) => vm.$u.post(config.adminPath+'/property/xcx/person', params),
|
||||
queryEmployeeById:(params = {}) => vm.$u.get(config.adminPath+'/property/xcx/person/'+ params.id),
|
||||
queryEmployee:(params = {}) => vm.$u.get(config.adminPath+'/property/xcx/person/list', params),
|
||||
updateEmployee:(params = {}) => vm.$u.put(config.adminPath+'/property/xcx/person', params),
|
||||
},
|
||||
// 增删改查例子
|
||||
testData: {
|
||||
form: (params = {}) => vm.$u.post(config.adminPath+'/test/testData/form', params),
|
||||
|
@@ -25,7 +25,7 @@ const install = (Vue, vm) => {
|
||||
req.header = [];
|
||||
}
|
||||
req.header["source"] = "uniapp";
|
||||
req.header["clientId"] = "dab457a1ea14411787c240db05bb0832"
|
||||
req.header["clientId"] = "22b351e7583881d0a608dd44371bae41"
|
||||
// 默认指定返回 JSON 数据
|
||||
if (!req.header[ajaxHeader]){
|
||||
req.header[ajaxHeader] = 'json';
|
||||
|
@@ -46,7 +46,7 @@ function uploadSingleFile({
|
||||
const headers = {
|
||||
'x-requested-with': 'XMLHttpRequest',
|
||||
source: 'uniapp',
|
||||
clientId: 'dab457a1ea14411787c240db05bb0832',
|
||||
clientId: '22b351e7583881d0a608dd44371bae41',
|
||||
};
|
||||
|
||||
// 手动加上 Token
|
||||
|
@@ -1,282 +1,282 @@
|
||||
<template>
|
||||
<view class="login-container">
|
||||
<!-- 顶部渐变背景和标题 -->
|
||||
<view class="login-header">
|
||||
<image class="login-bg-img" src="/static/ic_login_topbg.png" mode="widthFix" />
|
||||
<view class="login-title">登录注册</view>
|
||||
<view class="login-subtitle">欢迎使用数智南川</view>
|
||||
</view>
|
||||
<!-- 表单区域 -->
|
||||
<view class="login-form">
|
||||
<view class="input-row">
|
||||
<image class="iconfont" src="/static/ic_login_phone.png" />
|
||||
<input class="login-input" type="text" placeholder="输入手机号" v-model="username" />
|
||||
</view>
|
||||
<view class="input-row">
|
||||
<image class="iconfont2" src="/static/ic_login_code.png" />
|
||||
<input class="login-input" type="text" placeholder="请输入验证码" v-model="password"/>
|
||||
<button class="code-btn">获取校验码</button>
|
||||
</view>
|
||||
<view class="protocol-row">
|
||||
<label class="custom-checkbox-label">
|
||||
<input type="checkbox" :checked="checked" @change="handleCheckboxChange"
|
||||
class="custom-checkbox-input" />
|
||||
<image :src="checked ? '/static/ic_login_agree.png' : '/static/ic_login_dis.png'"
|
||||
class="custom-checkbox-img" @click="handleCheckboxChange({ target: { checked: !checked }})" />
|
||||
</label>
|
||||
<text>同意</text>
|
||||
<text class="protocol-link">《用户协议》</text>
|
||||
<text>和</text>
|
||||
<text class="protocol-link">《隐私政策》</text>
|
||||
</view>
|
||||
<button class="login-btn" @click="submit">登录</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="login-container">
|
||||
<!-- 顶部渐变背景和标题 -->
|
||||
<view class="login-header">
|
||||
<image class="login-bg-img" src="/static/ic_login_topbg.png" mode="widthFix"/>
|
||||
<view class="login-title">登录注册</view>
|
||||
<view class="login-subtitle">欢迎使用数智南川</view>
|
||||
</view>
|
||||
<!-- 表单区域 -->
|
||||
<view class="login-form">
|
||||
<view class="input-row">
|
||||
<image class="iconfont" src="/static/ic_login_phone.png"/>
|
||||
<input class="login-input" type="text" placeholder="输入手机号" v-model="username"/>
|
||||
</view>
|
||||
<view class="input-row">
|
||||
<image class="iconfont2" src="/static/ic_login_code.png"/>
|
||||
<input class="login-input" type="text" placeholder="请输入验证码" v-model="password"/>
|
||||
<button class="code-btn">获取校验码</button>
|
||||
</view>
|
||||
<view class="protocol-row">
|
||||
<label class="custom-checkbox-label">
|
||||
<input type="checkbox" :checked="checked" @change="handleCheckboxChange"
|
||||
class="custom-checkbox-input"/>
|
||||
<image :src="checked ? '/static/ic_login_agree.png' : '/static/ic_login_dis.png'"
|
||||
class="custom-checkbox-img" @click="handleCheckboxChange({ target: { checked: !checked }})"/>
|
||||
</label>
|
||||
<text>同意</text>
|
||||
<text class="protocol-link">《用户协议》</text>
|
||||
<text>和</text>
|
||||
<text class="protocol-link">《隐私政策》</text>
|
||||
</view>
|
||||
<button class="login-btn" @click="submit">登录</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import base64 from '@/common/base64.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
phoneNo: '',
|
||||
username: 'admin',
|
||||
password: 'admin123',
|
||||
loginType: 'currentPhone',
|
||||
showPassword: false,
|
||||
remember: true,
|
||||
isValidCodeLogin: false,
|
||||
validCode: '',
|
||||
imgValidCodeSrc: null,
|
||||
list: [{
|
||||
name: '用户名'
|
||||
}, {
|
||||
name: '手机号'
|
||||
}],
|
||||
current: 0,
|
||||
activeColor: '#007aff',
|
||||
checked: false
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getUserInfo()
|
||||
},
|
||||
methods: {
|
||||
async submit() {
|
||||
if (this.username.length == 0) {
|
||||
this.$u.toast('请输入账号');
|
||||
return;
|
||||
}
|
||||
if (this.password.length == 0) {
|
||||
this.$u.toast('请输入密码');
|
||||
return;
|
||||
}
|
||||
let res = await this.$u.api.login({
|
||||
"tenantId": "000000", // 把单引号换成双引号
|
||||
"username": this.username,
|
||||
"password": this.password,
|
||||
"grantType": "password",
|
||||
"uuid": "7cb3ea4fe2ae4f08bbd561c94ef0191b",
|
||||
"clientId": "dab457a1ea14411787c240db05bb0832"
|
||||
});
|
||||
console.log(res)
|
||||
if (res.code == "200") {
|
||||
this.$u.toast("登录成功")
|
||||
this.$store.commit('$uStore', {
|
||||
name: 'vuex_token',
|
||||
value: res.data.access_token
|
||||
});
|
||||
this.getUserInfo()
|
||||
// setTimeout(() => {
|
||||
// uni.reLaunch({
|
||||
// url: '/pages/sys/home/home'
|
||||
// });
|
||||
// }, 500);
|
||||
}
|
||||
},
|
||||
getUserInfo(){
|
||||
this.$u.api.getUserInfo({loginCheck: true}).then(res => {
|
||||
if (res.code == '200'){
|
||||
this.$store.commit('$uStore', {
|
||||
name: 'vuex_user',
|
||||
value: res.data.user
|
||||
});
|
||||
uni.reLaunch({
|
||||
url: '/pages/sys/home/home'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
handleCheckboxChange(e) {
|
||||
this.checked = e.target.checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
phoneNo: '',
|
||||
username: '15604081234',
|
||||
password: 'admin123',
|
||||
loginType: 'currentPhone',
|
||||
showPassword: false,
|
||||
remember: true,
|
||||
isValidCodeLogin: false,
|
||||
validCode: '',
|
||||
imgValidCodeSrc: null,
|
||||
list: [{
|
||||
name: '用户名'
|
||||
}, {
|
||||
name: '手机号'
|
||||
}],
|
||||
current: 0,
|
||||
activeColor: '#007aff',
|
||||
checked: false
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getUserInfo()
|
||||
},
|
||||
methods: {
|
||||
async submit() {
|
||||
if (this.username.length == 0) {
|
||||
this.$u.toast('请输入账号');
|
||||
return;
|
||||
}
|
||||
if (this.password.length == 0) {
|
||||
this.$u.toast('请输入密码');
|
||||
return;
|
||||
}
|
||||
let res = await this.$u.api.login({
|
||||
"tenantId": "000000",
|
||||
"username": this.username,
|
||||
"password": this.password,
|
||||
"rememberMe": false,
|
||||
"clientId": "22b351e7583881d0a608dd44371bae41",
|
||||
"grantType": "resident"
|
||||
});
|
||||
console.log(res)
|
||||
if (res.code == "200") {
|
||||
this.$u.toast("登录成功")
|
||||
this.$store.commit('$uStore', {
|
||||
name: 'vuex_token',
|
||||
value: res.data.access_token
|
||||
});
|
||||
this.getUserInfo()
|
||||
// setTimeout(() => {
|
||||
// uni.reLaunch({
|
||||
// url: '/pages/sys/home/home'
|
||||
// });
|
||||
// }, 500);
|
||||
}
|
||||
},
|
||||
getUserInfo() {
|
||||
this.$u.api.getUserInfo({loginCheck: true}).then(res => {
|
||||
if (res.code == '200') {
|
||||
console.log(res.data)
|
||||
this.$store.commit('$uStore', {
|
||||
name: 'vuex_user',
|
||||
value: res.data
|
||||
});
|
||||
uni.reLaunch({
|
||||
url: '/pages/sys/home/home'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
handleCheckboxChange(e) {
|
||||
this.checked = e.target.checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.login-container {
|
||||
min-height: 100vh;
|
||||
background: #fafbfc;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.login-container {
|
||||
min-height: 100vh;
|
||||
background: #fafbfc;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.login-header {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
.login-header {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.login-bg-img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 0;
|
||||
}
|
||||
.login-bg-img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.login-title,
|
||||
.login-subtitle {
|
||||
position: relative;
|
||||
top: 164rpx;
|
||||
z-index: 2;
|
||||
}
|
||||
.login-title,
|
||||
.login-subtitle {
|
||||
position: relative;
|
||||
top: 164rpx;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.login-title {
|
||||
color: #fff;
|
||||
font-size: 48rpx;
|
||||
font-weight: bold;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
.login-title {
|
||||
color: #fff;
|
||||
font-size: 48rpx;
|
||||
font-weight: bold;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.login-subtitle {
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.login-subtitle {
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.login-form {
|
||||
width: 80%;
|
||||
margin-top: 400rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.login-form {
|
||||
width: 80%;
|
||||
margin-top: 400rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.input-row {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #eee;
|
||||
margin-bottom: 30rpx;
|
||||
padding-bottom: 10rpx;
|
||||
}
|
||||
.input-row {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #eee;
|
||||
margin-bottom: 30rpx;
|
||||
padding-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
font-size: 32rpx;
|
||||
margin-right: 16rpx;
|
||||
width: 27rpx;
|
||||
height: 43rpx;
|
||||
}
|
||||
.iconfont {
|
||||
font-size: 32rpx;
|
||||
margin-right: 16rpx;
|
||||
width: 27rpx;
|
||||
height: 43rpx;
|
||||
}
|
||||
|
||||
.iconfont2 {
|
||||
font-size: 32rpx;
|
||||
margin-right: 16rpx;
|
||||
width: 31rpx;
|
||||
height: 35rpx;
|
||||
}
|
||||
.iconfont2 {
|
||||
font-size: 32rpx;
|
||||
margin-right: 16rpx;
|
||||
width: 31rpx;
|
||||
height: 35rpx;
|
||||
}
|
||||
|
||||
.login-input {
|
||||
flex: 1;
|
||||
border: none;
|
||||
background: transparent;
|
||||
font-size: 28rpx;
|
||||
padding: 10rpx 0;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.login-input {
|
||||
flex: 1;
|
||||
border: none;
|
||||
background: transparent;
|
||||
font-size: 28rpx;
|
||||
padding: 10rpx 0;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.code-btn {
|
||||
background: none;
|
||||
color: #2e6cf6;
|
||||
border: none;
|
||||
font-size: 26rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
.code-btn {
|
||||
background: none;
|
||||
color: #2e6cf6;
|
||||
border: none;
|
||||
font-size: 26rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
.protocol-row {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 20rpx 0 40rpx 0;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.protocol-row {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 20rpx 0 40rpx 0;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.protocol-checkbox {
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.protocol-checkbox {
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.protocol-link {
|
||||
color: #2e6cf6;
|
||||
margin: 0 4rpx;
|
||||
}
|
||||
.protocol-link {
|
||||
color: #2e6cf6;
|
||||
margin: 0 4rpx;
|
||||
}
|
||||
|
||||
.login-btn {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
background: linear-gradient(90deg, #2e6cf6 0%, #4fc3f7 100%);
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
border: none;
|
||||
border-radius: 40rpx;
|
||||
margin-top: 268rpx;
|
||||
}
|
||||
.login-btn {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
background: linear-gradient(90deg, #2e6cf6 0%, #4fc3f7 100%);
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
border: none;
|
||||
border-radius: 40rpx;
|
||||
margin-top: 268rpx;
|
||||
}
|
||||
|
||||
.custom-checkbox-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.custom-checkbox-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.custom-checkbox-input {
|
||||
display: none;
|
||||
}
|
||||
.custom-checkbox-input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.custom-checkbox-span {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
border-radius: 50%;
|
||||
border: 2rpx solid #2e6cf6;
|
||||
background: #fff;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
.custom-checkbox-span {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
border-radius: 50%;
|
||||
border: 2rpx solid #2e6cf6;
|
||||
background: #fff;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
.custom-checkbox-span.checked {
|
||||
background: #2e6cf6;
|
||||
border-color: #2e6cf6;
|
||||
}
|
||||
.custom-checkbox-span.checked {
|
||||
background: #2e6cf6;
|
||||
border-color: #2e6cf6;
|
||||
}
|
||||
|
||||
.custom-checkbox-span.checked::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 7rpx;
|
||||
top: 7rpx;
|
||||
width: 12rpx;
|
||||
height: 12rpx;
|
||||
background: #fff;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.custom-checkbox-span.checked::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 7rpx;
|
||||
top: 7rpx;
|
||||
width: 12rpx;
|
||||
height: 12rpx;
|
||||
background: #fff;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.custom-checkbox-img {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.custom-checkbox-img {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
</style>
|
@@ -108,7 +108,6 @@
|
||||
this.realSubmit();
|
||||
return;
|
||||
}
|
||||
|
||||
const result = await uploadFiles({
|
||||
files: images,
|
||||
url: this.vuex_config.baseUrl + '/resource/oss/upload',
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<view class="user-info">
|
||||
<view class="info-row">
|
||||
<text class="label">用户姓名:</text>
|
||||
<text class="value">余永乐</text>
|
||||
<text class="value">{{auditsDetail.userName}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="label">性别:</text>
|
||||
@@ -16,15 +16,15 @@
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="label">证件号:</text>
|
||||
<text class="value">5001255658789955</text>
|
||||
<text class="value">{{auditsDetail.idCard}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="label">联系电话:</text>
|
||||
<text class="value">17898987887</text>
|
||||
<text class="value">{{auditsDetail.phone}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="label">所属单位:</text>
|
||||
<text class="value">x x x x x</text>
|
||||
<text class="value">{{auditsDetail.name}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 人脸图片区域 -->
|
||||
@@ -32,7 +32,7 @@
|
||||
<text class="label">人脸图片:</text>
|
||||
<image
|
||||
class="face-image"
|
||||
:src="auditsDetail.avatar || '/static/ic_avg.png'"
|
||||
:src="auditsDetail.img || '/static/ic_avg.png'"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
</view>
|
||||
@@ -43,11 +43,11 @@
|
||||
<view class="user-info">
|
||||
<view class="info-row">
|
||||
<text class="label">邮箱:</text>
|
||||
<text class="value">-</text>
|
||||
<text class="value">{{auditsDetail.email}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="label">车牌号:</text>
|
||||
<text class="value">-</text>
|
||||
<text class="value">{{auditsDetail.carNumber}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -73,16 +73,54 @@
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
onLoad(options) {
|
||||
if (options.id) {
|
||||
const id = options.id;
|
||||
this.auditsDetail.id = id;
|
||||
this.queryEmployee(id);
|
||||
}
|
||||
},
|
||||
// 原有方法保持不变...
|
||||
handleApprove() {
|
||||
console.log('approve');
|
||||
this.auditsDetail.isAudit=1
|
||||
this.$u.api.unit.updateEmployee(this.auditsDetail).then(res => {
|
||||
if (res.code == "200") {
|
||||
// 提交逻辑
|
||||
uni.showToast({
|
||||
title: '审核通过',
|
||||
icon: 'success',
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/sys/workbench/unitManagement/employeeAudits'
|
||||
});
|
||||
}, 600);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleReject() {
|
||||
console.log('reject');
|
||||
},
|
||||
async submit(action) {
|
||||
// 提交逻辑...
|
||||
this.auditsDetail.isAudit=2
|
||||
this.$u.api.unit.updateEmployee(this.auditsDetail).then(res => {
|
||||
if (res.code == "200") {
|
||||
// 提交逻辑
|
||||
uni.showToast({
|
||||
title: '拒绝通过',
|
||||
icon: 'success',
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/sys/workbench/unitManagement/employeeAudits'
|
||||
});
|
||||
}, 600);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
queryEmployee(id){
|
||||
this.$u.api.unit.queryEmployeeById(this.auditsDetail).then(res => {
|
||||
this.auditsDetail = res.data;
|
||||
});
|
||||
}
|
||||
// 其他原有方法...
|
||||
}
|
||||
};
|
||||
|
@@ -11,48 +11,51 @@
|
||||
<!-- 用户姓名 -->
|
||||
<view class="form-item">
|
||||
<text class="item-label required">用户姓名</text>
|
||||
<input class="item-input" type="text" placeholder="请输入"/>
|
||||
<input class="item-input" type="text" placeholder="请输入" v-model="employeeInfo.userName"/>
|
||||
</view>
|
||||
|
||||
<!-- 性别 -->
|
||||
<view class="form-item">
|
||||
<text class="item-label required">性别</text>
|
||||
<picker class="item-input" @change="bindPickerChange" :value="index" :range="array">
|
||||
<view class="picker-content">{{array[index]}}</view>
|
||||
<picker class="item-input" @change="bindPickerChange" :range="array"
|
||||
v-model="employeeInfo.gender">
|
||||
<view class="picker-content">{{ array[index] }}</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<!-- 证件号 -->
|
||||
<view class="form-item">
|
||||
<text class="item-label required">证件号</text>
|
||||
<input class="item-input" type="text" placeholder="请输入"/>
|
||||
<input class="item-input" type="text" placeholder="请输入" v-model="employeeInfo.idCard"
|
||||
@blur="validateIdCard"/>
|
||||
</view>
|
||||
|
||||
<!-- 联系电话 -->
|
||||
<view class="form-item">
|
||||
<text class="item-label required">联系电话</text>
|
||||
<input class="item-input" type="number" placeholder="请输入"/>
|
||||
<input class="item-input" type="number" placeholder="请输入" v-model="employeeInfo.phone"/>
|
||||
</view>
|
||||
|
||||
<!-- 验证码 -->
|
||||
<view class="form-item">
|
||||
<text class="item-label required">验证码</text>
|
||||
<view class="code-input-wrapper">
|
||||
<input class="item-input code-input" type="number" placeholder="请输入"/>
|
||||
<button class="get-code-btn">获取验证码</button>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <!– 验证码 –>-->
|
||||
<!-- <view class="form-item">-->
|
||||
<!-- <text class="item-label required">验证码</text>-->
|
||||
<!-- <view class="code-input-wrapper">-->
|
||||
<!-- <input class="item-input code-input" type="number" placeholder="请输入"/>-->
|
||||
<!-- <button class="get-code-btn">获取验证码</button>-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
|
||||
<!-- 登录密码 -->
|
||||
<view class="form-item">
|
||||
<text class="item-label required">登录密码</text>
|
||||
<input class="item-input" type="password" placeholder="请输入"/>
|
||||
<input class="item-input" type="password" placeholder="请输入" v-model="employeeInfo.password"
|
||||
@blur="validatePassword"/>
|
||||
</view>
|
||||
|
||||
<!-- 确认密码 -->
|
||||
<view class="form-item">
|
||||
<text class="item-label required">确认密码</text>
|
||||
<input class="item-input" type="password" placeholder="请输入"/>
|
||||
<input class="item-input" type="password" placeholder="请输入" v-model="rePassword" @blur="validatePassword"/>
|
||||
</view>
|
||||
|
||||
<!-- 密码提示 -->
|
||||
@@ -67,46 +70,66 @@
|
||||
<view class="face-upload-container">
|
||||
<view class="upload-wrapper">
|
||||
<button class="upload-btn" @click="chooseImage">+</button>
|
||||
<view class="image-preview" v-if="imageUrl">
|
||||
<image :src="imageUrl" mode="aspectFill" class="preview-image"></image>
|
||||
<view class="image-preview" v-if="employeeInfo.img">
|
||||
<image :src="employeeInfo.img" mode="aspectFill" class="preview-image"></image>
|
||||
<view class="delete-btn" @click="deleteImage">×</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-tip upload-tip">
|
||||
请上传正脸并不超过5MB的jpg,jpeg,png,gif,webp格式文件
|
||||
</view>
|
||||
<view class="form-tip upload-tip">
|
||||
请上传正脸并不超过5MB的jpg,jpeg,png,gif,webp格式文件
|
||||
</view>
|
||||
|
||||
<!-- 邮箱和车牌号码 -->
|
||||
<view class="form-item">
|
||||
<text class="item-label">邮箱</text>
|
||||
<input class="item-input" type="text" placeholder="请输入"/>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<text class="item-label">车牌号码</text>
|
||||
<input class="item-input" type="text" placeholder="请输入"/>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<text class="item-label">邮箱</text>
|
||||
<input class="item-input" type="text" placeholder="请输入" v-model="employeeInfo.email"/>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<text class="item-label">车牌号码</text>
|
||||
<input class="item-input" type="text" placeholder="请输入" v-model="employeeInfo.carNumber"/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 提交按钮 -->
|
||||
<button class="submit-btn">提交</button>
|
||||
<button class="submit-btn" @click="submitForm">提交</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {uploadFiles} from "../../../../common/upload";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
imageUrl: '', // 存储上传的图片URL
|
||||
array: ['男', '女'],
|
||||
index: 0,
|
||||
employeeInfo: {
|
||||
userName: '',
|
||||
gender: 1,
|
||||
idCard: '',
|
||||
phone: '',
|
||||
password: '',
|
||||
img: '',
|
||||
unitId: '',
|
||||
email:'',
|
||||
carNumber:''
|
||||
},
|
||||
rePassword: '',
|
||||
passwordError: '', // 用于显示密码错误信息
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options.unitId) {
|
||||
const unitId = JSON.parse(decodeURIComponent(options.unitId));
|
||||
this.employeeInfo.unitId = unitId;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
bindPickerChange: function(e) {
|
||||
console.log('picker发送选择改变,携带值为', e.detail.value)
|
||||
this.index = e.detail.value
|
||||
bindPickerChange: function (e) {
|
||||
|
||||
this.employeeInfo.gender = e.detail.value + 1
|
||||
console.log('picker发送选择改变,携带值为', this.employeeInfo.gender)
|
||||
},
|
||||
// 选择图片
|
||||
chooseImage() {
|
||||
@@ -114,16 +137,92 @@ export default {
|
||||
count: 1,
|
||||
sizeType: ['compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: (res) => {
|
||||
success: async (res) => {
|
||||
const tempFilePaths = res.tempFilePaths;
|
||||
this.imageUrl = tempFilePaths[0];
|
||||
// 这里可以添加图片上传到服务器的逻辑
|
||||
this.employeeInfo.img = tempFilePaths[0];
|
||||
console.log(tempFilePaths);
|
||||
// 图片上传到服务器的逻辑
|
||||
const result = await uploadFiles({
|
||||
files: tempFilePaths,
|
||||
url: this.vuex_config.baseUrl + '/resource/oss/upload',
|
||||
name: 'file',
|
||||
vm: this // 关键:用于注入 token 等
|
||||
});
|
||||
const allSuccess = result.every(item => item.code == 200);
|
||||
if (!allSuccess) {
|
||||
uni.showToast({
|
||||
title: '上传失败',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 删除图片
|
||||
deleteImage() {
|
||||
this.imageUrl = '';
|
||||
this.employeeInfo.img = '';
|
||||
}, // 提交表单
|
||||
submitForm() {
|
||||
//密码对比
|
||||
if (!this.validatePassword()) {
|
||||
uni.showToast({
|
||||
title: this.passwordError,
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
//身份证验证
|
||||
if (!this.validateIdCard()) {
|
||||
uni.showToast({
|
||||
title: "身份证格式不正确",
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.$u.api.unit.addEmployee(this.employeeInfo).then(res => {
|
||||
if (res.code == "200") {
|
||||
// 提交逻辑
|
||||
console.log('提交数据:', this.employeeInfo);
|
||||
uni.showToast({
|
||||
title: '提交成功',
|
||||
icon: 'success'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 密码验证方法
|
||||
validatePassword() {
|
||||
// 密码正则表达式:8-20位,包含大小写字母、数字和特殊字符
|
||||
const passwordRegex = /^(?=.*[a-zA-Z\d!@$%^&*$%&+&*=\[\]?])[a-zA-Z\d!@$%^&*$%&+&*=\[\]?]{8,20}$/;
|
||||
|
||||
// 验证密码格式
|
||||
if (!passwordRegex.test(this.employeeInfo.password)) {
|
||||
this.passwordError = '密码必须包含8-20位大小写字母、数字和特殊字符';
|
||||
return false;
|
||||
} else {
|
||||
this.passwordError = '';
|
||||
}
|
||||
|
||||
// 验证两次密码是否一致
|
||||
if (this.employeeInfo.password !== this.rePassword) {
|
||||
this.passwordError = '两次输入的密码不一致';
|
||||
return false;
|
||||
} else {
|
||||
this.passwordError = '';
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
validateIdCard() {
|
||||
const idCardRegex = /^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/;
|
||||
if (!idCardRegex.test(this.employeeInfo.idCard)) {
|
||||
uni.showToast({title: '身份证格式错误', icon: 'none'});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -232,26 +331,6 @@ export default {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* 上传区域 */
|
||||
.upload-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.upload-btn {
|
||||
width: 80px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
font-size: 14px;
|
||||
color: #409eff;
|
||||
background-color: #ecf5ff;
|
||||
border: 1px solid #b3d8ff;
|
||||
border-radius: 4px;
|
||||
margin-right: 10px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* 提交按钮 */
|
||||
.submit-btn {
|
||||
width: 100%;
|
||||
@@ -271,19 +350,7 @@ export default {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.upload-btn {
|
||||
width: 60px; /* 正方形 */
|
||||
height: 60px; /* 正方形 */
|
||||
line-height: 40px;
|
||||
font-size: 40px; /* 加大+号 */
|
||||
color: #409eff;
|
||||
background-color: #ecf5ff;
|
||||
border: 1px solid #b3d8ff;
|
||||
border-radius: 4px;
|
||||
margin-right: 10px;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.face-upload-item {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
@@ -345,4 +412,6 @@ export default {
|
||||
font-size: 14px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
@@ -2,7 +2,7 @@
|
||||
<view class="audits-container">
|
||||
<!-- 员工审核列表 -->
|
||||
<scroll-view
|
||||
class="list-container"
|
||||
class="employeeList-container"
|
||||
scroll-y
|
||||
:refresher-enabled="true"
|
||||
refresher-background="#f7f7f7"
|
||||
@@ -13,14 +13,14 @@
|
||||
scroll-with-animation>
|
||||
|
||||
<!-- 员工审核卡片 -->
|
||||
<view v-for="(item, index) in list" :key="index" class="employee-card" @click="handleCardClick(item)">
|
||||
<view v-for="(item, index) in employeeList" :key="index" class="employee-card" @click="handleCardClick(item)">
|
||||
<!-- 左侧头像 -->
|
||||
<image class="avatar" :src="item.avatar || '/static/ic_avg.png'"/>
|
||||
|
||||
<!-- 右侧信息 -->
|
||||
<view class="info-container">
|
||||
<view class="name-row">
|
||||
<text class="name">{{ item.name }}</text>
|
||||
<text class="name">{{ item.userName }}</text>
|
||||
<image
|
||||
class="gender-icon"
|
||||
:src="item.gender === '1' ? '/static/ic_man.png' : '/static/ic_women.png'"
|
||||
@@ -52,8 +52,7 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
list: [
|
||||
{name: "于永乐", gender: "1", phone: "12448155", applyTime: "2025-09-01 10:51:32", status: "1"}
|
||||
employeeList: [
|
||||
], // 员工列表数据
|
||||
pageNum: 1, // 当前页码
|
||||
pageSize: 10, // 每页数量
|
||||
@@ -84,11 +83,11 @@ export default {
|
||||
async loadData() {
|
||||
this.loading = true;
|
||||
try {
|
||||
let res = await this.$u.api.getEmployeeAuditList({
|
||||
let res = await this.$u.api.unit.queryEmployee({
|
||||
pageNum: this.pageNum,
|
||||
pageSize: this.pageSize
|
||||
pageSize: this.pageSize,
|
||||
isAudit:2
|
||||
});
|
||||
|
||||
if (res.code == "200") {
|
||||
let rows = res.rows || [];
|
||||
if (rows.length < this.pageSize) {
|
||||
@@ -96,9 +95,9 @@ export default {
|
||||
}
|
||||
|
||||
if (this.pageNum === 1) {
|
||||
this.list = rows;
|
||||
this.employeeList = rows;
|
||||
} else {
|
||||
this.list = [...this.list, ...rows];
|
||||
this.employeeList = [...this.employeeList, ...rows];
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -109,9 +108,10 @@ export default {
|
||||
},
|
||||
// 点击卡片事件
|
||||
handleCardClick(item) {
|
||||
if (item.status === '1') {
|
||||
console.log(item.id);
|
||||
if (item.state === 1) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/sys/workbench/unitManagement/auditsDetail`
|
||||
url: `/pages/sys/workbench/unitManagement/auditsDetail?id=${item.id}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@ export default {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.list-container {
|
||||
.employeeList-container {
|
||||
flex: 1;
|
||||
padding: 28rpx 30rpx;
|
||||
box-sizing: border-box;
|
||||
@@ -219,17 +219,17 @@ export default {
|
||||
}
|
||||
|
||||
/* 隐藏滚动条 */
|
||||
.list-container {
|
||||
.employeeList-container {
|
||||
-webkit-overflow-scrolling: touch;
|
||||
scrollbar-width: none;
|
||||
-ms-overflow-style: none;
|
||||
}
|
||||
|
||||
.list-container::-webkit-scrollbar {
|
||||
.employeeList-container::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep .list-container ::-webkit-scrollbar {
|
||||
:deep .employeeList-container ::-webkit-scrollbar {
|
||||
display: none !important;
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
|
@@ -116,7 +116,7 @@ export default {
|
||||
// 获取uQRCode实例
|
||||
var qr = new uQRCode();
|
||||
// 设置二维码内容
|
||||
qr.data = "localhost:8081/#/pages/sys/workbench/unitManagement/employeeAdd";
|
||||
qr.data = `/pages/sys/workbench/unitManagement/employeeAdd?unitId=${uni.getStorageSync('lifeData').vuex_user.unitId}`;
|
||||
// 设置二维码大小,必须与canvas设置的宽高一致
|
||||
qr.size = 200;
|
||||
// 调用制作二维码方法
|
||||
|
Reference in New Issue
Block a user