index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view class="index-page">
  3. <view class="index-empty" v-if="!isLogin">
  4. <uv-empty icon="https://file-node.oss-cn-shanghai.aliyuncs.com/youji/fa57e25b38c442ebb0ba023cace796bb"
  5. :isImg="true" textSize="28" width="360" text="暂未登录">
  6. <view class="index-button-box">
  7. <uv-button type="primary" text="点击登录" size="small" @tap="$navigateTo('/pages/login/login')">
  8. </uv-button>
  9. </view>
  10. </uv-empty>
  11. </view>
  12. <view class="index-container" v-else>
  13. <view class="index-group">
  14. <view class="group-item" v-for="(item,index) in list" :key="item.id">
  15. <view class="item-title">{{item.name}}</view>
  16. <view class="item-content">
  17. <view class="content-item" v-for="(serve,i) in item.children" :key="serve.id"
  18. @tap="clickItem(serve)">
  19. <view class="content-icon">
  20. <uv-icon name="photo" color="#fff" size="60"></uv-icon>
  21. </view>
  22. <view class="content-label">{{serve.name}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import {
  32. getServeProductList
  33. } from '@/request/api/workark.js'
  34. export default {
  35. data() {
  36. return {
  37. isLogin: false,
  38. list: [],
  39. arguments: [{
  40. id: -1,
  41. name: '财务管理',
  42. children: [{
  43. id: -2,
  44. name: '合同管理'
  45. }, {
  46. id: -3,
  47. name: '发票管理'
  48. }]
  49. }]
  50. }
  51. },
  52. onShow() {
  53. this.isLogin = !!uni.getStorageSync('token');
  54. if (this.isLogin) this.init();
  55. },
  56. methods: {
  57. async init() {
  58. let productData = await getServeProductList(-1);
  59. if (productData.state) this.list = productData.data.concat(this.arguments);
  60. },
  61. clickItem(serve) {
  62. let url = '';
  63. if (serve.id > 0) url = '/subPages/indexPage/orderList/orderList?productLevelId=' + serve.id +
  64. '&productLevelName=' + serve.name;
  65. if(serve.id === -2) url = '/subPages/indexPage/contractList/contractList';
  66. if(serve.id === -3) url = '/subPages/indexPage/invoiceList/invoiceList';
  67. this.$navigateTo(url);
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. .index-page {
  74. padding: 30rpx 0;
  75. .index-button-box {
  76. margin-top: 40rpx;
  77. }
  78. .index-empty {
  79. padding-top: 80rpx;
  80. }
  81. .group-item {
  82. background: #fff;
  83. margin-bottom: 30rpx;
  84. &:last-child {
  85. margin-bottom: 0px;
  86. }
  87. }
  88. .item-title {
  89. line-height: 88rpx;
  90. padding: 0 30rpx;
  91. font-size: 30rpx;
  92. font-weight: 500;
  93. border-bottom: 2rpx solid $uv-border-color;
  94. }
  95. .item-content {
  96. display: flex;
  97. align-items: center;
  98. flex-wrap: wrap;
  99. padding-top: 30rpx;
  100. }
  101. .content-item {
  102. width: 25%;
  103. display: flex;
  104. justify-content: center;
  105. flex-direction: column;
  106. align-items: center;
  107. padding-bottom: 30rpx;
  108. }
  109. .content-icon {
  110. width: 100rpx;
  111. height: 100rpx;
  112. border-radius: 50%;
  113. background: #fc0107;
  114. display: flex;
  115. align-items: center;
  116. justify-content: center;
  117. }
  118. .content-label {
  119. color: $uv-content-color;
  120. margin-top: 10rpx;
  121. font-weight: 400;
  122. font-size: 26rpx;
  123. }
  124. }
  125. </style>