collection.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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" style="height: 70rpx">
  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. };
  89. },
  90. onLoad() {
  91. this.getCollection();
  92. },
  93. methods: {
  94. toDetail(index) {
  95. uni.navigateTo({
  96. url: "/pages/enterprise/enterprise_detail?id=" + index,
  97. });
  98. },
  99. enterPolicyDeatil(id) {
  100. uni.navigateTo({
  101. url: "/pages/policy/policy_deatil?id=" + id,
  102. });
  103. },
  104. getCollection() {
  105. let md5Sign = md5(
  106. "method=" +
  107. "user" +
  108. "&timestamp=" +
  109. getApp().globalData.globalTimestamp +
  110. "&secret=" +
  111. getApp().globalData.secret
  112. );
  113. let url =
  114. getApp().globalData.shareUrl +
  115. "api/api.php" +
  116. "?method=user&action=collect_list&timestamp=" +
  117. getApp().globalData.globalTimestamp +
  118. "&sign=" +
  119. md5Sign;
  120. let postData = {
  121. page: 1,
  122. page_size: 5,
  123. openId: getApp().globalData.open_id,
  124. };
  125. uni.request({
  126. url: url,
  127. method: "POST",
  128. header: {
  129. "content-type": "application/x-www-form-urlencoded",
  130. },
  131. data: postData,
  132. success: (res) => {
  133. console.log(res);
  134. if (res.data.code === 200) {
  135. let list = res.data.data.list;
  136. this.policyData = list.map((item) => {
  137. let ob = {
  138. title: "",
  139. time: "",
  140. id: "",
  141. };
  142. ob.title = item.source_title;
  143. ob.time = item.addtime;
  144. ob.id = item.id;
  145. return ob;
  146. });
  147. }
  148. },
  149. fail: () => {
  150. console.log("连接失败");
  151. },
  152. });
  153. },
  154. },
  155. };
  156. </script>
  157. <style lang="scss">
  158. .content {
  159. padding: 4%;
  160. .supply-box {
  161. width: 100%;
  162. display: flex;
  163. flex-direction: column;
  164. .supply-title {
  165. width: 100%;
  166. p {
  167. background-color: #02a7f0;
  168. width: 190rpx;
  169. height: 70rpx;
  170. color: #ffffff;
  171. border-radius: 0 40rpx 40rpx 0rpx;
  172. font-size: 28rpx;
  173. display: flex;
  174. justify-content: center;
  175. align-items: center;
  176. }
  177. }
  178. .supply-item-box {
  179. display: flex;
  180. justify-content: space-evenly;
  181. margin: 0 20rpx;
  182. margin-top: 10rpx;
  183. .supply-item-name {
  184. padding-bottom: 10rpx;
  185. font-size: 27rpx;
  186. }
  187. .active {
  188. font-weight: 600;
  189. border-bottom: 7rpx solid #02a7f0;
  190. }
  191. }
  192. .supply-content {
  193. width: 100%;
  194. display: flex;
  195. box-sizing: border-box;
  196. flex-direction: column;
  197. font-size: 25rpx;
  198. .supplyCard {
  199. display: flex;
  200. width: 92%;
  201. margin: 2% 0;
  202. padding: 2% 4%;
  203. height: 5%;
  204. border-radius: 30rpx;
  205. box-shadow: rgba(100, 100, 111, 0.2) 0rpx 14rpx 50rpx 0rpx;
  206. .image_content {
  207. margin-right: 5%;
  208. image {
  209. width: 100rpx;
  210. height: 100rpx;
  211. border-radius: 20rpx;
  212. background-color: rgb(228, 228, 228);
  213. }
  214. }
  215. .state {
  216. margin-left: 100rpx;
  217. image {
  218. width: 100rpx;
  219. height: 80rpx;
  220. }
  221. }
  222. .info {
  223. display: flex;
  224. flex-flow: column;
  225. justify-content: space-around;
  226. .time {
  227. font-weight: 100;
  228. font-size: 25rpx;
  229. }
  230. }
  231. }
  232. }
  233. }
  234. .policy-content {
  235. width: 100%;
  236. display: flex;
  237. box-sizing: border-box;
  238. flex-direction: column;
  239. margin-top: 10rpx;
  240. .policy-content-item {
  241. margin: 0 20rpx;
  242. display: flex;
  243. overflow: hidden;
  244. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  245. border-radius: 32rpx;
  246. padding-bottom: 10rpx;
  247. margin-top: 20rpx;
  248. padding: 30rpx;
  249. justify-content: space-between;
  250. .policy-content-item-left {
  251. display: flex;
  252. flex-direction: column;
  253. width: 70%;
  254. .policy-content-item-left-title {
  255. text-overflow: -o-ellipsis-lastline;
  256. overflow: hidden;
  257. text-overflow: ellipsis;
  258. display: -webkit-box;
  259. -webkit-line-clamp: 2;
  260. line-clamp: 2;
  261. -webkit-box-orient: vertical;
  262. font-size: 25rpx;
  263. margin-bottom: 2rpx;
  264. }
  265. .policy-content-item-left-time {
  266. width: 100%;
  267. display: flex;
  268. align-items: center;
  269. .moment {
  270. color: #c1c1c1;
  271. font-size: 20rpx;
  272. margin-right: 20rpx;
  273. }
  274. .maxMony {
  275. font-size: 20rpx;
  276. color: #00bfbf;
  277. border: 1px solid #00bfbf;
  278. padding: 10rpx;
  279. margin-right: 20rpx;
  280. border-radius: 12rpx;
  281. }
  282. .leftDay {
  283. font-size: 20rpx;
  284. background: #f7bbc3;
  285. color: #e32579;
  286. padding: 10rpx;
  287. border: 1px solid #f7bbc3;
  288. border-radius: 12rpx;
  289. }
  290. }
  291. }
  292. .policy-content-item-img {
  293. image {
  294. width: 180rpx;
  295. height: 120rpx;
  296. border-radius: 12rpx;
  297. }
  298. }
  299. }
  300. }
  301. .companys {
  302. margin-top: 3%;
  303. padding: 0 4%;
  304. font-size: 30rpx;
  305. .company {
  306. border-radius: 20rpx;
  307. box-shadow: rgba(0, 0, 0, 0.35) 0rpx 5rpx 15rpx;
  308. padding: 1%;
  309. margin: 2% 0;
  310. .title {
  311. display: flex;
  312. align-items: center;
  313. .logo {
  314. image {
  315. width: 100rpx;
  316. height: 70rpx;
  317. margin-right: 30rpx;
  318. }
  319. }
  320. }
  321. .line {
  322. width: 3rpx;
  323. height: 70rpx;
  324. background: rgb(175, 186, 197);
  325. }
  326. .info {
  327. font-size: 19rpx;
  328. font-weight: 100;
  329. display: flex;
  330. text-align: center;
  331. justify-content: space-between;
  332. align-items: center;
  333. padding: 0 2%;
  334. margin-top: 1%;
  335. .view {
  336. margin-top: 2%;
  337. .name {
  338. color: #02a7f0;
  339. }
  340. .info_t {
  341. margin-bottom: 10rpx;
  342. font-size: 25rpx;
  343. }
  344. }
  345. }
  346. }
  347. }
  348. }
  349. </style>