index.vue 6.5 KB

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