Aggregate-page.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view class="">
  3. <navbar ref="navbar" :config="config" backColor="#666666"></navbar>
  4. <template v-if="!loading">
  5. <template v-if="!themeVo.styleType || themeVo.styleType === 1">
  6. <aggregatedOne :themeVo="themeVo" :themeModuleVoList="themeModuleVoList" />
  7. </template>
  8. <template v-else-if="themeVo.styleType === 2">
  9. <aggregatedTwo :themeVo="themeVo" :themeModuleVoList="themeModuleVoList" />
  10. </template>
  11. </template>
  12. </view>
  13. </template>
  14. <script>
  15. import {
  16. getThemeInfo
  17. } from "@/api/government.js"
  18. import aggregatedOne from "@/components/aggregated/aggregated_1.vue"
  19. import aggregatedTwo from "@/components/aggregated/aggregated_2.vue"
  20. export default {
  21. components: {
  22. aggregatedOne,
  23. aggregatedTwo
  24. },
  25. data() {
  26. return {
  27. config: {
  28. back: true,
  29. title: '',
  30. color: 'black',
  31. backgroundColor: [1, '#fff'],
  32. },
  33. loading:false,
  34. themeId: null,
  35. themeModuleVoList: [],
  36. themeVo: {}
  37. }
  38. },
  39. onLoad(opt) {
  40. this.themeId = opt.themeId || null;
  41. this.getList()
  42. },
  43. watch:{
  44. loading:{
  45. handler:function(newLoad){
  46. if(newLoad){
  47. uni.showLoading()
  48. }else{
  49. uni.hideLoading()
  50. }
  51. },
  52. immediate:true
  53. }
  54. },
  55. methods: {
  56. getList() {
  57. if (!this.themeId) return
  58. this.loading = true;
  59. getThemeInfo(this.themeId).then(res => {
  60. if (res && res.code == 200) {
  61. this.themeModuleVoList = res.data.themeModuleVoList
  62. this.$set(this.config, 'title', res.data.themeVo.themeName);
  63. this.themeVo = res.data.themeVo
  64. try{
  65. this.$refs.navbar.init();
  66. }catch(e){
  67. //TODO handle the exception
  68. }
  69. }
  70. }).finally(() => {
  71. setTimeout(() => {
  72. this.loading = false
  73. },500)
  74. })
  75. },
  76. }
  77. }
  78. </script>
  79. <style lang="scss" scoped>
  80. </style>