| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580 |
- <template>
- <view class="switch-roles">
- <nav-bar title="选择公司规模" color="#000"></nav-bar>
- <view class="roles-content">
- <view class="content">
- <view class="title">{{isDisabled?'编辑【'+jobInfo.ruleClassifyName+'】':'发布社招'}}岗位</view>
- <view class="desc">{{companyName}}</view>
- <view class="step">
- <u-steps :list="numList" mode="number" :current="0"></u-steps>
- </view>
- <view class="check-title-big">招聘模式</view>
- <view class="check-select radioseletvi">
- <radio-group @change="onRadioChange">
- <view class="select-txt radioseletview">
- <label class="radio radioselet">
- <radio value="0" :checked="true" class="radio-size" :disabled="isDisabled" />普通岗位招聘
- </label>
- <label class="radio radioselet">
- <radio value="1" class="radio-size" :disabled="isDisabled"/>急聘
- </label>
- <text
- style="position: absolute;right: 0;bottom: 18px;font-size: 12px;color: rgba(120, 130, 138, 1);">急聘职位剩余{{vipDueTimes}}个</text>
- </view>
- </radio-group>
- </view>
- <view class="check-title">招聘类型</view>
- <view class="check-box" :class="{ disabled: isDisabled }">
- <view class="check-item" :class="{ 'is-check': check == index }" v-for="(item, index) in peopleList"
- :key="index" @click="!isDisabled && checkPeople(index)">{{ item }}</view>
- </view>
- <view class="check-title-big">招聘职位</view>
- <view class="check-select" @click="!isDisabledid && goJob()" :class="{ disabled: isDisabledid }">
- <view class="select-txt">{{jobInfo.ruleClassifyName}}</view>
- <u-icon name="arrow-down" color="#D3D3D6" size="22"></u-icon>
- </view>
- <view class="check-title-big">岗位描述</view>
- <view class="check-select" @click="goJobContent">
- <view class="select-txt">{{this.text ? this.text : "介绍工作内容、职位要求" }}</view>
- <u-icon name="arrow-down" color="#D3D3D6" size="22"></u-icon>
- </view>
- <view class="txt-desc">注:职位名称、职位类型等发布后不可修改</view>
- </view>
- </view>
- <view class="submit-btn" @click="goJobPostingSecond">下一步</view>
- </view>
- </template>
- <script>
- import navBar from "@/components/nav-bar/index.vue";
- export default {
- data() {
- return {
- selectedValue: 0, // 默认选中值
- peopleList: ["社招全职", "应届生校园招聘", "实习生招聘", "兼职招聘"],
- check: 0,
- isDisabled: false,
- isDisabledid:false,
- isCompanyVip: 0,
- vipDueTimes: 0,
- postPushId:"",
- update:"",
- vipPostTimes: 0,
- text: "",
- status: "",
- companyName: "",
- companyId: "",
- numList: [{
- name: "填写基本信息",
- },
- {
- name: "选择职位要求",
- },
- ],
- jobInfo: {
- ruleClassifyId: '',
- ruleClassifyName: '请选择要招聘的职位',
- price: ''
- }
- };
- },
- components: {
- navBar,
- },
- onLoad(options) {
- // 接收上个页面传递的公司名称参数
- if(options.postPushId){
- this.postPushId=options.postPushId
- this.getInfo()
- }
- if(options.type){
- this.update=decodeURIComponent(options.type);
- this.isDisabled = true;
- }
- if (options.companyName) {
- this.companyName = decodeURIComponent(options.companyName);
- }else{
- this.companyName = uni.getStorageSync('companyName')
- }
- this.descListener = uni.$on("jobDescUpdated", (data) => {
- this.text = data.desc; // 赋值给当前页变量
- });
- this.jobListener = uni.$on('jobs', (data) => {
- console.log('接收从B页传来的数据:', data);
- // 手动更新 A 页的 data
- this.jobInfo = data;
- });
- if (options.companyId) {
- this.companyId = options.companyId;
- }else{
- this.companyId = uni.getStorageSync('companyId')
- }
- if (options.status) {
- this.status = options.status;
- }else{
- this.status = uni.getStorageSync('companyStatus')
- }
- this.isCompanyVip = uni.getStorageSync('isCompanyVip') || 0
- this.vipDueTimes = uni.getStorageSync('vipDueTimes') || 0
- this.vipPostTimes = uni.getStorageSync('vipPostTimes') || 0
-
-
- console.log('接收的公司名称:', this.companyName);
- console.log("收到岗位描述数据:", this.text);
- console.log('接收的公司ID:', this.companyId);
- console.log('接收的公司状态:', this.status);
-
-
- },
- onUnload() {
- // 页面卸载时移除监听,避免内存泄漏
- uni.$off('jobs', this.jobListener);
- },
- methods: {
- goBusinessLicense() {
- uni.navigateTo({
- url: "/pages/my/businessLicense"
- });
- },
- checkPeople(index) {
- this.check = index;
- },
- goJob() {
- uni.navigateTo({
- url: "/package/jobIntention/jobList",
- });
- },
- goJobContent() {
- uni.navigateTo({
- url: `/package/jobIntention/editJob?text=${this.text}`,
- });
- },
-
- /**
- * 获取岗位详情
- */
- getInfo(){
- this.$Request.getT("/app/postPush/selectPostPushDetails",{
- // userId:uni.getStorageSync('userId'),
- postPushId:this.postPushId
- }).then(res => {
- if(res.code==0){
- this.jobInfo = res.data
- this.text=res.data.positionDetails
- if(!this.jobInfo?.ruleClassifyId){
- this.isDisabledid=false
- }else{
- this.isDisabledid=true
- }
- }
- })
- },
-
-
- //radio 选中变化时触发
- onRadioChange(e) {
- // 获取选中的值
- // 根据值做不同处理
- if (this.selectedValue === 0) {
- console.log('选中了:普通岗位招聘');
- // 执行普通岗位招聘的逻辑
- } else if (this.selectedValue === 1) {
- console.log('选中了:急聘');
- if (!this.isCompanyVip) {
- uni.showToast({
- title: '对不起,您还不是会员,不能发布急聘。',
- icon: 'none',
- duration: 2000
- });
- return
- }
- if (this.vipDueTimes < 1) {
- uni.showToast({
- title: '对不起,您的次数已经用完,不能发布。',
- icon: 'none',
- duration: 2000
- });
- return
- }
- // 执行急聘的逻辑
- }
- this.selectedValue = e.detail.value;
- },
- //提交
- goJobPostingSecond() {
- // 显示加载中
- uni.showLoading({
- title: '提交中...'
- });
- //校验数据
- // 校验数据
- const validate = () => {
- // 2. 校验岗位描述(positionDetails)
- if (!this.text || this.text.trim() === '') {
- uni.hideLoading();
- uni.showToast({
- title: '岗位描述不能为空',
- icon: 'none',
- duration: 2000
- });
- return false;
- }
- if (this.text.length > 500) {
- uni.hideLoading();
- uni.showToast({
- title: '岗位描述不能超过500字',
- icon: 'none',
- duration: 2000
- });
- return false;
- }
- // 校验是否包含违规内容(简单示例,可根据实际需求扩展)
- const illegalChars = /QQ|微信|电话|手机号|\?/g;
- if (illegalChars.test(this.text)) {
- uni.hideLoading();
- uni.showToast({
- title: '岗位描述不能包含联系方式或特殊符号',
- icon: 'none',
- duration: 2000
- });
- return false;
- }
- // 3. 校验岗位分类信息(假设ruleClassifyId是必选)
- if (!this.jobInfo?.ruleClassifyId) {
- uni.hideLoading();
- uni.showToast({
- title: '请选择岗位分类',
- icon: 'none',
- duration: 2000
- });
- return false;
- }
- if (!this.jobInfo?.ruleClassifyName || this.jobInfo?.ruleClassifyName == '请选择要招聘的职位') {
- uni.hideLoading();
- uni.showToast({
- title: '岗位分类名称异常,请重新选择',
- icon: 'none',
- duration: 2000
- });
- return false;
- }
- // 4. 校验orderId(如果有实际业务含义,可根据需求调整)
- // if (!this.orderId || this.orderId < 1) {
- // uni.hideLoading();
- // uni.showToast({
- // title: '订单信息异常',
- // icon: 'none',
- // duration: 2000
- // });
- // return false;
- // }
- // 所有校验通过
- return true;
- };
- // 执行校验,通过后再提交
- if (!validate()) {
- return; // 校验失败,终止提交
- }
- if (this.selectedValue == 1) {//急聘刚
- if (!this.isCompanyVip) {
- uni.showToast({
- title: '对不起,您还不是会员,不能发布急聘。',
- icon: 'none',
- duration: 2000
- });
- return
- }
- if (this.vipDueTimes < 1) {
- uni.showToast({
- title: '对不起,您的次数已经用完,不能发布。',
- icon: 'none',
- duration: 2000
- });
- return
- }
- }
- const data = {
- postPushId:this.postPushId,
- type: this.check,
- isDue: this.selectedValue,
- positionDetails: this.text,
- ruleClassifyId: this.jobInfo.ruleClassifyId,
- ruleClassifyName: this.jobInfo.ruleClassifyName,
- orderId: 1
- }
- // 发送请求
- this.$Request.postJson("/app/postPush/savePostPush", data)
- .then((res) => {
- uni.hideLoading();
- if (res.code === 0) {
- uni.showToast({
- title: '提交成功',
- icon: 'success'
- });
- console.log("sssssss", this.companyId)
- var pid = res.data || ""
- if (!pid) {
- uni.showToast({
- title: '系统错误,请重新提交',
- icon: 'none'
- });
- return
- }
- // 提交成功后跳转到职位发布页面
- setTimeout(() => {
- uni.navigateTo({
- url: "/pages/my/jobPostingSecond?pid=" + pid + "&status=" + this
- .status + "&companyName=" + this.companyName + '&companyId=' +
- this.companyId+'&type='+this.update
- });
- }, 1500);
- } 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: hidden;
- overflow-y: auto;
- .content {
- padding: 40rpx;
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- .title {
- color: #333;
- width: 100%;
- font-family: DM Sans;
- font-size: 40rpx;
- font-weight: 600;
- }
- .desc {
- color: rgba(102, 102, 102, 1);
- width: 100%;
- font-family: DM Sans;
- font-size: 24rpx;
- font-weight: 400;
- line-height: 32rpx;
- letter-spacing: 0.5%;
- text-align: left;
- padding: 20rpx 0;
- box-sizing: border-box;
- }
- .check-title {
- width: 100%;
- color: rgba(31, 44, 55, 1);
- font-family: DM Sans;
- font-size: 28rpx;
- font-weight: 500;
- line-height: 44rpx;
- margin-top: 20rpx;
- margin-bottom: 16rpx;
- }
- .check-title-big {
- color: rgba(58, 57, 67, 1);
- font-family: DM Sans;
- font-size: 36rpx;
- font-weight: 500;
- line-height: 48rpx;
- width: 100%;
- padding: 20rpx 0;
- box-sizing: border-box;
- }
- .check-select {
- width: 100%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- border-radius: 12rpx;
- box-shadow: 0px 16rpx 300rpx 0px rgba(0, 0, 0, 0.06);
- background: rgba(255, 255, 255, 1);
- padding: 32rpx 47rpx;
- box-sizing: border-box;
- .select-txt {}
- }
- /* 禁用状态样式 */
- .check-select.disabled {
- background-color: #f5f5f5;
- opacity: 0.6;
- pointer-events: none; /* 防止点击穿透 */
- }
- .check-select.disabled .select-txt {
- color: #999; /* 文字变灰 */
- }
- .check-select.disabled u-icon {
- color: #ccc; /* 图标变灰 */
- }
- /* 禁用状态样式 */
- .check-box.disabled {
- opacity: 0.6;
- }
- .check-box.disabled .check-item {
- pointer-events: none;
- background-color: #e9e9e9;
- color: #999;
- }
- .check-box.disabled .check-item.is-check {
- background-color: #b3d1ff;
- color: #666;
- }
- .radioseletvi {
- position: relative;
- }
- .radioseletview {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- font-size: 14px;
- }
- .radioselet {
- display: block;
- margin-top: 10px;
- }
- .radio-size {
- transform: scale(0.5);
- /* 放大到1.5倍,可根据需要调整数值 */
- /* 可选:调整位置避免偏移 */
- }
- .check-box {
- width: 100%;
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- gap: 24rpx;
- .check-item {
- border-radius: 16rpx;
- background: rgba(245, 248, 254, 1);
- color: rgba(153, 153, 153, 1);
- font-family: DM Sans;
- font-size: 28rpx;
- font-weight: 400;
- line-height: 44rpx;
- text-align: center;
- padding: 12rpx 48rpx;
- box-sizing: border-box;
- }
- .is-check {
- box-sizing: border-box;
- border: 1rpx solid #016bf6;
- border-radius: 16rpx;
- background: rgba(252, 233, 220, 1);
- color: #016bf6;
- }
- }
- }
- }
- .step {
- width: 100%;
- padding: 32rpx 0;
- box-sizing: border-box;
- }
- .submit-btn {
- flex-shrink: 0;
- border-radius: 999px;
- box-shadow: 0px 2px 4px 0px rgba(9, 196, 116, 0.3);
- background: linear-gradient(90deg, rgba(13, 39, 247, 1), rgba(19, 193, 234, 1) 100%);
- color: rgba(255, 255, 255, 1);
- font-family: DM Sans;
- font-size: 32rpx;
- font-weight: 400;
- line-height: 48rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- padding: 16rpx 32rpx;
- box-sizing: border-box;
- margin: 60rpx 20rpx;
- }
- .txt-desc {
- color: rgba(102, 102, 102, 1);
- font-family: DM Sans;
- font-size: 24rpx;
- font-weight: 400;
- line-height: 32rpx;
- text-align: left;
- width: 100%;
- margin-top: 20rpx;
- }
- }
- </style>
|