collection.vue 8.1 KB

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