collection.vue 7.9 KB

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