|
@@ -2,13 +2,14 @@
|
|
|
<view class="container">
|
|
|
<u-navbar :is-back="false" title="" :background="{ background: '#f7f7f7' }" :border-bottom="false">
|
|
|
<view class="slot-wrap">
|
|
|
- <image src="https://sylwt.top/api/visitor/resources/image?name=/ydl/menber-center/login-icon.png" mode="aspectFit" style="width: 300rpx;"></image>
|
|
|
+ <image src="https://sylwt.top/api/visitor/resources/image?name=/ydl/menber-center/login-icon.png"
|
|
|
+ mode="aspectFit" style="width: 300rpx;"></image>
|
|
|
</view>
|
|
|
</u-navbar>
|
|
|
<view class="page-content">
|
|
|
<swiper class="swiper" circular indicator-dots style="border-radius: 20rpx;overflow: hidden;height: 200px">
|
|
|
<swiper-item v-for="(data, index) in swiperList" style="width: 100%;height: 100%;" :key="index">
|
|
|
- <view class="swiper-item" style="width: 100%;height: 100%;">
|
|
|
+ <view class="swiper-item" style="width: 100%;height: 100%;" @click="itemClick(data)">
|
|
|
<image :src="data.imgUrl" mode="aspectFill" style="width: 100%;height: 100%;"></image>
|
|
|
</view>
|
|
|
</swiper-item>
|
|
@@ -16,7 +17,9 @@
|
|
|
<u-grid :col="4" :border="false" style="margin: 10rpx 0 ;">
|
|
|
<template v-for="(item,index) in navList" :key="index">
|
|
|
<u-grid-item bg-color="none" @click="jumpToPage(item)">
|
|
|
- <image :src="`https://sylwt.top/api/visitor/resources/image?name=/ydl/menber-center/index-icon/${item.image}.png`" style="height: 70rpx;width: 70rpx;">
|
|
|
+ <image
|
|
|
+ :src="`https://sylwt.top/api/visitor/resources/image?name=/ydl/menber-center/index-icon/${item.image}.png`"
|
|
|
+ style="height: 70rpx;width: 70rpx;">
|
|
|
</image>
|
|
|
<view class="grid-text">{{item.title}}</view>
|
|
|
</u-grid-item>
|
|
@@ -28,7 +31,10 @@
|
|
|
<u-section title="课程预告" sub-title="查看更多" sub-color="#000000"></u-section>
|
|
|
</template>
|
|
|
<template v-slot:body>
|
|
|
- <lg-swiper v-if="courseList.length!=0" :sildeItems="courseList" @swiperClick="swiperClick" image="courseImg" title="courseName"></lg-swiper>
|
|
|
+ <lg-swiper v-if="courseList.length!=0"
|
|
|
+ :sildeItems="courseList"
|
|
|
+ @swiperClick="swiperClick"
|
|
|
+ image="courseImg" title="courseName"></lg-swiper>
|
|
|
<u-empty text="暂无内容" mode="data" v-else></u-empty>
|
|
|
</template>
|
|
|
</u-card>
|
|
@@ -46,14 +52,15 @@
|
|
|
<view class="item-content">
|
|
|
<text class="item-content-title text-ellipsis">{{data.title}}</text>
|
|
|
<text class="item-content-type">{{data.type}}</text>
|
|
|
- <text class="item-content-price" v-if="!data.memberFree">¥{{data.price}}元</text>
|
|
|
+ <text class="item-content-price"
|
|
|
+ v-if="data.viewMode==='3'">¥{{isMember?data.priceMember:data.price}}元</text>
|
|
|
</view>
|
|
|
<view class="item-button">
|
|
|
- <view v-if="!data.memberFree && data.hasBuy" class="item-button-yiGouMai">已购买
|
|
|
+ <view v-if="data.viewMode==='3' && data.hasBuy" class="item-button-yiGouMai">已购买
|
|
|
</view>
|
|
|
- <view v-else-if="!data.memberFree && !data.hasBuy" class="item-button-goumai">
|
|
|
+ <view v-else-if="data.viewMode==='3' && !data.hasBuy" class="item-button-goumai">
|
|
|
点击购买</view>
|
|
|
- <view v-else-if="data.memberFree" class="item-button-huiyuan">
|
|
|
+ <view v-else-if="data.viewMode==='2'" class="item-button-huiyuan">
|
|
|
会员免费
|
|
|
</view>
|
|
|
</view>
|
|
@@ -87,25 +94,33 @@
|
|
|
import {
|
|
|
useAuthStore
|
|
|
} from '@/store/authStore'
|
|
|
- import { count } from '@/api/chat.js'
|
|
|
- import {
|
|
|
+ import {
|
|
|
+ count
|
|
|
+ } from '@/api/chat.js'
|
|
|
+ import {
|
|
|
homeCourseList,
|
|
|
homeReportList,
|
|
|
homeSetting,
|
|
|
homeSwiperList
|
|
|
} from '@/api/home.js'
|
|
|
- import { me } from '@/api/user.js'
|
|
|
+ import {
|
|
|
+ me
|
|
|
+ } from '@/api/user.js'
|
|
|
const authStore = useAuthStore()
|
|
|
// 屏幕状态栏高度
|
|
|
const statusBarHeight = ref(0)
|
|
|
// 顶部导航栏高度
|
|
|
const navBarHeight = ref(0)
|
|
|
// 是否登录
|
|
|
-
|
|
|
+
|
|
|
const loginModal = ref(false)
|
|
|
// 是否为会员,从缓存里拿取用户信息
|
|
|
// const userInfo = uni.getStorageSync("userinfo") || {}
|
|
|
- // const isMember = userInfo?.isMember || false
|
|
|
+ const isMemberMap = {
|
|
|
+ 0: true,
|
|
|
+ 1: false
|
|
|
+ }
|
|
|
+ const isMember = ref(false)
|
|
|
|
|
|
// 首页-轮播图
|
|
|
const swiperList = ref([{
|
|
@@ -253,42 +268,48 @@
|
|
|
// 确认跳转至登录
|
|
|
const confirmModal = () => {
|
|
|
uni.navigateTo({
|
|
|
- url: "/pages/login/login"
|
|
|
+ url: "/pages/initial/initial"
|
|
|
})
|
|
|
}
|
|
|
const toPage = () => {
|
|
|
if (!authStore.isAuthenticated) {
|
|
|
uni.navigateTo({
|
|
|
- url: "/pages/login/login"
|
|
|
+ url: "/pages/initial/initial"
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
+ const itemClick = (data) =>{
|
|
|
+ console.log("swiper", data)
|
|
|
+ }
|
|
|
const swiperClick = (data) => {
|
|
|
console.log(data, "课程预告数据")
|
|
|
}
|
|
|
-
|
|
|
- function initUser(){
|
|
|
- me().then(res=>{
|
|
|
- if(res?.data){
|
|
|
+
|
|
|
+ function initUser() {
|
|
|
+ me().then(res => {
|
|
|
+ if (res?.data) {
|
|
|
authStore.setUserInfo(res.data);
|
|
|
+ isMember.value = res.data.isMember;
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
function init() {
|
|
|
- homeSwiperList().then(res=>{
|
|
|
- console.log("轮播图", res)
|
|
|
+ homeSwiperList().then(res => {
|
|
|
+ if (res?.data) {
|
|
|
+ swiperList.value = res.data
|
|
|
+ }
|
|
|
})
|
|
|
- homeCourseList().then(res=>{
|
|
|
+ homeCourseList().then(res => {
|
|
|
// console.log(1000, res.data)
|
|
|
- if(res?.data){
|
|
|
+ if (res?.data) {
|
|
|
courseList.value = res.data
|
|
|
console.log(courseList.value)
|
|
|
}
|
|
|
})
|
|
|
- homeReportList().then(res=>{
|
|
|
- if(res?.data){
|
|
|
+ homeReportList().then(res => {
|
|
|
+ if (res?.data) {
|
|
|
reportList.value = res.data
|
|
|
}
|
|
|
})
|
|
@@ -296,7 +317,8 @@
|
|
|
// console.log(res)
|
|
|
// })
|
|
|
}
|
|
|
- function getCharCount(){
|
|
|
+
|
|
|
+ function getCharCount() {
|
|
|
count().then(res => {
|
|
|
if (res && res.message === 'success') {
|
|
|
uni.setTabBarBadge({ //显示数字
|
|
@@ -319,15 +341,17 @@
|
|
|
init()
|
|
|
// initUser()
|
|
|
})
|
|
|
- onShow(()=>{
|
|
|
+ onShow(() => {
|
|
|
const isLogin = authStore.isAuthenticated;
|
|
|
const isUserInfo = authStore.isUserInfo;
|
|
|
- if(isLogin){
|
|
|
+ if (isLogin) {
|
|
|
// 登录后才请求消息数量
|
|
|
getCharCount()
|
|
|
// 没有用户信息就加载一边
|
|
|
- if(!isUserInfo){
|
|
|
+ if (!isUserInfo) {
|
|
|
initUser();
|
|
|
+ } else {
|
|
|
+ isMember.value = authStore.userInfo.isMember;
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -360,11 +384,11 @@
|
|
|
color: #333;
|
|
|
margin-bottom: 30rpx;
|
|
|
height: 140rpx;
|
|
|
-
|
|
|
+
|
|
|
&:last-of-type {
|
|
|
margin-bottom: 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.u-body-item-content {
|
|
|
position: relative;
|
|
|
flex: 1;
|
|
@@ -380,9 +404,11 @@
|
|
|
margin: 10rpx;
|
|
|
color: $uni-text-color;
|
|
|
}
|
|
|
- .item-content .item-content-title{
|
|
|
+
|
|
|
+ .item-content .item-content-title {
|
|
|
font-size: $uni-title-font-size-2;
|
|
|
}
|
|
|
+
|
|
|
.item-content .item-content-price {
|
|
|
color: $uni-color-error;
|
|
|
// font-weight: bold;
|
|
@@ -507,4 +533,4 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|