index.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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:"2",
  17. pageIndex:1,
  18. recordsTotal:0
  19. }],
  20. current: 0
  21. }
  22. },
  23. components: {
  24. },
  25. onReachBottom() {
  26. if(this.list[this.current].list.length<this.list[this.current].recordsTotal){
  27. this.myLoadmore();
  28. }
  29. },
  30. onLoad(op){
  31. //this.id=op.id;
  32. },
  33. methods: {
  34. change(index) {
  35. this.current = index;
  36. var obj=this.list[this.current];
  37. if(obj.list.length==0){
  38. this.getLabourList()
  39. }
  40. },
  41. myLoadmore(){
  42. var obj=this.list[this.current];
  43. obj.pageIndex+=1;
  44. this.getLabourList()
  45. },
  46. getLabourList(){
  47. uni.showLoading({
  48. title:"加载中",mask:true,
  49. })
  50. var obj=this.list[this.current];
  51. var data={
  52. typeB:obj.approvalStatus,
  53. pageIndex:obj.pageIndex
  54. };
  55. API.getLabourList(data).then((res) => {
  56. obj.list=[
  57. ...obj.list,
  58. ...res.data.data
  59. ];
  60. obj.recordsTotal=res.data.recordsTotal
  61. uni.hideLoading()
  62. console.log(this.list)
  63. }).catch(error => {
  64. uni.showToast({
  65. title:error
  66. })
  67. })
  68. }
  69. },onReady(){
  70. this.getLabourList()
  71. this.isReady=true;
  72. },onShow(){
  73. if(this.isReady){
  74. }
  75. },
  76. }