shouye.vue 1.9 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.length" :data="{...data.hetongList[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 {onLoad, onShow} from "@dcloudio/uni-app"
  22. import {reactive} from "vue"
  23. import cacheManager from '@/utils/cacheManager.js'
  24. const data = reactive({
  25. realName: '',
  26. defaultIndexImg: '',
  27. hetongList: [],
  28. iconsArr: {
  29. jzgsIcon: '',
  30. htJzIcon: '',
  31. htKhIcon: '',
  32. htTimeIcon: '',
  33. htZtIcon: '',
  34. },
  35. })
  36. function initPage() {
  37. httpApi.getKehuIndex().then(res => {
  38. const {
  39. hetong
  40. } = res.data;
  41. data.hetongList = hetong.id ? [hetong] : [];
  42. })
  43. }
  44. onLoad(() => {
  45. const auth = cacheManager.get('auth');
  46. data.realName = auth.realName;
  47. data.defaultIndexImg = cacheManager.get('projectImg').index_default_img;
  48. data.iconsArr.jzgsIcon = cacheManager.get('projectImg').jzgs_icon;
  49. data.iconsArr.htJzIcon = cacheManager.get('projectImg').user_green_icon;
  50. data.iconsArr.htKhIcon = cacheManager.get('projectImg').zymc_icon;
  51. data.iconsArr.htTimeIcon = cacheManager.get('projectImg').date_icon;
  52. data.iconsArr.htZtIcon = cacheManager.get('projectImg').htzt_icon;
  53. })
  54. onShow(() => {
  55. initPage();
  56. })
  57. </script>