list.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <view>
  3. <view class="tab">
  4. <u-tabs :list="type" @click="click($event, 'type')"></u-tabs>
  5. </view>
  6. <view class="position">
  7. <view class="audits">
  8. <view class="audit" :class="{ active: current == index }" v-for="(item, index) in audit" :key="index" @click="click({ index: index }, 'audit')">{{ item.name }}</view>
  9. </view>
  10. <view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
  11. <view class="top">
  12. <view class="title omit">
  13. <text class="icon" :style="{ color: item.state == 0 ? '#4CAF50' : '#545555' }">&#xe614;</text>
  14. <text>{{ item.title }}</text>
  15. </view>
  16. <view class="audit" v-if="item.audit == 0">
  17. <text class="icon">&#xe642;</text>
  18. <text>审核中</text>
  19. </view>
  20. <view class="audit" style="color: #4caf50" v-if="item.audit == 1">
  21. <text class="icon">&#xe612;</text>
  22. <text>审核通过</text>
  23. </view>
  24. <view class="audit" v-if="item.audit == 2">
  25. <text class="icon">&#xec72;</text>
  26. <text>审核不通过</text>
  27. </view>
  28. </view>
  29. <view class="desc">
  30. <text class="tag">{{ item.experience }}</text>
  31. <text class="tag">{{ item.salary }}</text>
  32. <text class="tag">{{ item.regionName }}</text>
  33. <text class="date">{{ item.createTime }}</text>
  34. </view>
  35. <view class="flex">
  36. <view class="f br" @click.stop="manageState(item)">{{ item.state == 0 ? '关闭' : '启用' }}</view>
  37. <view class="f danger" @click.stop="manageRemove(item)">删除</view>
  38. </view>
  39. </view>
  40. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  41. <u-empty v-if="!loadMore && list.length == 0"></u-empty>
  42. </view>
  43. <u-action-sheet round="20" :actions="type" @select="selectClick" cancelText="取消" :show="show" @close="show = false"></u-action-sheet>
  44. <view class="mfooter">
  45. <button class="btn" @click="show = true">
  46. <text class="icon">&#xe7c4;</text>
  47. <text>发布职位</text>
  48. </button>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. export default {
  54. data() {
  55. return {
  56. type: [
  57. { name: '全职', value: 0 },
  58. { name: '兼职', value: 1 }
  59. ],
  60. audit: [
  61. { name: '全部', value: '' },
  62. { name: '待审核', value: 0 },
  63. { name: '审核通过', value: 1 },
  64. { name: '未通过', value: 2 }
  65. ],
  66. current: 0,
  67. list: [],
  68. param: { pageNum: 1, pageSize: 10, type: 0 },
  69. loadMore: true,
  70. show: false
  71. };
  72. },
  73. onLoad(e) {
  74. this.getData();
  75. uni.$on('position', (res) => {
  76. this.refresh();
  77. });
  78. },
  79. methods: {
  80. getData() {
  81. this.http.request({
  82. url: '/app/position/manage/list',
  83. data: this.param,
  84. loading: 'false',
  85. success: (res) => {
  86. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  87. res.data.rows.forEach((item) => {
  88. item.createTime = uni.$u.timeFrom(Date.parse(item.createTime));
  89. this.list.push(item);
  90. });
  91. }
  92. });
  93. },
  94. click(e, tag) {
  95. this.param[tag] = this[tag][e.index].value;
  96. if (tag == 'audit') {
  97. this.current = e.index;
  98. }
  99. this.refresh();
  100. },
  101. selectClick(e) {
  102. uni.navigateTo({ url: '/pages/job/position/manage/push?type=' + e.value });
  103. },
  104. detail(item) {
  105. uni.navigateTo({ url: '/pages/job/position/manage/push?id=' + item.id });
  106. },
  107. manageState(item) {
  108. uni.showModal({
  109. title: '提示',
  110. content: item.state == 0 ? '确定关闭该职位' : '确定启用该职位',
  111. success: (res) => {
  112. if (res.confirm) {
  113. this.http.request({
  114. url: '/app/position/manage/state',
  115. data: { id: item.id, state: item.state == 0 ? 1 : 0 },
  116. method: 'POST',
  117. success: (res) => {
  118. uni.showToast({ title: '操作成功' });
  119. item.state = item.state == 0 ? 1 : 0;
  120. }
  121. });
  122. }
  123. }
  124. });
  125. },
  126. manageRemove(item) {
  127. uni.showModal({
  128. title: '提示',
  129. content: '确定删除该职位?删除后包括已投递简历也全部清除',
  130. success: (res) => {
  131. if (res.confirm) {
  132. this.http.request({
  133. url: '/app/position/manage/remove/' + item.id,
  134. success: (res) => {
  135. uni.showToast({ title: '删除成功' });
  136. this.list.splice(this.list.indexOf(item), 1);
  137. }
  138. });
  139. }
  140. }
  141. });
  142. },
  143. //刷新数据
  144. refresh() {
  145. this.loadMore = true;
  146. this.param.pageNum = 1;
  147. this.list = [];
  148. this.getData();
  149. }
  150. },
  151. //下拉刷新
  152. onPullDownRefresh() {
  153. setTimeout(() => {
  154. this.refresh();
  155. uni.stopPullDownRefresh();
  156. }, 1000);
  157. },
  158. //上拉加载
  159. onReachBottom() {
  160. if (this.loadMore) {
  161. this.param.pageNum++;
  162. this.getData();
  163. }
  164. }
  165. };
  166. </script>
  167. <style lang="scss"></style>