index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <template>
  2. <view class="container">
  3. <u-navbar :is-back="false" title="" :background="{ background: '#f7f7f7' }" :border-bottom="false">
  4. <view class="slot-wrap">
  5. <image src="https://sylwt.top/api/visitor/resources/image?name=/ydl/menber-center/login-icon.png" mode="aspectFit" style="width: 300rpx;"></image>
  6. </view>
  7. </u-navbar>
  8. <view class="page-content">
  9. <swiper class="swiper" circular indicator-dots style="border-radius: 20rpx;overflow: hidden;height: 200px">
  10. <swiper-item v-for="(data, index) in swiperList" style="width: 100%;height: 100%;" :key="index">
  11. <view class="swiper-item" style="width: 100%;height: 100%;">
  12. <image :src="data.imgUrl" mode="aspectFill" style="width: 100%;height: 100%;"></image>
  13. </view>
  14. </swiper-item>
  15. </swiper>
  16. <u-grid :col="4" :border="false" style="margin: 10rpx 0 ;">
  17. <template v-for="(item,index) in navList" :key="index">
  18. <u-grid-item bg-color="none" @click="jumpToPage(item)">
  19. <image :src="`https://sylwt.top/api/visitor/resources/image?name=/ydl/menber-center/index-icon/${item.image}.png`" style="height: 70rpx;width: 70rpx;">
  20. </image>
  21. <view class="grid-text">{{item.title}}</view>
  22. </u-grid-item>
  23. </template>
  24. </u-grid>
  25. <u-card padding="20" margin="0rpx 0rpx 30rpx" border-radius="20"
  26. box-shadow="0px 2px 5px rgba(0, 0, 0, 0.1)">
  27. <template v-slot:head>
  28. <u-section title="课程预告" sub-title="查看更多" sub-color="#000000"></u-section>
  29. </template>
  30. <template v-slot:body>
  31. <lg-swiper :sildeItems="courseList" @swiperClick="swiperClick" image="courseImg" title="courseName"></lg-swiper>
  32. </template>
  33. </u-card>
  34. <u-card padding="30" margin="0rpx 0rpx 30rpx" border-radius="20"
  35. box-shadow="0px 2px 5px rgba(0, 0, 0, 0.1)">
  36. <template v-slot:head>
  37. <u-section title="研究报告" sub-title="查看更多" sub-color="#000000"></u-section>
  38. </template>
  39. <template v-slot:body>
  40. <view>
  41. <view v-for="(data,index) in reportList" :key="index" class="u-body-item u-flex u-p-t-0 "
  42. style="align-items: inherit;">
  43. <image :src="data.imgUrl" mode="aspectFill"></image>
  44. <view class="u-body-item-content">
  45. <view class="item-content">
  46. <text class="item-content-title text-ellipsis">{{data.title}}</text>
  47. <text class="item-content-type">{{data.type}}</text>
  48. <text class="item-content-price" v-if="!data.memberFree">¥{{data.price}}元</text>
  49. </view>
  50. <view class="item-button">
  51. <view v-if="!data.memberFree && data.hasBuy" class="item-button-yiGouMai">已购买
  52. </view>
  53. <view v-else-if="!data.memberFree && !data.hasBuy" class="item-button-goumai">
  54. 点击购买</view>
  55. <view v-else-if="data.memberFree" class="item-button-huiyuan">
  56. 会员免费
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. </u-card>
  64. </view>
  65. <u-modal v-model="loginModal" mask-close-able class="modal" show-cancel-button
  66. :title-style="{fontWeight: 'bold'}" @confirm="confirmModal">
  67. <view class="modal-content">
  68. <text>请登录后使用该功能</text>
  69. </view>
  70. </u-modal>
  71. </view>
  72. </template>
  73. <script setup>
  74. import lgSwiper from '@/components/lgSwiper.vue'
  75. import {
  76. onMounted,
  77. ref
  78. } from 'vue'
  79. import {
  80. onReady,
  81. onLoad
  82. } from '@dcloudio/uni-app'
  83. import {
  84. useAuthStore
  85. } from '@/store/authStore'
  86. const authStore = useAuthStore()
  87. // 屏幕状态栏高度
  88. const statusBarHeight = ref(0)
  89. // 顶部导航栏高度
  90. const navBarHeight = ref(0)
  91. // 是否登录
  92. const isLogin = ref(true)
  93. const loginModal = ref(false)
  94. // 是否为会员,从缓存里拿取用户信息
  95. // const userInfo = uni.getStorageSync("userinfo") || {}
  96. // const isMember = userInfo?.isMember || false
  97. // 首页-轮播图
  98. const swiperList = ref([{
  99. imgUrl: 'https://tse3-mm.cn.bing.net/th/id/OIP-C.YKoZzgmubNBxQ8j-mmoTKAHaEK?rs=1&pid=ImgDetMain',
  100. id: 1
  101. },
  102. {
  103. imgUrl: 'https://pic3.zhimg.com/v2-e52354ffdbd94a8e0a7649eacd34a788_r.jpg?source=1940ef5c',
  104. id: 2
  105. },
  106. {
  107. imgUrl: 'https://desk-fd.zol-img.com.cn/t_s960x600c5/g4/M03/00/0C/Cg-4zFS8bC-Ie9zBADCvovJAqiEAATJ8wDX__cAMK-6184.jpg',
  108. id: 3
  109. },
  110. ])
  111. const courseList = ref([{
  112. courseImg: 'https://tse3-mm.cn.bing.net/th/id/OIP-C.YKoZzgmubNBxQ8j-mmoTKAHaEK?rs=1&pid=ImgDetMain',
  113. id: 1,
  114. courseName: '【8月8日】房地产经纪进阶培训班'
  115. },
  116. {
  117. courseImg: 'https://pic3.zhimg.com/v2-e52354ffdbd94a8e0a7649eacd34a788_r.jpg?source=1940ef5c',
  118. id: 2,
  119. courseName: '【8月9日】《房地产中介服务规范》培训'
  120. },
  121. {
  122. courseImg: 'https://desk-fd.zol-img.com.cn/t_s960x600c5/g4/M03/00/0C/Cg-4zFS8bC-Ie9zBADCvovJAqiEAATJ8wDX__cAMK-6184.jpg',
  123. id: 3,
  124. courseName: '【已结束】《广州市房屋租赁管理规定》'
  125. },
  126. ])
  127. // 首页-导航栏
  128. const navList = ref([{
  129. id: 'notice',
  130. title: '通知公告',
  131. image: 'notice',
  132. url: '/pages/notice/notice/notice',
  133. toOtherApp: false,
  134. otherAppId: '其他小程序的appid'
  135. },
  136. {
  137. id: 'dynamic',
  138. title: '协会动态',
  139. image: 'dynamic',
  140. url: '/pages/dynamic/dynamic/dynamic',
  141. toOtherApp: false,
  142. otherAppId: '其他小程序的appid'
  143. },
  144. {
  145. id: 'guide',
  146. title: '办事指引',
  147. image: 'guide',
  148. url: '/pages/guide/guide/guide',
  149. toOtherApp: false,
  150. otherAppId: '其他小程序的appid'
  151. },
  152. {
  153. id: 'edu',
  154. title: '继续教育',
  155. image: 'edu',
  156. url: '/pages/goOnEdu/index',
  157. toOtherApp: false,
  158. otherAppId: '其他小程序的appid'
  159. },
  160. {
  161. id: 'level',
  162. title: '水平认证',
  163. image: 'level',
  164. url: '跳转页面的路径',
  165. toOtherApp: true,
  166. otherAppId: '其他小程序的appid'
  167. },
  168. {
  169. id: 'report',
  170. title: '研究报告',
  171. image: 'report',
  172. url: '/pages/researchReport/reportHome/reportHome',
  173. toOtherApp: false,
  174. otherAppId: '其他小程序的appid'
  175. },
  176. {
  177. id: 'index',
  178. title: '经理人指数',
  179. image: 'index',
  180. url: '跳转页面的路径',
  181. toOtherApp: true,
  182. otherAppId: '其他小程序的appid'
  183. },
  184. {
  185. id: 'pay',
  186. title: '会费缴交',
  187. image: 'pay',
  188. url: '跳转页面的路径',
  189. toOtherApp: true,
  190. otherAppId: '其他小程序的appid'
  191. }
  192. ])
  193. const reportList = ref(
  194. [{
  195. "id": 1,
  196. "title": "2023年7月广州市中介促成二手住宅市场交易简报",
  197. "imgUrl": "https://tse3-mm.cn.bing.net/th/id/OIP-C.YKoZzgmubNBxQ8j-mmoTKAHaEK?rs=1&pid=ImgDetMain",
  198. "type": "月度成交简报",
  199. "price": 150.80,
  200. "hasBuy": true,
  201. "memberFree": false
  202. },
  203. {
  204. "id": 2,
  205. "title": "成交有望稳中微升——2023年8月中介协会经理人指数报告经理人指数报告经理人指数报告",
  206. "imgUrl": "https://pic3.zhimg.com/v2-e52354ffdbd94a8e0a7649eacd34a788_r.jpg?source=1940ef5c",
  207. "type": "经理人指数报告",
  208. "price": 200.88,
  209. "hasBuy": false,
  210. "memberFree": false
  211. },
  212. {
  213. "id": 3,
  214. "title": "2023年6月广州市住宅租金动态监测报告",
  215. "imgUrl": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g4/M03/00/0C/Cg-4zFS8bC-Ie9zBADCvovJAqiEAATJ8wDX__cAMK-6184.jpg",
  216. "type": "月度租赁简报",
  217. "price": 300.00,
  218. "hasBuy": true,
  219. "memberFree": true
  220. }
  221. ])
  222. // 跳转页面
  223. const jumpToPage = (data) => {
  224. if (data.toOtherApp) {
  225. // 跳转其他小程序
  226. console.log("跳转至其他小程序", data.otherAppId)
  227. return
  228. }
  229. if (!authStore.isAuthenticated) {
  230. loginModal.value = true
  231. return
  232. }
  233. uni.navigateTo({
  234. url: data.url
  235. })
  236. }
  237. // 确认跳转至登录
  238. const confirmModal = () => {
  239. uni.navigateTo({
  240. url: "/pages/login/login"
  241. })
  242. }
  243. const toPage = () => {
  244. if (!authStore.isAuthenticated) {
  245. uni.navigateTo({
  246. url: "/pages/login/login"
  247. })
  248. return
  249. }
  250. }
  251. const swiperClick = (data) => {
  252. console.log(data, "课程预告数据")
  253. }
  254. onReady(() => {
  255. uni.getSystemInfo({
  256. success(e) {
  257. statusBarHeight.value = e.statusBarHeight;
  258. let custom = uni.getMenuButtonBoundingClientRect();
  259. navBarHeight.value = custom.height + (custom.top - e.statusBarHeight) * 2;
  260. }
  261. })
  262. })
  263. onLoad(() => {
  264. uni.setTabBarBadge({ //显示数字
  265. index: 1, //tabbar下标
  266. text: '999' //数字
  267. })
  268. })
  269. </script>
  270. <style lang="scss" scoped>
  271. .container {
  272. width: 100vw;
  273. background-color: $uni-bg-color;
  274. padding: 0 20rpx 5rpx;
  275. }
  276. .slot-wrap {
  277. padding-left: 20rpx;
  278. }
  279. .grid-text {
  280. font-size: 28rpx;
  281. margin-top: 4rpx;
  282. color: $uni-text-color;
  283. }
  284. .u-card-wrap {
  285. background-color: $u-bg-color;
  286. padding: 1px;
  287. }
  288. .u-body-item {
  289. font-size: 32rpx;
  290. color: #333;
  291. margin-bottom: 30rpx;
  292. height: 140rpx;
  293. &:last-of-type {
  294. margin-bottom: 0;
  295. }
  296. .u-body-item-content {
  297. position: relative;
  298. flex: 1;
  299. /* 剩余空间占用 Flex 规则 */
  300. min-width: 0;
  301. // width: 100%;
  302. height: inherit;
  303. .item-content text {
  304. width: inherit;
  305. font-size: $uni-font-size-2;
  306. display: block;
  307. margin: 10rpx;
  308. color: $uni-text-color;
  309. }
  310. .item-content .item-content-title{
  311. font-size: $uni-title-font-size-2;
  312. }
  313. .item-content .item-content-price {
  314. color: $uni-color-error;
  315. // font-weight: bold;
  316. }
  317. .item-button {
  318. position: absolute;
  319. right: 0;
  320. bottom: 0;
  321. font-size: 22rpx;
  322. .item-button-huiyuan {
  323. padding: 15rpx 0 5rpx;
  324. text-align: center;
  325. width: 150rpx;
  326. background-image: url('https://sylwt.top/api/visitor/resources/image?name=/ydl/menber-center/bg-label.png');
  327. background-size: cover;
  328. background-repeat: no-repeat;
  329. // background-position: center;
  330. }
  331. .item-button-goumai {
  332. padding: 5rpx 0;
  333. text-align: center;
  334. width: 150rpx;
  335. background-color: #fe0000;
  336. border-radius: 30rpx;
  337. color: #fff;
  338. }
  339. .item-button-yiGouMai {
  340. text-align: center;
  341. width: 150rpx;
  342. padding: 5rpx 0;
  343. background-color: #006af4;
  344. border-radius: 30rpx;
  345. color: #fff;
  346. }
  347. }
  348. }
  349. image {
  350. width: 200rpx;
  351. flex: 0 0 200rpx;
  352. height: 100%;
  353. border-radius: 20rpx;
  354. margin-right: 12rpx;
  355. }
  356. }
  357. .course-swiper {
  358. height: 200px;
  359. .swiper-item {
  360. width: 33.33%;
  361. height: 200px;
  362. /* 三个一排,宽度为三分之一 */
  363. transition: transform 0.3s ease;
  364. /* 加入过渡效果 */
  365. display: flex;
  366. flex-direction: column;
  367. align-items: center;
  368. justify-content: center;
  369. }
  370. .swiper-item.active {
  371. transform: scale(2);
  372. /* 主项放大 */
  373. }
  374. image {
  375. width: 80%;
  376. /* 图片宽度 */
  377. height: auto;
  378. }
  379. text {
  380. margin-top: 10px;
  381. }
  382. }
  383. .text-ellipsis {
  384. overflow: hidden;
  385. /* 隐藏超出内容 */
  386. white-space: nowrap;
  387. /* 禁止换行 */
  388. text-overflow: ellipsis;
  389. }
  390. .swiper-container {
  391. perspective: 1000px;
  392. }
  393. .swiper-item {
  394. transition: transform 0.5s;
  395. transform-style: preserve-3d;
  396. /* 其他样式 */
  397. }
  398. .content {
  399. backface-visibility: hidden;
  400. /* 确保背面不可见 */
  401. display: flex;
  402. justify-content: center;
  403. align-items: center;
  404. height: 200px;
  405. /* 设置高度 */
  406. font-size: 24px;
  407. color: white;
  408. background: linear-gradient(45deg, #ff5858, #f09819);
  409. /* 示例背景 */
  410. }
  411. // 登录模拟态
  412. .modal {
  413. .modal-content {
  414. padding: 50rpx;
  415. .content-a {
  416. color: #2979ff;
  417. }
  418. }
  419. }
  420. </style>