index.vue 6.6 KB

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