index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <view class="content-box">
  3. <view class="uni-list title-date-box" style="border: none;">
  4. <view class="uni-list-cell">
  5. <view class="uni-list-cell-db display-flex-start" style="padding-left: 10rpx;">
  6. <picker :range="arraySort" :value="sortSelect" @change="bindSortChange" class="picker-class" style="width: 35%;">
  7. <view class="uni-input display-between items-center" style="color: #707070;">{{sortSelect}}<image src="/static/arrow_down.svg" mode="aspectFit"></image></view>
  8. </picker>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="companys">
  13. <!-- <view>推荐企业</view> -->
  14. <view v-for="(company, index) in companyList" :key="index" @tap="toDetail(company.id)" class="company">
  15. <image src="/static/selfCenter/add-icon.png" mode="aspectFit" class="addIcon"></image>
  16. <view class="title">
  17. <view class="logo">
  18. <!-- <image :src="globalUrl + company.pic_url" alt="" class="logo-img" mode="aspectFit"/> -->
  19. <image src="/static/nodata.svg" alt="" class="logo-img" mode="aspectFit"/>
  20. </view>
  21. <view class="name">
  22. {{ company.name }}
  23. </view>
  24. </view>
  25. <view class="info">
  26. <view class="view">
  27. <view class="info_t">亩均排序</view>
  28. <view class="name">
  29. {{ company.representative }}
  30. </view>
  31. </view>
  32. <view class="line"></view>
  33. <view class="view">
  34. <view class="info_t">总产值</view>
  35. {{ company.capital }}(亿元)
  36. <!-- <text v-if="company.capital_type == '1'">美元</text>
  37. <text v-else>人民币</text> -->
  38. </view>
  39. <view class="line"></view>
  40. <view class="view">
  41. <view class="info_t">产值增速</view>
  42. {{ company.found_date }}
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import md5 from "@/common/md5.js";
  51. export default {
  52. data() {
  53. return{
  54. arraySort:['全部','一至当月产值','当月产值','一至当月产值增速','当月产值增速','亩均排序'],
  55. sortSelect:'全部',
  56. companyList: [],
  57. globalUrl:getApp().globalData.shareUrl,
  58. }
  59. },
  60. onLoad() {
  61. this.getCompany();
  62. },
  63. methods:{
  64. bindSortChange(e){
  65. this.sortSelect = this.arraySort[e.target.value]
  66. },
  67. goScale(){
  68. uni.navigateTo({
  69. url:'./largeScale/index'
  70. })
  71. },
  72. getCompany() {
  73. let md5Sign = md5(
  74. "method=" +
  75. "common" +
  76. "&timestamp=" +
  77. getApp().globalData.globalTimestamp +
  78. "&secret=" +
  79. getApp().globalData.secret
  80. );
  81. let url =
  82. getApp().globalData.shareUrl +
  83. "api/api.php" +
  84. "?method=common&source=company&action=list&timestamp=" +
  85. getApp().globalData.globalTimestamp +
  86. "&sign=" +
  87. md5Sign;
  88. let postData = {
  89. s_pub: "1",
  90. order_by : "weight desc,id desc"
  91. };
  92. uni.request({
  93. url: url,
  94. method: "POST",
  95. header: {
  96. "content-type": "application/x-www-form-urlencoded",
  97. },
  98. data: postData,
  99. success: (res) => {
  100. if (res.data.code === 200) {
  101. let list = res.data.data.list;
  102. console.log(res.data.data.list);
  103. list.forEach((e, i) => {
  104. let { pic_url, name, representative, capital, capital_type, found_date, id } = e;
  105. list[i] = {
  106. pic_url,
  107. name,
  108. representative,
  109. capital,
  110. capital_type,
  111. found_date,
  112. id,
  113. };
  114. });
  115. this.companyList = list;
  116. }
  117. },
  118. fail: () => {
  119. console.log("连接失败");
  120. },
  121. });
  122. },
  123. }
  124. };
  125. </script>
  126. <style lang="scss">
  127. .content-box {
  128. display: flex;
  129. flex-direction: column;
  130. flex: 1;
  131. }
  132. .title-date-box {
  133. margin-top: 10px;
  134. border-bottom: 1px solid #d7d7d7;
  135. padding-bottom: 10px;
  136. }
  137. .picker-class {
  138. border-radius: 10rpx;
  139. padding: 10rpx;
  140. width: 180rpx;
  141. font-size: 28rpx;
  142. background: #f5f5f5;
  143. margin-left: 20rpx;
  144. }
  145. .picker-class image {
  146. width: 26rpx;
  147. height: 26rpx;
  148. }
  149. .companys {
  150. // margin-top: 3%;
  151. padding: 0 4%;
  152. .company {
  153. border-radius: 20rpx;
  154. box-shadow: rgba(0, 0, 0, 0.35) 0rpx 5rpx 15rpx;
  155. padding: 2%;
  156. margin: 3% 0;
  157. position: relative;
  158. .addIcon{
  159. width: 60rpx;
  160. height: 60rpx;
  161. position: absolute;
  162. right: 20rpx;
  163. }
  164. .title {
  165. display: flex;
  166. align-items: center;
  167. .logo {
  168. margin-right: 30rpx;
  169. display: flex;
  170. justify-content: center;
  171. align-items: center;
  172. overflow: hidden;
  173. width: 150rpx;
  174. height: 100rpx;
  175. overflow: hidden;
  176. .logo-img {
  177. max-width: 100%;
  178. max-height: 100%;
  179. }
  180. }
  181. }
  182. .line {
  183. width: 2rpx;
  184. height: 70rpx;
  185. background: rgb(175, 186, 197);
  186. }
  187. .info {
  188. font-size: 24rpx;
  189. font-weight: 100;
  190. display: flex;
  191. text-align: center;
  192. justify-content: space-around;
  193. align-items: center;
  194. padding: 0 2%;
  195. margin-top: 2%;
  196. .view {
  197. margin-top: 2%;
  198. font-size: 26rpx;
  199. // .name {
  200. // color: #02a7f0;
  201. // }
  202. .info_t {
  203. margin-bottom: 10rpx;
  204. }
  205. }
  206. }
  207. }
  208. }
  209. </style>