index.vue 10 KB

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