index.vue 11 KB

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