jobList.vue 9.2 KB

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