index.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. //import * as WxJsApi from '@/utils/wxJsApi.js'
  2. import * as API from '@/apis/hr/news.js'
  3. export default {
  4. data() {
  5. return {
  6. isReady:false,
  7. list: [{
  8. name: '我要用人',
  9. list:[],
  10. approvalStatus:"1",
  11. pageIndex:1,
  12. recordsTotal:0
  13. }, {
  14. name: '我有工人',
  15. list:[],
  16. approvalStatus:"0",
  17. pageIndex:1,
  18. recordsTotal:0
  19. }],
  20. current: 0
  21. }
  22. },
  23. components: {
  24. },
  25. onLoad(op){
  26. //this.id=op.id;
  27. },
  28. methods: {
  29. change(index) {
  30. this.current = index;
  31. var obj=this.list[this.current];
  32. if(obj.list.length==0){
  33. this.getLabourList()
  34. }
  35. },
  36. myLoadmore(){
  37. var obj=this.list[this.current];
  38. obj.pageIndex+=1;
  39. this.getLabourList()
  40. },
  41. getLabourList(){
  42. uni.showLoading({
  43. title:"加载中"
  44. })
  45. var obj=this.list[this.current];
  46. var data={
  47. typeB:obj.approvalStatus,
  48. pageIndex:obj.pageIndex
  49. };
  50. API.getLabourList(data).then((res) => {
  51. obj.list=[
  52. ...obj.list,
  53. ...res.data.data
  54. ];
  55. obj.recordsTotal=res.data.recordsTotal
  56. uni.hideLoading()
  57. console.log(this.list)
  58. }).catch(error => {
  59. uni.showToast({
  60. title:error
  61. })
  62. })
  63. }
  64. },onReady(){
  65. this.getLabourList()
  66. this.isReady=true;
  67. },onShow(){
  68. if(this.isReady){
  69. }
  70. },
  71. }