workbench.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <view>
  3. <!-- 工作台头图 -->
  4. <view class="top">
  5. <image :src="header"></image>
  6. </view>
  7. <!-- nav -->
  8. <view class="section">
  9. <view class="list">
  10. <view class="item" v-for="(item,index) in nav" :key="index" @click="go_link(item)">
  11. <view class="icon">
  12. <image :src="item.icon" mode=""></image>
  13. </view>
  14. <view class="name">
  15. <view class="num"
  16. v-if="item.link.indexOf('http://oa_system.nxjiewei.com:8011/?m=ying&d=we&num=daiban&hideheader=true') != -1 && num_1 > 0">
  17. {{num_1}}
  18. </view>
  19. <view class="num"
  20. v-if="item.link.indexOf('http://oa_system.nxjiewei.com:8011/?m=ying&d=we&num=todo&hideheader=true') != -1 && num_2 > 0">
  21. {{num_2}}
  22. </view>
  23. <view class="name_title">{{item.title}}</view>
  24. <view class="sub_title">{{item.sub_title}}</view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="section" v-for="(item,index) in module" :key="index">
  30. <view class="title">
  31. <view class="icon">
  32. <image :src="item.icon" mode=""></image>
  33. </view>
  34. <view class="text">{{item.title}}</view>
  35. </view>
  36. <view class="list">
  37. <view class="item" v-for="(item_2,index_2) in item.children" :key="index_2" @click="go_link(item_2)">
  38. <view class="icon">
  39. <image :src="item_2.icon" mode=""></image>
  40. </view>
  41. <view class="name">
  42. <view class="name_title">{{item_2.title}}</view>
  43. <view class="sub_title">{{item_2.sub_title}}</view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import {
  52. goToLink
  53. } from "@/common/common.js"
  54. export default {
  55. data() {
  56. return {
  57. // 当前煤矿编码
  58. mine_code: "",
  59. // 头部图片
  60. header: "",
  61. nav: [],
  62. module: [],
  63. num_1: 0,
  64. num_2: 0
  65. };
  66. },
  67. onLoad() {
  68. // 初始化当前煤矿编码
  69. this.mine_code = uni.getStorageSync('mine_code')
  70. this.get_workbench_index()
  71. },
  72. onShow() {
  73. this.get_workflow_todo_query()
  74. },
  75. methods: {
  76. // 获取基础数据
  77. get_workbench_index() {
  78. this.$api.workbench_index({
  79. }).then((res) => {
  80. // console.log(res.data.data)
  81. this.header = res.data.data.header
  82. this.nav = res.data.data.nav
  83. this.module = res.data.data.module
  84. })
  85. },
  86. // 获取消息提醒数量
  87. get_workflow_todo_query() {
  88. this.$api.workflow_todo_query({
  89. staff_num: uni.getStorageSync('user').staff_num,
  90. query_type: 2
  91. }).then((res) => {
  92. this.num_1 = res.data.content.data
  93. this.$api.workflow_todo_query({
  94. staff_num: uni.getStorageSync('user').staff_num,
  95. query_type: 1
  96. }).then((res) => {
  97. this.num_2 = res.data.content.data
  98. let num = this.num_1 + this.num_2
  99. // if(num > 0){
  100. // uni.setTabBarBadge({
  101. // index: 2,
  102. // text: '' + num + ''
  103. // })
  104. // }
  105. })
  106. })
  107. },
  108. go_link(item) {
  109. // console.log(item)
  110. goToLink(item, this.mine_code)
  111. },
  112. },
  113. }
  114. </script>
  115. <style lang="scss">
  116. page {
  117. background-color: #F2FAF7;
  118. margin-bottom: 20rpx;
  119. }
  120. .top {
  121. image {
  122. width: 750rpx;
  123. height: 270rpx;
  124. display: block;
  125. }
  126. }
  127. .section {
  128. margin-top: 20rpx;
  129. background-color: #FFFFFF;
  130. padding: 25rpx;
  131. .title {
  132. display: flex;
  133. align-items: center;
  134. height: 90rpx;
  135. .icon {
  136. margin-right: 20rpx;
  137. image {
  138. width: 50rpx;
  139. height: 50rpx;
  140. display: block;
  141. }
  142. }
  143. .text {
  144. font-weight: 700;
  145. font-size: 34rpx;
  146. }
  147. }
  148. .list {
  149. margin-top: 30rpx;
  150. width: 700rpx;
  151. overflow: hidden;
  152. .item {
  153. float: left;
  154. margin-bottom: 30rpx;
  155. width: 350rpx;
  156. display: flex;
  157. align-items: center;
  158. height: 140rpx;
  159. .icon {
  160. margin-bottom: 10rpx;
  161. image {
  162. width: 90rpx;
  163. height: 90rpx;
  164. display: block;
  165. }
  166. }
  167. .name {
  168. position: relative;
  169. margin-left: 20rpx;
  170. .num {
  171. z-index: 10;
  172. position: absolute;
  173. top: -10rpx;
  174. right: -50rpx;
  175. width: 40rpx;
  176. text-align: center;
  177. line-height: 40rpx;
  178. background-color: #F56C6C;
  179. border-radius: 50%;
  180. color: #FFF;
  181. font-size: 26rpx;
  182. }
  183. .name_title {
  184. font-size: 28rpx;
  185. margin-bottom: 10rpx;
  186. }
  187. .sub_title {
  188. font-size: 24rpx;
  189. color: #999;
  190. }
  191. }
  192. }
  193. .item:nth-child(2n) {
  194. box-sizing: border-box;
  195. border-left: 1rpx solid #F2FAF7;
  196. padding-left: 40rpx;
  197. }
  198. }
  199. }
  200. </style>