list.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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">{{ item.title }}</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="state" :style="{ color: item.state == 0 ? '#4CAF50' : '#F44336' }">{{ item.state == 0 ? '已启用' : '已关闭' }}</text>
  28. <text class="tag">发布于:{{ item.createTime }}</text>
  29. </view>
  30. <view class="flex">
  31. <view class="f br">简历</view>
  32. <view class="f br" @click.stop="manageState(item)">{{ item.state == 0 ? '关闭' : '启用' }}</view>
  33. <view class="f danger" @click.stop="manageRemove(item)">删除</view>
  34. </view>
  35. </view>
  36. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  37. <u-empty v-if="!loadMore && list.length == 0"></u-empty>
  38. </view>
  39. <u-action-sheet round="20" :actions="type" @select="selectClick" cancelText="取消" :show="show" @close="show = false"></u-action-sheet>
  40. <view class="mfooter">
  41. <button class="btn" @click="show = true">
  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. type: [
  53. { name: '全职', value: 0 },
  54. { name: '兼职', value: 1 }
  55. ],
  56. audit: [
  57. { name: '全部', value: '' },
  58. { name: '待审核', value: 0 },
  59. { name: '审核通过', value: 1 },
  60. { name: '未通过', value: 2 }
  61. ],
  62. current: 0,
  63. list: [],
  64. param: { pageNum: 1, pageSize: 10, type: 0 },
  65. loadMore: true,
  66. show: false
  67. };
  68. },
  69. onLoad(e) {
  70. this.getData();
  71. uni.$on('position', (res) => {
  72. this.refresh();
  73. });
  74. },
  75. methods: {
  76. getData() {
  77. this.http.request({
  78. url: '/app/position/manage/list',
  79. data: this.param,
  80. loading: 'false',
  81. success: (res) => {
  82. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  83. this.list.push(...res.data.rows);
  84. }
  85. });
  86. },
  87. click(e, tag) {
  88. this.param[tag] = this[tag][e.index].value;
  89. if (tag == 'audit') {
  90. this.current = e.index;
  91. }
  92. this.refresh();
  93. },
  94. selectClick(e) {
  95. uni.navigateTo({ url: '/pages/job/position/manage/push?type=' + e.value });
  96. },
  97. detail(item) {
  98. uni.navigateTo({ url: '/pages/job/position/manage/push?id=' + item.id });
  99. },
  100. manageState(item) {
  101. uni.showModal({
  102. title: '提示',
  103. content: item.state == 0 ? '确定关闭该职位' : '确定启用该职位',
  104. success: (res) => {
  105. if (res.confirm) {
  106. this.http.request({
  107. url: '/app/position/manage/state',
  108. data: { id: item.id, state: item.state == 0 ? 1 : 0 },
  109. method: 'POST',
  110. success: (res) => {
  111. uni.showToast({ title: '操作成功' });
  112. item.state = item.state == 0 ? 1 : 0;
  113. }
  114. });
  115. }
  116. }
  117. });
  118. },
  119. manageRemove(item) {
  120. uni.showModal({
  121. title: '提示',
  122. content: '确定删除该职位?删除后包括已投递简历也全部清除',
  123. success: (res) => {
  124. if (res.confirm) {
  125. this.http.request({
  126. url: '/app/position/manage/remove/' + item.id,
  127. success: (res) => {
  128. uni.showToast({ title: '删除成功' });
  129. this.list.splice(this.list.indexOf(item), 1);
  130. }
  131. });
  132. }
  133. }
  134. });
  135. },
  136. //刷新数据
  137. refresh() {
  138. this.loadMore = true;
  139. this.param.pageNum = 1;
  140. this.list = [];
  141. this.getData();
  142. }
  143. },
  144. //下拉刷新
  145. onPullDownRefresh() {
  146. setTimeout(() => {
  147. this.refresh();
  148. uni.stopPullDownRefresh();
  149. }, 1000);
  150. },
  151. //上拉加载
  152. onReachBottom() {
  153. if (this.loadMore) {
  154. this.param.pageNum++;
  155. this.getData();
  156. }
  157. }
  158. };
  159. </script>
  160. <style lang="scss"></style>