companyMsg.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  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 workTimeData = {
  147. workTime: `${this.startTime}-${this.endTime}`,
  148. restTime: this.peopleList[this.check],
  149. };
  150. uni.navigateTo({
  151. url:
  152. "/my/renzheng/companyDev?workTime=" +
  153. encodeURIComponent(workTimeData.workTime),
  154. });
  155. },
  156. // 比较时间大小
  157. compareTime(time1, time2) {
  158. const [h1, m1] = time1.split(":").map(Number);
  159. const [h2, m2] = time2.split(":").map(Number);
  160. if (h1 !== h2) {
  161. return h1 - h2;
  162. }
  163. return m1 - m2;
  164. },
  165. },
  166. };
  167. </script>
  168. <style lang="scss" scoped>
  169. .switch-roles {
  170. background-color: #fff;
  171. position: absolute;
  172. left: 0;
  173. right: 0;
  174. top: 0;
  175. bottom: 0;
  176. display: flex;
  177. flex-direction: column;
  178. .roles-content {
  179. width: 100%;
  180. flex: 1;
  181. overflow: hidden;
  182. overflow-y: auto;
  183. .content {
  184. padding: 40rpx;
  185. box-sizing: border-box;
  186. display: flex;
  187. flex-direction: column;
  188. align-items: center;
  189. justify-content: center;
  190. .progress-num {
  191. color: #016bf6;
  192. font-family: DM Sans;
  193. font-size: 24rpx;
  194. font-weight: 500;
  195. width: 100%;
  196. padding-bottom: 20rpx;
  197. box-sizing: border-box;
  198. text {
  199. font-size: 48rpx;
  200. font-weight: 700;
  201. }
  202. }
  203. .title {
  204. color: #333;
  205. width: 100%;
  206. font-family: DM Sans;
  207. font-size: 48rpx;
  208. font-weight: 700;
  209. }
  210. .desc {
  211. color: rgba(102, 102, 102, 1);
  212. width: 100%;
  213. font-family: DM Sans;
  214. font-size: 24rpx;
  215. font-weight: 400;
  216. line-height: 32rpx;
  217. letter-spacing: 0.5%;
  218. text-align: left;
  219. padding: 20rpx 0;
  220. box-sizing: border-box;
  221. }
  222. .time-picker-container {
  223. width: 100%;
  224. display: flex;
  225. align-items: center;
  226. justify-content: space-between;
  227. margin-bottom: 20rpx;
  228. .time-item-box {
  229. text-align: center;
  230. min-width: 40%;
  231. }
  232. .time-item {
  233. flex: 1;
  234. border-radius: 100rpx;
  235. padding: 20rpx 32rpx;
  236. box-sizing: border-box;
  237. border: 2rpx solid rgba(227, 231, 236, 1);
  238. display: flex;
  239. flex-direction: column;
  240. align-items: center;
  241. }
  242. .time-label {
  243. color: rgba(153, 153, 153, 1);
  244. font-family: DM Sans;
  245. font-size: 20rpx;
  246. font-weight: 400;
  247. padding-bottom: 20rpx;
  248. box-sizing: border-box;
  249. }
  250. .time-value {
  251. color: rgba(51, 51, 51, 1);
  252. font-family: DM Sans;
  253. font-size: 24rpx;
  254. font-weight: 500;
  255. }
  256. .time-separator {
  257. margin: 0 20rpx;
  258. padding-top: 40rpx;
  259. box-sizing: border-box;
  260. color: rgba(102, 102, 102, 1);
  261. font-family: DM Sans;
  262. font-size: 24rpx;
  263. font-weight: 500;
  264. }
  265. }
  266. .selected-time {
  267. width: 100%;
  268. text-align: center;
  269. color: #016bf6;
  270. font-family: DM Sans;
  271. font-size: 28rpx;
  272. font-weight: 500;
  273. margin-bottom: 20rpx;
  274. padding: 16rpx;
  275. background: rgba(245, 248, 254, 1);
  276. border-radius: 16rpx;
  277. }
  278. .check-title-big {
  279. color: rgba(31, 44, 55, 1);
  280. font-family: DM Sans;
  281. font-size: 28rpx;
  282. font-weight: 500;
  283. line-height: 44rpx;
  284. letter-spacing: 0.5%;
  285. width: 100%;
  286. padding: 20rpx 0;
  287. box-sizing: border-box;
  288. }
  289. .check-box {
  290. width: 100%;
  291. display: grid;
  292. grid-template-columns: repeat(2, 1fr);
  293. gap: 24rpx;
  294. .check-item {
  295. border-radius: 16rpx;
  296. background: rgba(245, 248, 254, 1);
  297. color: rgba(153, 153, 153, 1);
  298. font-family: DM Sans;
  299. font-size: 28rpx;
  300. font-weight: 400;
  301. line-height: 44rpx;
  302. text-align: center;
  303. padding: 12rpx 48rpx;
  304. box-sizing: border-box;
  305. }
  306. .is-check {
  307. box-sizing: border-box;
  308. border: 1rpx solid #016bf6;
  309. border-radius: 16rpx;
  310. background: rgba(252, 233, 220, 1);
  311. color: #016bf6;
  312. }
  313. }
  314. .grid-three {
  315. grid-template-columns: repeat(3, 1fr) !important;
  316. }
  317. }
  318. }
  319. .submit-btn {
  320. flex-shrink: 0;
  321. border-radius: 999px;
  322. background: #ff6600;
  323. color: rgba(255, 255, 255, 1);
  324. font-family: DM Sans;
  325. font-size: 32rpx;
  326. font-weight: 400;
  327. line-height: 48rpx;
  328. display: flex;
  329. justify-content: center;
  330. align-items: center;
  331. padding: 16rpx 32rpx;
  332. box-sizing: border-box;
  333. margin: 60rpx 62rpx;
  334. }
  335. }
  336. </style>