index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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" :style="'background: '+serve.iconColor+';'">
  20. <uv-icon :name="serve.iconName" custom-prefix="custom-icon" color="#fff" size="60">
  21. </uv-icon>
  22. </view>
  23. <view class="content-label">{{serve.name}}</view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import {
  33. getServeProductList
  34. } from '@/request/api/workark.js'
  35. export default {
  36. data() {
  37. return {
  38. isLogin: false,
  39. list: [],
  40. arguments: [{
  41. id: -1,
  42. name: '财务管理',
  43. children: [{
  44. id: -2,
  45. name: '合同管理',
  46. iconName: 'hetongguanli',
  47. iconColor: '#5cc8b4'
  48. }, {
  49. id: -3,
  50. name: '发票管理',
  51. iconName: 'fapiaoguanli',
  52. iconColor: '#fd5c54'
  53. }]
  54. }]
  55. }
  56. },
  57. onShow() {
  58. this.isLogin = !!uni.getStorageSync('token');
  59. if (this.isLogin) this.init();
  60. },
  61. methods: {
  62. async init() {
  63. let productData = await getServeProductList(-1);
  64. if (productData.state) {
  65. this.list = productData.data.concat(this.arguments);
  66. }
  67. },
  68. clickItem(serve) {
  69. let url = '',
  70. signUrl = '';
  71. if (serve.id > 0) {
  72. url = '/subPages/indexPage/orderList/orderList?productLevelId=' + serve.id + '&productLevelName=' +
  73. serve.name + '&iconName=' + serve.iconName + '&iconColor=' + serve.iconColor;
  74. signUrl = '/work/serve/list/' + serve.sign + '/list';
  75. }
  76. if (serve.id === -2) {
  77. url = '/subPages/indexPage/contractList/contractList';
  78. }
  79. if (serve.id === -3) {
  80. url = '/subPages/indexPage/invoiceList/invoiceList';
  81. }
  82. if (signUrl) {
  83. let isRole = JSON.parse(this.$store.getters.user.workarkMenu).filter(node => node === signUrl);
  84. if (isRole.length === 0) url = '/subPages/indexPage/noPermission/noPermission'
  85. }
  86. this.$navigateTo(url);
  87. }
  88. }
  89. }
  90. </script>
  91. <style lang="scss" scoped>
  92. .index-page {
  93. padding: 30rpx 0;
  94. .index-button-box {
  95. margin-top: 40rpx;
  96. }
  97. .index-empty {
  98. padding-top: 80rpx;
  99. }
  100. .group-item {
  101. background: #fff;
  102. margin-bottom: 30rpx;
  103. &:last-child {
  104. margin-bottom: 0px;
  105. }
  106. }
  107. .item-title {
  108. line-height: 88rpx;
  109. padding: 0 30rpx;
  110. font-size: 30rpx;
  111. font-weight: 500;
  112. border-bottom: 2rpx solid $uv-border-color;
  113. }
  114. .item-content {
  115. display: flex;
  116. align-items: center;
  117. flex-wrap: wrap;
  118. padding-top: 30rpx;
  119. }
  120. .content-item {
  121. width: 25%;
  122. display: flex;
  123. justify-content: center;
  124. flex-direction: column;
  125. align-items: center;
  126. padding-bottom: 30rpx;
  127. }
  128. .content-icon {
  129. width: 100rpx;
  130. height: 100rpx;
  131. border-radius: 16rpx;
  132. display: flex;
  133. align-items: center;
  134. justify-content: center;
  135. }
  136. .content-label {
  137. color: $uv-content-color;
  138. margin-top: 10rpx;
  139. font-weight: 400;
  140. font-size: 26rpx;
  141. }
  142. }
  143. </style>