|
@@ -28,7 +28,8 @@
|
|
|
<u-section title="课程预告" sub-title="查看更多" sub-color="#000000"></u-section>
|
|
|
</template>
|
|
|
<template v-slot:body>
|
|
|
- <lg-swiper :sildeItems="courseList" @swiperClick="swiperClick" image="courseImg" title="courseName"></lg-swiper>
|
|
|
+ <lg-swiper v-if="reportList.length!=0" :sildeItems="courseList" @swiperClick="swiperClick" image="courseImg" title="courseName"></lg-swiper>
|
|
|
+ <u-empty text="暂无内容" mode="data" v-else></u-empty>
|
|
|
</template>
|
|
|
</u-card>
|
|
|
<u-card padding="30" margin="0rpx 0rpx 30rpx" border-radius="20"
|
|
@@ -37,7 +38,7 @@
|
|
|
<u-section title="研究报告" sub-title="查看更多" sub-color="#000000"></u-section>
|
|
|
</template>
|
|
|
<template v-slot:body>
|
|
|
- <view>
|
|
|
+ <view v-if="reportList.length!=0">
|
|
|
<view v-for="(data,index) in reportList" :key="index" class="u-body-item u-flex u-p-t-0 "
|
|
|
style="align-items: inherit;">
|
|
|
<image :src="data.imgUrl" mode="aspectFill"></image>
|
|
@@ -59,6 +60,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <u-empty text="暂无内容" mode="data" v-else></u-empty>
|
|
|
</template>
|
|
|
</u-card>
|
|
|
</view>
|
|
@@ -79,12 +81,18 @@
|
|
|
} from 'vue'
|
|
|
import {
|
|
|
onReady,
|
|
|
- onLoad
|
|
|
+ onLoad,
|
|
|
+ onShow
|
|
|
} from '@dcloudio/uni-app'
|
|
|
import {
|
|
|
useAuthStore
|
|
|
} from '@/store/authStore'
|
|
|
import { count } from '@/api/chat.js'
|
|
|
+ import {
|
|
|
+ homeCourseList,
|
|
|
+ homeReportList,
|
|
|
+ homeSetting
|
|
|
+ } from '@/api/home.js'
|
|
|
const authStore = useAuthStore()
|
|
|
// 屏幕状态栏高度
|
|
|
const statusBarHeight = ref(0)
|
|
@@ -258,16 +266,23 @@
|
|
|
const swiperClick = (data) => {
|
|
|
console.log(data, "课程预告数据")
|
|
|
}
|
|
|
- onReady(() => {
|
|
|
- uni.getSystemInfo({
|
|
|
- success(e) {
|
|
|
- statusBarHeight.value = e.statusBarHeight;
|
|
|
- let custom = uni.getMenuButtonBoundingClientRect();
|
|
|
- navBarHeight.value = custom.height + (custom.top - e.statusBarHeight) * 2;
|
|
|
+
|
|
|
+ function init() {
|
|
|
+ homeCourseList().then(res=>{
|
|
|
+ if(res?.data){
|
|
|
+ courseList.value = res.data
|
|
|
}
|
|
|
})
|
|
|
- })
|
|
|
- onLoad(() => {
|
|
|
+ homeReportList().then(res=>{
|
|
|
+ if(res?.data){
|
|
|
+ reportList.value = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // homeSetting().then(res=>{
|
|
|
+ // console.log(res)
|
|
|
+ // })
|
|
|
+ }
|
|
|
+ function getCharCount(){
|
|
|
count().then(res => {
|
|
|
if (res && res.message === 'success') {
|
|
|
uni.setTabBarBadge({ //显示数字
|
|
@@ -276,6 +291,23 @@
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
+ }
|
|
|
+ onReady(() => {
|
|
|
+ uni.getSystemInfo({
|
|
|
+ success(e) {
|
|
|
+ statusBarHeight.value = e.statusBarHeight;
|
|
|
+ let custom = uni.getMenuButtonBoundingClientRect();
|
|
|
+ navBarHeight.value = custom.height + (custom.top - e.statusBarHeight) * 2;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ onLoad(() => {
|
|
|
+ init()
|
|
|
+ })
|
|
|
+ onShow(()=>{
|
|
|
+ if(isLogin){
|
|
|
+ getCharCount()
|
|
|
+ }
|
|
|
})
|
|
|
</script>
|
|
|
|