index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <view class="content-box">
  3. <view class="policy-item-box" style="justify-content: space-around;">
  4. <view v-for="(item, idx) in projectList" :key="idx" :class="{ active: active === idx }" class="policy-item-name" @click="changeProjectTabs(idx)">
  5. {{ item }}
  6. </view>
  7. </view>
  8. <view class="project-box">
  9. <view class="project-content display-around-column" v-for="(item, idx) in projectData" :key="idx" style="padding-top: 20rpx;"
  10. :class="{ borderBottom: idx == projectData.length - 1 }" @click="enterProjectDeatil(item.id)">
  11. <view class="display-between items-center pos-class">
  12. <view style="font-size: 30rpx;">{{item.name}}</view>
  13. <image v-if="item.importent === '1'" src="/static/important_icon.png" mode="aspectFit" style="width:80rpx;height: 80rpx;"></image>
  14. </view>
  15. <view class="display-flex-start pos-class">
  16. <view class="left-title">业主名称</view>
  17. <view>{{item.owner}}</view>
  18. </view>
  19. <view class="display-flex-start pos-class" style="margin-bottom: 20rpx;">
  20. <view class="left-title">总投资</view>
  21. <view>{{item.investment_count}}(万元)</view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import md5 from "@/common/md5.js";
  29. export default {
  30. data() {
  31. return {
  32. swiperList: [],
  33. projectList: ["新建", "续建"],
  34. active: 0,
  35. projectData:[],
  36. // projectData: new Array(5).fill({
  37. // title:"普汇中金生命科学国际合作中心",
  38. // name: "普汇中金国际控股有限公司",
  39. // maxMony: "160000(万元)",
  40. // }),
  41. };
  42. },
  43. onLoad(option) {
  44. this.active = Number(option.idx)
  45. this.getProjectList(this.active)
  46. },
  47. methods: {
  48. enterProjectDeatil(id) {
  49. uni.navigateTo({
  50. url:"/pages/metrics/projectPage/detail?id=" + id
  51. });
  52. },
  53. getProjectList(tabVal){
  54. let tabObj = {
  55. 0:'新建',
  56. 1:'续建',
  57. }
  58. let md5Sign = md5(
  59. "method=" +
  60. "stat" +
  61. "&timestamp=" +
  62. getApp().globalData.globalTimestamp +
  63. "&secret=" +
  64. getApp().globalData.secret
  65. );
  66. let url =
  67. getApp().globalData.shareUrl +
  68. "api/api.php" +
  69. "?method=stat&action=importent_project_list&timestamp=" +
  70. getApp().globalData.globalTimestamp +
  71. "&sign=" +
  72. md5Sign;
  73. uni.request({
  74. url: url,
  75. method: "POST",
  76. header: {
  77. "content-type": "application/x-www-form-urlencoded",
  78. },
  79. data: {
  80. tab : tabObj[tabVal]
  81. },
  82. success: (res) => {
  83. if (res.data.code === 200) {
  84. this.projectData = res.data.data;
  85. this.$forceUpdate();
  86. }
  87. },
  88. fail: () => {
  89. console.log("连接失败");
  90. },
  91. });
  92. },
  93. changeProjectTabs(idx) {
  94. let that = this;
  95. that.active = idx;
  96. switch (idx) {
  97. case 0:
  98. that.getProjectList(0);
  99. break;
  100. case 1:
  101. that.getProjectList(1);
  102. break;
  103. }
  104. },
  105. },
  106. };
  107. </script>
  108. <style lang="scss">
  109. .content-box {
  110. display: flex;
  111. flex-direction: column;
  112. flex: 1;
  113. }
  114. .policy-item-box {
  115. display: flex;
  116. justify-content: space-between;
  117. margin: 0 20rpx;
  118. margin-top: 20rpx;
  119. .policy-item-name {
  120. padding-bottom: 10rpx;
  121. font-size: 30rpx;
  122. width: 25%;
  123. text-align: center;
  124. }
  125. .active {
  126. font-weight: 600;
  127. border-bottom: 7rpx solid #02a7f0;
  128. }
  129. }
  130. .project-content {
  131. border-top: 1px solid #f2f2f2;
  132. }
  133. .pos-class {
  134. padding-left: 10rpx;
  135. margin-bottom: 10rpx;
  136. font-size: 28rpx;
  137. }
  138. .left-title {
  139. width: 20%;
  140. color: #7F7F7F;
  141. font-size: 26rpx;
  142. }
  143. .borderBottom {
  144. border-bottom: 1px solid #f2f2f2;
  145. }
  146. </style>