welcomePage.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  1. <template>
  2. <view class="welcome-page">
  3. <view class="welcome-content">
  4. <swiper
  5. class="custom-swiper"
  6. :autoplay="false"
  7. :current="currentIndex"
  8. @change="onSwiperChange"
  9. >
  10. <!-- circular -->
  11. <swiper-item>
  12. <view class="swiper-content">
  13. <view class="bg-img">
  14. <image src="@/static/images/jobApplicant/BG.svg" mode="aspectFill" />
  15. </view>
  16. <view class="swiper-img">
  17. <image
  18. src="@/static/images/jobApplicant/delivery_bro.svg"
  19. mode="scaleToFill"
  20. class="bro-img"
  21. />
  22. </view>
  23. <view class="swiper-txt">
  24. <view class="content-title"
  25. >了解多一点 <br />
  26. 推荐更准确</view
  27. >
  28. <view class="content-desc"
  29. >亿职赞,专为跨境行业提供人才服务 <br />
  30. 请您完成求职引导</view
  31. >
  32. <view class="next-page" @click="switchBanner(1)"
  33. >下一步
  34. <image src="@/static/images/jobApplicant/next.svg" mode="scaleToFill" />
  35. </view>
  36. </view>
  37. </view>
  38. </swiper-item>
  39. <swiper-item>
  40. <view class="swiper-content">
  41. <view class="bg-img">
  42. <image src="@/static/images/jobApplicant/BG.svg" mode="aspectFill" />
  43. </view>
  44. <view class="swiper-img">
  45. <image
  46. src="@/static/images/jobApplicant/delivery-address_bro.png"
  47. mode="aspectFix"
  48. class="address-img"
  49. />
  50. </view>
  51. <view class="swiper-txt" style="height: 1004rpx">
  52. <!-- 表单内容 -->
  53. <view class="form-container">
  54. <!-- 工作城市 -->
  55. <view class="form-item">
  56. <text class="form-label">期望工作的城市</text>
  57. <view class="form-input" @click="selectCity">
  58. <text class="input-text">{{ city || "请选择" }}</text>
  59. <u-icon name="arrow-right" color="#999" size="24"></u-icon>
  60. </view>
  61. </view>
  62. <!-- 工作职位 -->
  63. <view class="form-item">
  64. <text class="form-label">期望的职位</text>
  65. <view class="form-input" @click="selectJob">
  66. <text class="input-text">{{ jobTitle || "请选择" }}</text>
  67. <u-icon name="arrow-right" color="#999" size="24"></u-icon>
  68. </view>
  69. </view>
  70. <!-- 期望薪酬 -->
  71. <view class="form-item">
  72. <text class="form-label">期望的薪酬</text>
  73. <view class="salary-container">
  74. <view class="salary-inputs">
  75. <view class="salary-input">
  76. <text class="currency">¥</text>
  77. <input
  78. v-model="minSalary"
  79. type="number"
  80. placeholder="8000"
  81. class="salary-field"
  82. />
  83. </view>
  84. <view class="salary-input">
  85. <text class="currency">¥</text>
  86. <input
  87. v-model="maxSalary"
  88. type="number"
  89. placeholder="10000"
  90. class="salary-field"
  91. />
  92. </view>
  93. </view>
  94. <!-- 范围滑块 -->
  95. <view class="range-slider-container">
  96. <view class="range-slider-track" @click="onTrackClick">
  97. <view class="range-slider-progress" :style="progressStyle"></view>
  98. <view
  99. class="range-slider-thumb range-slider-thumb-left"
  100. :style="leftThumbStyle"
  101. @touchstart.stop="onLeftThumbStart"
  102. @touchmove.stop="onLeftThumbMove"
  103. @touchend.stop="onLeftThumbEnd"
  104. ></view>
  105. <view
  106. class="range-slider-thumb range-slider-thumb-right"
  107. :style="rightThumbStyle"
  108. @touchstart.stop="onRightThumbStart"
  109. @touchmove.stop="onRightThumbMove"
  110. @touchend.stop="onRightThumbEnd"
  111. ></view>
  112. </view>
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. <view class="next-page" @click="switchBanner(2)"
  118. >下一步
  119. <image src="@/static/images/jobApplicant/next.svg" mode="scaleToFill" />
  120. </view>
  121. </view>
  122. </view>
  123. </swiper-item>
  124. <swiper-item>
  125. <view class="swiper-content">
  126. <view class="bg-img">
  127. <image src="@/static/images/jobApplicant/BG.svg" mode="aspectFill" />
  128. </view>
  129. <view class="swiper-img">
  130. <image
  131. src="@/static/images/jobApplicant/bangongyuansu.svg"
  132. mode="aspectFix"
  133. class="people-img"
  134. />
  135. </view>
  136. <view class="swiper-txt">
  137. <view class="content-title">跨境电商工作经验?</view>
  138. <view class="content-desc"
  139. >请根据过往经验进行选择 <br />
  140. 届时我们将为您提供更为准确的服务</view
  141. >
  142. <view class="check-box">
  143. <view class="check-item" @click="checkWork(1)">
  144. <image
  145. v-if="check == 1"
  146. src="@/static/images/jobApplicant/check.svg"
  147. mode="scaleToFill"
  148. />
  149. <image
  150. v-else
  151. src="@/static/images/jobApplicant/border.svg"
  152. mode="scaleToFill"
  153. />
  154. 有跨境电商工作经验
  155. </view>
  156. <view class="check-item" @click="checkWork(2)">
  157. <image
  158. v-if="check == 2"
  159. src="@/static/images/jobApplicant/check.svg"
  160. mode="scaleToFill"
  161. />
  162. <image
  163. v-else
  164. src="@/static/images/jobApplicant/border.svg"
  165. mode="scaleToFill"
  166. />
  167. 有跨境电商工作经验
  168. </view>
  169. </view>
  170. <view class="next-page" @click="goWord"
  171. >下一步
  172. <image src="@/static/images/jobApplicant/next.svg" mode="scaleToFill" />
  173. </view>
  174. </view>
  175. </view>
  176. </swiper-item>
  177. </swiper>
  178. <!-- 自定义指示器 -->
  179. <view class="custom-indicator">
  180. <view
  181. v-for="(item, index) in 3"
  182. :key="index"
  183. class="indicator-dot"
  184. :class="{ active: currentIndex === index }"
  185. @click="switchBanner(index)"
  186. ></view>
  187. </view>
  188. </view>
  189. </view>
  190. </template>
  191. <script>
  192. export default {
  193. data() {
  194. return {
  195. currentIndex: 0,
  196. check: 1,
  197. jobTitle: "",
  198. city: "",
  199. minSalary: "8000",
  200. maxSalary: "10000",
  201. jobType: "fulltime",
  202. industry: "",
  203. // 范围滑块相关数据
  204. minValue: 8000,
  205. maxValue: 10000,
  206. sliderMin: 5000,
  207. sliderMax: 50000,
  208. step: 1000,
  209. trackWidth: 0,
  210. draggingThumb: null, // 'left' 或 'right' 或 null
  211. startX: 0,
  212. startValue: 0,
  213. };
  214. },
  215. computed: {
  216. // 左侧滑块位置百分比
  217. leftPercent() {
  218. return ((this.minValue - this.sliderMin) / (this.sliderMax - this.sliderMin)) * 100;
  219. },
  220. // 右侧滑块位置百分比
  221. rightPercent() {
  222. return ((this.maxValue - this.sliderMin) / (this.sliderMax - this.sliderMin)) * 100;
  223. },
  224. // 进度条样式
  225. progressStyle() {
  226. return {
  227. left: this.leftPercent + "%",
  228. width: this.rightPercent - this.leftPercent + "%",
  229. };
  230. },
  231. // 左侧滑块样式
  232. leftThumbStyle() {
  233. return {
  234. left: this.leftPercent + "%",
  235. };
  236. },
  237. // 右侧滑块样式
  238. rightThumbStyle() {
  239. return {
  240. left: this.rightPercent + "%",
  241. };
  242. },
  243. },
  244. methods: {
  245. checkWork(value) {
  246. this.check = value;
  247. },
  248. // 轮播图切换事件
  249. onSwiperChange(e) {
  250. this.currentIndex = e.detail.current;
  251. },
  252. // 切换轮播图
  253. switchBanner(index) {
  254. this.currentIndex = index;
  255. },
  256. // 点击轮播图
  257. handleBannerClick(item) {
  258. if (item.link) {
  259. uni.navigateTo({
  260. url: item.link,
  261. });
  262. }
  263. },
  264. // 暂停自动播放
  265. pauseAutoplay() {
  266. this.autoplay = false;
  267. },
  268. // 开始自动播放
  269. startAutoplay() {
  270. this.autoplay = true;
  271. },
  272. selectJob() {
  273. uni.navigateTo({
  274. url: "/package/jobIntention/jobList",
  275. });
  276. },
  277. selectCity() {
  278. uni.navigateTo({
  279. url: "/package/jobIntention/city",
  280. });
  281. },
  282. selectJobType(type) {
  283. this.jobType = type;
  284. },
  285. // 获取滑块轨道宽度
  286. getTrackWidth() {
  287. uni
  288. .createSelectorQuery()
  289. .in(this)
  290. .select(".range-slider-track")
  291. .boundingClientRect((data) => {
  292. this.trackWidth = data.width;
  293. })
  294. .exec();
  295. },
  296. // 将像素位置转换为数值
  297. pixelToValue(pixel) {
  298. const percent = (pixel / this.trackWidth) * 100;
  299. const value = this.sliderMin + (percent / 100) * (this.sliderMax - this.sliderMin);
  300. return Math.round(value / this.step) * this.step;
  301. },
  302. // 左侧滑块开始拖拽
  303. onLeftThumbStart(e) {
  304. this.draggingThumb = "left";
  305. this.startX = e.touches[0].clientX;
  306. this.startValue = this.minValue;
  307. e.preventDefault();
  308. },
  309. // 左侧滑块拖拽中
  310. onLeftThumbMove(e) {
  311. if (this.draggingThumb !== "left") return;
  312. const deltaX = e.touches[0].clientX - this.startX;
  313. const deltaPercent = (deltaX / this.trackWidth) * 100;
  314. const deltaValue = (deltaPercent / 100) * (this.sliderMax - this.sliderMin);
  315. let newValue = this.startValue + deltaValue;
  316. // 限制范围
  317. newValue = Math.max(this.sliderMin, Math.min(newValue, this.maxValue - this.step));
  318. newValue = Math.round(newValue / this.step) * this.step;
  319. this.minValue = newValue;
  320. this.minSalary = newValue.toString();
  321. e.preventDefault();
  322. },
  323. // 左侧滑块结束拖拽
  324. onLeftThumbEnd(e) {
  325. this.draggingThumb = null;
  326. e.preventDefault();
  327. },
  328. // 右侧滑块开始拖拽
  329. onRightThumbStart(e) {
  330. this.draggingThumb = "right";
  331. this.startX = e.touches[0].clientX;
  332. this.startValue = this.maxValue;
  333. e.preventDefault();
  334. },
  335. // 右侧滑块拖拽中
  336. onRightThumbMove(e) {
  337. if (this.draggingThumb !== "right") return;
  338. const deltaX = e.touches[0].clientX - this.startX;
  339. const deltaPercent = (deltaX / this.trackWidth) * 100;
  340. const deltaValue = (deltaPercent / 100) * (this.sliderMax - this.sliderMin);
  341. let newValue = this.startValue + deltaValue;
  342. // 限制范围
  343. newValue = Math.max(this.minValue + this.step, Math.min(newValue, this.sliderMax));
  344. newValue = Math.round(newValue / this.step) * this.step;
  345. this.maxValue = newValue;
  346. this.maxSalary = newValue.toString();
  347. e.preventDefault();
  348. },
  349. // 右侧滑块结束拖拽
  350. onRightThumbEnd(e) {
  351. this.draggingThumb = null;
  352. e.preventDefault();
  353. },
  354. // 点击轨道
  355. onTrackClick(e) {
  356. if (this.draggingThumb) return;
  357. const rect = e.currentTarget.getBoundingClientRect();
  358. const clickX = e.detail.x - rect.left;
  359. const clickPercent = (clickX / rect.width) * 100;
  360. const clickValue =
  361. this.sliderMin + (clickPercent / 100) * (this.sliderMax - this.sliderMin);
  362. // 判断点击位置更靠近哪个滑块
  363. const distanceToLeft = Math.abs(clickValue - this.minValue);
  364. const distanceToRight = Math.abs(clickValue - this.maxValue);
  365. if (distanceToLeft < distanceToRight) {
  366. // 更靠近左侧滑块
  367. let newValue = Math.round(clickValue / this.step) * this.step;
  368. newValue = Math.max(
  369. this.sliderMin,
  370. Math.min(newValue, this.maxValue - this.step)
  371. );
  372. this.minValue = newValue;
  373. this.minSalary = newValue.toString();
  374. } else {
  375. // 更靠近右侧滑块
  376. let newValue = Math.round(clickValue / this.step) * this.step;
  377. newValue = Math.max(
  378. this.minValue + this.step,
  379. Math.min(newValue, this.sliderMax)
  380. );
  381. this.maxValue = newValue;
  382. this.maxSalary = newValue.toString();
  383. }
  384. },
  385. goWord(){
  386. uni.navigateTo({
  387. url:'/pages/my/jobApplicant/workProgress'
  388. })
  389. },
  390. },
  391. onHide() {
  392. // 页面隐藏时暂停自动播放
  393. this.pauseAutoplay();
  394. },
  395. mounted() {
  396. // 初始化滑块轨道宽度
  397. this.$nextTick(() => {
  398. this.getTrackWidth();
  399. });
  400. },
  401. onShow() {
  402. // 页面显示时恢复自动播放
  403. this.startAutoplay();
  404. // 监听选择结果
  405. uni.$on("jobSelected", (data) => {
  406. this.jobTitle = data.name;
  407. });
  408. uni.$on("citySelected", (data) => {
  409. this.city = data.name;
  410. });
  411. uni.$on("industrySelected", (data) => {
  412. this.industry = data.name;
  413. });
  414. },
  415. onUnload() {
  416. // 移除监听
  417. uni.$off("jobSelected");
  418. uni.$off("citySelected");
  419. uni.$off("industrySelected");
  420. },
  421. };
  422. </script>
  423. <style scoped lang="scss">
  424. .welcome-page {
  425. background: linear-gradient(90deg, rgba(13, 39, 247, 1), rgba(19, 193, 234, 1) 100%);
  426. position: absolute;
  427. left: 0;
  428. right: 0;
  429. top: 0;
  430. bottom: 0;
  431. display: flex;
  432. flex-direction: column;
  433. box-sizing: border-box;
  434. .bg-img {
  435. position: absolute;
  436. z-index: -1;
  437. top: 26rpx;
  438. left: -240rpx;
  439. width: 1680rpx;
  440. height: 1570rpx;
  441. image {
  442. width: 100%;
  443. height: 100%;
  444. }
  445. }
  446. .check-box {
  447. .check-item {
  448. color: rgba(51, 51, 51, 1);
  449. font-family: DM Sans;
  450. font-size: 36rpx;
  451. font-weight: 400;
  452. line-height: 46rpx;
  453. display: flex;
  454. justify-content: center;
  455. align-items: center;
  456. margin-top: 26rpx;
  457. image {
  458. width: 48rpx;
  459. height: 48rpx;
  460. margin-right: 24rpx;
  461. }
  462. }
  463. }
  464. .welcome-content {
  465. position: absolute;
  466. left: 0;
  467. bottom: 0;
  468. right: 0;
  469. top: 0;
  470. z-index: 2;
  471. }
  472. .custom-swiper {
  473. height: 100%;
  474. }
  475. .custom-indicator {
  476. display: flex;
  477. justify-content: center;
  478. align-items: center;
  479. margin-top: -186rpx;
  480. gap: 16rpx;
  481. position: relative;
  482. z-index: 3;
  483. .indicator-dot {
  484. width: 32rpx;
  485. height: 24rpx;
  486. border-radius: 100rpx;
  487. background: #1be5df;
  488. transition: all 0.3s ease;
  489. &.active {
  490. width: 48rpx;
  491. border-radius: 100rpx;
  492. background: #016bf6;
  493. }
  494. }
  495. }
  496. .swiper-content {
  497. display: flex;
  498. flex-direction: column;
  499. width: 100%;
  500. height: 100%;
  501. position: relative;
  502. .swiper-img {
  503. flex: 1;
  504. width: 100%;
  505. display: flex;
  506. justify-content: center;
  507. align-items: center;
  508. .bro-img {
  509. width: 640rpx;
  510. height: 436rpx;
  511. }
  512. .address-img {
  513. width: 714rpx;
  514. height: 298rpx;
  515. }
  516. .people-img {
  517. width: 586rpx;
  518. height: 586rpx;
  519. }
  520. }
  521. .swiper-txt {
  522. flex-shrink: 0;
  523. background: #fff;
  524. border-top-left-radius: 48rpx;
  525. border-top-right-radius: 48rpx;
  526. width: 100%;
  527. height: 782rpx;
  528. padding: 56rpx 40rpx;
  529. padding-bottom: 160rpx;
  530. box-sizing: border-box;
  531. .next-page {
  532. color: #016bf6;
  533. font-family: DM Sans;
  534. font-size: 30rpx;
  535. font-weight: 400;
  536. line-height: 36rpx;
  537. letter-spacing: 0%;
  538. position: absolute;
  539. right: 34rpx;
  540. bottom: 46rpx;
  541. display: flex;
  542. justify-content: center;
  543. align-items: center;
  544. image {
  545. width: 48rpx;
  546. height: 48rpx;
  547. }
  548. }
  549. .content-title {
  550. color: #016bf6;
  551. font-family: DM Sans;
  552. font-size: 68rpx;
  553. font-weight: 700;
  554. line-height: 88rpx;
  555. letter-spacing: 0%;
  556. text-align: center;
  557. }
  558. .content-desc {
  559. color: #016bf6;
  560. font-family: DM Sans;
  561. font-size: 34rpx;
  562. font-weight: 500;
  563. line-height: 48rpx;
  564. letter-spacing: 0px;
  565. text-align: center;
  566. margin-top: 24rpx;
  567. }
  568. .form-container {
  569. height: 100%;
  570. overflow: hidden;
  571. overflow-y: auto;
  572. }
  573. .form-item {
  574. margin-bottom: 40rpx;
  575. &:last-child {
  576. margin-bottom: 0;
  577. }
  578. .form-label {
  579. color: rgba(58, 57, 67, 1);
  580. font-family: DM Sans;
  581. font-size: 36rpx;
  582. font-weight: 500;
  583. line-height: 48rpx;
  584. letter-spacing: 0px;
  585. text-align: left;
  586. }
  587. .form-input {
  588. height: 108rpx;
  589. display: flex;
  590. justify-content: space-between;
  591. align-items: center;
  592. padding: 32rpx 48rpx;
  593. border-radius: 12rpx;
  594. box-shadow: 0px 8px 150px 0px rgba(0, 0, 0, 0.06);
  595. margin-top: 20rpx;
  596. .input-text {
  597. color: rgba(97, 110, 124, 1);
  598. font-family: DM Sans;
  599. font-weight: 400;
  600. line-height: 20px;
  601. letter-spacing: 0px;
  602. text-align: left;
  603. font-size: 28rpx;
  604. }
  605. }
  606. }
  607. .salary-container {
  608. .salary-inputs {
  609. display: flex;
  610. align-items: center;
  611. margin: 20rpx 0 30rpx 0;
  612. gap: 50rpx;
  613. .salary-input {
  614. display: flex;
  615. align-items: center;
  616. flex: 1;
  617. padding: 20rpx;
  618. border-radius: 12rpx;
  619. box-shadow: 0px 8px 150px 0px rgba(0, 0, 0, 0.06);
  620. background: rgba(255, 255, 255, 1);
  621. .currency,
  622. .salary-field {
  623. color: rgba(97, 110, 124, 1);
  624. font-family: DM Sans;
  625. font-weight: 400;
  626. line-height: 20px;
  627. letter-spacing: 0px;
  628. text-align: left;
  629. font-size: 28rpx;
  630. }
  631. }
  632. .salary-separator {
  633. margin: 0 20rpx;
  634. color: rgba(153, 153, 153, 1);
  635. font-size: 28rpx;
  636. }
  637. }
  638. .range-slider-container {
  639. padding: 20rpx 10rpx;
  640. }
  641. .range-slider-track {
  642. position: relative;
  643. height: 6rpx;
  644. background-color: #e5e5ea;
  645. border-radius: 3rpx;
  646. cursor: pointer;
  647. }
  648. .range-slider-progress {
  649. position: absolute;
  650. top: 0;
  651. height: 100%;
  652. background-color: #007aff;
  653. border-radius: 3rpx;
  654. transition: all 0.1s ease;
  655. }
  656. .range-slider-thumb {
  657. position: absolute;
  658. top: 50%;
  659. width: 40rpx;
  660. height: 40rpx;
  661. background-color: #007aff;
  662. border-radius: 50%;
  663. border: 4rpx solid #ffffff;
  664. box-shadow: 0 2rpx 8rpx rgba(0, 122, 255, 0.3);
  665. transform: translate(-50%, -50%);
  666. cursor: pointer;
  667. transition: all 0.1s ease;
  668. }
  669. .range-slider-thumb:active {
  670. transform: translate(-50%, -50%) scale(1.1);
  671. box-shadow: 0 4rpx 12rpx rgba(0, 122, 255, 0.4);
  672. }
  673. }
  674. .job-type-container {
  675. display: flex;
  676. gap: 50rpx;
  677. margin-top: 20rpx;
  678. }
  679. }
  680. }
  681. }
  682. </style>