index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <app-view class="home-main">
  3. <template #header>
  4. <app-navbar :show-back-button="false">
  5. <div class="home-main__title">
  6. <span>{{ globalStore.getSystemInfo('appName') }}</span>
  7. <span>订单管理系统</span>
  8. </div>
  9. </app-navbar>
  10. </template>
  11. <div class="home-main__banner">
  12. <Banner :data-list="topBanners" />
  13. </div>
  14. <PullRefresh class="home-main__container" v-model="refreshing" @refresh="onRefresh">
  15. <app-block>
  16. <Cell title="通知公告" value="更多" :to="{ name: 'notice-list' }" icon="volume" is-link />
  17. </app-block>
  18. <app-block class="home-main__iconbar bg">
  19. <ul>
  20. <li @click="routerTo('home-market', true)">
  21. <Iconfont label-direction="bottom" icon="g-icon-quote--line">行情</Iconfont>
  22. </li>
  23. <li @click="routerTo('order-list')">
  24. <Iconfont label-direction="bottom" icon="g-icon-order--line">持有订单</Iconfont>
  25. </li>
  26. <li @click="routerTo('delivery-list')">
  27. <Iconfont label-direction="bottom" icon="g-icon-delivery--line">交料订单</Iconfont>
  28. </li>
  29. <li @click="routerTo('pickup-list')">
  30. <Iconfont label-direction="bottom" icon="g-icon-pickup--line">提料订单</Iconfont>
  31. </li>
  32. </ul>
  33. </app-block>
  34. <app-block class="home-main__news">
  35. <CellGroup class="article">
  36. <Cell class="home-main__titlebar" title="市场资讯" value="更多" icon="fire" @click="routerTo('home-news', true)"
  37. is-link />
  38. <template v-for="(item, index) in newsList" :key="index">
  39. <Cell class="article-item" :title="item.data.content" :value="formatDate(item.time, 'MM/DD')"
  40. @click="routerTo('home-news', true)" />
  41. </template>
  42. </CellGroup>
  43. </app-block>
  44. </PullRefresh>
  45. </app-view>
  46. </template>
  47. <script lang="ts" setup>
  48. import { shallowRef } from "vue";
  49. import { Cell, CellGroup, PullRefresh } from "vant";
  50. import { formatDate } from "@/filters";
  51. import { useNavigation } from '@mobile/router/navigation';
  52. import { queryImageConfigs, getJ10News } from "@/services/api/common";
  53. import { useGlobalStore } from '@/stores'
  54. import Banner from '@mobile/components/base/banner/index.vue'
  55. import Iconfont from '@/components/base/iconfont/index.vue'
  56. const { routerTo } = useNavigation()
  57. const globalStore = useGlobalStore()
  58. const refreshing = shallowRef(false) // 是否处于加载中状态
  59. const topBanners = shallowRef<string[]>([]) // 轮播图列表
  60. const newsList = shallowRef<Model.J10NewsRsp[]>([]) // 资讯列表
  61. // 下拉刷新
  62. const onRefresh = () => {
  63. queryImageConfigs({
  64. data: {
  65. imageType: 1,
  66. }
  67. }).then((res) => {
  68. topBanners.value = res.data.map((e) => e.imagepath)
  69. })
  70. // 市场资讯
  71. getJ10News({
  72. data: {
  73. limit: 10
  74. }
  75. }).then((res) => {
  76. newsList.value = res.data
  77. }).finally(() => {
  78. refreshing.value = false
  79. })
  80. }
  81. onRefresh()
  82. </script>
  83. <style lang="less">
  84. @import "./index.less";
  85. </style>