最小薪资提示
This commit is contained in:
@@ -50,9 +50,11 @@
|
|||||||
<view class="label">最小薪资 (元/月)</view>
|
<view class="label">最小薪资 (元/月)</view>
|
||||||
<input
|
<input
|
||||||
class="input"
|
class="input"
|
||||||
placeholder="请输入最小薪资"
|
placeholder="请输入最小薪资(最低2000元)"
|
||||||
type="number"
|
type="number"
|
||||||
v-model="formData.minSalary"
|
v-model="formData.minSalary"
|
||||||
|
@input="handleMinSalaryInput"
|
||||||
|
@blur="handleMinSalaryBlur"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="form-group">
|
<view class="form-group">
|
||||||
@@ -285,7 +287,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted, onUnmounted } from 'vue';
|
import { ref, reactive, onMounted, onUnmounted, watch } from 'vue';
|
||||||
import { onShow } from '@dcloudio/uni-app';
|
import { onShow } from '@dcloudio/uni-app';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { createRequest } from '@/utils/request';
|
import { createRequest } from '@/utils/request';
|
||||||
@@ -393,6 +395,15 @@ onShow(() => {
|
|||||||
getCompanyInfo();
|
getCompanyInfo();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 监听最小薪资变化
|
||||||
|
watch(() => formData.minSalary, (newValue) => {
|
||||||
|
console.log('minSalary changed to:', newValue);
|
||||||
|
if (newValue && parseFloat(newValue) < 2000) {
|
||||||
|
console.log('setting minSalary to 2000 via watch');
|
||||||
|
formData.minSalary = '2000';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 获取企业信息(参考首页方法)
|
// 获取企业信息(参考首页方法)
|
||||||
const getCompanyInfo = () => {
|
const getCompanyInfo = () => {
|
||||||
try {
|
try {
|
||||||
@@ -704,6 +715,32 @@ const handleCompanySelected = (company) => {
|
|||||||
formData.companyId = company.id;
|
formData.companyId = company.id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 处理最小薪资输入
|
||||||
|
const handleMinSalaryInput = (e) => {
|
||||||
|
let value = e.detail.value;
|
||||||
|
if (value && parseFloat(value) < 2000) {
|
||||||
|
formData.minSalary = '2000';
|
||||||
|
uni.showToast({
|
||||||
|
title: '最小薪资最低为2000元',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 处理最小薪资失去焦点
|
||||||
|
const handleMinSalaryBlur = () => {
|
||||||
|
console.log('blur event triggered');
|
||||||
|
console.log('current minSalary:', formData.minSalary);
|
||||||
|
let value = formData.minSalary;
|
||||||
|
if (value && parseFloat(value) < 2000) {
|
||||||
|
console.log('setting minSalary to 2000');
|
||||||
|
formData.minSalary = '2000';
|
||||||
|
uni.showToast({
|
||||||
|
title: '最小薪资最低为2000元',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 发布岗位
|
// 发布岗位
|
||||||
const publishJob = async () => {
|
const publishJob = async () => {
|
||||||
@@ -824,6 +861,14 @@ const validateForm = () => {
|
|||||||
const minSalary = parseFloat(formData.minSalary);
|
const minSalary = parseFloat(formData.minSalary);
|
||||||
const maxSalary = parseFloat(formData.maxSalary);
|
const maxSalary = parseFloat(formData.maxSalary);
|
||||||
|
|
||||||
|
if (minSalary < 2000) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '最小薪资最低为2000元',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (minSalary >= maxSalary) {
|
if (minSalary >= maxSalary) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '最大薪资必须大于最小薪资',
|
title: '最大薪资必须大于最小薪资',
|
||||||
|
|||||||
@@ -698,7 +698,7 @@ const changePoliticalAffiliation = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function generateDatePickerArrays(startYear = 1975, endYear = new Date().getFullYear()) {
|
function generateDatePickerArrays(startYear = 1950, endYear = new Date().getFullYear()) {
|
||||||
const years = [];
|
const years = [];
|
||||||
const months = [];
|
const months = [];
|
||||||
const days = [];
|
const days = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user