index.vue 6.5 KB

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