jobList.vue 9.1 KB

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