list.blade.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. @extends('app.rcstfwlt.module.layouts.main')
  2. @section('content')
  3. <div>
  4. <van-nav-bar @if($back == 1) left-text="返回" @click-left="onClickLeft" @endif title="晋江人才生态服务链条"></van-nav-bar>
  5. <form action="/">
  6. <van-search
  7. v-model="value"
  8. placeholder="请输入搜索关键词"
  9. show-action
  10. @search="onSearch"
  11. @cancel="onCancel"
  12. ></van-search>
  13. </form>
  14. <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
  15. <van-cell v-for="item in list" :key="item.id" :title="item.title" is-link :url="'{{route('rcstfwlt.detail')}}?id='+item.id" ></van-cell>
  16. </van-list>
  17. </div>
  18. @endsection
  19. @section('script')
  20. <script>
  21. new Vue({
  22. el: '#app',
  23. data: {
  24. list: [],
  25. loading: false,
  26. finished: false,
  27. value:'',
  28. page:1
  29. },
  30. methods: {
  31. onLoad() {
  32. this.getData();
  33. },
  34. getData(){
  35. let keyword = this.value,page = this.page,that = this;
  36. axios.post('/mobile/active/rcg/getChainList',{id:{{$id}},keyword: keyword,page:page}).then( res => {
  37. that.loading = false;
  38. if(res.data.status == 'ok'){
  39. let list = [],arr = res.data.data,that = this;
  40. for (let i = 0,len = arr.length;i < len;i++){
  41. let item = new Array()
  42. item['title'] = arr[i].title
  43. item['id'] = arr[i].id
  44. this.list.push(item)
  45. }
  46. if(res.data.count <= (this.page * 20)){
  47. this.finished = true;
  48. }else{
  49. this.page++
  50. }
  51. }
  52. });
  53. },
  54. onSearch(){
  55. this.page = 1;
  56. this.list = [];
  57. this.getData();
  58. },
  59. onCancel(){
  60. this.page = 1;
  61. this.list = [];
  62. this.getData();
  63. },
  64. onClickLeft(){
  65. history.back();
  66. }
  67. }
  68. });
  69. </script>
  70. @endsection