index.vue 6.2 KB

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