You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 2.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <div>
  3. <TopHeader :menu="0"></TopHeader>
  4. <div class="ui container">
  5. <SearchBar :condition="condition" @changeCondition="changeCondition"></SearchBar>
  6. <div class="conent-c">
  7. <div class="filter-c">
  8. <Filters :type="0" :condition="condition" @changeCondition="changeCondition"></Filters>
  9. </div>
  10. <div class="result-c">
  11. <SciAndTechPrjList ref="resultListRef" :condition="condition"></SciAndTechPrjList>
  12. </div>
  13. </div>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. import TopHeader from '../components/TopHeader.vue';
  19. import SearchBar from '../components/SearchBar.vue';
  20. import Filters from '../components/Filters.vue';
  21. import SciAndTechPrjList from '../components/SciAndTechPrjList.vue';
  22. import { getUrlSearchParams } from '~/utils';
  23. export default {
  24. data() {
  25. return {
  26. condition: {
  27. q: '', // 搜索框
  28. type_name: '', // 项目类型
  29. institution_name: '', // 项目参与单位
  30. execute_year: '', // 执行周期包含年份
  31. apply_year: '',
  32. page: '',
  33. pageSize: '',
  34. sort: '',
  35. },
  36. pageSizes: [15, 30, 50, 100],
  37. };
  38. },
  39. components: {
  40. TopHeader,
  41. SearchBar,
  42. Filters,
  43. SciAndTechPrjList
  44. },
  45. methods: {
  46. changeCondition(params) {
  47. this.condition = {
  48. ...this.condition,
  49. ...params,
  50. };
  51. window.location.href = `/tech/tech_view?` + `q=${encodeURIComponent(this.condition.q.trim())}` +
  52. `&type_name=${encodeURIComponent(this.condition.type_name)}` +
  53. `&institution_name=${encodeURIComponent(this.condition.institution_name)}` +
  54. `&execute_year=${encodeURIComponent(this.condition.execute_year)}` +
  55. `&apply_year=${encodeURIComponent(this.condition.apply_year)}` +
  56. `&page=${encodeURIComponent(this.condition.page)}` +
  57. `&pageSize=${encodeURIComponent(this.condition.pageSize)}` +
  58. `&sort=${encodeURIComponent(this.condition.sort)}`;
  59. },
  60. },
  61. beforeMount() {
  62. const urlParams = getUrlSearchParams();
  63. this.condition.q = urlParams.q || '';
  64. this.condition.type_name = urlParams.type_name || '';
  65. this.condition.institution_name = urlParams.institution_name || '';
  66. this.condition.execute_year = urlParams.execute_year || '';
  67. this.condition.apply_year = urlParams.apply_year || '';
  68. this.condition.sort = urlParams.sort || '';
  69. this.condition.page = Number(urlParams.page) || 1;
  70. this.condition.pageSize = this.pageSizes.indexOf(Number(urlParams.pageSize)) >= 0 ? Number(urlParams.pageSize) : 15;
  71. },
  72. mounted() { },
  73. beforeDestroy() { },
  74. };
  75. </script>
  76. <style scoped lang="less">
  77. .conent-c {
  78. display: flex;
  79. }
  80. .filter-c {
  81. flex: 1;
  82. padding-left: 12px;
  83. }
  84. .result-c {
  85. margin-left: 10px;
  86. flex: 3;
  87. }
  88. </style>