<template>
  <view class="switch-roles">
    <nav-bar title="公司信息" color="#000"></nav-bar>
    <view class="roles-content">
      <view class="content">
        <view class="progress-num"> <text>5</text>/8 </view>
        <view class="title">
          <view>编辑公司简介</view>
        </view>
        <view class="desc"> 可以简单介绍一下公司发展状况、服务领域、主要产品等信息</view>
        <view class="small-desc">一句短介绍</view>
        <view class="content-index">
          <view class="check-box">
            <textarea
              v-model="text"
              placeholder="填写公司介绍（最少10个字）"
              maxlength="500"
              class="textarea"
            ></textarea>
            <view class="word-count">
              <text>{{ text ? text.length : 0 }}</text> /500</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 {
      text: "",
	  companyData:{}
    };
  },
  components: {
    navBar,
  },
  onLoad(options) {
    if (options.companyData) {
      this.companyData = JSON.parse(options.companyData);
    }
  },
  methods: {
    goJobPostingSecond(){
		const companyData = this.companyData
		if (this.text === '') {
		  uni.showToast({
		    title: "请填写公司介绍",
		    icon: "none",
		  });
		  return;
		}
		if (this.text.length < 10) {
		  uni.showToast({
		    title: "公司介绍最少10个字",
		    icon: "none",
		  });
		  return;
		}
		companyData.companyContent=this.text
        uni.navigateTo({ url: "/my/renzheng/companyLogo?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;
  .check-box {
    width: 100%;
    border-radius: 12rpx;
    background: rgba(240, 240, 240, 1);
    padding: 34rpx;
    padding-top: 40rpx;
    box-sizing: border-box;
    margin: 20rpx 0;
    .word-count {
      font-family: DM Sans;
      font-size: 20rpx;
      font-weight: 400;
      line-height: 26rpx;
      text-align: right;
      text {
        color: #016bf6;
      }
    }
  }
  .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;
        box-sizing: border-box;
        margin-bottom: 20rpx;
      }
      .small-desc {
        color: rgba(34, 37, 42, 1);
        font-family: DM Sans;
        font-size: 32rpx;
        font-weight: 400;
        line-height: 48rpx;
        width: 100%;
      }
      .content-index {
        width: 100%;
      }
    }
  }

  .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;
  }
}
::v-deep .textarea-placeholder {
  color: rgba(153, 153, 153, 1);
  font-family: DM Sans;
  font-size: 20rpx !important;
  font-weight: 400;
  line-height: 26rpx;
}
::v-deep .uni-textarea-textarea {
  font-size: 20rpx;
}
</style>
