home.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <ComponentLoading class="outer" :loading="loading">
  3. <view class="top-img">
  4. <view class="tree-body">
  5. <!-- <view class="header">物建员</view> -->
  6. <TreeAddress :treeList="treeList" @node-click="treeClick"></TreeAddress>
  7. </view>
  8. </view>
  9. </ComponentLoading>
  10. </template>
  11. <script>
  12. import {
  13. getrequest,
  14. getLdListPt,
  15. login
  16. } from '@/api/wjxxy.js'
  17. import md5 from '@/utils/md5.js'
  18. import TreeAddress from '@/components/tree-address/index'
  19. import ComponentLoading from '@/components/component-loading/index'
  20. export default {
  21. components: {
  22. TreeAddress,
  23. ComponentLoading
  24. },
  25. data() {
  26. return {
  27. tenantId: '000000',
  28. username: 'sqmj1',
  29. password: '123456',
  30. treeList: [],
  31. loading: false,
  32. bj_blue: require('./img/bj_blue.svg'),
  33. }
  34. },
  35. onLoad(option) {
  36. this.login()
  37. },
  38. methods: {
  39. // 监听按钮点击事件
  40. onNavigationBarButtonTap(e) {
  41. plus.runtime.quit()
  42. },
  43. //下拉后触发的事件
  44. onPullDownRefresh() {},
  45. login() {
  46. this.loading = true
  47. getrequest('bladeTokenEndPoint', 'token3').then(res => {
  48. let userInfo = JSON.parse(res.data.dataList[0].fieldValues[0].value)
  49. this.$u.func.login(userInfo)
  50. this.getLdListPt()
  51. })
  52. // login(this.tenantId, this.username, md5(this.password)).then(res => {
  53. // this.$u.func.login(res)
  54. // this.getLdListPt()
  55. // })
  56. },
  57. getLdListPt() {
  58. getrequest('xxyController', 'getLdListPt').then(res => {
  59. let result = JSON.parse(res.data.dataList[0].fieldValues[0].value)
  60. let list = result.data.map(r1 => { // 五兴村
  61. let l1 = {}
  62. if (r1.data) { // 前兴屯
  63. l1.data = r1.data.map(r2 => {
  64. let l2 = r2
  65. l2.isClick = false
  66. return l2
  67. })
  68. }
  69. l1.ldph = r1.ldph
  70. l1.isClick = false
  71. return l1
  72. })
  73. this.treeList = list
  74. }).finally(() => {
  75. this.loading = false
  76. })
  77. // getLdListPt().then(res => {
  78. // let list = res.data.map(r1 => { // 五兴村
  79. // let l1 = {}
  80. // if (r1.data) { // 前兴屯
  81. // l1.data = r1.data.map(r2 => {
  82. // let l2 = r2
  83. // l2.isClick = false
  84. // return l2
  85. // })
  86. // }
  87. // l1.ldph = r1.ldph
  88. // l1.isClick = false
  89. // return l1
  90. // })
  91. // this.treeList = list
  92. // }).finally(() => {
  93. // this.loading = false
  94. // })
  95. },
  96. treeClick(item, parent, index) {
  97. const param = JSON.stringify(item)
  98. uni.navigateTo({
  99. url: `/pages/home/wjy?param=${param}`
  100. })
  101. },
  102. }
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .outer {
  107. background-color: rgba(248, 248, 248, 1);
  108. height: 100vh;
  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;
  120. }
  121. .header {
  122. color: rgba(17, 17, 17, 1);
  123. font-size: 36rpx;
  124. font-weight: 600;
  125. text-align: center;
  126. width: 100%;
  127. height: 100rpx;
  128. line-height: 100rpx;
  129. }
  130. </style>