shouye.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <view class="client-shouye-page">
  3. <customNavbarVue title="首页"></customNavbarVue>
  4. <template v-if="data.hetongList.length">
  5. <!-- 合同 -->
  6. <hetongCardVue v-if="data.hetongList!={}" :data="{ count: data.kaoshiCount, ...data.kaoshiList[0],iconsArr:data.iconsArr}"></hetongCardVue>
  7. </template>
  8. <view class="default-img-box" v-else>
  9. <icon :style="{ backgroundImage: 'url(' + data.defaultIndexImg + ')' }"></icon>
  10. <text>没有可培训的内容...</text>
  11. </view>
  12. <!-- 底部区域 -->
  13. <customTabbarKehu :currentTab="0"></customTabbarKehu>
  14. </view>
  15. </template>
  16. <script setup>
  17. import customNavbarVue from "@/components/custom-navbar/custom-navbar.vue";
  18. import hetongCardVue from '@/components/listCard/hetongCard.vue';
  19. import customTabbarKehu from "@/components/custom-tabbar/custom-tabbar-kehu.vue"
  20. import * as httpApi from "@/api/khShouye.js"
  21. import {
  22. onLoad, onShow
  23. } from "@dcloudio/uni-app"
  24. import {
  25. reactive
  26. } from "vue"
  27. import cacheManager from '@/utils/cacheManager.js'
  28. const data = reactive({
  29. hetongList: [],
  30. realName: '',
  31. defaultIndexImg: '',
  32. iconsArr: {
  33. jzIcon: '',
  34. keIcon: '',
  35. timeIcon: '',
  36. hzIcon: '',
  37. },
  38. })
  39. function initPage() {
  40. httpApi.getKehuIndex().then(res => {
  41. const {hetong} = res.data;
  42. data.hetongList = hetong || [];
  43. })
  44. }
  45. onLoad(() => {
  46. const auth = cacheManager.get('auth');
  47. data.realName = auth.realName;
  48. data.defaultIndexImg = cacheManager.get('projectImg').index_default_img;
  49. data.iconsArr.jzIcon = cacheManager.get('projectImg').index_content_icon2;
  50. data.iconsArr.keIcon = cacheManager.get('projectImg').index_content_icon3;
  51. data.iconsArr.timeIcon = cacheManager.get('projectImg').index_content_icon1;
  52. data.iconsArr.hzIcon = cacheManager.get('projectImg').index_content_icon4;
  53. })
  54. onShow(() => {
  55. initPage();
  56. })
  57. </script>