| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409 |
- <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': selectedUp.includes(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': selectedPeople.includes(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': selectedPower.includes(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: ["考核晋升", "定期晋升", "完善的晋升机制"],
- selectedUp: [], // 改为数组存储多个选择
- peopleList: [
- "定期普调",
- "定期绩效调薪",
- "晋级涨薪",
- "项目奖金",
- "团队奖金",
- "个人奖金",
- "绩效提成",
- "股票期权",
- "人才补贴",
- ],
- selectedPeople: [], // 改为数组存储多个选择
- powerList: [
- "老员工带新",
- "导师一对一",
- "岗前带薪培训",
- "内部定期培训",
- "专业技能培训",
- "内部课程资源",
- "大牛带队",
- "人脉积累",
- "国内外进修",
- "校招培养",
- ],
- selectedPower: [], // 改为数组存储多个选择
- companyData: {},
- companyPeopleDevelop: [],
- isUpdateMode: false // 新增:标记是否为编辑模式
- };
- },
- components: {
- navBar,
- },
- onLoad(options) {
- // 判断是否为编辑模式
- if (options.update == 'true') {
- this.isUpdateMode = true;
- this.loadSavedPeopleDevelop();
- }
-
- if (options.companyData) {
- this.companyData = JSON.parse(options.companyData);
- // 如果之前有保存的数据,恢复选择状态
- this.restoreSelections();
- }
- },
- methods: {
- // 加载已保存的人才发展数据(从缓存)
- loadSavedPeopleDevelop() {
- try {
- let companyInfo = uni.getStorageSync('companyInfo');
-
- if (companyInfo?.companyPeopleDevelop) {
- // 处理字符串并分割为数组
- const savedPeopleDevelop = companyInfo.companyPeopleDevelop
- .replace(/,/g, ',') // 替换中文逗号
- .split(',') // 分割
- .map(item => item.trim()) // 去除空格
- .filter(item => item); // 过滤空值
-
- console.log('加载的人才发展数据:', savedPeopleDevelop);
-
- // 清空之前的选中
- this.selectedUp = [];
- this.selectedPeople = [];
- this.selectedPower = [];
-
- // 恢复晋升制度选择
- this.upList.forEach((item, index) => {
- if (savedPeopleDevelop.includes(item)) {
- this.selectedUp.push(index);
- }
- });
-
- // 恢复人才激励选择
- this.peopleList.forEach((item, index) => {
- if (savedPeopleDevelop.includes(item)) {
- this.selectedPeople.push(index);
- }
- });
-
- // 恢复能力培养选择
- this.powerList.forEach((item, index) => {
- if (savedPeopleDevelop.includes(item)) {
- this.selectedPower.push(index);
- }
- });
-
- console.log('人才发展数据已加载完成');
- } else {
- console.log('缓存中没有人才发展数据');
- }
- } catch (error) {
- console.error('加载人才发展数据失败:', error);
- }
- },
- // 晋升制度多选
- checkUp(index) {
- const idx = this.selectedUp.indexOf(index);
- if (idx > -1) {
- // 如果已选中,则取消选中
- this.selectedUp.splice(idx, 1);
- } else {
- // 如果未选中,则添加
- this.selectedUp.push(index);
- }
- },
- // 人才激励多选
- checkPeople(index) {
- const idx = this.selectedPeople.indexOf(index);
- if (idx > -1) {
- this.selectedPeople.splice(idx, 1);
- } else {
- this.selectedPeople.push(index);
- }
- },
- // 能力培养多选
- checkPower(index) {
- const idx = this.selectedPower.indexOf(index);
- if (idx > -1) {
- this.selectedPower.splice(idx, 1);
- } else {
- this.selectedPower.push(index);
- }
- },
- // 恢复之前的选择(编辑时使用)
- restoreSelections() {
- if (this.companyData.companyPeopleDevelop) {
- const savedData = this.companyData.companyPeopleDevelop.split(',');
- // 恢复晋升制度选择
- this.upList.forEach((item, index) => {
- if (savedData.includes(item)) {
- this.selectedUp.push(index);
- }
- });
- // 恢复人才激励选择
- this.peopleList.forEach((item, index) => {
- if (savedData.includes(item)) {
- this.selectedPeople.push(index);
- }
- });
- // 恢复能力培养选择
- this.powerList.forEach((item, index) => {
- if (savedData.includes(item)) {
- this.selectedPower.push(index);
- }
- });
- }
- },
- goJobPostingSecond() {
- // 清空之前的数组
- this.companyPeopleDevelop = [];
- // 添加选中的晋升制度
- this.selectedUp.forEach(index => {
- if (this.upList[index]) {
- this.companyPeopleDevelop.push(this.upList[index]);
- }
- });
- // 添加选中的人才激励
- this.selectedPeople.forEach(index => {
- if (this.peopleList[index]) {
- this.companyPeopleDevelop.push(this.peopleList[index]);
- }
- });
- // 添加选中的能力培养
- this.selectedPower.forEach(index => {
- if (this.powerList[index]) {
- this.companyPeopleDevelop.push(this.powerList[index]);
- }
- });
- // 验证是否至少选择了一项
- if (this.companyPeopleDevelop.length === 0) {
- uni.showToast({
- title: "请至少选择一项人才发展方向",
- icon: "none",
- });
- return;
- }
- // 保存到 companyData
- const companyData = {
- ...this.companyData,
- companyPeopleDevelop: this.companyPeopleDevelop.join(',')
- };
- // 如果是编辑模式,同时更新缓存
- if (this.isUpdateMode) {
- try {
- let companyInfo = uni.getStorageSync('companyInfo');
- if (companyInfo) {
- companyInfo.companyPeopleDevelop = companyData.companyPeopleDevelop;
- uni.setStorageSync('companyInfo', companyInfo);
- console.log('已更新缓存中的人才发展数据');
- }
- } catch (error) {
- console.error('更新缓存失败:', error);
- }
- }
- // 跳转到下一步
- uni.navigateTo({
- url: "/my/renzheng/editCompanyDesc?companyData=" +
- encodeURIComponent(JSON.stringify(companyData)) +
- (this.isUpdateMode ? "&update=true" : "")
- });
- }
- },
- };
- </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 {
- margin-bottom: 40rpx;
- .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;
- cursor: pointer;
- transition: all 0.3s;
- }
- .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>
|