jobList.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <template>
  2. <view>
  3. <!-- 职业选择头部 -->
  4. <view class="profession-header">
  5. <view class="header-content">
  6. <view class="header-left" @click="goBack">
  7. <u-icon name="close" color="#333" size="32"></u-icon>
  8. </view>
  9. <view class="header-title">职位选择</view>
  10. <view class="header-right"></view>
  11. </view>
  12. </view>
  13. <!-- 搜索 -->
  14. <!-- <view class="search flex justify-center align-center">
  15. <view class="search-box">
  16. <u-search placeholder="搜索岗位" :show-action="false" @change="getSearchList" v-model="keyword"></u-search>
  17. </view>
  18. </view> -->
  19. <!-- 搜索列表 -->
  20. <view class="searchList flex justify-center" v-if="keyword!=''">
  21. <view class="searchList-box">
  22. <scroll-view scroll-y="true" class="searchList-box-scroll">
  23. <view class="searchList-box-item" @click="selectJob(item)" v-for="(item,index) in searchList" :key="index">
  24. <view class="">
  25. {{item.ruleClassifyName}}
  26. </view>
  27. <view class="" style="font-size: 24rpx;color: #999999;margin-top: 10rpx;">
  28. {{item.title}}
  29. </view>
  30. </view>
  31. </scroll-view>
  32. </view>
  33. </view>
  34. <!-- 列表 -->
  35. <view class="list flex justify-between" v-else>
  36. <!-- 左侧分类 -->
  37. <view class="list-l">
  38. <scroll-view scroll-y="true" style="width: 100%;height: 100%;padding-bottom: 20rpx;">
  39. <view class="list-l-item flex align-center " @click="setRightList(index)" :class="current==index?'active':''" v-for="(item,index) in list" :key="index">
  40. {{item.ruleClassifyName}}
  41. </view>
  42. </scroll-view>
  43. </view>
  44. <!-- 右侧列表 -->
  45. <view class="list-r">
  46. <view class="list-r-container">
  47. <!-- 中间标题列 -->
  48. <view class="list-r-titles">
  49. <scroll-view scroll-y="true" style="width: 100%;height: 100%;padding-bottom: 20rpx;">
  50. <view class="list-r-title-item" @click="setActiveTitle(index)" :class="activeTitle==index?'active':''" v-for="(item,index) in rightList" :key="index">
  51. {{item.title}}
  52. </view>
  53. </scroll-view>
  54. </view>
  55. <!-- 最右侧子内容列 -->
  56. <view class="list-r-content">
  57. <scroll-view scroll-y="true" style="width: 100%;height: 100%;padding-bottom: 20rpx;">
  58. <view class="list-r-item-childs-vertical" v-if="rightList.length>0 && rightList[activeTitle]">
  59. <view class="list-r-item-childs-i" @click="selectJob(ite)" v-for="(ite,ind) in rightList[activeTitle].childrens" :key="ind">
  60. {{ite.ruleClassifyName}}
  61. </view>
  62. </view>
  63. <empty v-if="rightList.length==0" />
  64. </scroll-view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <!-- 底部确定按钮 -->
  70. <view class="bottom-btn-container">
  71. <view class="confirm-btn" @click="confirmSelection">
  72. <text>确定</text>
  73. </view>
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. import empty from '../../components/empty.vue'
  79. export default {
  80. components:{
  81. empty
  82. },
  83. data() {
  84. return {
  85. searchList:[],
  86. keyword:'',
  87. current:0,
  88. activeTitle:0,
  89. rightList:[],
  90. list:[],
  91. };
  92. },
  93. onLoad() {
  94. this.getJobList()
  95. },
  96. methods:{
  97. /**
  98. * 返回上一页
  99. */
  100. goBack(){
  101. uni.navigateBack()
  102. },
  103. /**
  104. * 搜索岗位
  105. */
  106. getSearchList(){
  107. let data = {
  108. ruleClassifyName:this.keyword
  109. }
  110. this.$Request.getT('/app/rule/userGetClassify',data).then(res => {
  111. if(res.code==0){
  112. this.searchList = res.data
  113. }
  114. })
  115. },
  116. /**
  117. * @param {Object} info
  118. * 选择岗位并返回
  119. */
  120. selectJob(info){
  121. uni.$emit('jobs',{
  122. ruleClassifyId:info.ruleClassifyId,//岗位分类id
  123. ruleClassifyName:info.ruleClassifyName,//岗位分类名称
  124. price:info.price,//岗位价格
  125. // ruleClassifyId2:topInfo.ruleClassifyId,//上级分类id
  126. // ruleClassifyId1:topInfo.parentId//一级分类id
  127. })
  128. uni.navigateBack()
  129. },
  130. /**
  131. * 切换菜单
  132. */
  133. setRightList(index){
  134. this.current=index
  135. this.rightList = this.list[index].childrens
  136. this.activeTitle = 0 // 重置为第一个标题
  137. },
  138. /**
  139. * 设置激活的标题
  140. */
  141. setActiveTitle(index){
  142. this.activeTitle = index
  143. },
  144. /**
  145. * 确定选择
  146. */
  147. // confirmSelection(){
  148. // // 获取当前选中的职位信息
  149. // if(this.rightList.length > 0 && this.rightList[this.activeTitle] && this.rightList[this.activeTitle].childrens.length > 0) {
  150. // // 这里可以获取选中的职位信息
  151. // uni.showToast({
  152. // title: '选择成功',
  153. // icon: 'success'
  154. // })
  155. // // 返回上一页
  156. // setTimeout(() => {
  157. // uni.navigateBack()
  158. // }, 1500)
  159. // } else {
  160. // uni.showToast({
  161. // title: '请先选择职位',
  162. // icon: 'none'
  163. // })
  164. // }
  165. // },
  166. /**
  167. * 获取岗位列表
  168. */
  169. getJobList(){
  170. this.$Request.getT('/app/rule/getClassifyList').then(res => {
  171. if(res.code==0){
  172. if(res.data){
  173. this.list = res.data
  174. this.rightList = this.list[this.current].childrens
  175. this.activeTitle = 0 // 初始化时选择第一个标题
  176. }
  177. }
  178. })
  179. },
  180. }
  181. }
  182. </script>
  183. <style lang="scss">
  184. page {
  185. background-color: #FCFCFC;
  186. padding: 0 20rpx;
  187. }
  188. .profession-header {
  189. padding-top: 80rpx;
  190. background-color: #FCFCFC;
  191. z-index: 9999;
  192. box-sizing: border-box;
  193. margin-bottom: 40rpx;
  194. .header-content {
  195. display: flex;
  196. align-items: center;
  197. justify-content: space-between;
  198. height: 100%;
  199. .header-left, .header-right {
  200. width: 60rpx;
  201. height: 60rpx;
  202. display: flex;
  203. align-items: center;
  204. justify-content: center;
  205. }
  206. .header-title {
  207. color: rgba(51, 51, 51, 1);
  208. font-family: DM Sans;
  209. font-size: 36rpx;
  210. font-weight: 700;
  211. line-height: 26px;
  212. letter-spacing: 0px;
  213. text-align: center;
  214. }
  215. }
  216. }
  217. .searchList{
  218. width: 100%;
  219. /* #ifdef MP-WEIXIN */
  220. height: calc(100vh - 100rpx);
  221. /* #endif */
  222. /* #ifndef MP-WEIXIN */
  223. height: calc(100vh - 180rpx);
  224. /* #endif */
  225. position: fixed;
  226. bottom: 0;
  227. .searchList-box{
  228. width: 686rpx;
  229. .searchList-box-scroll{
  230. width: 100%;
  231. // background-color: red;
  232. .searchList-box-item{
  233. // margin-bottom: 20rpx;
  234. border-bottom: 1rpx solid #F2F2F2;
  235. padding-top: 20rpx;
  236. padding-bottom: 20rpx;
  237. }
  238. }
  239. }
  240. }
  241. .search{
  242. width: 100%;
  243. height: 100rpx;
  244. border-bottom: 1rpx solid #F2F2F7;
  245. box-sizing: border-box;
  246. .search-box{
  247. width: 686rpx;
  248. height: 60rpx;
  249. border-radius: 44rpx;
  250. background-color: #F2F2F7;
  251. }
  252. }
  253. .active{
  254. border-left: 16rpx solid rgba(1, 107, 246, 1) !important;
  255. padding: 10px 0px 10px 0px;
  256. color: rgba(1, 107, 246, 1) !important;
  257. background: rgba(255, 255, 255, 1);
  258. border-radius: 6px;
  259. }
  260. .list{
  261. width: 100;
  262. height: calc(100vh - 180rpx);
  263. gap: 12rpx;
  264. .list-l{
  265. width: 25%;
  266. height: 90%;
  267. border-radius: 6px;
  268. background: rgba(245, 245, 245, 1);
  269. .list-l-item{
  270. margin-top: 20rpx;
  271. color: rgba(102, 102, 102, 1);
  272. font-family: DM Sans;
  273. padding: 20rpx 10rpx;
  274. font-size: 16px;
  275. font-weight: 400;
  276. line-height: 21px;
  277. letter-spacing: 0%;
  278. text-align: center;
  279. display: flex;
  280. align-items: center;
  281. justify-content: center;
  282. }
  283. }
  284. .list-r{
  285. width: 75%;
  286. height: 90%;
  287. background-color: #ffffff;
  288. border-left: 1rpx solid #F2F2F7;
  289. box-sizing: border-box;
  290. .list-r-container{
  291. width: 100%;
  292. height: 100%;
  293. display: flex;
  294. flex-direction: row;
  295. }
  296. .list-r-titles{
  297. width: 50%;
  298. height: 100%;
  299. border-right: 1rpx solid #F2F2F7;
  300. box-sizing: border-box;
  301. .list-r-title-item{
  302. margin-top: 20rpx;
  303. padding: 20rpx 10rpx;
  304. color: var(--016BF6, rgba(1, 107, 246, 1));
  305. font-family: DM Sans;
  306. font-size: 16px;
  307. font-weight: 400;
  308. line-height: 21px;
  309. letter-spacing: 0%;
  310. text-align: center;
  311. &.active{
  312. color: rgba(1, 107, 246, 1) !important;
  313. background: rgba(252, 233, 220, 1);
  314. padding: 20rpx 10rpx;
  315. border-left: none !important;
  316. border-radius: 0 !important;
  317. }
  318. }
  319. }
  320. .list-r-content{
  321. width: 70%;
  322. height: 100%;
  323. flex: 1;
  324. .list-r-item-childs-vertical{
  325. width: 100%;
  326. display: flex;
  327. flex-direction: column;
  328. gap: 12rpx;
  329. padding: 20rpx;
  330. .list-r-item-childs-i{
  331. width: 100%;
  332. padding: 15rpx 20rpx;
  333. background-color: #F5F5F5;
  334. border-radius: 8rpx;
  335. margin-bottom: 4rpx;
  336. color: rgba(102, 102, 102, 1);
  337. font-family: DM Sans;
  338. font-size: 14px;
  339. font-weight: 400;
  340. line-height: 18px;
  341. letter-spacing: 0.5%;
  342. text-align: center;
  343. &:active {
  344. background-color: #E5E5E5;
  345. transform: scale(0.98);
  346. }
  347. }
  348. }
  349. }
  350. }
  351. }
  352. .bottom-btn-container {
  353. position: fixed;
  354. bottom: 0;
  355. left: 0;
  356. right: 0;
  357. padding: 30rpx 20rpx;
  358. background: #fff;
  359. border-top: 1px solid #f0f0f0;
  360. z-index: 9999;
  361. }
  362. .confirm-btn {
  363. width: 100%;
  364. height: 88rpx;
  365. background: var(--线性渐变, linear-gradient(90.00deg, rgba(13, 39, 247, 1),rgba(19, 193, 234, 1) 100%));
  366. border-radius: 44rpx;
  367. display: flex;
  368. align-items: center;
  369. justify-content: center;
  370. text {
  371. font-size: 32rpx;
  372. font-weight: 600;
  373. color: #fff;
  374. }
  375. }
  376. </style>