index.vue 5.8 KB

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