index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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) {
  60. this.initBadge();
  61. this.init();
  62. }
  63. },
  64. methods: {
  65. async init() {
  66. let productData = await getServeProductList(-1);
  67. if (productData.state) {
  68. this.list = productData.data.concat(this.arguments);
  69. }
  70. },
  71. clickItem(serve) {
  72. let url = '',
  73. signUrl = '';
  74. if (serve.id > 0) {
  75. url = '/subPages/indexPage/orderList/orderList?productLevelId=' + serve.id + '&productLevelName=' +
  76. serve.name + '&iconName=' + serve.iconName + '&iconColor=' + serve.iconColor;
  77. signUrl = '/work/serve/list/' + serve.sign + '/list';
  78. }
  79. if (serve.id === -2) {
  80. url = '/subPages/indexPage/contractList/contractList';
  81. }
  82. if (serve.id === -3) {
  83. url = '/subPages/indexPage/invoiceList/invoiceList';
  84. }
  85. if (signUrl) {
  86. let roleData = this.$store.getters.user.workarkMenu || '[]';
  87. let isRole = JSON.parse(roleData).filter(node => node === signUrl);
  88. if (isRole.length === 0) url = '/subPages/indexPage/noPermission/noPermission'
  89. }
  90. this.$navigateTo(url);
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="scss" scoped>
  96. .index-page {
  97. padding: 30rpx 0;
  98. .index-button-box {
  99. margin-top: 40rpx;
  100. }
  101. .index-empty {
  102. padding-top: 80rpx;
  103. }
  104. .group-item {
  105. background: #fff;
  106. margin-bottom: 30rpx;
  107. &:last-child {
  108. margin-bottom: 0px;
  109. }
  110. }
  111. .item-title {
  112. line-height: 88rpx;
  113. padding: 0 30rpx;
  114. font-size: 30rpx;
  115. font-weight: 500;
  116. border-bottom: 2rpx solid $uv-border-color;
  117. }
  118. .item-content {
  119. display: flex;
  120. align-items: center;
  121. flex-wrap: wrap;
  122. padding-top: 30rpx;
  123. }
  124. .content-item {
  125. width: 25%;
  126. display: flex;
  127. justify-content: center;
  128. flex-direction: column;
  129. align-items: center;
  130. padding-bottom: 30rpx;
  131. }
  132. .content-icon {
  133. width: 100rpx;
  134. height: 100rpx;
  135. border-radius: 16rpx;
  136. display: flex;
  137. align-items: center;
  138. justify-content: center;
  139. }
  140. .content-label {
  141. color: $uv-content-color;
  142. margin-top: 10rpx;
  143. font-weight: 400;
  144. font-size: 26rpx;
  145. }
  146. }
  147. </style>