index.vue 11 KB

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