reportHome.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. <template>
  2. <view class="container">
  3. <view v-show="menuCurrent === 0">
  4. <view class="menus-box">
  5. <view class="menus-item-box"
  6. @click="toReportList(key, data.value)"
  7. v-for="(data,key) in categoryList"
  8. :key="key">
  9. <view class="icon-box">
  10. <view class="iconfont icon-hetong"></view>
  11. </view>
  12. <view class="text-box">
  13. {{ key }}
  14. </view>
  15. </view>
  16. <!-- <view class="menus-item-box" @click="toReportList('二手住宅市场')">
  17. <view class="icon-box">
  18. <view class="iconfont icon-hetong"></view>
  19. </view>
  20. <view class="text-box">
  21. 二手住宅市场
  22. </view>
  23. </view>
  24. <view class="menus-item-box" @click="toReportList('住宅租赁市场')">
  25. <view class="icon-box">
  26. <view class="iconfont icon-chengshi"></view>
  27. </view>
  28. <view class="text-box">
  29. 住宅租赁市场
  30. </view>
  31. </view>
  32. <view class="menus-item-box" @click="toReportList('房地产中介行业')">
  33. <view class="icon-box">
  34. <view class="iconfont icon-zhongjie"></view>
  35. </view>
  36. <view class="text-box">
  37. 房地产中介行业
  38. </view>
  39. </view> -->
  40. </view>
  41. </view>
  42. <view v-show="menuCurrent === 1">
  43. <view class="header-box">
  44. <view class="search-box">
  45. <u-search
  46. v-model="searchForm.keyword"
  47. :clearabled="true"
  48. bg-color="#E5E5E5"
  49. :input-style="searchInputStyle"
  50. placeholder="搜索您想要的内容"
  51. ></u-search>
  52. </view>
  53. </view>
  54. <view class="list-box">
  55. <view class="list-item-box" v-for="item in list" :key="item.id" @click="onClickReport(item)">
  56. <view class="image-box">
  57. <image :src="item.image" mode="aspectFill"></image>
  58. </view>
  59. <view class="info-box">
  60. <view class="title">
  61. {{item.title}}
  62. </view>
  63. <view class="time">
  64. <span class="iconfont icon-time"></span>
  65. <span>{{item.time}}</span>
  66. </view>
  67. <view class="func">
  68. <view v-if="item.free > 0" class="button free">免费</view>
  69. <view v-else-if="item.memberFree > 0" class="button member-free">会员免费</view>
  70. <view v-else :class="['button', item.status > 0 ? 'free' : 'buy']">{{item.status > 0 ? '已购买' : '立即购买'}}</view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. <view v-show="menuCurrent === 2">
  77. <view class="header-box">
  78. <view class="search-box">
  79. <u-search
  80. v-model="searchForm.keyword"
  81. :clearabled="true"
  82. bg-color="#E5E5E5"
  83. :input-style="searchInputStyle"
  84. placeholder="搜索您想要的内容"
  85. ></u-search>
  86. </view>
  87. </view>
  88. <view class="list-box">
  89. <view class="list-item-box" v-for="item in list2" :key="item.id" @click="onClickReport(item)">
  90. <view class="image-box">
  91. <image :src="item.image" mode="aspectFill"></image>
  92. </view>
  93. <view class="info-box">
  94. <view class="title">
  95. {{item.title}}
  96. </view>
  97. <view class="time">
  98. <span>购买时间:&nbsp;{{item.time}}</span>
  99. </view>
  100. <view class="func">
  101. <view class="price">实付款:{{item.price}}元</view>
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. <view class="bottom-block"></view>
  108. <view class="bottom-box">
  109. <view class="menu-box">
  110. <view class="menu-item-box" :class="{'is-active': menuCurrent === 0}" @click="onMenuClick(0)">
  111. <view class="iconfont icon-home"></view>
  112. <view class="text">首页</view>
  113. </view>
  114. <view class="menu-item-box" :class="{'is-active': menuCurrent === 1}" @click="onMenuClick(1)">
  115. <view class="iconfont icon-time"></view>
  116. <view class="text">我的浏览</view>
  117. </view>
  118. <view class="menu-item-box" :class="{'is-active': menuCurrent === 2}" @click="onMenuClick(2)">
  119. <view class="iconfont icon-baogao"></view>
  120. <view class="text">我的报告</view>
  121. </view>
  122. </view>
  123. </view>
  124. </view>
  125. </template>
  126. <script setup>
  127. import { ref, computed } from 'vue'
  128. import { onLoad } from '@dcloudio/uni-app'
  129. import {
  130. getReportCate
  131. } from '@/api/report.js'
  132. import { useReportStore } from '@/store/reportStore.js'
  133. const reportStore = useReportStore();
  134. const categoryList = ref({});
  135. const customButtonStyle = {
  136. height: '40rpx',
  137. lineHeight: '40rpx',
  138. padding: '0 30rpx'
  139. }
  140. const searchInputStyle = {
  141. backgroundColor: '#E5E5E5'
  142. }
  143. const searchForm = ref({
  144. keyword: '',
  145. type: 0
  146. })
  147. const menuCurrent = ref(0)
  148. function onMenuClick(index) {
  149. menuCurrent.value = index
  150. }
  151. function toReportList(model, val) {
  152. // console.log(model,val)
  153. uni.setStorageSync("reportCate", categoryList.value[model].child);
  154. uni.navigateTo({
  155. url: `/pages/researchReport/reportList/reportList?model=${model}&value=${val}`
  156. })
  157. }
  158. async function init(){
  159. const cateRes = await getReportCate();
  160. if (cateRes.code === 0) {
  161. const result = cateRes.data.reduce((acc, curr) => {
  162. const modifiedChild = [{
  163. value: " ",
  164. label: "全部"
  165. }, // 新增的默认项(value 为空格)
  166. ...curr.child.map(child => ({
  167. value: child.code, // 将子对象的 code 改为 value
  168. label: child.name
  169. }))
  170. ];
  171. acc[curr.name] = {
  172. value: curr.code,
  173. child: modifiedChild
  174. };
  175. return acc;
  176. }, {});
  177. categoryList.value = result;
  178. reportStore.setReportCate(result);
  179. }
  180. }
  181. const list = [
  182. {
  183. id: '01',
  184. title: '2024年11月广州市中介促成二手住宅市场交易简报',
  185. time: '2023年8月8日',
  186. image: 'https://img.shetu66.com/2023/10/21/1697901453723364.png',
  187. free: 0, // 是否免费
  188. memberFree: 0, // 是否会员免费
  189. status: 0, // 是否购买
  190. },
  191. {
  192. id: '02',
  193. title: '2024年11月广州市中介促成二手住宅市场交易简报',
  194. time: '2023年8月8日',
  195. image: 'https://img.shetu66.com/2023/12/13/1702403646894275.png',
  196. free: 0, // 是否免费
  197. memberFree: 0, // 是否会员免费
  198. status: 1, // 是否购买
  199. },
  200. {
  201. id: '03',
  202. title: '2024年11月广州市中介促成二手住宅市场交易简报',
  203. time: '2023年8月8日',
  204. image: 'https://img.shetu66.com/2023/10/16/1697397333933789.png',
  205. free: 1, // 是否免费
  206. memberFree: 0, // 是否会员免费
  207. status: 0, // 是否购买
  208. },
  209. {
  210. id: '04',
  211. title: '2024年11月广州市中介促成二手住宅市场交易简报',
  212. time: '2023年8月8日',
  213. image: 'https://img.shetu66.com/2023/10/24/1698106006242859.png',
  214. free: 0, // 是否免费
  215. memberFree: 1, // 是否会员免费
  216. status: 0, // 是否购买
  217. },
  218. {
  219. id: '05',
  220. title: '2024年11月广州市中介促成二手住宅市场交易简报',
  221. time: '2023年8月8日',
  222. image: 'https://static.fxbaogao.com/subject/cover/prod/361.jpg',
  223. free: 0, // 是否免费
  224. memberFree: 1, // 是否会员免费
  225. status: 0, // 是否购买
  226. },
  227. {
  228. id: '06',
  229. title: '2024年11月广州市中介促成二手住宅市场交易简报',
  230. time: '2023年8月8日',
  231. image: 'https://img.shetu66.com/2023/10/16/1697387221220874.png',
  232. free: 0, // 是否免费
  233. memberFree: 1, // 是否会员免费
  234. status: 1, // 是否购买
  235. },
  236. {
  237. id: '07',
  238. title: '2024年11月广州市中介促成二手住宅市场交易简报',
  239. time: '2023年8月8日',
  240. image: 'https://img.shetu66.com/2023/10/21/1697901453723364.png',
  241. free: 0, // 是否免费
  242. memberFree: 0, // 是否会员免费
  243. status: 0, // 是否购买
  244. },
  245. {
  246. id: '08',
  247. title: '2024年11月广州市中介促成二手住宅市场交易简报',
  248. time: '2023年8月8日',
  249. image: 'https://img.shetu66.com/2023/12/13/1702403646894275.png',
  250. free: 0, // 是否免费
  251. memberFree: 0, // 是否会员免费
  252. status: 0, // 是否购买
  253. },
  254. ]
  255. const list2 = [
  256. {
  257. id: '01',
  258. title: '2024年11月广州市中介促成二手住宅市场交易简报',
  259. time: '2023年8月8日',
  260. image: 'https://img.shetu66.com/2023/10/21/1697901453723364.png',
  261. price: '9.9'
  262. },
  263. {
  264. id: '02',
  265. title: '2024年11月广州市中介促成二手住宅市场交易简报',
  266. time: '2023年8月8日',
  267. image: 'https://img.shetu66.com/2023/12/13/1702403646894275.png',
  268. price: '9.9'
  269. },
  270. {
  271. id: '03',
  272. title: '2024年11月广州市中介促成二手住宅市场交易简报',
  273. time: '2023年8月8日',
  274. image: 'https://img.shetu66.com/2023/10/16/1697397333933789.png',
  275. price: '9.9'
  276. },
  277. {
  278. id: '04',
  279. title: '2024年11月广州市中介促成二手住宅市场交易简报',
  280. time: '2023年8月8日',
  281. image: 'https://img.shetu66.com/2023/10/24/1698106006242859.png',
  282. price: '9.9'
  283. },
  284. {
  285. id: '05',
  286. title: '2024年11月广州市中介促成二手住宅市场交易简报',
  287. time: '2023年8月8日',
  288. image: 'https://static.fxbaogao.com/subject/cover/prod/361.jpg',
  289. price: '9.9'
  290. },
  291. {
  292. id: '06',
  293. title: '2024年11月广州市中介促成二手住宅市场交易简报',
  294. time: '2023年8月8日',
  295. image: 'https://img.shetu66.com/2023/10/16/1697387221220874.png',
  296. price: '9.9'
  297. },
  298. {
  299. id: '07',
  300. title: '2024年11月广州市中介促成二手住宅市场交易简报',
  301. time: '2023年8月8日',
  302. image: 'https://img.shetu66.com/2023/10/21/1697901453723364.png',
  303. price: '9.9'
  304. },
  305. {
  306. id: '08',
  307. title: '2024年11月广州市中介促成二手住宅市场交易简报',
  308. time: '2023年8月8日',
  309. image: 'https://img.shetu66.com/2023/12/13/1702403646894275.png',
  310. price: '9.9'
  311. },
  312. ]
  313. function onClickReport(report) {
  314. uni.navigateTo({
  315. url: `/pages/reportDetail/reportDetail?id=${report.id}&title=${report.title}`
  316. })
  317. }
  318. onLoad((load) => {
  319. // console.log(load,"reporthome")
  320. if (load.menuCurrent) {
  321. menuCurrent.value = Number(load.menuCurrent)
  322. }
  323. init()
  324. })
  325. </script>
  326. <style lang="scss" scoped>
  327. $image-width: 230rpx;
  328. .container {
  329. height: 100vh;
  330. width: 100vw;
  331. background-color: $uni-text-color-inverse;
  332. .header-box {
  333. padding: 0 20rpx;
  334. background-color: $uni-text-color-inverse;
  335. @include topMagnet();
  336. }
  337. .search-box {
  338. margin-bottom: 20rpx;
  339. ::v-deep(.u-search) {
  340. background-color: #e5e5e5;
  341. border-radius: 50rpx;
  342. .u-action {
  343. width: 18%;
  344. background-color: $uni-color-primary;
  345. border-radius: 50rpx;
  346. color: $uni-text-color-inverse;
  347. margin-right: 8rpx;
  348. font-size: 28rpx;
  349. line-height: 50rpx;
  350. letter-spacing: 3rpx;
  351. text-align: center;
  352. }
  353. }
  354. }
  355. .list-box {
  356. padding: 0 20rpx;
  357. .list-item-box {
  358. padding: 30rpx 20rpx;
  359. display: flex;
  360. gap: 20rpx;
  361. height: 210rpx;
  362. border-bottom: 5rpx solid #E6E6E6;
  363. &:active {
  364. background-color: $uni-bg-color-hover;
  365. }
  366. .image-box {
  367. width: $image-width;
  368. image {
  369. width: $image-width;
  370. flex: 0 0 $image-width;
  371. height: 100%;
  372. border-radius: $uni-card-border-radius;
  373. }
  374. }
  375. .info-box {
  376. .title {
  377. font-size: $uni-title-font-size-2;
  378. font-weight: bold;
  379. line-height: 40rpx;
  380. margin-bottom: 15rpx;
  381. @include text-line-overflow(2);
  382. }
  383. .time {
  384. font-size: $uni-font-size-2;
  385. color: $uni-text-color-grey;
  386. .iconfont {
  387. font-size: $uni-font-size-2;
  388. padding-right: 10rpx;
  389. }
  390. }
  391. .func {
  392. display: flex;
  393. justify-content: flex-end;
  394. font-size: $uni-font-size-2;
  395. font-weight: bold;
  396. .button {
  397. text-align: center;
  398. width: 130rpx;
  399. }
  400. .price {
  401. color: $uni-color-error;
  402. font-size: $uni-title-font-size-2;
  403. }
  404. .buy {
  405. padding: 6rpx 25rpx;
  406. background-color: $uni-color-error;
  407. border-radius: $uni-card-border-radius;
  408. color: $uni-text-color-inverse;
  409. }
  410. .free {
  411. padding: 6rpx 25rpx;
  412. background-color: $uni-color-primary;
  413. border-radius: $uni-card-border-radius;
  414. color: $uni-text-color-inverse;
  415. }
  416. .member-free {
  417. padding: 10rpx 20rpx;
  418. @include backgroundImg('https://sylwt.top/api/visitor/resources/image?name=/ydl/menber-center/bg-label.png');
  419. color: $uni-text-color;
  420. }
  421. }
  422. }
  423. }
  424. }
  425. .menus-box {
  426. padding: 0 20rpx;
  427. .menus-item-box {
  428. width: 100%;
  429. padding: 35rpx 50rpx;
  430. margin-bottom: 35rpx;
  431. display: flex;
  432. gap: 30rpx;
  433. align-items: center;
  434. background-color: #006AF4;
  435. border-radius: $uni-card-border-radius;
  436. &:active {
  437. background-color: #005AF4;
  438. }
  439. .icon-box {
  440. width: 40%;
  441. text-align: center;
  442. width: 100rpx;
  443. height: 100rpx;
  444. line-height: 100rpx;
  445. text-align: center;
  446. border-radius: 50%;
  447. border: 3rpx solid $uni-text-color-inverse;
  448. background-color: #004DC9;
  449. .iconfont {
  450. font-size: 60rpx;
  451. color: $uni-text-color-inverse;
  452. }
  453. }
  454. .text-box {
  455. font-size: 50rpx;
  456. font-weight: bold;
  457. color: $uni-text-color-inverse;
  458. }
  459. }
  460. }
  461. .bottom-block {
  462. // height: 112rpx;
  463. height: calc(112rpx + env(safe-area-inset-bottom, 0));
  464. }
  465. .bottom-box {
  466. padding: 5rpx 20rpx;
  467. background-color: $uni-bg-color-grey;
  468. border: 1rpx solid #E9E9E9;
  469. padding-bottom: calc(5rpx + env(safe-area-inset-bottom, 0));
  470. @include bottomMagnet();
  471. .menu-box {
  472. height: 100rpx;
  473. display: flex;
  474. align-items: center;
  475. .menu-item-box {
  476. width: calc(100% / 3);
  477. text-align: center;
  478. .iconfont {
  479. font-size: 55rpx;
  480. }
  481. .text {
  482. font-size: $uni-font-size-2;
  483. }
  484. }
  485. .is-active {
  486. color: $uni-color-primary;
  487. }
  488. }
  489. }
  490. }
  491. </style>