页面修改

This commit is contained in:
2025-08-23 18:32:30 +08:00
parent 50dbd27f51
commit c74e635212
3 changed files with 75 additions and 5 deletions

View File

@@ -64,8 +64,17 @@
<view class="form-item">
<text class="label">被访单位</text>
<view class="input-wrapper">
<input type="text" placeholder="请输入被访单位名称" v-model="formData.interviewedUnit"/>
<view class="select-wrapper" :class="{active: showUnitDialog}" @click.stop="showUnitDialog = true">
<text>{{ formData.interviewedUnit || '请选择被访单位' }}</text>
<image class="filter-img" src="/static/ic_down_arrow_g.png"/>
<view v-if="showUnitDialog" class="dropdown">
<view class="dropdown-list">
<view v-for="(item, index) in unitList" :key="index" class="dropdown-item"
@click.stop="selectInterviewedUnit(item)">
{{ item.name }}
</view>
</view>
</view>
</view>
</view>
@@ -138,6 +147,11 @@
</view>
</view>
</view>
<view class="form-item">
<view class="face-tip-wrapper">
<text class="face-tip">请确保无遮挡光线明亮正脸拍摄</text>
</view>
</view>
<!-- <view class="form-item">
<text class="label">预约状态</text>
@@ -174,7 +188,7 @@ export default {
visitorPhone: '15555555555',
visitingReason: '',
interviewedPerson: '1',
interviewedUnit: '1',
interviewedUnit: '',
interviewedPhone: '15555555555',
visitingBeginDate: date,
visitingBeginTime: time,
@@ -194,7 +208,9 @@ export default {
3: '已完成'
},
typeList: ['业务洽谈', '会议参与', '面试应聘', '技术支持', '办事咨询', '调研考察'],
showTypeDialog: false
unitList: [],
showTypeDialog: false,
showUnitDialog: false
}
},
onLoad(options) {
@@ -218,6 +234,9 @@ export default {
// #ifdef APP-PLUS
plus.screen.lockOrientation('default');
// #endif
// 获取单位列表
this.getUnits();
},
onReady() {
// #ifdef APP-PLUS
@@ -226,20 +245,36 @@ export default {
},
mounted() {
document.addEventListener('click', this.handleClickOutside);
// 调用getUnits方法获取被访单位数据
this.getUnits();
},
beforeDestroy() {
document.removeEventListener('click', this.handleClickOutside);
},
methods: {
async getUnits() {
let res = await this.$u.api.getUnits();
if (res.code == '200') {
this.unitList = res.data;
}
},
// 添加选择拜访事由方法
selectVisitingReason(reason) {
this.formData.visitingReason = reason;
this.showTypeDialog = false;
},
// 添加选择被访单位方法
selectInterviewedUnit(unit) {
this.formData.interviewedUnit = unit.name;
this.formData.interviewedUnitId = unit.value;
this.showUnitDialog = false;
},
// 点击外部关闭下拉菜单
handleClickOutside() {
this.showTypeDialog = false;
this.showUnitDialog = false;
},
// 处理日期时间选择
@@ -277,6 +312,20 @@ export default {
success: (res) => {
// console.log(res.tempFilePaths[0])
this.formData.facePictures = res.tempFilePaths[0];
// 压缩图片
uni.compressImage({
src: this.formData.facePictures, // 原图路径
quality: 70, // 压缩质量 0-100
success: (res) => {
this.formData.facePictures = res.tempFilePath
},
fail: (err) => {
uni.showToast({
title: '拍照失败',
icon: 'none'
});
}
});
},
fail: (err) => {
uni.showToast({
@@ -297,6 +346,7 @@ export default {
visitorPhone,
visitingReason,
interviewedPerson,
interviewedUnit,
bookingParkingSpace,
licensePlate,
facePictures,
@@ -316,6 +366,11 @@ export default {
return '请输入证件号';
}
// 验证被访单位
if (!interviewedUnit) {
return '请选择被访单位';
}
// 验证电话
if (!visitorPhone) {
return '请输入联系电话';
@@ -428,6 +483,7 @@ export default {
const ossId = parsedData.data.ossId;
console.log("ossId",ossId)
submitData.facePictures=ossId;
submitData.interviewedUnitId = this.formData.interviewedUnitId;
console.log(submitData)
this.$u.api.fksub(submitData).then(res => {
console.log(res)
@@ -520,6 +576,7 @@ export default {
visitingReason: '',
interviewedPerson: '',
interviewedUnit: '',
interviewedUnitId: '',
interviewedPhone: '',
visitingBeginDate: date,
visitingBeginTime: time,
@@ -780,4 +837,13 @@ export default {
.dropdown-item:hover {
background-color: #f5f7fa;
}
.face-tip-wrapper {
flex: 1;
margin-left: 108px; /* 与label宽度和margin一致 */
}
.face-tip {
font-size: 12px;
color: #999;
}
</style>