classification.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <view>
  3. <view class="top">
  4. <view class="search">
  5. <u-search placeholder="搜索岗位/拼音" v-model="param.title" bgColor="white" :animation="true" actionText="取消" @search="search" @clear="show = false"></u-search>
  6. </view>
  7. </view>
  8. <view class="left">
  9. <view class="item" :class="{ active: index == current }" v-for="(item, index) in list" :key="index" @click="current = index">{{ item.title }}</view>
  10. </view>
  11. <view class="right">
  12. <view class="list" v-if="list.length > 0">
  13. <view v-for="(item, index) in list[current].children" :key="item.id" style="overflow: hidden">
  14. <view class="title">{{ item.title }}</view>
  15. <view class="tags" v-for="(child, i) in item.children" :key="child.id" @click="select(child)">
  16. <view class="out">
  17. <view class="int">{{ child.title }}</view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="search_view" v-if="show">
  24. <view class="list">
  25. <view class="item" v-for="(item, index) in search_list" :key="item.id" @click="select(item)">
  26. <view class="title">{{ item.title }}</view>
  27. <view class="desc">{{ item.tag }}</view>
  28. </view>
  29. <u-empty v-if="search_list.length == 0"></u-empty>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. list: [],
  39. search_list: [], //搜索列表
  40. show: false,
  41. current: 0,
  42. param: { type: 'position' }
  43. };
  44. },
  45. onLoad(e) {
  46. this.getData();
  47. if (e.title) {
  48. setTimeout(() => {
  49. uni.setNavigationBarTitle({ title: e.title });
  50. }, 300);
  51. }
  52. },
  53. methods: {
  54. getData() {
  55. this.http.request({
  56. url: '/app/common/column/list',
  57. data: this.param,
  58. success: (res) => {
  59. this.list = res.data.data;
  60. }
  61. });
  62. },
  63. //选择
  64. select(item) {
  65. uni.$emit('select_position', item);
  66. uni.navigateBack();
  67. },
  68. //搜索
  69. search() {
  70. if (this.param.title) {
  71. this.show = true;
  72. this.http.request({
  73. url: '/app/common/column/search',
  74. data: this.param,
  75. success: (res) => {
  76. this.search_list = res.data.data;
  77. }
  78. });
  79. } else {
  80. this.show = false;
  81. }
  82. }
  83. },
  84. destroyed() {
  85. uni.$off('other_city');
  86. }
  87. };
  88. </script>
  89. <style lang="scss">
  90. .top {
  91. position: fixed;
  92. height: 70px;
  93. width: 100%;
  94. .search {
  95. padding: 12px 20px 15px 20px;
  96. }
  97. }
  98. .left {
  99. position: fixed;
  100. /* #ifdef H5 */
  101. top: 100px;
  102. height: 86%;
  103. /* #endif */
  104. /* #ifdef APP-PLUS||MP-WEIXIN */
  105. top: 60px;
  106. height: 92%;
  107. /* #endif */
  108. width: 35%;
  109. overflow-y: auto;
  110. z-index: 2;
  111. .item {
  112. padding: 10px 10px 10px 10px;
  113. font-size: 14px;
  114. &.active {
  115. background-color: white;
  116. color: $main-color;
  117. }
  118. }
  119. }
  120. .right {
  121. position: fixed;
  122. /* #ifdef H5 */
  123. top: 100px;
  124. height: 86%;
  125. /* #endif */
  126. /* #ifdef APP-PLUS||MP-WEIXIN */
  127. top: 60px;
  128. height: 92%;
  129. /* #endif */
  130. width: 65%;
  131. overflow-y: auto;
  132. left: 35%;
  133. z-index: 1;
  134. background-color: white;
  135. .list {
  136. padding: 0px 12px 12px 12px;
  137. .title {
  138. padding: 15px 10px 10px 7px;
  139. font-weight: bold;
  140. }
  141. }
  142. }
  143. .search_view {
  144. /* #ifdef H5 */
  145. top: 100px;
  146. height: 86%;
  147. /* #endif */
  148. /* #ifdef APP-PLUS||MP-WEIXIN */
  149. top: 60px;
  150. height: 92%;
  151. /* #endif */
  152. border-top: 1px solid $line;
  153. }
  154. </style>