|
@@ -91,16 +91,17 @@
|
|
import {
|
|
import {
|
|
homeCourseList,
|
|
homeCourseList,
|
|
homeReportList,
|
|
homeReportList,
|
|
- homeSetting
|
|
|
|
|
|
+ homeSetting,
|
|
|
|
+ homeSwiperList
|
|
} from '@/api/home.js'
|
|
} from '@/api/home.js'
|
|
|
|
+ import { me } from '@/api/user.js'
|
|
const authStore = useAuthStore()
|
|
const authStore = useAuthStore()
|
|
// 屏幕状态栏高度
|
|
// 屏幕状态栏高度
|
|
const statusBarHeight = ref(0)
|
|
const statusBarHeight = ref(0)
|
|
// 顶部导航栏高度
|
|
// 顶部导航栏高度
|
|
const navBarHeight = ref(0)
|
|
const navBarHeight = ref(0)
|
|
// 是否登录
|
|
// 是否登录
|
|
- const isLogin = authStore.isAuthenticated;
|
|
|
|
-
|
|
|
|
|
|
+
|
|
const loginModal = ref(false)
|
|
const loginModal = ref(false)
|
|
// 是否为会员,从缓存里拿取用户信息
|
|
// 是否为会员,从缓存里拿取用户信息
|
|
// const userInfo = uni.getStorageSync("userinfo") || {}
|
|
// const userInfo = uni.getStorageSync("userinfo") || {}
|
|
@@ -267,7 +268,18 @@
|
|
console.log(data, "课程预告数据")
|
|
console.log(data, "课程预告数据")
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function initUser(){
|
|
|
|
+ me().then(res=>{
|
|
|
|
+ if(res?.data){
|
|
|
|
+ authStore.setUserInfo(res.data);
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
function init() {
|
|
function init() {
|
|
|
|
+ homeSwiperList().then(res=>{
|
|
|
|
+ console.log("轮播图", res)
|
|
|
|
+ })
|
|
homeCourseList().then(res=>{
|
|
homeCourseList().then(res=>{
|
|
// console.log(1000, res.data)
|
|
// console.log(1000, res.data)
|
|
if(res?.data){
|
|
if(res?.data){
|
|
@@ -305,10 +317,18 @@
|
|
})
|
|
})
|
|
onLoad(() => {
|
|
onLoad(() => {
|
|
init()
|
|
init()
|
|
|
|
+ // initUser()
|
|
})
|
|
})
|
|
onShow(()=>{
|
|
onShow(()=>{
|
|
|
|
+ const isLogin = authStore.isAuthenticated;
|
|
|
|
+ const isUserInfo = authStore.isUserInfo;
|
|
if(isLogin){
|
|
if(isLogin){
|
|
|
|
+ // 登录后才请求消息数量
|
|
getCharCount()
|
|
getCharCount()
|
|
|
|
+ // 没有用户信息就加载一边
|
|
|
|
+ if(!isUserInfo){
|
|
|
|
+ initUser();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|