home.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <ComponentLoading class="outer" :loading="loading">
  3. <view class="top-img">
  4. <view class="tree-body">
  5. <HomeSearch @search="search"></HomeSearch>
  6. <TreeNomal :treeList="treeList" @detail="detail" v-if="dataList.length == 0"></TreeNomal>
  7. <view class="data_item" v-for="(item) in dataList" :key="item.id" v-else>
  8. <view>{{ item.dictValue }}</view>
  9. <view class="btn-group">
  10. <view class="btn_orange btns" @click="detail(item)">详情</view>
  11. </view>
  12. </view>
  13. </view>
  14. </view>
  15. </ComponentLoading>
  16. </template>
  17. <script>
  18. import {
  19. getrequest,
  20. login,
  21. bsznList,
  22. selectListByMc
  23. } from '@/api/wjxxy.js'
  24. import ComponentLoading from '@/components/component-loading/index'
  25. import HomeSearch from './components/HomeSearch.vue'
  26. import TreeNomal from '@/components/tree-nomal/tree-nomal.vue'
  27. import md5 from '@/utils/md5.js'
  28. export default {
  29. components: {
  30. ComponentLoading,
  31. HomeSearch,
  32. TreeNomal
  33. },
  34. data() {
  35. return {
  36. loading: false,
  37. bj_blue: require('./img/bj_blue.svg'),
  38. treeList: [],
  39. dataList: [],
  40. tenantId: '000000',
  41. // username: 'admin',
  42. username: 'sqmj1',
  43. // password: 'admin',
  44. password: '123456',
  45. }
  46. },
  47. onLoad(option) {
  48. // console.log(uni.getStorageSync('isSzApp'))
  49. this.login()
  50. },
  51. methods: {
  52. search(val) {
  53. if (val) {
  54. this.loading = true
  55. selectListByMc(val).then(res => {
  56. let data = JSON.parse(res.data.dataList[0].fieldValues[0].value)
  57. this.dataList = data.data
  58. }).finally(() => {
  59. this.loading = false
  60. })
  61. } else {
  62. this.dataList = []
  63. }
  64. },
  65. login() {
  66. this.loading = true
  67. getrequest('bladeTokenEndPoint', 'token3').then(res => {
  68. let userInfo = JSON.parse(res.data.dataList[0].fieldValues[0].value)
  69. this.$u.func.login(userInfo)
  70. bsznList().then(res => {
  71. console.log('bsznList bsznList bsznList', res)
  72. let list = JSON.parse(res.data.dataList[0].fieldValues[0].value)
  73. this.treeList = list.data
  74. }).finally(() => {
  75. this.loading = false
  76. })
  77. })
  78. // login(this.tenantId, this.username, md5(this.password)).then(user => {
  79. // this.$u.func.login(user)
  80. // bsznList().then(res => {
  81. // this.treeList = res.data
  82. // }).finally(() => {
  83. // this.loading = false
  84. // })
  85. // })
  86. },
  87. detail(val) {
  88. console.log('detail', val)
  89. uni.navigateTo({
  90. url: `/pages/home/detail?param=${JSON.stringify(val)}`
  91. })
  92. // switch (val) {
  93. // case '户口簿损毁换领':
  94. // uni.navigateTo({
  95. // url: '/pages/jmhkb/hkbShhl'
  96. // })
  97. // break;
  98. // default:
  99. // break;
  100. // }
  101. },
  102. }
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .outer {
  107. background-color: rgba(248, 248, 248, 1);
  108. height: calc(100vh - 88rpx);
  109. overflow-y: scroll;
  110. font-family: PingFangSC, PingFang SC;
  111. .top-img {
  112. width: 100%;
  113. background-image: url(./img/bj_blue.svg);
  114. background-repeat: repeat-x;
  115. }
  116. }
  117. .tree-body {
  118. width: 100%;
  119. padding: 24rpx 16rpx;
  120. // background-color: rgba(248, 248, 248, 1);
  121. }
  122. .data_item {
  123. display: flex;
  124. justify-content: space-between;
  125. // min-height: 68rpx;
  126. margin: 16rpx 0 16rpx 40rpx;
  127. line-height: 48rpx;
  128. }
  129. .btn-group {
  130. width: 100rpx;
  131. display: flex;
  132. .btns {
  133. height: 48rpx;
  134. width: 96rpx;
  135. text-align: center;
  136. line-height: 46rpx;
  137. border-radius: 8rpx;
  138. margin-left: 24rpx;
  139. }
  140. .btn_orange {
  141. color: rgba(237, 123, 47, 1);
  142. border: 1rpx solid rgba(237, 123, 47, 1);
  143. }
  144. .btn_green {
  145. color: rgba(0, 168, 112, 1);
  146. border: 1rpx solid rgba(0, 168, 112, 1);
  147. }
  148. .btn_blue {
  149. color: rgba(16, 109, 255, 1);
  150. border: 1rpx solid rgba(16, 109, 255, 1);
  151. }
  152. }
  153. </style>