peopleDev.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. <template>
  2. <view class="switch-roles">
  3. <nav-bar title="公司信息" color="#000"></nav-bar>
  4. <view class="roles-content">
  5. <view class="content">
  6. <view class="progress-num"> <text>4</text>/8 </view>
  7. <view class="title">
  8. <view>人才发展</view>
  9. </view>
  10. <view class="desc">
  11. 介绍公司可提供的员工培养&晋升制度,良好的职业成长空间对人才更有吸引力</view>
  12. <view class="content-index">
  13. <view class="content-item">
  14. <view class="content-item-title">晋升制度</view>
  15. <view class="check-box">
  16. <view class="check-item" :class="{ 'check-active': selectedUp.includes(index) }"
  17. v-for="(item, index) in upList" :key="index" @click="checkUp(index)">{{ item }}</view>
  18. </view>
  19. </view>
  20. <view class="content-item">
  21. <view class="content-item-title">人才激励</view>
  22. <view class="check-box">
  23. <view class="check-item" :class="{ 'check-active': selectedPeople.includes(index) }"
  24. v-for="(item, index) in peopleList" :key="index" @click="checkPeople(index)">{{ item }}
  25. </view>
  26. </view>
  27. </view>
  28. <view class="content-item">
  29. <view class="content-item-title">能力培养</view>
  30. <view class="check-box">
  31. <view class="check-item" :class="{ 'check-active': selectedPower.includes(index) }"
  32. v-for="(item, index) in powerList" :key="index" @click="checkPower(index)">{{ item }}
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="submit-btn" @click="goJobPostingSecond">下一步</view>
  40. </view>
  41. </template>
  42. <script>
  43. import navBar from "@/components/nav-bar/index.vue";
  44. export default {
  45. data() {
  46. return {
  47. upList: ["考核晋升", "定期晋升", "完善的晋升机制"],
  48. selectedUp: [], // 改为数组存储多个选择
  49. peopleList: [
  50. "定期普调",
  51. "定期绩效调薪",
  52. "晋级涨薪",
  53. "项目奖金",
  54. "团队奖金",
  55. "个人奖金",
  56. "绩效提成",
  57. "股票期权",
  58. "人才补贴",
  59. ],
  60. selectedPeople: [], // 改为数组存储多个选择
  61. powerList: [
  62. "老员工带新",
  63. "导师一对一",
  64. "岗前带薪培训",
  65. "内部定期培训",
  66. "专业技能培训",
  67. "内部课程资源",
  68. "大牛带队",
  69. "人脉积累",
  70. "国内外进修",
  71. "校招培养",
  72. ],
  73. selectedPower: [], // 改为数组存储多个选择
  74. // companyData: {},
  75. companyPeopleDevelop: [],
  76. isUpdateMode: false // 新增:标记是否为编辑模式
  77. };
  78. },
  79. components: {
  80. navBar,
  81. },
  82. onLoad(options) {
  83. this.loadSavedPeopleDevelop();
  84. // if (options.companyData) {
  85. // this.companyData = JSON.parse(options.companyData);
  86. // // 如果之前有保存的数据,恢复选择状态
  87. // this.restoreSelections();
  88. // }
  89. },
  90. methods: {
  91. // 加载已保存的人才发展数据(从缓存)
  92. loadSavedPeopleDevelop() {
  93. try {
  94. let companyInfo = uni.getStorageSync('companyInfo');
  95. if (companyInfo?.companyPeopleDevelop) {
  96. // 处理字符串并分割为数组
  97. const savedPeopleDevelop = companyInfo.companyPeopleDevelop
  98. .replace(/,/g, ',') // 替换中文逗号
  99. .split(',') // 分割
  100. .map(item => item.trim()) // 去除空格
  101. .filter(item => item); // 过滤空值
  102. console.log('加载的人才发展数据:', savedPeopleDevelop);
  103. // 清空之前的选中
  104. this.selectedUp = [];
  105. this.selectedPeople = [];
  106. this.selectedPower = [];
  107. // 恢复晋升制度选择
  108. this.upList.forEach((item, index) => {
  109. if (savedPeopleDevelop.includes(item)) {
  110. this.selectedUp.push(index);
  111. }
  112. });
  113. // 恢复人才激励选择
  114. this.peopleList.forEach((item, index) => {
  115. if (savedPeopleDevelop.includes(item)) {
  116. this.selectedPeople.push(index);
  117. }
  118. });
  119. // 恢复能力培养选择
  120. this.powerList.forEach((item, index) => {
  121. if (savedPeopleDevelop.includes(item)) {
  122. this.selectedPower.push(index);
  123. }
  124. });
  125. console.log('人才发展数据已加载完成');
  126. } else {
  127. console.log('缓存中没有人才发展数据');
  128. }
  129. } catch (error) {
  130. console.error('加载人才发展数据失败:', error);
  131. }
  132. },
  133. // 晋升制度多选
  134. checkUp(index) {
  135. const idx = this.selectedUp.indexOf(index);
  136. if (idx > -1) {
  137. // 如果已选中,则取消选中
  138. this.selectedUp.splice(idx, 1);
  139. } else {
  140. // 如果未选中,则添加
  141. this.selectedUp.push(index);
  142. }
  143. },
  144. // 人才激励多选
  145. checkPeople(index) {
  146. const idx = this.selectedPeople.indexOf(index);
  147. if (idx > -1) {
  148. this.selectedPeople.splice(idx, 1);
  149. } else {
  150. this.selectedPeople.push(index);
  151. }
  152. },
  153. // 能力培养多选
  154. checkPower(index) {
  155. const idx = this.selectedPower.indexOf(index);
  156. if (idx > -1) {
  157. this.selectedPower.splice(idx, 1);
  158. } else {
  159. this.selectedPower.push(index);
  160. }
  161. },
  162. // 恢复之前的选择(编辑时使用)
  163. // restoreSelections() {
  164. // if (this.companyData.companyPeopleDevelop) {
  165. // const savedData = this.companyData.companyPeopleDevelop.split(',');
  166. // // 恢复晋升制度选择
  167. // this.upList.forEach((item, index) => {
  168. // if (savedData.includes(item)) {
  169. // this.selectedUp.push(index);
  170. // }
  171. // });
  172. // // 恢复人才激励选择
  173. // this.peopleList.forEach((item, index) => {
  174. // if (savedData.includes(item)) {
  175. // this.selectedPeople.push(index);
  176. // }
  177. // });
  178. // // 恢复能力培养选择
  179. // this.powerList.forEach((item, index) => {
  180. // if (savedData.includes(item)) {
  181. // this.selectedPower.push(index);
  182. // }
  183. // });
  184. // }
  185. // },
  186. goJobPostingSecond() {
  187. // 清空之前的数组
  188. this.companyPeopleDevelop = [];
  189. // 添加选中的晋升制度
  190. this.selectedUp.forEach(index => {
  191. if (this.upList[index]) {
  192. this.companyPeopleDevelop.push(this.upList[index]);
  193. }
  194. });
  195. // 添加选中的人才激励
  196. this.selectedPeople.forEach(index => {
  197. if (this.peopleList[index]) {
  198. this.companyPeopleDevelop.push(this.peopleList[index]);
  199. }
  200. });
  201. // 添加选中的能力培养
  202. this.selectedPower.forEach(index => {
  203. if (this.powerList[index]) {
  204. this.companyPeopleDevelop.push(this.powerList[index]);
  205. }
  206. });
  207. // 验证是否至少选择了一项
  208. if (this.companyPeopleDevelop.length === 0) {
  209. uni.showToast({
  210. title: "请至少选择一项人才发展方向",
  211. icon: "none",
  212. });
  213. return;
  214. }
  215. let companyData = {
  216. companyId: this.$queue.getData('companyId'),
  217. companyPeopleDevelop: this.companyPeopleDevelop.join(',')
  218. }
  219. this.$Request.postJson('/app/company/updateCompany', companyData).then(res => {
  220. if (res.code == 0) {
  221. uni.showToast({
  222. title: '提交成功',
  223. duration: 1500,
  224. });
  225. setTimeout(() => {
  226. uni.switchTab({
  227. url: '/pages/my/index'
  228. });
  229. }, 500)
  230. }
  231. })
  232. // 如果是编辑模式,同时更新缓存
  233. // if (this.isUpdateMode) {
  234. // try {
  235. // let companyInfo = uni.getStorageSync('companyInfo');
  236. // if (companyInfo) {
  237. // companyInfo.companyPeopleDevelop = companyData.companyPeopleDevelop;
  238. // uni.setStorageSync('companyInfo', companyInfo);
  239. // console.log('已更新缓存中的人才发展数据');
  240. // }
  241. // } catch (error) {
  242. // console.error('更新缓存失败:', error);
  243. // }
  244. // }
  245. // 跳转到下一步
  246. // uni.navigateTo({
  247. // url: "/my/renzheng/editCompanyDesc?companyData=" +
  248. // encodeURIComponent(JSON.stringify(companyData)) +
  249. // (this.isUpdateMode ? "&update=true" : "")
  250. // });
  251. }
  252. },
  253. };
  254. </script>
  255. <style lang="scss" scoped>
  256. /* 样式保持不变 */
  257. .switch-roles {
  258. background-color: #fff;
  259. position: absolute;
  260. left: 0;
  261. right: 0;
  262. top: 0;
  263. bottom: 0;
  264. display: flex;
  265. flex-direction: column;
  266. .roles-content {
  267. width: 100%;
  268. flex: 1;
  269. overflow: hidden;
  270. overflow-y: auto;
  271. .content {
  272. padding: 40rpx;
  273. box-sizing: border-box;
  274. display: flex;
  275. flex-direction: column;
  276. align-items: center;
  277. justify-content: center;
  278. .progress-num {
  279. color: #016bf6;
  280. font-family: DM Sans;
  281. font-size: 24rpx;
  282. font-weight: 500;
  283. width: 100%;
  284. padding-bottom: 20rpx;
  285. box-sizing: border-box;
  286. text {
  287. font-size: 48rpx;
  288. font-weight: 700;
  289. }
  290. }
  291. .title {
  292. color: #333;
  293. width: 100%;
  294. font-family: DM Sans;
  295. font-size: 48rpx;
  296. font-weight: 700;
  297. display: flex;
  298. justify-content: space-between;
  299. align-items: center;
  300. margin-bottom: 20rpx;
  301. }
  302. .desc {
  303. color: rgba(102, 102, 102, 1);
  304. width: 100%;
  305. font-family: DM Sans;
  306. font-size: 24rpx;
  307. font-weight: 400;
  308. line-height: 32rpx;
  309. letter-spacing: 0.5%;
  310. text-align: left;
  311. padding: 20rpx 0;
  312. box-sizing: border-box;
  313. margin-bottom: 20rpx;
  314. }
  315. .content-index {
  316. width: 100%;
  317. .content-item {
  318. margin-bottom: 40rpx;
  319. .content-item-title {
  320. color: rgba(34, 37, 42, 1);
  321. font-family: DM Sans;
  322. font-size: 32rpx;
  323. font-weight: 400;
  324. line-height: 48rpx;
  325. padding-bottom: 12rpx;
  326. box-sizing: border-box;
  327. }
  328. .check-box {
  329. display: flex;
  330. gap: 20rpx;
  331. flex-wrap: wrap;
  332. align-items: center;
  333. .check-item {
  334. flex-shrink: 0;
  335. padding: 8rpx;
  336. border-radius: 8rpx;
  337. background: #9999991a;
  338. border: 1rpx solid #9999991a;
  339. box-sizing: border-box;
  340. color: rgba(102, 102, 102, 1);
  341. font-family: DM Sans;
  342. font-size: 26rpx;
  343. font-weight: 400;
  344. cursor: pointer;
  345. transition: all 0.3s;
  346. }
  347. .check-active {
  348. box-sizing: border-box;
  349. border: 1rpx solid #016bf6;
  350. border-radius: 8rpx;
  351. background: rgba(252, 233, 220, 1);
  352. color: #016bf6;
  353. }
  354. }
  355. }
  356. }
  357. }
  358. }
  359. .submit-btn {
  360. flex-shrink: 0;
  361. border-radius: 999px;
  362. background: #ff6600;
  363. color: rgba(255, 255, 255, 1);
  364. font-family: DM Sans;
  365. font-size: 32rpx;
  366. font-weight: 400;
  367. line-height: 48rpx;
  368. display: flex;
  369. justify-content: center;
  370. align-items: center;
  371. padding: 24rpx 32rpx;
  372. box-sizing: border-box;
  373. margin: 30rpx 40rpx;
  374. margin-top: 20rpx;
  375. }
  376. }
  377. </style>