part_time.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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: index }, 'audit')">{{ item.name }}</view>
  6. </view>
  7. <view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
  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/part_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: 1 },
  61. loadMore: true,
  62. show: false
  63. };
  64. },
  65. onLoad(e) {
  66. this.getData();
  67. uni.$on('position', (res) => {
  68. this.refresh();
  69. });
  70. },
  71. methods: {
  72. getData() {
  73. this.http.request({
  74. url: '/app/position/manage/list',
  75. data: this.param,
  76. loading: 'false',
  77. success: (res) => {
  78. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  79. res.data.rows.forEach((item) => {
  80. item.createTime = uni.$u.timeFrom(Date.parse(item.createTime));
  81. this.list.push(item);
  82. });
  83. }
  84. });
  85. },
  86. click(e, tag) {
  87. this.param[tag] = this[tag][e.index].value;
  88. if (tag == 'audit') {
  89. this.current = e.index;
  90. }
  91. this.refresh();
  92. },
  93. selectClick(e) {
  94. uni.navigateTo({ url: '/pages/job/position/manage/push?type=' + e.value });
  95. },
  96. go(url) {
  97. uni.navigateTo({ url: url });
  98. },
  99. manageState(item) {
  100. uni.showModal({
  101. title: '提示',
  102. content: item.state == 0 ? '确定关闭该职位' : '确定启用该职位',
  103. success: (res) => {
  104. if (res.confirm) {
  105. this.http.request({
  106. url: '/app/position/manage/state',
  107. data: { id: item.id, state: item.state == 0 ? 1 : 0 },
  108. method: 'POST',
  109. success: (res) => {
  110. uni.showToast({ title: '操作成功' });
  111. item.state = item.state == 0 ? 1 : 0;
  112. }
  113. });
  114. }
  115. }
  116. });
  117. },
  118. manageRemove(item) {
  119. uni.showModal({
  120. title: '提示',
  121. content: '确定删除该职位?删除后包括已投递简历也全部清除',
  122. success: (res) => {
  123. if (res.confirm) {
  124. this.http.request({
  125. url: '/app/position/manage/remove/' + item.id,
  126. success: (res) => {
  127. uni.showToast({ title: '删除成功' });
  128. this.list.splice(this.list.indexOf(item), 1);
  129. }
  130. });
  131. }
  132. }
  133. });
  134. },
  135. //刷新数据
  136. refresh() {
  137. this.loadMore = true;
  138. this.param.pageNum = 1;
  139. this.list = [];
  140. this.getData();
  141. }
  142. },
  143. //下拉刷新
  144. onPullDownRefresh() {
  145. setTimeout(() => {
  146. this.refresh();
  147. uni.stopPullDownRefresh();
  148. }, 1000);
  149. },
  150. //上拉加载
  151. onReachBottom() {
  152. if (this.loadMore) {
  153. this.param.pageNum++;
  154. this.getData();
  155. }
  156. }
  157. };
  158. </script>
  159. <style lang="scss"></style>