index.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. //import * as WxJsApi from '@/utils/wxJsApi.js'
  2. import * as API from '@/apis/hr/my.js'
  3. export default {
  4. data() {
  5. return {
  6. isReady:false,
  7. src: '/static/img/head/png',
  8. keyword: '遥看瀑布挂前川',
  9. list: [
  10. {
  11. name: '招聘中',
  12. list:[],
  13. status:"publish",
  14. pageIndex:1,
  15. recordsTotal:0
  16. }, {
  17. name: '审核中',
  18. list:[],
  19. status:"approve",
  20. pageIndex:1,
  21. recordsTotal:0
  22. }, {
  23. name: '已下架',
  24. list:[],
  25. status:"close",
  26. pageIndex:1,
  27. recordsTotal:0
  28. }],
  29. current: 0,
  30. customStyle: {
  31. margin: '0',
  32. background: 'none!important'
  33. }
  34. }
  35. },
  36. components: {
  37. },
  38. onReachBottom() {
  39. if(this.list[this.current].list.length<this.list[this.current].recordsTotal){
  40. this.myLoadmore();
  41. }
  42. },
  43. onLoad(op){
  44. //this.id=op.id;
  45. },
  46. methods: {
  47. publish(count,id){
  48. uni.showLoading({
  49. title:"加载中",mask:true,
  50. })
  51. var data={
  52. recruitmentId:id,
  53. publishTag:count
  54. };
  55. API.publishRecruitment(data).then((res) => {
  56. for(var i in this.list){
  57. var obj=this.list[i];
  58. obj.list=[]
  59. obj.pageIndex=1
  60. }
  61. this.getList()
  62. uni.hideLoading()
  63. }).catch(error => {
  64. uni.showToast({
  65. title:error
  66. })
  67. })
  68. },
  69. myLoadmore(){
  70. var obj=this.list[this.current];
  71. obj.pageIndex+=1;
  72. this.getList()
  73. }, change(index) {
  74. this.current = index;
  75. var obj=this.list[this.current];
  76. if(obj.list.length==0){
  77. this.getList()
  78. }
  79. },
  80. getList(){
  81. uni.showLoading({
  82. title:"加载中",mask:true,
  83. })
  84. var obj=this.list[this.current];
  85. var data={
  86. status:obj.status,
  87. pageIndex:obj.pageIndex
  88. };
  89. API.loadOwnRecruitments(data).then((res) => {
  90. obj.list=[
  91. ...obj.list,
  92. ...res.data.data
  93. ];
  94. obj.recordsTotal=res.data.recordsTotal
  95. uni.hideLoading()
  96. console.log(this.list)
  97. }).catch(error => {
  98. uni.showToast({
  99. title:error
  100. })
  101. })
  102. }
  103. },onReady(){
  104. this.getList()
  105. this.isReady=true;
  106. },onShow(){
  107. if(this.isReady){
  108. }
  109. },
  110. }