companyMsg.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  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>1</text>/8 </view>
  7. <view class="title">公司标准工作时间</view>
  8. <view class="desc">
  9. 开始完善公司主页吧,让求职者了解公司、信任职位
  10. 添加工作时间,标准时间仅为求职者提供参考;不代表公司下所有职位工作时间
  11. </view>
  12. <view class="check-title-big">工作时间</view>
  13. <view class="time-picker-container">
  14. <view class="time-item-box" @click="showStartTime = true">
  15. <view class="time-label">开始时间</view>
  16. <view class="time-value time-item">{{ startTime || "请选择开始时间" }}</view>
  17. </view>
  18. <text class="time-separator">至</text>
  19. <view class="time-item-box" @click="showEndTime = true">
  20. <view class="time-label">结束时间</view>
  21. <view class="time-value time-item">{{ endTime || "请选择结束时间" }}</view>
  22. </view>
  23. </view>
  24. <view class="selected-time" v-if="startTime && endTime">
  25. 已选择:{{ startTime }} - {{ endTime }}
  26. </view>
  27. <view class="check-title-big">休息时间(可选)</view>
  28. <view class="check-box">
  29. <view
  30. class="check-item"
  31. :class="{ 'is-check': check == index }"
  32. v-for="(item, index) in peopleList"
  33. :key="index"
  34. @click="checkPeople(index)"
  35. >
  36. {{ item }}
  37. </view>
  38. </view>
  39. <view class="check-title-big">加班情况(可选)</view>
  40. <view class="check-box grid-three">
  41. <view
  42. class="check-item"
  43. :class="{ 'is-check': work == index }"
  44. v-for="(item, index) in workList"
  45. :key="index"
  46. @click="checkWork(index)"
  47. >
  48. {{ item }}
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="submit-btn" @click="goJobPostingSecond">下一步</view>
  54. <!-- 开始时间选择器 -->
  55. <u-picker
  56. mode="time"
  57. v-model="showStartTime"
  58. @confirm="onStartTimeConfirm"
  59. :params="timeParams"
  60. ></u-picker>
  61. <!-- 结束时间选择器 -->
  62. <u-picker
  63. mode="time"
  64. v-model="showEndTime"
  65. @confirm="onEndTimeConfirm"
  66. :params="timeParams"
  67. ></u-picker>
  68. </view>
  69. </template>
  70. <script>
  71. import navBar from "@/components/nav-bar/index.vue";
  72. export default {
  73. data() {
  74. return {
  75. peopleList: ["单休", "双休"],
  76. workList: ["不加班", "偶尔加班", "弹性工作"],
  77. check: 0,
  78. work: 0,
  79. text: "",
  80. showStartTime: false,
  81. showEndTime: false,
  82. startTime: "",
  83. endTime: "",
  84. timeParams: {
  85. year: false,
  86. month: false,
  87. day: false,
  88. hour: true,
  89. minute: true,
  90. second: false,
  91. },
  92. numList: [
  93. {
  94. name: "填写基本信息",
  95. },
  96. {
  97. name: "选择职位要求",
  98. },
  99. ],
  100. };
  101. },
  102. components: {
  103. navBar,
  104. },
  105. onLoad(options) {
  106. if (options.text) {
  107. this.text = options.text;
  108. }
  109. },
  110. methods: {
  111. goBusinessLicense() {
  112. uni.navigateTo({ url: "/pages/my/businessLicense" });
  113. },
  114. checkPeople(index) {
  115. this.check = index;
  116. },
  117. checkWork(index) {
  118. this.work = index;
  119. },
  120. // 开始时间确认
  121. onStartTimeConfirm(e) {
  122. this.startTime = `${e.hour}:${e.minute}`;
  123. },
  124. // 结束时间确认
  125. onEndTimeConfirm(e) {
  126. this.endTime = `${e.hour}:${e.minute}`;
  127. },
  128. goJobPostingSecond() {
  129. // 验证时间选择
  130. if (!this.startTime || !this.endTime) {
  131. uni.showToast({
  132. title: "请选择完整的工作时间",
  133. icon: "none",
  134. });
  135. return;
  136. }
  137. // 这里可以添加时间逻辑验证,比如结束时间不能早于开始时间
  138. if (this.compareTime(this.startTime, this.endTime) >= 0) {
  139. uni.showToast({
  140. title: "结束时间必须晚于开始时间",
  141. icon: "none",
  142. });
  143. return;
  144. }
  145. // 将选择的时间数据传递到下一页或保存
  146. const companyData = {
  147. workTime: `${this.startTime}-${this.endTime}`,
  148. workRestTime: this.peopleList[this.check],
  149. workOverTime:this.workList[this.work]
  150. };
  151. uni.navigateTo({
  152. url:
  153. "/my/renzheng/companyDev?companyData=" +
  154. encodeURIComponent(JSON.stringify(companyData)),
  155. });
  156. },
  157. // 比较时间大小
  158. compareTime(time1, time2) {
  159. const [h1, m1] = time1.split(":").map(Number);
  160. const [h2, m2] = time2.split(":").map(Number);
  161. if (h1 !== h2) {
  162. return h1 - h2;
  163. }
  164. return m1 - m2;
  165. },
  166. },
  167. };
  168. </script>
  169. <style lang="scss" scoped>
  170. .switch-roles {
  171. background-color: #fff;
  172. position: absolute;
  173. left: 0;
  174. right: 0;
  175. top: 0;
  176. bottom: 0;
  177. display: flex;
  178. flex-direction: column;
  179. .roles-content {
  180. width: 100%;
  181. flex: 1;
  182. overflow: hidden;
  183. overflow-y: auto;
  184. .content {
  185. padding: 40rpx;
  186. box-sizing: border-box;
  187. display: flex;
  188. flex-direction: column;
  189. align-items: center;
  190. justify-content: center;
  191. .progress-num {
  192. color: #016bf6;
  193. font-family: DM Sans;
  194. font-size: 24rpx;
  195. font-weight: 500;
  196. width: 100%;
  197. padding-bottom: 20rpx;
  198. box-sizing: border-box;
  199. text {
  200. font-size: 48rpx;
  201. font-weight: 700;
  202. }
  203. }
  204. .title {
  205. color: #333;
  206. width: 100%;
  207. font-family: DM Sans;
  208. font-size: 48rpx;
  209. font-weight: 700;
  210. }
  211. .desc {
  212. color: rgba(102, 102, 102, 1);
  213. width: 100%;
  214. font-family: DM Sans;
  215. font-size: 24rpx;
  216. font-weight: 400;
  217. line-height: 32rpx;
  218. letter-spacing: 0.5%;
  219. text-align: left;
  220. padding: 20rpx 0;
  221. box-sizing: border-box;
  222. }
  223. .time-picker-container {
  224. width: 100%;
  225. display: flex;
  226. align-items: center;
  227. justify-content: space-between;
  228. margin-bottom: 20rpx;
  229. .time-item-box {
  230. text-align: center;
  231. min-width: 40%;
  232. }
  233. .time-item {
  234. flex: 1;
  235. border-radius: 100rpx;
  236. padding: 20rpx 32rpx;
  237. box-sizing: border-box;
  238. border: 2rpx solid rgba(227, 231, 236, 1);
  239. display: flex;
  240. flex-direction: column;
  241. align-items: center;
  242. }
  243. .time-label {
  244. color: rgba(153, 153, 153, 1);
  245. font-family: DM Sans;
  246. font-size: 20rpx;
  247. font-weight: 400;
  248. padding-bottom: 20rpx;
  249. box-sizing: border-box;
  250. }
  251. .time-value {
  252. color: rgba(51, 51, 51, 1);
  253. font-family: DM Sans;
  254. font-size: 24rpx;
  255. font-weight: 500;
  256. }
  257. .time-separator {
  258. margin: 0 20rpx;
  259. padding-top: 40rpx;
  260. box-sizing: border-box;
  261. color: rgba(102, 102, 102, 1);
  262. font-family: DM Sans;
  263. font-size: 24rpx;
  264. font-weight: 500;
  265. }
  266. }
  267. .selected-time {
  268. width: 100%;
  269. text-align: center;
  270. color: #016bf6;
  271. font-family: DM Sans;
  272. font-size: 28rpx;
  273. font-weight: 500;
  274. margin-bottom: 20rpx;
  275. padding: 16rpx;
  276. background: rgba(245, 248, 254, 1);
  277. border-radius: 16rpx;
  278. }
  279. .check-title-big {
  280. color: rgba(31, 44, 55, 1);
  281. font-family: DM Sans;
  282. font-size: 28rpx;
  283. font-weight: 500;
  284. line-height: 44rpx;
  285. letter-spacing: 0.5%;
  286. width: 100%;
  287. padding: 20rpx 0;
  288. box-sizing: border-box;
  289. }
  290. .check-box {
  291. width: 100%;
  292. display: grid;
  293. grid-template-columns: repeat(2, 1fr);
  294. gap: 24rpx;
  295. .check-item {
  296. border-radius: 16rpx;
  297. background: rgba(245, 248, 254, 1);
  298. color: rgba(153, 153, 153, 1);
  299. font-family: DM Sans;
  300. font-size: 28rpx;
  301. font-weight: 400;
  302. line-height: 44rpx;
  303. text-align: center;
  304. padding: 12rpx 48rpx;
  305. box-sizing: border-box;
  306. }
  307. .is-check {
  308. box-sizing: border-box;
  309. border: 1rpx solid #016bf6;
  310. border-radius: 16rpx;
  311. background: rgba(252, 233, 220, 1);
  312. color: #016bf6;
  313. }
  314. }
  315. .grid-three {
  316. grid-template-columns: repeat(3, 1fr) !important;
  317. }
  318. }
  319. }
  320. .submit-btn {
  321. flex-shrink: 0;
  322. border-radius: 999px;
  323. background: #ff6600;
  324. color: rgba(255, 255, 255, 1);
  325. font-family: DM Sans;
  326. font-size: 32rpx;
  327. font-weight: 400;
  328. line-height: 48rpx;
  329. display: flex;
  330. justify-content: center;
  331. align-items: center;
  332. padding: 16rpx 32rpx;
  333. box-sizing: border-box;
  334. margin: 60rpx 62rpx;
  335. }
  336. }
  337. </style>