collection.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <view class="content">
  3. <view class="supply-box">
  4. <view class="supply-item-box">
  5. <view
  6. v-for="(item, idx) in titleList"
  7. :key="idx"
  8. :class="{ active: active === idx }"
  9. class="supply-item-name"
  10. @click="active = idx"
  11. >
  12. {{ item }}
  13. </view>
  14. </view>
  15. <view class="policy-content" v-if="active == 0">
  16. <view
  17. class="policy-content-item"
  18. v-for="(item, idx) in policyData"
  19. :key="idx"
  20. @click="enterPolicyDeatil(item.id)"
  21. >
  22. <view class="policy-content-item-left">
  23. <p class="policy-content-item-left-title">
  24. {{ item.title }}
  25. </p>
  26. <view class="policy-content-item-left-time">
  27. <p class="moment">收藏时间: {{ item.time | globalTime }}</p>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="companys" v-if="active == 1">
  33. <view
  34. class="company"
  35. v-for="(company, index) in companyList"
  36. :key="index"
  37. @tap="toDetail(index)"
  38. >
  39. <view class="title">
  40. <view class="logo">
  41. <img :src="company.logo" alt="" />
  42. </view>
  43. <view class="name">
  44. {{ company.name }}
  45. </view>
  46. </view>
  47. <view class="info">
  48. <view class="view">
  49. <view class="info_t">法定代表人</view>
  50. <view class="name">
  51. {{ company.info.person }}
  52. </view>
  53. </view>
  54. <view class="line"></view>
  55. <view class="view">
  56. <view class="info_t">注册资本</view>
  57. {{ company.info.money }}
  58. </view>
  59. <view class="line"></view>
  60. <view class="view">
  61. <view class="info_t">成立日期</view>
  62. {{ company.info.time }}
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import md5 from "@/common/md5.js";
  72. export default {
  73. data() {
  74. return {
  75. titleList: ["政策", "企业"],
  76. active: 0,
  77. searchVal: "",
  78. policyData: [],
  79. // companyList: new Array(5).fill({
  80. // logo: "/static/enterprise/logo.png",
  81. // name: "康拓科技有限责任公司",
  82. // info: {
  83. // person: "马须伦",
  84. // money: "1,776,759.3万(元)",
  85. // time: "1995-03-25",
  86. // },
  87. // }),
  88. companyList: []
  89. };
  90. },
  91. onLoad() {
  92. //this.getCollection();
  93. },
  94. onShow() {
  95. this.getCollection();
  96. },
  97. methods: {
  98. toDetail(id) {
  99. uni.navigateTo({
  100. url: "/pages/enterprise/enterprise_detail?id=" + id,
  101. });
  102. },
  103. enterPolicyDeatil(id) {
  104. uni.navigateTo({
  105. url: "/pages/policy/policy_deatil?id=" + id,
  106. });
  107. },
  108. getCollection() {
  109. let md5Sign = md5(
  110. "method=" +
  111. "user" +
  112. "&timestamp=" +
  113. getApp().globalData.globalTimestamp +
  114. "&secret=" +
  115. getApp().globalData.secret
  116. );
  117. let url =
  118. getApp().globalData.shareUrl +
  119. "api/api.php" +
  120. "?method=user&action=collect_list&timestamp=" +
  121. getApp().globalData.globalTimestamp +
  122. "&sign=" +
  123. md5Sign;
  124. let postData = {
  125. page: 1,
  126. page_size: 5,
  127. openId: getApp().globalData.open_id,
  128. };
  129. uni.request({
  130. url: url,
  131. method: "POST",
  132. header: {
  133. "content-type": "application/x-www-form-urlencoded",
  134. },
  135. data: postData,
  136. success: (res) => {
  137. console.log(res);
  138. if (res.data.code === 200) {
  139. let list = res.data.data.list;
  140. this.policyData = list.map((item) => {
  141. let ob = {
  142. title: "",
  143. time: "",
  144. id: "",
  145. };
  146. ob.title = item.source_title;
  147. ob.time = item.addtime;
  148. ob.id = item.source_id;
  149. return ob;
  150. });
  151. }
  152. },
  153. fail: () => {
  154. console.log("连接失败");
  155. },
  156. });
  157. },
  158. },
  159. };
  160. </script>
  161. <style lang="scss">
  162. .content {
  163. padding: 4%;
  164. .supply-box {
  165. width: 100%;
  166. display: flex;
  167. flex-direction: column;
  168. .supply-title {
  169. width: 100%;
  170. p {
  171. background-color: #02a7f0;
  172. width: 190rpx;
  173. height: 70rpx;
  174. color: #ffffff;
  175. border-radius: 0 40rpx 40rpx 0rpx;
  176. font-size: 28rpx;
  177. display: flex;
  178. justify-content: center;
  179. align-items: center;
  180. }
  181. }
  182. .supply-item-box {
  183. display: flex;
  184. justify-content: space-evenly;
  185. margin: 0 20rpx;
  186. margin-top: 10rpx;
  187. .supply-item-name {
  188. padding-bottom: 10rpx;
  189. font-size: 27rpx;
  190. }
  191. .active {
  192. font-weight: 600;
  193. border-bottom: 7rpx solid #02a7f0;
  194. }
  195. }
  196. .supply-content {
  197. width: 100%;
  198. display: flex;
  199. box-sizing: border-box;
  200. flex-direction: column;
  201. font-size: 25rpx;
  202. .supplyCard {
  203. display: flex;
  204. width: 92%;
  205. margin: 2% 0;
  206. padding: 2% 4%;
  207. height: 5%;
  208. border-radius: 30rpx;
  209. box-shadow: rgba(100, 100, 111, 0.2) 0rpx 14rpx 50rpx 0rpx;
  210. .image_content {
  211. margin-right: 5%;
  212. image {
  213. width: 100rpx;
  214. height: 100rpx;
  215. border-radius: 20rpx;
  216. background-color: rgb(228, 228, 228);
  217. }
  218. }
  219. .state {
  220. margin-left: 100rpx;
  221. image {
  222. width: 100rpx;
  223. height: 80rpx;
  224. }
  225. }
  226. .info {
  227. display: flex;
  228. flex-flow: column;
  229. justify-content: space-around;
  230. .time {
  231. font-weight: 100;
  232. font-size: 25rpx;
  233. }
  234. }
  235. }
  236. }
  237. }
  238. .policy-content {
  239. width: 100%;
  240. display: flex;
  241. box-sizing: border-box;
  242. flex-direction: column;
  243. margin-top: 10rpx;
  244. .policy-content-item {
  245. margin: 0 20rpx;
  246. display: flex;
  247. overflow: hidden;
  248. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  249. border-radius: 32rpx;
  250. padding-bottom: 10rpx;
  251. margin-top: 20rpx;
  252. padding: 30rpx;
  253. justify-content: space-between;
  254. .policy-content-item-left {
  255. display: flex;
  256. flex-direction: column;
  257. width: 98%;
  258. .policy-content-item-left-title {
  259. font-weight: 550;
  260. text-overflow: -o-ellipsis-lastline;
  261. overflow: hidden;
  262. text-overflow: ellipsis;
  263. display: -webkit-box;
  264. -webkit-line-clamp: 2;
  265. line-clamp: 2;
  266. -webkit-box-orient: vertical;
  267. font-size: 26rpx;
  268. margin-bottom: 20rpx;
  269. }
  270. .policy-content-item-left-time {
  271. width: 100%;
  272. display: flex;
  273. align-items: center;
  274. .moment {
  275. color: #c1c1c1;
  276. font-size: 22rpx;
  277. margin-right: 20rpx;
  278. }
  279. .maxMony {
  280. font-size: 22rpx;
  281. color: #00bfbf;
  282. border: 1px solid #00bfbf;
  283. padding: 10rpx;
  284. margin-right: 20rpx;
  285. border-radius: 12rpx;
  286. }
  287. .leftDay {
  288. font-size: 22rpx;
  289. background: #f7bbc3;
  290. color: #e32579;
  291. padding: 10rpx;
  292. border: 1px solid #f7bbc3;
  293. border-radius: 12rpx;
  294. }
  295. }
  296. }
  297. .policy-content-item-img {
  298. image {
  299. width: 180rpx;
  300. height: 120rpx;
  301. border-radius: 12rpx;
  302. }
  303. }
  304. }
  305. }
  306. .companys {
  307. margin-top: 3%;
  308. padding: 0 4%;
  309. font-size: 30rpx;
  310. .company {
  311. border-radius: 20rpx;
  312. box-shadow: rgba(0, 0, 0, 0.35) 0rpx 5rpx 15rpx;
  313. padding: 1%;
  314. margin: 2% 0;
  315. .title {
  316. display: flex;
  317. align-items: center;
  318. .logo {
  319. image {
  320. width: 100rpx;
  321. height: 70rpx;
  322. margin-right: 30rpx;
  323. }
  324. }
  325. }
  326. .line {
  327. width: 3rpx;
  328. height: 70rpx;
  329. background: rgb(175, 186, 197);
  330. }
  331. .info {
  332. font-size: 19rpx;
  333. font-weight: 100;
  334. display: flex;
  335. text-align: center;
  336. justify-content: space-between;
  337. align-items: center;
  338. padding: 0 2%;
  339. margin-top: 1%;
  340. .view {
  341. margin-top: 2%;
  342. .name {
  343. color: #02a7f0;
  344. }
  345. .info_t {
  346. margin-bottom: 10rpx;
  347. font-size: 25rpx;
  348. }
  349. }
  350. }
  351. }
  352. }
  353. }
  354. </style>