full_time.vue 4.1 KB

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