<template>
  <view class="switch-roles">
    <nav-bar title="公司信息" color="#000"></nav-bar>
    <view class="roles-content">
      <view class="content">
        <view class="progress-num"> <text>4</text>/8 </view>
        <view class="title">
          <view>人才发展</view>
        </view>
        <view class="desc">
          介绍公司可提供的员工培养＆晋升制度，良好的职业成长空间对人才更有吸引力</view
        >
        <view class="content-index">
          <view class="content-item">
            <view class="content-item-title">晋升制度</view>
            <view class="check-box">
              <view
                class="check-item"
                :class="{ 'check-active': up == index }"
                v-for="(item, index) in upList"
                :key="index"
                @click="checkUp(index)"
                >{{ item }}</view
              >
            </view>
          </view>
          <view class="content-item">
            <view class="content-item-title">人才激励</view>
            <view class="check-box">
              <view
                class="check-item"
                :class="{ 'check-active': people == index }"
                v-for="(item, index) in peopleList"
                :key="index"
                @click="checkPeople(index)"
                >{{ item }}</view
              >
            </view>
          </view>
          <view class="content-item">
            <view class="content-item-title">能力培养</view>
            <view class="check-box">
              <view
                class="check-item"
                :class="{ 'check-active': power == index }"
                v-for="(item, index) in powerList"
                :key="index"
                @click="checkPower(index)"
                >{{ item }}</view
              >
            </view>
          </view>
        </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 {
      upList: ["考核晋升", "定期晋升", "完善的晋升机制"],
      up: null,
      peopleList: [
        "定期普调",
        "定期绩效调薪",
        "晋级涨薪",
        "项目奖金",
        "团队奖金",
        "个人奖金",
        "绩效提成",
        "股票期权",
        "人才补贴",
      ],
      people: null,
      powerList: [
        "老员工带新",
        "导师一对一",
        "岗前带薪培训",
        "内部定期培训",
        "专业技能培训",
        "内部课程资源",
        "大牛带队",
        "人脉积累",
        "国内外进修",
        "校招培养",
      ],
      power: null,
	    companyData:{},
	    companyPeopleDevelop:[]
    };
  },
  components: {
    navBar,
  },
  onLoad(options) {
    if (options.companyData) {
      this.companyData = JSON.parse(options.companyData);
    }
  },
  methods: {
    checkUp(index) {
      this.up = index;
    },
    checkPeople(index) {
      this.people = index;
    },
    checkPower(index) {
      this.power = index;
    },
    goJobPostingSecond(){
		if(this.upList[this.up]){
			this.companyPeopleDevelop.push(this.upList[this.up])
		}
		if(this.peopleList[this.people]){
			this.companyPeopleDevelop.push(this.peopleList[this.people])
		}
		if(this.powerList[this.power]){
			this.companyPeopleDevelop.push(this.powerList[this.power])
		}
		if (this.companyPeopleDevelop.length === 0) {
		  uni.showToast({
		    title: "请至少选择一项人才发展方向",
		    icon: "none",
		  });
		  return;
		}
		const companyData = this.companyData
		companyData.companyPeopleDevelop = this.companyPeopleDevelop.join(',')
        uni.navigateTo({ url: "/my/renzheng/editCompanyDesc?companyData=" +
          encodeURIComponent(JSON.stringify(companyData)) })
    }
  },
};
</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;

      .progress-num {
        color: #016bf6;
        font-family: DM Sans;
        font-size: 24rpx;
        font-weight: 500;
        width: 100%;
        padding-bottom: 20rpx;
        box-sizing: border-box;
        text {
          font-size: 48rpx;
          font-weight: 700;
        }
      }

      .title {
        color: #333;
        width: 100%;
        font-family: DM Sans;
        font-size: 48rpx;
        font-weight: 700;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20rpx;
      }

      .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;
        margin-bottom: 20rpx;
      }
      .content-index {
        width: 100%;
        .content-item {
          .content-item-title {
            color: rgba(34, 37, 42, 1);
            font-family: DM Sans;
            font-size: 32rpx;
            font-weight: 400;
            line-height: 48rpx;
            padding-bottom: 12rpx;
            box-sizing: border-box;
          }
          .check-box {
            display: flex;
            gap: 12rpx;
            flex-wrap: wrap;
            align-items: center;
            .check-item {
              flex-shrink: 0;
              padding: 8rpx;
              border-radius: 8rpx;
              background: #9999991a;
              border: 1rpx solid #9999991a;

              box-sizing: border-box;
              color: rgba(102, 102, 102, 1);
              font-family: DM Sans;
              font-size: 16rpx;
              font-weight: 400;
            }
            .check-active {
              box-sizing: border-box;
              border: 1rpx solid #016bf6;
              border-radius: 8rpx;
              background: rgba(252, 233, 220, 1);
              color: #016bf6;
            }
          }
        }
      }
    }
  }

  .submit-btn {
    flex-shrink: 0;
    border-radius: 999px;
    background: #ff6600;
    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: 24rpx 32rpx;
    box-sizing: border-box;
    margin: 30rpx 40rpx;
    margin-top: 20rpx;
  }
}
</style>
