index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <view>
  3. <index ref="首页" v-show="page == '首页'" />
  4. <store ref="活动" v-show="page == '活动'" />
  5. <my-case ref="案例" v-show="page == '案例'" />
  6. <user-center ref="我的" v-show="page == '我的'" />
  7. <workbench ref="工作台" v-show="page == '工作台'" />
  8. <dataBank ref="资料库" v-show="page == '资料库'" />
  9. <school ref="商学院" v-show="page == '商学院'" />
  10. <product ref="单品" v-show="page == '单品'" />
  11. <bottom-suspension-frame ref="pages" @onChange="pageChange" />
  12. </view>
  13. </template>
  14. <script>
  15. import index from './index/index.vue'
  16. import store from './index/store.vue'
  17. import myCase from './index/myCase.vue'
  18. import userCenter from './index/userCenter.vue'
  19. import dataBank from './cloud/dataBank.vue'
  20. import school from './cloud/school.vue'
  21. import product from './cloud/product.vue'
  22. import workbench from './cloud/workbench.vue'
  23. import bottomSuspensionFrame from "./modules/bottomSuspensionFrame.vue";
  24. export default {
  25. components: { bottomSuspensionFrame, index, store, myCase, userCenter, dataBank, school, product, workbench },
  26. data() {
  27. return {
  28. swiperItemID: 'index',
  29. page: '首页'
  30. }
  31. },
  32. onShow() {
  33. const systemInitIsComplete = this.$Http.systemInitIsComplete;
  34. if (!systemInitIsComplete || typeof systemInitIsComplete == 'object') {
  35. this.$Http.HomePageStartRendering = render(this)
  36. } else {
  37. render(this)
  38. }
  39. function render(that) {
  40. that.$Http.changePage = function (itemId, page, params) {
  41. that.$refs.pages.onClick(itemId, page, false, params)
  42. }.bind(that)
  43. // #ifdef MP-WEIXIN
  44. that.updatePageData(that.swiperItemID, that.page)
  45. // #endif
  46. }
  47. },
  48. methods: {
  49. updatePageData(itemId, page) {
  50. if (this.$refs[this.page].updatePage) this.$refs.pages.onClick(itemId, page)
  51. },
  52. changePage(itemId, page, params) {
  53. },
  54. pageChange(detail) {
  55. uni.setNavigationBarTitle({
  56. title: detail.name,
  57. })
  58. this.page = detail.name;
  59. try {
  60. console.log(this.$refs[detail.name].updatePage)
  61. if (this.$refs[detail.name].updatePage) uni.pageScrollTo({
  62. scrollTop: 0,
  63. duration: 0,
  64. })
  65. this.$refs[detail.name].init(detail.callBack, detail.params)
  66. } catch (error) {
  67. detail.callBack()
  68. }
  69. console.log("切换页面", detail)
  70. }
  71. }
  72. }
  73. </script>
  74. <style lang="scss"></style>