<template>
	<view class="container">
		<!-- 禁用弹窗 -->
		 <restrictedTip ref="restrictedTip"/>
		<view class="homeHeader">
			<view class="top">
				<view class="one">
					<search
					   ref="searchRef"
						:isSearch="1" 
						:userId="userId"
						:initialQuery.sync="searchQuery"
						@send="getCourseList"
						v-if="showSearch"
					></search>
				</view>
				<view class="two">
					<text class="iconfont icon-gongsi" @click="getIntroduce('center')"></text> 
				</view>
			</view>
			<view class="bottom">
				<view class="content">
					<view class="featureContent">
						<!-- 顶部快捷菜单 -->
						<view class="nav_wrapper">
							<view class="nav_content" v-for="featureItem in featureLists" :key="featureItem.key"
								@click="featureSelect(featureItem)">
								<view class="imgbox">
									<view class="iconfont iconSize" :class="`${featureItem.icon}`"></view>
								</view>
								<view style="font-size: 26rpx;color: #fff;">{{featureItem.name}}</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- <view class="carouselBox">
			<view class="swiperBox">
				<swiper
					style="height:250rpx;"
					circular 
					:indicator-dots="true" 
					:autoplay="true" 
					:interval="3000"
					:duration="1000"
				>
					<swiper-item v-for="(bannerItem,index) in cffpUserInfo.fileUploadItemList" :key="index">
						<view class="swiperItemBox">
							<view class="swiperBtn" @click="jumpUrl(bannerItem.destinationAddress)">
								立即查看
							</view>
							<image class="swiperImg" :src="bannerItem.filePath" mode="widthFix" ></image>
						</view>
					</swiper-item>
				</swiper>
			</view>
			
		</view> -->
		<!-- 产品区域 -->
		<view class="productContainer">
	
			<view class="productList" v-if="cffpCourseInfos.length>0">
			 <courselist 
				:showFlag="false" 
				:cffpCourseInfos="cffpCourseInfos" 
				@changeCourseClassify="changeCourseClassify"
				ref="courselist"
				pageSource="index"
			 ></courselist>
			  
			</view>
			<view class="productEmpty" v-else>
				暂无数据
			</view>
		</view>
		<!-- 使用封装后的弹窗组件 -->
		    <join-popup 
		      ref="joinPopup"
		      @confirm="gotoApply"
		    ></join-popup>
		
		<!-- <tabBar :currentPage="currentPage"></tabBar> -->
		
	</view>
	<uni-popup ref="popup" type="top" background-color="#fff">
		<view class="descriptionBox">
			<view class="popupClose">
				<text class="iconfont icon-guanbi" @click="$refs.popup.close()"></text> 
			</view>
			<view class="imageBox">
				<image src="@/static/suplogo.png" mode="widthFix" style="width: 120rpx !important;"></image>
			</view>
			<view class="description">
				{{cffpUserInfo.description}}
			</view>
		</view>
		
	</uni-popup>
	<uni-popup ref="applyPopup" type="center" background-color="#fff">
		<view class="applyBox">
			<view style="text-align: right;" @click="$refs.applyPopup.close()">
				<view class="iconfont icon-chahao" ></view>
			</view>
			<view class="applyCon">
				<view style="text-align: center;" >
					<view class="iconfont icon-dianzan" ></view>
				</view>
				
				<view class="title">
					您已加盟为银盾家办合伙人
				</view>
				<view class="applycontent">
					<view class="subtit">
						晋升下一级目标
					</view>
					<view class="" v-if="partnerStatistic.reachPeopleNum>0">
						<view class="">
							<text class="iconfont icon-a-tuandui3 leftIcon" ></text>
							<text>团队有效人数</text>
							
							<text 
								v-if="partnerStatistic.totalPeopleNum<partnerStatistic.reachPeopleNum" 
								class="iconfont icon-weiwancheng rightIcon" 
							></text>
							<text
								v-else
								class="iconfont icon-duihao2 rightIcon" 
							></text>
						</view>
						<view class="num">
							<text  >{{partnerStatistic.totalPeopleNum}} / {{partnerStatistic.reachPeopleNum}}</text>
							<text v-if="partnerStatistic.peopleNum>0">（相差{{partnerStatistic.peopleNum}}人）</text>
						</view>
					</view>
					<view class="" v-if="partnerStatistic.reachSingeSaleNum>0">
						<view class="" >
							<text class="iconfont icon-xiaoshoue leftIcon" ></text>
							<text>个人标准销售累计金额</text>
							<!-- <text class="iconfont icon-duihao2 rightIcon" ></text> -->
							<text
								v-if="partnerStatistic.totalSingeSaleNum<partnerStatistic.reachSingeSaleNum" 
								class="iconfont icon-weiwancheng rightIcon" 
							></text>
							<text
								v-else
								class="iconfont icon-duihao2 rightIcon" 
							></text>
						</view>
						<view class="num">
							<text  >{{partnerStatistic.totalSingeSaleNum.toFixed(2)}}元 / {{partnerStatistic.reachSingeSaleNum.toFixed(2)}}元</text>
						</view>
					</view>
					<view class="" v-if="partnerStatistic.reachSaleNum>0">
						<view class="">
							<text class="iconfont icon-ddailirenshu leftIcon" ></text>
							<text>团队标准销售累计金额</text>
							<!-- <text class="iconfont icon-weiwancheng rightIcon" ></text> -->
							
							<text 
								v-if="partnerStatistic.totalSaleNum<partnerStatistic.reachSaleNum" 
								class="iconfont icon-weiwancheng rightIcon" 
							></text>
							<text
								v-else
								class="iconfont icon-duihao2 rightIcon" 
							></text>
						</view>
						<view class="num">
							<text >{{partnerStatistic.totalSaleNum.toFixed(2)}}元 / {{partnerStatistic.reachSaleNum.toFixed(2)}}元</text>
							<text v-if="partnerStatistic.saleNum>0">（相差{{partnerStatistic.saleNum.toFixed(2)}}元）</text>
						</view>
					</view>
					
				</view>
				
			</view>
		</view>
	</uni-popup>
	<!-- 不是新锐合伙人提示 -->
	  <partner-tip-popup 
		ref="PartnerTipPopup"
		content="您还未升级为新锐合伙人，团队成员销售成功您不能拿到收益。购买产品升级为新锐合伙人 "
		joinText="暂不升级，继续邀请"
		continueText="购买产品，立即升级"
		btnType="vertical"
		:tipIcon="true"
		@join="jumpPage('2')"
		@continue="jumpPage('1')"
	  />
	 
</template>

<script>
	import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
	import dataHandling from "@/util/dataHandling";
	import courselist from '@/pages/courselist/courselist.vue';
	import api from "../../api/api";
	import tabBar from '../../components/tabBar/tabBar.vue';
	import carousel from '@/components/carousel/carousel.vue';
	import search from '@/components/search/search.vue';
	import courseItem from "@/components/courseItem/courseItem.vue";
	import {companyInfo,baseURL,shareURL} from "@/environments/environment";
	import JoinPopup from '@/components/commonPopup/JoinPopup.vue';
	import PartnerTipPopup from "@/components/commonPopup/PartnerTipPopup.vue";
	import {hshare} from '@/util/fiveshare';
	import restrictedTip from '@/components/commonPopup/restrictedTip.vue';
	import wx from 'weixin-js-sdk'
	export default {
		data() {
			return {
				productType: 4,
				partnerStatistic:{}, //申请加盟统计
				 showSearch: true,
				searchQuery: '',
				companyFullName : companyInfo.companyFullName,
				cffpCourseInfos: [],
				featureLists: [
					{
						key: '02',
						name: '申请加盟',
						icon: 'icon-hezuo',
						link: '/myPackageA/applyFranchise/applyFranchise',
						isOpen: true,
						isApply:true
					},
					{
						key: '07',
						name: '分享产品',
						icon: 'icon-zhuanfa',
						link: '/pages/courselist/courselist',
						isOpen: true,
					},
					
					{
						key: '04',
						name: '邀请加盟',
						icon: 'icon-yaoqing',
						link: '/pages/inviteJoin/inviteJoin',
						isOpen: true,
						isJoin: true
					},
					
				],
				cffpUserInfo: {
					address: '',
					description: '',
					fileUploadItemList: [],
					logo: '',
					name: '',
					type: '' //类型1,区域中心，2工作室
				},
				tagIds: 123,
				currentPage: 'index',
				carouselList: [],
				userId: uni.getStorageSync('cffp_userId'),
				shareId: null,
				kefu: '../../static/kefu.png',
				queryName: '',
				loginType : uni.getStorageSync('loginType'),
				userInfo:{} ,//用户信息,
				productItem:{},
				dataToken:'',
			}
		},
		components: {
			courselist,
			tabBar,
			carousel,
			search,
			courseItem,
			JoinPopup,
			PartnerTipPopup,
			restrictedTip,
			
		},
		
		onShow() {
			if(uni.getStorageSync('dataToken')){
				this.dataToken = uni.getStorageSync('dataToken')
			}
			this.loginType = uni.getStorageSync('loginType')
			
			this.init();
			this.showSearch = false;
			  this.$nextTick(() => {
			    this.showSearch = true;
			    this.searchQuery = '';
			  });
			  if(uni.getStorageSync('cffp_userInfo')){
			  	this.userInfo = JSON.parse(uni.getStorageSync('cffp_userInfo'))
			  }
			  if(uni.getStorageSync('cffp_userId')){
			  	this.userId = uni.getStorageSync('cffp_userId')
			  }
			 if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') {
			 	let shareInfo = {
			 		title: '成为银盾合伙人，分享商品赚不停',
			 		desc:  `资源+伙伴，共赢未来！`,
			 		link: `${shareURL}/pages/index/index?miniShare=1`, //分享链接
			 		imgUrl: `${shareURL}/myPackageA/static/images/logo3.png`, //图片
			 		commonId:uni.getStorageSync('cffp_userId') || Date.now(),
			 		sharePage:'index'//分享出去得页面
			 	}
			 	wx.miniProgram.postMessage({
			 		data: {
			 			type: 'share',
			 			shareData: JSON.stringify(shareInfo)
			 		}
			 
			 	})
			 	return
			 }
		},
		onHide() {
			this.$nextTick(()=>{
				this.$refs.courselist.$refs.sharePosterPop.closeDropdown()
			})
		},
		onLoad(options) {
			
			if(options.sharePoster){
				dataHandling.pocessTracking(
				  '进入',
				  `用户通过分享海报进入系统，邀请码为${options.invitationCode},邀请人userId为${options.inviteUserId}`,
				  '进入',
				  2,
				  '首页',
				  'pages/index/index'
				)
				let sharePosterObj = {invitationCode:options.invitationCode,inviteUserId:options.inviteUserId,sharePoster:1}
				uni.setStorageSync('sharePosterObj',sharePosterObj)
			}
			//如果用户在其他的地方快捷登录,没有返回到首页,执行此监听方法
			uni.$on('loginUpdate',()=>{
				this.queryAreaCenterInfo();
			})
		},
		
		beforeDestroy() {
			this.dataToken = ''
		  // 清除事件监听
		  uni.$off('loginUpdate', this.queryAreaCenterInfo);
		  
		},
		methods: {
			 // 初始化首页分享   注意sdk时序问题。传递的url一定要是当前页面的url window.location.href.split('#')[0]
			 // 不是window.location.href.split('#')[0]很可能不成功
			    initShare() {
					// #ifdef H5
						initJssdkShare(() => {
						  setWechatShare();
						}, window.location.href.split('#')[0]);
					// #endif
					
			    },
			jumpPage(type){
				
				if(type=='1'){
					uni.navigateTo({
						url:'/pages/inviteJoin/inviteJoin'
					})
				}else {
					uni.navigateTo({
						url: `/pages/courseDetail/courseDetail?fileId=${this.productItem.fileId}`
					});
				}
			},	
			changeCourseClassify(val){
				this.productType = val
			},
			
			queryInfo() {
				api.queryInfo({userId:uni.getStorageSync('cffp_userId')}).then(res=>{
					// 保存用户得个人信息
					if (res['success']) {
						delete res.data.commonResult
						const cffp_userInfo = {
							...res.data
						}
						this.userInfo = cffp_userInfo
						uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo));
						uni.setStorageSync('user_mobile', res.data.mobile)
						if(cffp_userInfo.partnerType){
							this.featureLists = [{key: '00',name: '成交订单',icon:'icon-dingdan',link: '/pages/saleCourseLists/saleCourseLists',isOpen: true,enName:'order'},
							{key: '01',name: '佣金',icon: 'icon-yongjin',link: '/pages/pointsExchange/pointsExchange',isOpen: true,isJoin: true},
							{key: '07',name: '分享产品',icon: 'icon-zhuanfa',link: '/pages/courselist/courselist',isOpen: true},
							{key: '04',name: '邀请加盟',icon: 'icon-yaoqing',link: '/pages/inviteJoin/inviteJoin',isOpen: true,isJoin: true}];
						}else {
							this.featureLists =[
								{
									key: '02',
									name: '申请加盟',
									icon: 'icon-hezuo',
									link: '/myPackageA/applyFranchise/applyFranchise',
									isOpen: true,
									isApply:true
								},
								{
									key: '07',
									name: '分享产品',
									icon: 'icon-zhuanfa',
									link: '/pages/courselist/courselist',
									isOpen: true,
								},
								
								{
									key: '04',
									name: '邀请加盟',
									icon: 'icon-yaoqing',
									link: '/pages/inviteJoin/inviteJoin',
									isOpen: true,
									isJoin: true
								},
								
							]
						}
					}
					
				})
			},
			getPartnerStatistic(){
				if(this.userId){
					api.partnerStatisticsGrade({userId:uni.getStorageSync('cffp_userId')}).then((res)=>{
						if(res['success']){
							this.partnerStatistic = res['data']
							for (let key in this.partnerStatistic) {
								if(key!='peopleNum' && key!='reachPeopleNum'&& key!='totalPeopleNum'){
									if(key){
										this.partnerStatistic[key] = Number(this.partnerStatistic[key].toFixed(2))
									}
								}
							}
							this.$refs.applyPopup.open()
						}else {
							uni.showToast({
								title: res['message'],
								duration: 2000,
								icon: 'none'					
							})
						}
					})
				}
			},
			gotoApply(){
				dataHandling.pocessTracking(
				  '点击',
				  `用户点击了首页“去加盟为合伙人”弹窗按钮`,
				  '点击',
				  2,
				  '首页',
				  'pages/index/index'
				)
				uni.navigateTo({ 
						url: '/myPackageA/applyFranchise/applyFranchise'
					})
				this.$refs.joinPopup.close()
				
			},
			 jumpUrl(url) {
			 	if (!url) {
			 		return false
			 	} else {
			 		const match = url.match(/fileId=([^&]*)/);
			 		const fileId = match ? match[1] : null;
			 		uni.navigateTo({
			 				url: `/pages/courseDetail/courseDetail?fileId=${fileId}`
			 			})
			 	}
			 },
			init() {
				// 从家办商城跳转过来
				if(this.dataToken){
					this.reLogin()
					return
				}
				let loginType = uni.getStorageSync('loginType')
				if(loginType == 'codelogin'){
					 this.querySystemMessage()
					 this.queryInfo()
					 this.courseList()
					 this.initShare();
					 this.getOneProduct()
					 this.queryAreaCenterInfo()
					 return
				}else {
					// 未登录
					this.featureLists =[
						{
							key: '02',
							name: '申请加盟',
							icon: 'icon-hezuo',
							link: '/myPackageA/applyFranchise/applyFranchise',
							isOpen: true,
							isApply:true
						},
						{
							key: '07',
							name: '分享产品',
							icon: 'icon-zhuanfa',
							link: '/pages/courselist/courselist',
							isOpen: true,
						},
						
						{
							key: '04',
							name: '邀请加盟',
							icon: 'icon-yaoqing',
							link: '/pages/inviteJoin/inviteJoin',
							isOpen: true,
							isJoin: true
						},
						
					]
					uni.removeTabBarBadge({ index: 3 });
					api.loginVerification({
						"loginType": 1,
					}).then((res) => {
						if (res['success']) {
							this.userId = String(res['data']['userId']);
							uni.setStorageSync('isLogin', '1');
							uni.setStorageSync('cffp_userId', this.userId);
							uni.setStorageSync('loginType', 'visitor');
							uni.setStorageSync('uni-token', res.data['token']);
							this.courseList();
							this.getOneProduct()
							this.initShare();
							this.queryAreaCenterInfo()
						} else {
							uni.showToast({
								title: res['message'],
								duration: 2000,
								icon: 'none'
							})
						}
					})
				}
			},	
			querySystemMessage() {
			   api.querySystemMessage({systemType:1,userId:uni.getStorageSync('cffp_userId')}).then(res => {
			     if (res['success']&& res['data']['dataList']&& res['data']['dataList'].length>0) {
			       
				 let total =  res['data']['dataList'].filter(item=>{
					 
					  return item.isRead == 0
				   })
				   if(total.length>0){
					  uni.setTabBarBadge({
					         index: 3,
					         text: total.length.toString()
					       }); 
				   }else {
					uni.removeTabBarBadge({ index: 3 });
				  }
				   
			     }else {
					 uni.removeTabBarBadge({ index: 3 });
				 }
			   });
			},
			goDetail(item) {
				dataHandling.pocessTracking(
				  '点击',
				  `用户查看首页产品详情`,
				  '点击',
				  2,
				  '首页',
				  'pages/index/index'
				)
				uni.navigateTo({
					url: `/pages/courseDetail/courseDetail?fileId=${item.fileId}&partnerType=${this.cffpUserInfo.partnerType}`
				});
			},
			getCourseList(res){
				 this.queryName = res.trim();
				 this.courseList()
				 dataHandling.pocessTracking(
				   '搜索',
				   `用户搜索产品`,
				   '点击',
				   2,
				   '首页',
				   'pages/index/index'
				 )
			},
			courseList() {
				const param = {
					queryName: this.queryName,
					courseClassify: this.productType 
				}
				api.courseList(param).then(res => {
					if (res['success']) {
						this.cffpCourseInfos = res['data']['data'];
						if(this.cffpCourseInfos.length>0){
							this.cffpCourseInfos.forEach(item=>{
								item.coursePrice =Number(item.coursePrice).toFixed(2) || '0.00'
								if(item.productCode&&item.productCode=='ZNTJ'){
									this.productItem = item
									uni.setStorageSync('productItem',this.productItem );
								}
							})
						}
					}
				})
			},
			tokefu() {
				let url = 'http://q.url.cn/abkzV9?_type=wpa&qidian=true' // URL是要跳转的外部地址 作为参数
				// #ifdef APP-PLUS
				uni.navigateTo({
					url: '/components/webview?url=' + url
					// page.json定义的路径 传url 到webview界面去接收 实现跳转
				})
				// #endif
				// #ifdef H5
				window.location.href = url;
				// #endif
			},
			// 顶部菜单跳转
			featureSelect(featureItem) {
				if(uni.getStorageSync('cffp_userInfo')){
					this.userInfo = JSON.parse(uni.getStorageSync('cffp_userInfo'))
				}
				if(uni.getStorageSync('loginType')){
					this.loginType = uni.getStorageSync('loginType')
				}
				if(featureItem.isApply && (!this.loginType||this.loginType=='visitor')){
					dataHandling.pocessTracking(
					  '点击',
					  `用户未登录状态下在首页点击申请加盟`,
					  '点击',
					  2,
					  '首页',
					  'pages/index/index'
					) 
					
					uni.navigateTo({url: `${featureItem.link}`});
					
					return
				}
				// 未登录状态，不允许未登录状态跳转的，直接去登录页
				if(!this.loginType||this.loginType=='visitor'){
					if (featureItem.key == '07') {
						uni.switchTab({
							url: featureItem.link
						})
					}else {
						uni.navigateTo({
							url:'/myPackageA/login/login'
						})
					}
					return
				}
				if(featureItem.isApply&& this.userInfo.partnerType){
					dataHandling.pocessTracking(
					  '点击',
					  `用户在首页点击申请加盟查看团队等级差`,
					  '点击',
					  2,
					  '首页',
					  'pages/index/index'
					)
					this.getPartnerStatistic()
					return
				}
				//当为见习合伙人的时候，弹出框提示
				if(featureItem.key == '04'&& this.userInfo.levelCode == 'P1'&& this.userInfo.userIsActive == 1){
					this.$refs.PartnerTipPopup.open()
					return
				}
				
				if (featureItem.key == '02') {
					if (this.cffpUserInfo.levelCode == 'C1' || this.cffpUserInfo.levelCode == 'C2' || this.cffpUserInfo
						.levelCode == 'C3') {
						uni.showToast({
							title: "您已是区域服务中心，无需申请加盟",
							duration: 2000,
							icon: 'none'
						});
						return false
					}
				}
				if ( this.userInfo.partnerType == null && featureItem.isJoin) {
					dataHandling.pocessTracking(
					  '点击',
					  `用户在首页未加盟时点击${featureItem.name}`,
					  '点击',
					  2,
					  '首页',
					  'pages/index/index'
					)
					this.$refs.joinPopup.open()
					return false
				} else if (featureItem.isOpen && featureItem.link) {
					if (featureItem.key == '07') {
						uni.switchTab({
							url: featureItem.link
						})
					} else {
						const urlObj = JSON.parse(JSON.stringify(featureItem))
						urlObj.link =urlObj.enName=='order'? `${urlObj.link}?partnerType=${this.cffpUserInfo.partnerType}`:urlObj.link
						console.log('url',urlObj.link);
						uni.navigateTo({
							url: urlObj.link
						})
					}
				} else {
					uni.showToast({
						title: '此功能暂未开放，敬请期待。',
						duration: 2000,
						icon: 'none'
					})
				}
			},
			// 获取轮播图
			queryAreaCenterInfo() {
				api.queryAreaCenterInfo({
					userId: uni.getStorageSync('cffp_userId'),
					companyType: `${companyInfo.companyType}`
				}).then((res) => {
					if (res['success']) {
						this.cffpUserInfo = res['data'];
						uni.setStorageSync('fileUploadItemCFFPList', this.cffpUserInfo['fileUploadItemCFFPList'])
						
					}
				})
			},
			getIntroduce(type) {
				this.type = type;
				// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
				this.$refs.popup.open(type)
				dataHandling.pocessTracking(
				  '查看',
				  `用户查看了公司简介`,
				  '点击',
				  2,
				  '首页',
				  'pages/index/index'
				)
			},
			jumpToAnnouncement() {
				uni.navigateTo({
					url: `../announcement/announcement`
				})
			},
			goToCourselist() {
				dataHandling.pocessTracking(
				  '点击',
				  `用户查看更多产品`,
				  '点击',
				  2,
				  '首页',
				  'pages/index/index'
				)
				uni.switchTab({
					url: '../../pages/courselist/courselist'
				})
			},
			
			getOneProduct() {
				api.courseList().then(res => {
					if (res['success']) {
						let result = res['data']['data'];
						if(result.length>0){
							result.forEach(item=>{
								if(item.productCode&&item.productCode=='ZNTJ'){
									this.productItem = item
									uni.setStorageSync('productItem',this.productItem );
								}
							})
						}
					}
				})
			},
			reLogin(){
				console.log('index调用');
					uni.showLoading({
					  title: '加载中...'
					});
					// 添加iOS平台检测
					  const isIOS = navigator.platform.match(/(iPhone|iPod|iPad)/i);
					const params = {
						loginType:'5',
						 authToken: this.dataToken,
						 loginType: '5',
						 visitorUuid:uni.getStorageSync('visitorUuid')?uni.getStorageSync('visitorUuid'):dataHandling.uuid()
					}
					api.loginVerification(params).then((res)=>{
						if(res['success']){
							uni.setStorageSync('isLogin','1');
							uni.setStorageSync('loginType','codelogin');
							uni.setStorageSync('cffp_userId', JSON.stringify(res.data.userId));
							uni.setStorageSync('uni-token', res.data['token']);
							this.userId = res.data.userId
							this.querySystemMessage()
							this.queryInfo()
							this.courseList()
							this.initShare();
							this.getOneProduct()
							this.queryAreaCenterInfo()
							this.dataToken = ''
							// uni.removeStorageSync('dataToken')
						}else{
							uni.showToast({
								title: res['message'],
								duration: 2000,
								icon: 'none',
							})
						}
					})
					uni.hideLoading()
				
			}
		},
		
	}
</script>

<style lang="scss" scoped>
	::v-deep .uni-popup .uni-popup__wrapper{
		 margin: 0 !important;
		 border-radius: 30rpx;
	 }
	.container {
		height: auto;
		overflow-y: auto; /* 关键属性 */
		-webkit-overflow-scrolling: touch; /* 优化移动端滚动 */
		background-color: rgba(235, 239, 247, 1);
		
		.homeHeader{
			box-sizing: border-box;
			width: 100%;
			background: linear-gradient(225deg, rgba(65, 69, 188, 1) 0%, rgba(29, 30, 125, 1) 100%);
			padding: 15rpx 30rpx;
			.top{
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: space-between;
				.one{
					width: 80%;
				}
				.two{
					.icon-gongsi{
						font-size: 40rpx;
						color: #fff;
					}
				}
			}
			.bottom{
				.content {
					
					overflow: hidden;
					position: relative;
					.featureContent {
						box-sizing: border-box;
						padding: 30rpx 0;
						.nav_wrapper {
							display: flex;
							align-items: center;
							justify-content: space-around;
							flex-wrap: wrap;
							width: 100%;
							box-sizing: border-box;
							.nav_content {
								display: flex;
								flex-direction: column;
								align-items: center;
								justify-content: center;
								flex: 0 0 20%;
								font-size: 14px;
								color: rgba(51, 51, 51, 1);
								image {
									max-width: 80%;
								}
								.imgbox{
									margin-bottom: 10rpx;
									.iconSize{
										font-size: 40rpx;
										color: #fff;
									}
								}
							}
						}
					}
				}
			}
		}
		.carouselBox{
			width: 100%;
			background-color: #fff;
			padding: 15rpx;
			box-sizing: border-box;
			overflow: hidden;
			.swiperBox{
				.swiperItemBox{
					position: relative;
					.swiperBtn{
						position: absolute;
						left: 10%;
						bottom: 20%;
						padding: 15rpx 30rpx;
						border-radius: 50rpx;
						z-index: 2;
						color: #fff;
						font-size: 26rpx;
						background: linear-gradient(180deg, rgba(111, 156, 255, 1) 0%, rgba(34, 96, 251, 1) 100%);
					}
					.swiperImg{
						width: 100%;
						height: 100%;
						border-radius: 50rpx;
					}
				}
				
			}
		}
		.productContainer {
		  background-color: #fff;
		  margin-top: 15rpx;
		  box-sizing: border-box;
		  margin-bottom: 100rpx;
		  
		  .productTitle {
		    border-bottom: 1rpx solid rgba(238, 238, 238, 1);
		    padding-bottom: 10rpx;
		    
		    .titleTxt {
		      padding: 15rpx 30rpx;
		      display: flex;
		      justify-content: space-between;
		      align-items: center;		
		    }
		    
		    .more {
		      font-size: 26rpx;
		      color: rgba(84, 84, 84, 1);
		      
		      .icon-youjiantou {
		        font-size: 26rpx;
		      }
		    }
		  }
		  
		  .productList {
		    width: 100%;
		    box-sizing: border-box;
		    
		    .productListBox {
		      padding: 30rpx;
		      display: grid;
		      /* 默认两列，固定宽度 */
		      grid-template-columns: repeat(auto-fill, minmax(300rpx, 1fr));
		      gap: 30rpx;
		      justify-content: center;
		      
		      .productListItem {
		        width: 100%;
		        max-width: 350rpx; /* 设置最大宽度 */
		        display: flex;
		        flex-direction: column;
		        overflow: hidden;
		        box-sizing: border-box;
		        margin: 0 auto; /* 居中显示 */
		        
		        .top {
		          width: 100%;
		          position: relative;
		          border-radius: 20rpx;
		          overflow: hidden;
		          
		          /* 确保图片容器有固定宽高比 */
		          &::before {
		            content: "";
		            display: block;
		            padding-top: 100%; /* 1:1 宽高比 */
		          }
		          
		          .productImg {
		            position: absolute;
		            top: 0;
		            left: 0;
		            width: 100%;
		            height: 100%;
		            object-fit: cover;
		            display: block;
		          }
		          .shareBtn{
		          	position: absolute;
		          	right: 0;
		          	top: 0;
		          	height: 50rpx;
					color: red;
					z-index: 1;
					background-color: #F43530;
					border-radius: 6rpx;
					padding: 0 10rpx;
					color: #fff;
					display: flex;
					flex-direction: row;
					align-items: center;
					justify-content: center;
		          }
		          .productDesBox {
					  box-sizing: border-box;
		            position: absolute;
		            left: 0;
		            bottom: 0;
		            width: 100%;
		            padding: 0  15rpx;
		            box-sizing: border-box;
		            background: rgba(0, 0, 0, 0.1);
		            border-radius: 0 0 20rpx 20rpx;
		            font-size: 24rpx;
		            color: #fff;
		            display: -webkit-box;
		            -webkit-line-clamp: 2;
		            -webkit-box-orient: vertical;
		            overflow: hidden;
		            text-overflow: ellipsis;
		            /* 关键修改：添加精确的高度计算 */
		            max-height: calc(2 * 1.4 * 24rpx); /* 2行 × 行高 × 字体大小 */
		            line-height: 1.5;
		            /* 确保在Firefox等浏览器也有效 */
		            display: -moz-box;
		            -moz-box-orient: vertical;
		            -moz-line-clamp: 2;
		          }
		        }
		        
		        .bottom {
		          width: 100%;
		          box-sizing: border-box;
		          padding: 10rpx 0;
		          
		          .one {
		            font-size: 27rpx;
		            margin-bottom: 5rpx;
		            display: -webkit-box;
		            -webkit-line-clamp: 1;
		            -webkit-box-orient: vertical;
		            overflow: hidden;
		            text-overflow: ellipsis;
		            white-space: nowrap;
		          }
		          
		          .two {
		            display: flex;
		            justify-content: space-between;
		            align-items: center;
		            
		            .price {
		              font-size: 28rpx;
		              color: rgba(32, 39, 155, 1);
		            }
		            
		            .num {
		              font-size: 24rpx;
		              color: rgba(166, 166, 166, 1);
		            }
		          }
		        }
		      }
		    }
		  }
		  
		  /* iPad竖屏和小屏幕平板 */
		  @media (min-width: 768px) and (max-width: 1023px) {
		    .productList .productListBox {
		      grid-template-columns: repeat(auto-fill, minmax(300rpx, 1fr));
		      gap: 30rpx;
		    }
		  }
		  
		  /* iPad横屏和大屏幕平板 */
		  @media (min-width: 1024px) and (max-width: 1279px) {
		    .productList .productListBox {
		      grid-template-columns: repeat(auto-fill, minmax(300rpx, 1fr));
		      gap: 30rpx;
		    }
		  }
		  
		  /* 电脑端 */
		  @media (min-width: 1280px) {
		    .productList .productListBox {
		      grid-template-columns: repeat(auto-fill, minmax(300rpx, 1fr));
		      gap: 30rpx;
		    }
		  }
		  
		  .productEmpty {
		    color: rgba(166, 166, 166, 1);
		    width: 100%;
		    display: flex;
		    align-items: center;
		    justify-content: center;
		    padding: 30rpx 0;
		    font-size: 28rpx;
		  }
		}
		.joinContent{
			width: 500rpx;
			// height: 300rpx;
			border-radius: 30rpx;
			background-color: #ffff;
			padding: 30rpx;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			flex-direction: column;
			.joinHeader{
				width: 60rpx;
				height: 60rpx;
				border-radius: 50%;
				background: rgba(54, 57, 169, 1);
				display: flex;
				align-items: center;
				justify-content: center;
				margin-bottom: 20rpx;
			}
			.joinCon{
				// padding: 20rpx 0;
				.one{
					font-size: 30rpx;
					color: rgba(38, 41, 44, 1);
					font-weight: 600;
					text-align: center;
				}
				.two{
					color: rgba(145, 144, 148, 1);
					font-size: 26rpx;
					text-align: center;
					margin-top: 10rpx;
					margin-bottom: 20rpx;
				}
			}
			.joinFotter{
				width: 100%;
				color: #fff;
				display: flex;
				align-items: center;
				justify-content: center;
				box-sizing: border-box;
				padding: 10rpx 0;
				background: rgba(54, 57, 169, 1);
				border-radius: 60rpx;
				font-size: 28rpx;
			}
		}
		

		.message {
			display: flex;
			align-items: center;
			margin: 20rpx 0;
			background-color: #fff;
			padding: 20rpx;
			justify-content: space-between;
			box-sizing: border-box;
			border-radius: 10rpx;
			.icon-gonggao {
				font-size: 60rpx;
				color: #20279b;
				margin-right: 20rpx;
			}

			.msg {
				color: red;
			}
		}

		// .content {
		// 	margin-bottom: 20rpx;
		// 	overflow: hidden;
		// 	background: #fff;
		// 	position: relative;

		// 	.featureContent {
		// 		box-sizing: border-box;
		// 		padding: 30rpx 0;
		// 		.nav_wrapper {
		// 			display: flex;
		// 			align-items: center;
		// 			justify-content: space-around;
		// 			flex-wrap: wrap;
		// 			width: 100%;
		// 			box-sizing: border-box;
		// 			// padding: 10rpx;
		// 			.nav_content {
		// 				display: flex;
		// 				flex-direction: column;
		// 				align-items: center;
		// 				justify-content: center;
		// 				flex: 0 0 20%;
		// 				font-size: 14px;
		// 				color: rgba(51, 51, 51, 1);
		// 				// margin: 10px 2%;

		// 				image {
		// 					max-width: 80%;
		// 				}
		// 				.imgbox{
		// 					margin-bottom: 10rpx;
		// 					.iconSize{
		// 						font-size: 40rpx;
		// 					}
		// 				}
		// 			}
		// 		}
		// 	}
		// }

		.course_content {
			position: relative;
			padding-bottom: 30rpx;
			// background-color: pink;
			.tag {
				box-sizing: border-box;
				padding: 20rpx;
				display: flex;
				justify-content: space-between;
				position: relative;
				background: #fff;
				margin-bottom: 20rpx;
				border-radius: 10rpx;
				h4 {
					margin-left: 20rpx;
					font-size: 32rpx;
				}
			}

			.tag:before {
				position: absolute;
				left: 20rpx;
				top: 50%;
				transform: translateY(-50%);
				display: inline-block;
				content: '';
				width: 2px;
				height: 32rpx;
				background-color:  #20279b;
				border-radius: 2px;
			}
		}
	}
	.applyBox{
		width: 500rpx;
		border-radius: 30rpx;
		background-color: #ffff;
		padding: 30rpx;
		box-sizing: border-box;
		
		.icon-chahao{
			color: #272536;
			font-size: 28rpx;
		}
		.applyCon{
			display: flex;
			// align-items: center;
			flex-direction: column;
			.icon-dianzan{
				color: #FF8D1A;
				font-size: 60rpx;
			}
			.title{
				font-size: 35rpx;
				font-weight: 600;
				margin: 20rpx 0;
			}
			.applycontent{
				color: #20269B;
				font-size: 28rpx;
				.subtit{
					font-size: 30rpx;
					margin-bottom: 10rpx;
				}
				.num{
					font-size: 26rpx;
					color: #333333;
					margin: 10rpx 0;
				}
				.leftIcon{
					color: #20269B;
					font-size: 26rpx;
					margin-right: 5rpx;
				}
				.rightIcon{
					margin-left: 5rpx;
					font-size: 26rpx;
					color: #F43530;
				}
				.icon-duihao2{
					color: #41C740;
				}
			}
			
		}
	}
	.descriptionBox {
		width: 550rpx;
		padding: 40rpx;
		.popupClose{
			display: flex;
			align-items: center;
			justify-content: flex-end;
			.icon-guanbi{
				font-size: 28rpx;
				
			}
		}
		.imageBox{
			display: flex;
			align-items: center;
			justify-content: center;
			margin-bottom: 20rpx;
		}
		.description{
			color: rgba(56, 56, 56, 1);
			font-size: 26rpx;
			line-height: 1.5;
		}
	}
	.ulBox {
		flex-direction: column;
		width: 100%;
		box-sizing: border-box;
	}

	.liBox {
		box-sizing: border-box;
		background-color: #fff;
		border-radius: 20rpx;
		margin-bottom: 20rpx;
		padding: 10rpx;
		width: 100%;
	}

	
</style>