| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671 |
- <template>
- <view class="switch-roles">
- <nav-bar title="选择职位要求" color="#000"></nav-bar>
- <view class="roles-content">
- <view class="content">
- <view class="title">继续填写</view>
- <view class="desc">“{{companyName}}”的职位要求</view>
- <view class="step">
- <u-steps :list="numList" mode="number" :current="2"></u-steps>
- </view>
- <!-- 经验要求 -->
- <view class="check-title-big">经验要求</view>
- <view class="check-select" @click="showExper = true">
- <view class="select-txt">{{ selectedExper || "请选择经验要求" }}</view>
- <u-icon name="arrow-down" color="#D3D3D6" size="22"></u-icon>
- </view>
- <!-- 最低学历 -->
- <view class="check-title-big">最低学历</view>
- <view class="check-select" @click="showLevel = true">
- <view class="select-txt">{{ selectedLevel || "请选择学历" }}</view>
- <u-icon name="arrow-down" color="#D3D3D6" size="22"></u-icon>
- </view>
- <!-- 薪资范围 -->
- <view class="check-title-big">薪资范围</view>
- <view class="check-select" @click="showMoney = true">
- <view class="select-txt">{{ selectedSalary+'——'+salaryTimes || "请选择合理的薪资范围" }}</view>
- <u-icon name="arrow-down" color="#D3D3D6" size="22"></u-icon>
- </view>
- <!-- 福利待遇 -->
- <view class="check-title-big">福利待遇(选填)</view>
- <view class="check-select" @click="goFund">
- <view class="select-txt">{{ welfareTag || "请填写奖金绩效" }}</view>
- <u-icon name="arrow-down" color="#D3D3D6" size="22"></u-icon>
- </view>
- <!-- 职位关键词 -->
- <view class="check-title-big">职位关键词</view>
- <view class="check-select" @click="goJobSkill">
- <view class="select-txt">{{ positionTag || "被选中的关键词将突出展示给牛人" }}</view>
- <u-icon name="arrow-down" color="#D3D3D6" size="22"></u-icon>
- </view>
- <!-- 工作地址 -->
- <view class="check-title-big">工作地址</view>
- <view class="check-select" @click="goAddAddress">
- <view class="select-txt">{{ address || stationName.fullText || "请填写精确的工作地点" }}</view>
- <u-icon name="arrow-down" color="#D3D3D6" size="22"></u-icon>
- </view>
- <view class="txt-desc">
- 温馨提示:职位类型、职位名称和工作城市发布后不可修改,请您确保信息正确 <br /><br />
- 发布职位即表示同意遵守《招聘行为管理规范》,如违反规则将导致账号被锁定
- </view>
- </view>
- </view>
- <view class="submit-btn" @click="submitPost">确定</view>
- <!-- 经验选择器 -->
- <u-select v-model="showExper" :list="listExper" title="请选择经验" @confirm="onExperConfirm"
- @cancel="showExper = false"></u-select>
- <!-- 学历选择器 -->
- <u-select v-model="showLevel" :list="listLevel" title="请选择学历" @confirm="onLevelConfirm"
- @cancel="showLevel = false"></u-select>
- <!-- 薪资选择器 -->
- <u-select v-model="showMoney" mode="mutil-column" :list="listMoney" title="请选择月薪范围" @confirm="onMoneyConfirm"
- @cancel="showMoney = false"></u-select>
- </view>
- </template>
- <script>
- import navBar from "@/components/nav-bar/index.vue";
- export default {
- data() {
- return {
- // 选中值(用于页面渲染)
- selectedExper: "", // 经验
- selectedLevel: "", // 学历
- selectedSalary: "", // 薪资范围
- welfareTag: "", // 福利待遇
- positionTag: "", // 职位关键词
- stationName: [],
- companyName: "",
- companyId: "",
- status: 1,
- pid: "",
- address:"",
- salaryTimes:"",
- // 选择器显示控制
- showExper: false,
- showLevel: false,
- showMoney: false,
-
- // 经验选择数据源
- listExper: [{
- label: "不限",
- value: "不限"
- },
- {
- label: "1年以内",
- value: "1年以内"
- },
- {
- label: "1-3年",
- value: "1-3年"
- },
- {
- label: "3-5年",
- value: "3-5年"
- },
- {
- label: "5-8年",
- value: "5-8年"
- },
- {
- label: "8年以上",
- value: "8年以上"
- },
- ],
- // 学历选择数据源
- listLevel: [{
- label: "不限",
- value: "不限"
- },
- {
- label: "专科",
- value: "专科"
- },
- {
- label: "本科",
- value: "本科"
- },
- {
- label: "硕士",
- value: "硕士"
- },
- {
- label: "博士",
- value: "博士"
- },
- ],
- // 薪资选择数据源(修正格式)
- listMoney: [
- [{
- value: "3k",
- label: "3k"
- },
- {
- value: "4k",
- label: "4k"
- },
- {
- value: "5k",
- label: "5k"
- },
- {
- value: "6k",
- label: "6k"
- },
- {
- value: "8k",
- label: "8k"
- },
- {
- value: "10k",
- label: "10k"
- },
- {
- value: "12k",
- label: "12k"
- },
- {
- value: "15k",
- label: "15k"
- },
- {
- value: "18k",
- label: "18k"
- },
- {
- value: "20k",
- label: "20k"
- },
- {
- value: "30k",
- label: "30k"
- },
- {
- value: "50k",
- label: "50k"
- },
- ],
- [{
- value: "3k",
- label: "3k"
- },
- {
- value: "4k",
- label: "4k"
- },
- {
- value: "5k",
- label: "5k"
- },
- {
- value: "6k",
- label: "6k"
- },
- {
- value: "8k",
- label: "8k"
- },
- {
- value: "10k",
- label: "10k"
- },
- {
- value: "12k",
- label: "12k"
- },
- {
- value: "15k",
- label: "15k"
- },
- {
- value: "18k",
- label: "18k"
- },
- {
- value: "20k",
- label: "20k"
- },
- {
- value: "30k",
- label: "30k"
- },
- {
- value: "50k",
- label: "50k"
- },
- ],
- [
- {
- "value": "12薪",
- "label": "12薪"
- },
- {
- "value": "13薪",
- "label": "13薪"
- },
- {
- "value": "14薪",
- "label": "14薪"
- },
- {
- "value": "15薪",
- "label": "15薪"
- },
- {
- "value": "16薪",
- "label": "16薪"
- },
- {
- "value": "17薪",
- "label": "17薪"
- },
- {
- "value": "18薪",
- "label": "18薪"
- },
- {
- "value": "19薪",
- "label": "19薪"
- },
- {
- "value": "20薪",
- "label": "20薪"
- },
- {
- "value": "21薪",
- "label": "21薪"
- },
- {
- "value": "22薪",
- "label": "22薪"
- },
- {
- "value": "23薪",
- "label": "23薪"
- }
- ]
- ],
- numList: [{
- name: "填写基本信息"
- },
- {
- name: "选择职位要求"
- },
- ],
- };
- },
- components: {
- navBar,
- },
- onLoad(options) {
- // 接收上个页面传递的公司名称参数
- if (options.companyName) {
- this.companyName = decodeURIComponent(options.companyName);
- console.log('接收的公司名称:', this.companyName);
- }
- if (options.status) {
- this.status = decodeURIComponent(options.status);
- console.log('接收的公司状态:', this.status);
- }else{
- this.status = uni.getStorageSync('companyStatus')
- }
- this.fundListener = uni.$on("fundData", (data) => {
- console.log("接收到的福利数据:", data);
- this.welfareTag = data; // 赋值给当前页面变量
- });
- this.fundListener = uni.$on("skillsUpdated", (data) => {
- console.log("接收到的职位技能数据:", data);
- this.positionTag = data.selectedTags; // 赋值给当前页面变量
- });
- this.fundListener = uni.$on("addressData", (data) => {
- console.log("接收到的地址数据:", data);
- this.stationName = data; // 赋值给当前页面变量
- });
- if (options.companyId) {
- this.companyId = options.companyId;
- console.log('接收的公司ID:', this.companyId);
- } else {
- this.companyId = uni.getStorageSync('companyId') || ""
- }
- if (options.pid) {
- this.pid = options.pid;
- if(options.type && options.type=='updata'){
- this.getInfo()
- }
-
- console.log('接收PID:', this.pid);
- } else {
- uni.navigateTo({
- url: '/pages/my/jobPosting?companyId=' + this.companyId + '&status=' + this.status +
- '&companyName=' + this.companyName
- })
- }
- },
- onUnload() {
- // 页面关闭时移除监听,避免内存泄漏
- if (this.fundListener) {
- uni.$off("fundData", this.fundListener);
- }
- },
- methods: {
- // 处理经验选择(核心修复:直接接收选中的label)
- onExperConfirm(selectedItem) {
- // 不同版本u-select返回格式可能是对象或数组,这里兼容处理
- if (Array.isArray(selectedItem)) {
- this.selectedExper = selectedItem[0]?.label || "";
- } else {
- this.selectedExper = selectedItem?.label || "";
- }
- this.showExper = false; // 关闭选择器
- },
- // 处理学历选择(核心修复)
- onLevelConfirm(selectedItem) {
- if (Array.isArray(selectedItem)) {
- this.selectedLevel = selectedItem[0]?.label || "";
- } else {
- this.selectedLevel = selectedItem?.label || "";
- }
- this.showLevel = false;
- },
- /**
- * 获取岗位详情
- */
- getInfo(){
- this.$Request.getT("/app/postPush/selectPostPushDetails",{
- // userId:uni.getStorageSync('userId'),
- postPushId:this.pid
- }).then(res => {
- if(res.code==0){
- this.selectedExper=res.data.experience
- this.selectedLevel=res.data.education
- this.selectedSalary=res.data.salaryRange
- this.welfareTag=res.data.welfareTag
- this.positionTag=res.data.positionTag
- this.address=res.data.address
- this.stationName.fullText=res.data.address
- this.stationName.latitude=res.data.lat
- this.stationName.longitude=res.data.lng
- this.stationName.province=res.data.province
- this.stationName.city=res.data.city
- this.stationName.district=res.data.county
- this.salaryTimes=res.data.salaryTimes
- console.log(this.stationName)
- }else{
- uni.showToast({
- title: '数据有误',
- icon: 'none', // 注意这里需要加引号
- duration: 2000, // 可选:设置提示框显示时长
- complete() { // 正确的回调函数写法
- uni.navigateBack();
- }
- });
-
- }
- })
- },
- // 处理薪资范围选择(核心修复)
- onMoneyConfirm(selectedItems) {
- // 多列选择器返回数组,取每列选中的label拼接
- console.log(selectedItems)
- if (Array.isArray(selectedItems) && selectedItems.length >= 2) {
- const min = selectedItems[0]?.label || "";
- const max = selectedItems[1]?.label || "";
- const xin = selectedItems[2]?.label || "";
- this.selectedSalary = `${min}-${max}`;
- this.salaryTimes=`${xin}`
- }
- this.showMoney = false;
- },
- // 跳转页面并接收参数(福利待遇)
- goFund() {
- uni.navigateTo({
- url: "/package/jobIntention/fund",
- events: {
- // 监听子页面发送的福利数据
- fundData: (data) => {
- this.welfareTag = data;
- },
- },
- });
- },
- // 跳转页面并接收参数(职位关键词)
- goJobSkill() {
- uni.navigateTo({
- url: "/package/jobIntention/jobSkills",
- events: {
- skillsUpdated: (data) => {
- this.positionTag = data.selectedTags;
- },
- },
- });
- },
- // 跳转页面并接收参数(工作地址)
- goAddAddress() {
- uni.navigateTo({
- url: "/package/jobIntention/addAddress",
- events: {
- addressData: (data) => {
- this.stationName = data;
- },
- },
- });
- },
- // 提交表单
- submitPost() {
- // 验证必填项
- if (!this.selectedExper) {
- return uni.showToast({
- title: "请选择经验要求",
- icon: "none"
- });
- }
- if (!this.selectedLevel) {
- return uni.showToast({
- title: "请选择最低学历",
- icon: "none"
- });
- }
- if (!this.selectedSalary) {
- return uni.showToast({
- title: "请选择薪资范围",
- icon: "none"
- });
- }
- if (!this.stationName.fullText && !this.address) {
- return uni.showToast({
- title: "请填写工作地址",
- icon: "none"
- });
- }
- if (!this.stationName.longitude) {
- return uni.showToast({
- title: "请选择位置",
- icon: "none"
- });
- }
- if (!this.positionTag) {
- return uni.showToast({
- title: "请选择职位标签",
- icon: "none"
- });
- }
- var positionTag = this.positionTag
- const str = positionTag.join(',');
- // 构造提交数据
- const data = {
- orderid: 1,
- postPushId: this.pid,
- experience: this.selectedExper, //工作经验
- education: this.selectedLevel, //学历
- salaryRange: this.selectedSalary, //薪资范围
- welfareTag: this.welfareTag, //福利相关标签
- positionTag: str, //职位技能
- address: this.stationName.fullText|| this.address, //地址
- lat: this.stationName.latitude,
- lng: this.stationName.longitude,
- province: this.stationName.province,
- city: this.stationName.city,
- county: this.stationName.district,
- companyId:this.companyId,
- salaryTimes:this.salaryTimes
- };
- // 调用接口提交
- uni.showLoading({
- title: "提交中..."
- });
- this.$Request.postJson("/app/postPush/savePostPush", data)
- .then((res) => {
- uni.hideLoading();
- if (res.code === 0) {
- uni.showToast({
- title: "提交成功",
- icon: "success"
- });
- //这里要选择跳转,第一次是要跳公司页,如果是二次就到职位管理页
- if (this.status == 1) { //审核中
- uni.navigateTo({
- url: "/package/jobIntention/company?companyName=" + this.companyName +
- '&companyId=' + this.companyId
- });
- } else {
- uni.navigateTo({
- url: '/pages/jobManagement/jobManagement'
- })
- }
- } else {
- uni.showToast({
- title: res.msg || "提交失败",
- icon: "none"
- });
- }
- })
- .catch((err) => {
- uni.hideLoading();
- console.error("提交失败:", err);
- uni.showToast({
- title: "网络异常",
- icon: "none"
- });
- });
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- /* 原有样式保持不变 */
- .switch-roles {
- background-color: #fff;
- position: absolute;
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- display: flex;
- flex-direction: column;
- .roles-content {
- width: 100%;
- flex: 1;
- overflow: auto;
- .content {
- padding: 40rpx;
- .title {
- color: #333;
- font-size: 40rpx;
- font-weight: 600;
- margin-bottom: 10rpx;
- }
- .desc {
- color: #666;
- font-size: 24rpx;
- margin-bottom: 20rpx;
- }
- .check-title-big {
- color: #3a3943;
- font-size: 36rpx;
- font-weight: 500;
- padding: 20rpx 0;
- }
- .check-select {
- width: 100%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 32rpx 47rpx;
- border-radius: 12rpx;
- box-shadow: 0 16rpx 300rpx rgba(0, 0, 0, 0.06);
- background: #fff;
- margin-bottom: 20rpx;
- .select-txt {
- color: #999;
- font-size: 28rpx;
- }
- }
- .txt-desc {
- color: #666;
- font-size: 24rpx;
- margin-top: 20rpx;
- line-height: 1.5;
- }
- }
- }
- .step {
- padding: 32rpx 0;
- }
- .submit-btn {
- margin: 60rpx 20rpx;
- padding: 16rpx 32rpx;
- border-radius: 999px;
- background: linear-gradient(90deg, #0d27f7, #13c1ea);
- color: #fff;
- font-size: 32rpx;
- text-align: center;
- line-height: 48rpx;
- }
- }
- </style>
|