index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <view class="content" v-if="isShow">
  3. <!-- 搜索框 -->
  4. <view class="input-box">
  5. <image src="/static/policy/u377.png" alt="" mode="aspectFit"/>
  6. <input
  7. type="text"
  8. placeholder="请输入关键词搜索"
  9. @confirm="searchCompany"
  10. v-model="searchVal"
  11. />
  12. </view>
  13. <view class="companys">
  14. <view>推荐企业</view>
  15. <view v-for="(company, index) in companyList" :key="index" @tap="toDetail(company.id)" class="company">
  16. <view class="title">
  17. <view class="logo">
  18. <image :src="globalUrl + company.pic_url" alt="" class="logo-img" mode="aspectFit"/>
  19. </view>
  20. <view class="name">
  21. {{ company.name }}
  22. </view>
  23. </view>
  24. <view class="info">
  25. <view class="view">
  26. <view class="info_t">法定代表人</view>
  27. <view class="name">
  28. {{ company.representative }}
  29. </view>
  30. </view>
  31. <view class="line"></view>
  32. <view class="view">
  33. <view class="info_t">注册资本</view>
  34. {{ company.capital }}万
  35. <text v-if="company.capital_type == '1'">美元</text>
  36. <text v-else>人民币</text>
  37. </view>
  38. <view class="line"></view>
  39. <view class="view">
  40. <view class="info_t">成立日期</view>
  41. {{ company.found_date }}
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. import md5 from "@/common/md5.js";
  50. export default {
  51. data() {
  52. return {
  53. companyList: [],
  54. isShow: false,
  55. searchVal: "",
  56. globalUrl:getApp().globalData.shareUrl,
  57. // new Array(5).fill({
  58. // logo: "/static/enterprise/logo.png",
  59. // name: "康拓科技有限责任公司",
  60. // info: {
  61. // person: "马须伦",
  62. // money: "1,776,759.3万(元)",
  63. // time: "1995-03-25",
  64. // },
  65. // })
  66. };
  67. },
  68. onLoad() {
  69. this.getCompany();
  70. },
  71. methods: {
  72. toDetail(index) {
  73. uni.navigateTo({
  74. url: "/pages/enterprise/enterprise_detail?id=" + index,
  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. this.isShow = true;
  122. }
  123. },
  124. fail: () => {
  125. console.log("连接失败");
  126. },
  127. });
  128. },
  129. searchCompany() {
  130. let md5Sign = md5(
  131. "method=" +
  132. "common" +
  133. "&timestamp=" +
  134. getApp().globalData.globalTimestamp +
  135. "&secret=" +
  136. getApp().globalData.secret
  137. );
  138. let url =
  139. getApp().globalData.shareUrl +
  140. "api/api.php" +
  141. "?method=common&source=company&action=list&timestamp=" +
  142. getApp().globalData.globalTimestamp +
  143. "&sign=" +
  144. md5Sign;
  145. uni.request({
  146. url: url,
  147. method: "POST",
  148. header: {
  149. "content-type": "application/x-www-form-urlencoded",
  150. },
  151. data: {
  152. ss_name: this.searchVal,
  153. s_pub:1
  154. },
  155. success: (res) => {
  156. if (res.data.code === 200) {
  157. let list = res.data.data.list;
  158. console.log(list);
  159. list.forEach((e, i) => {
  160. let { pic_url, name, representative, capital, found_date, id } =
  161. e;
  162. list[i] = {
  163. pic_url,
  164. name,
  165. representative,
  166. capital,
  167. found_date,
  168. id,
  169. };
  170. });
  171. this.companyList = list;
  172. }
  173. },
  174. fail: () => {
  175. console.log("连接失败");
  176. },
  177. });
  178. },
  179. },
  180. };
  181. </script>
  182. <style lang="scss">
  183. .content {
  184. font-size: 32rpx;
  185. .input-box {
  186. width: 100%;
  187. height: 100rpx;
  188. background-color: #02a7f0;
  189. display: flex;
  190. justify-content: center;
  191. align-items: center;
  192. position: relative;
  193. image {
  194. position: absolute;
  195. left: 72rpx;
  196. width: 30rpx;
  197. height: 30rpx;
  198. }
  199. input {
  200. background-color: #ffffff;
  201. width: 90%;
  202. height: 70%;
  203. border-radius: 50rpx;
  204. padding: 3rpx;
  205. font-size: 28rpx;
  206. padding-left: 80rpx;
  207. box-sizing: border-box;
  208. }
  209. }
  210. .companys {
  211. margin-top: 3%;
  212. padding: 0 4%;
  213. .company {
  214. border-radius: 20rpx;
  215. box-shadow: rgba(0, 0, 0, 0.35) 0rpx 5rpx 15rpx;
  216. padding: 2%;
  217. margin: 3% 0;
  218. .title {
  219. display: flex;
  220. align-items: center;
  221. .logo {
  222. margin-right: 30rpx;
  223. display: flex;
  224. justify-content: center;
  225. align-items: center;
  226. overflow: hidden;
  227. width: 150rpx;
  228. height: 100rpx;
  229. overflow: hidden;
  230. .logo-img {
  231. max-width: 100%;
  232. max-height: 100%;
  233. }
  234. }
  235. }
  236. .line {
  237. width: 2rpx;
  238. height: 70rpx;
  239. background: rgb(175, 186, 197);
  240. }
  241. .info {
  242. font-size: 24rpx;
  243. font-weight: 100;
  244. display: flex;
  245. text-align: center;
  246. justify-content: space-around;
  247. align-items: center;
  248. padding: 0 2%;
  249. margin-top: 2%;
  250. .view {
  251. margin-top: 2%;
  252. font-size: 26rpx;
  253. // .name {
  254. // color: #02a7f0;
  255. // }
  256. .info_t {
  257. margin-bottom: 10rpx;
  258. }
  259. }
  260. }
  261. }
  262. }
  263. }
  264. </style>