Просмотр исходного кода

Signed-off-by: 李妹妹 <1639016684@qq.com>

李妹妹 14 часов назад
Родитель
Сommit
23543ef3b8

+ 5 - 0
api/home.js

@@ -44,3 +44,8 @@ export function listPublicCourseCategory(data) {
 export function listPublicCourse(data) {
 	return request('/course_auto/app/course/publicCourse/list', data || {}, 'GET');
 }
+
+//东坡
+export function getHisStoreConfig(data) {
+	return request('/app/index/getHisStoreConfig', data || {}, 'GET');
+}

+ 5 - 2
common/request.js

@@ -11,8 +11,8 @@ export default class Request {
 		let path = 'https://userapp.klbycp.com/store'; //百域承品
 		let path2 = 'https://userapp.klbycp.com'; //百域承品
 
-		// let path = 'http://vab6e976.natappfree.cc/store'; //本地
-		// let path2 = 'http://vab6e976.natappfree.cc'; //本地
+		// let path = 'http://p3a4a6bc.natappfree.cc/store'; //本地
+		// let path2 = 'http://p3a4a6bc.natappfree.cc'; //本地
 
 		// let path = 'http://jc5cb469.natappfree.cc/store'; //本地
 		// let path2 = 'http://jc5cb469.natappfree.cc'; //本地
@@ -57,6 +57,9 @@ export default class Request {
 			path = `${path2}/companyapp`;
 		}
 		if (router.indexOf("/companyapp") != -1) {
+			if (router.indexOf("/addVoicePrintUrl") !== -1) {
+				router = router.replace('/companyapp', '')
+			}
 			// router =router.replace('/companyapp','')
 			// path = 'https://userapp.klbycp.com' //百域承品
 			path = path2 //本地

+ 22 - 6
pages/home/index.vue

@@ -171,7 +171,7 @@
 </template>
 
 <script>
-import { listPublicCourseCategory, listPublicCourse } from '@/api/home.js'
+import { listPublicCourseCategory, listPublicCourse ,getHisStoreConfig } from '@/api/home.js'
 
 export default {
 	data() {
@@ -193,6 +193,7 @@ export default {
 			courseSectionLoading: true,
 			videoThumbSrc: '',
 			menuButtonInfo: {}, // 胶囊按钮布局信息
+			yxy:{}
 		}
 	},
 	computed: {
@@ -202,10 +203,10 @@ export default {
 	},
 	onLoad() {
 		this.getMenuButtonInfo(); // 初始化获取胶囊信息
-		
 	},
 	onShow() {
-		this.initPublicVideoData();
+		this.loadConfig();
+		//this.initPublicVideoData();
 		this.initPublicCourseData();
 	},
 	methods: {
@@ -232,11 +233,26 @@ export default {
 			this.videoTagIndex = cateId;
 			this.getPublicVideoList(cateId);
 		},
+		async loadConfig() {
+		  try {
+		    // 1. 先拿配置(必须等它完成)
+		    const res = await getHisStoreConfig({ name: 'moduleShow' })
+		    const list = res?.courseChannels || []
+		    const y = list.filter(item => item.dictLabel == '原乡行')
+		    this.yxy = y[0] || {}
+		
+		    // 2. 配置拿完,再加载视频(关键!)
+		    await this.initPublicVideoData()
+		  } catch (err) {
+		    console.error('加载配置失败', err)
+		    this.yxy = {}
+		  }
+		},
 		async initPublicVideoData() {
 			const hasCache = this.videoTags.length > 0 && this.hasVideoContent
 			if (!hasCache) this.videoLoading = true
 			try {
-				const res = await listPublicCourseCategory({homePage:1,yxxTag:1, pageNum: 1, pageSize: 4 });
+				const res = await listPublicCourseCategory({homePage:1,yxxTag:this.yxy.dictValue||1, pageNum: 1, pageSize: 4 });
 				const list = (res && res.data && res.data.list) || [];
 				this.videoTags = list
 				if (this.videoTags.length > 0) {
@@ -258,7 +274,7 @@ export default {
 			const hasCache = this.navList.length > 0 && this.courses.length > 0
 			if (!hasCache) this.courseSectionLoading = true
 			try {
-				const res = await listPublicCourseCategory({ homePage:1, pageNum: 1, pageSize: 10 });
+				const res = await listPublicCourseCategory({ homePage:1, pageNum: 1, pageSize: 10 ,yxxTag:0});
 				const list = (res && res.data && res.data.list) || [];
 				const mapped = list.map(item => ({
 					id: item.cateId,
@@ -300,7 +316,7 @@ export default {
 			try {
 				const res = await listPublicCourse({
 					recommendSlot:1,
-					yxxTag:1,
+					yxxTag:this.yxy.dictValue||1,
 					pageNum: 1,
 					pageSize: 1,
 					subCateId: subCateId

+ 81 - 33
pages/home/newindex.vue

@@ -18,13 +18,15 @@
          </view>
 		<!-- 主横幅:两图横向 -->
 		<view class="banner-row-wrap" v-if="showBannerBlock">
-			<view class="banner-row banner-skeleton" v-if="showBannerSkeleton">
-				<view class="banner-sk-item" v-for="i in 2" :key="'banner-sk-' + i"></view>
-			</view>
-			<view class="banner-row" v-else-if="showBannerContent">
-				<view class="banner-item" v-for="(item, i) in advList" :key="i" @tap="handleAdvClick(item)">
-					<image class="banner-img" :src="imageUrl[i]" mode="widthFix"></image>
-				</view>
+			<view class="banner-row" :class="{ 'banner-skeleton': showBannerSkeleton }">
+				<template v-if="showBannerContent">
+					<view class="banner-item" v-for="(item, i) in bannerList" :key="item.slotKey" @tap="handleAdvClick(item.course)">
+						<image class="banner-img" :src="item.image" mode="widthFix"></image>
+					</view>
+				</template>
+				<template v-else-if="showBannerSkeleton">
+					<view class="banner-sk-item" v-for="i in 2" :key="'banner-sk-' + i"></view>
+				</template>
 			</view>
 		</view>
 
@@ -80,7 +82,7 @@
 import zModal from '@/components/z-modal/z-modal.vue'
 import { getMenu, getIndexData, getCartCount } from '@/api/index'
 import { getStoreConfig } from '@/api/common'
-import { getHomeInit, getHomeRecommend, getHomeGoods,listPublicCourse } from '@/api/home.js'
+import { getHomeInit, getHomeRecommend, getHomeGoods, listPublicCourse, getHisStoreConfig } from '@/api/home.js'
 import HotProduct from './components/HotProduct.vue'
 //import TuiProduct from '@/components/tuiProduct.vue'
 import SearchBar from './components/SearchBar.vue'
@@ -132,8 +134,8 @@ export default {
 			goodsPageNum: 1,
 			goodsRequestId: 0,
 			cartCount: 0,
-			advList: [],
-			bannerLoading: true,
+			bannerList: [],
+			bannerLoading: false,
 			top: 0,
 			statusBarHeight: (uni.getStorageSync('menuInfo') && uni.getStorageSync('menuInfo').statusBarHeight) || 20,
 			userinfoa: [],
@@ -154,10 +156,10 @@ export default {
 			}
 		},
 		showBannerSkeleton() {
-			return this.bannerLoading && !(this.advList && this.advList.length)
+			return this.bannerLoading && !(this.bannerList && this.bannerList.length)
 		},
 		showBannerContent() {
-			return !!(this.advList && this.advList.length)
+			return !!(this.bannerList && this.bannerList.length)
 		},
 		showBannerBlock() {
 			return this.showBannerSkeleton || this.showBannerContent
@@ -186,6 +188,7 @@ export default {
 			uni.setStorageSync('userCode', obj.userCode)
 			if (this.utils.checkLoginState()) this.getUserInfo()
 		}
+		this.loadBannerConfig()
 	},
 	onUnload() {
 		uni.$emit('stop')
@@ -200,7 +203,6 @@ export default {
 		this.getHomeInit()
     this.getHomeRecommend()
 		this.getMenu()
-		this.getIndexData()
 		if (uni.getStorageSync('AppToken')) {
 			this.getUserInfo()
 		} else {
@@ -388,22 +390,59 @@ export default {
 				if (res.code == 200) this.menus = res.data || []
 			})
 		},
-		getIndexData() {
-			if (!this.advList.length) this.bannerLoading = true
-			const data = {
-				pageNum: 1,
-				pageSize: 2,
-				yxxTag: 3,
-				recommendSlot: 2,
-			}
-			listPublicCourse(data).then(res => {
-				if (res.code == 200) {
-					this.advList = res.data.list || []
-				} else {
-					uni.showToast({ icon: 'none', title: '请求失败' })
+		getBannerImage(item) {
+			const images = this.imageUrl || []
+			if (item && item.dictLabel === '原乡行') return images[1] || ''
+			return images[0] || ''
+		},
+		loadBannerConfig() {
+			if (this.bannerList.length) return
+			getHisStoreConfig({ name: 'moduleShow' }).then(res => {
+				if (res.code != 200) return
+				const selectId = res.courseChannels || []
+				if (!res.moduleOneShow && !res.moduleTwoShow) {
+					this.bannerLoading = false
+					return
 				}
-			}).catch(() => {}).finally(() => {
-				this.bannerLoading = false
+				const tasks = []
+				if (res.moduleOneShow && selectId[0]) tasks.push({ channel: selectId[0], slotKey: '0' })
+				if (res.moduleTwoShow && selectId[1]) tasks.push({ channel: selectId[1], slotKey: '1' })
+				tasks.sort((a, b) => {
+					const aBack = a.channel.dictLabel === '原乡行' ? 1 : 0
+					const bBack = b.channel.dictLabel === '原乡行' ? 1 : 0
+					return aBack - bBack
+				})
+				this.bannerLoading = true
+				const newList = []
+				const loadNext = (i) => {
+					if (i >= tasks.length) {
+						this.bannerList = newList
+						this.bannerLoading = false
+						return
+					}
+					const task = tasks[i]
+					listPublicCourse({
+						pageNum: 1,
+						pageSize: 1,
+						yxxTag: task.channel.dictValue,
+						recommendSlot: 2
+					}).then(r => {
+						newList.push({
+							slotKey: task.slotKey,
+							image: this.getBannerImage(task.channel),
+							course: r.code == 200 && r.data && r.data.list ? r.data.list[0] : null
+						})
+						loadNext(i + 1)
+					}).catch(() => {
+						newList.push({
+							slotKey: task.slotKey,
+							image: this.getBannerImage(task.channel),
+							course: null
+						})
+						loadNext(i + 1)
+					})
+				}
+				loadNext(0)
 			})
 		},
 		getUserInfo() {
@@ -462,6 +501,7 @@ export default {
 			}
 		},
 		handleAdvClick(item) {
+			// console.log('item',item)
 			if (item && item.courseId) {
 				uni.navigateTo({ url: '/pages_index/courseDetail?courseId=' + item.courseId})
 				return;
@@ -505,16 +545,21 @@ export default {
 .banner-row {
 	position: relative;
 	display: flex;
+	align-items: flex-start;
 	gap: 20rpx;
-	padding:0 20rpx 24rpx;
+	padding: 0 20rpx 24rpx;
 }
-.banner-skeleton {
-	min-height: 220rpx;
+.banner-skeleton .banner-sk-item::after {
+	content: '';
+	display: block;
+	width: 100%;
+	padding-bottom: 63.8%;
 }
 .banner-sk-item {
 	flex: 1;
-	height: 220rpx;
+	min-width: 0;
 	border-radius: 16rpx;
+	overflow: hidden;
 	background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
 	background-size: 200% 100%;
 	animation: banner-shimmer 1.2s ease-in-out infinite;
@@ -525,10 +570,13 @@ export default {
 }
 .banner-item {
 	flex: 1;
+	min-width: 0;
+	border-radius: 16rpx;
+	overflow: hidden;
 }
 .banner-img {
 	width: 100%;
-	height: 100%;
+	display: block;
 }
 .bg {
 	width: 100%;

+ 1 - 4
pages_course/components/goodsList.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>
-		<view v-for="(item,index) in treatmentPackage" :key="getItemKey(item, index)">
+		<view v-for="(item,index) in treatmentPackage" :key="index">
 			<view class="goodsitem">
 				<view class="goodsitem-img">
 					<image :src="item.images" mode="aspectFill" style="height: 100%;width: 100%"></image>
@@ -69,9 +69,6 @@
 			}
 		},
 		methods: {
-			getItemKey(item, index) {
-				return item.productId || item.packageId || `idx_${index}`
-			},
 			hasHotSaleTag(item) {
 				return hasHotSaleTag(item)
 			},

+ 14 - 14
pages_course/video.vue

@@ -130,15 +130,15 @@
 			  :style="{ display:isFull&&cardPopup && currentCardItem ? 'block' : 'none'}"
 			  @click.stop="goBuy(currentCardItem)"
 			>
-			  <!-- 关闭按钮 -->
-			  <cover-view class="close-box" @click.stop="closeCardPopup">
-			    <cover-image src="/static/images/close.png"></cover-image>
-			  </cover-view>
-			  <cover-view class="goods-cover-hot" v-if="hasHotSaleTag(currentCardItem) && getProductHotCount(currentCardItem) > 0">
-			   <cover-image style="height: 28px;" src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/class/remai.png" mode="heightFix"></cover-image>
-			     <cover-view class="goods-cover-hot-text">{{ getProductHotCount(currentCardItem) }}</cover-view>
-			   </cover-view>
+			<cover-view class="goods-cover-hot" v-if="hasHotSaleTag(currentCardItem) && getProductHotCount(currentCardItem) > 0">
+			 <cover-image style="height: 30px;" src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/class/remai.png" mode="heightFix"></cover-image>
+			   <cover-view class="goods-cover-hot-text">{{ getProductHotCount(currentCardItem) }}</cover-view>
+			 </cover-view>
 			  <cover-view class="goods-cover-inner">
+				  <!-- 关闭按钮 -->
+				  <cover-view class="close-box" @click.stop="closeCardPopup">
+				    <cover-image src="/static/images/close.png"></cover-image>
+				  </cover-view>
 			    <!-- 商品主图 -->
 			    <cover-view class="goods-cover-img">
 					<cover-image 
@@ -5554,24 +5554,22 @@
        right: 12px;
      	 width: 150px;
        z-index: 99999;
-       background: #FFFFFF;
        border-radius: 10px;
        overflow: visible;
        bottom: 40px;
 
        &-hot {
-        position: absolute;
-        top: -33px;
-        left: 15px;
-        z-index: 11;
+		// margin-left: 15px;
+		margin-bottom: 15px;
         display: flex;
         flex-direction: row;
         align-items: center;
+		position: relative;
        }
        
        &-hot-text {
          position: absolute;
-         left:65px;
+         left:85px;
          font-family: PingFangSC, PingFang SC;
          font-weight: 600;
          font-size: 20px;
@@ -5585,6 +5583,8 @@
          flex-direction:column;
          border-radius: 10px;
          overflow: hidden;
+		 background: #FFFFFF;
+		 position: relative;
        }
      
        &-img {

+ 33 - 32
pages_course/videovip.vue

@@ -112,16 +112,17 @@
 					  :style="{ display:isFull&&cardPopup && currentCardItem ? 'block' : 'none'}"
 					  @click.stop="goBuy(currentCardItem)"
 					>
-					  <!-- 关闭按钮 -->
-					  <cover-view class="close-box" @click.stop="closeCardPopup">
-					    <cover-image src="/static/images/close.png"></cover-image>
-					  </cover-view>
+					  
 					  <cover-view class="goods-cover-hot" v-if="hasHotSaleTag(currentCardItem) && getProductHotCount(currentCardItem) > 0">
-					  <cover-image style="height: 28px;" src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/class/remai.png" mode="heightFix"></cover-image>
+					  <cover-image style="height: 30px;" src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/class/remai.png" mode="heightFix"></cover-image>
 					    <cover-view class="goods-cover-hot-text">{{ getProductHotCount(currentCardItem) }}</cover-view>
 					  </cover-view>
 					
 					  <cover-view class="goods-cover-inner">
+						  <!-- 关闭按钮 -->
+						  <cover-view class="close-box" @click.stop="closeCardPopup">
+						    <cover-image src="/static/images/close.png"></cover-image>
+						  </cover-view>
 					    <!-- 商品主图 -->
 					    <cover-view class="goods-cover-img">
 							<cover-image 
@@ -5468,39 +5469,39 @@
      right: 12px;
 	 width: 150px;
      z-index: 99999;
-     background: #FFFFFF;
+    
      border-radius: 10px;
      overflow: visible;
      bottom: 40px;
 
-     &-hot {
+    &-hot {
+    		// margin-left: 15px;
+    margin-bottom: 15px;
+     display: flex;
+     flex-direction: row;
+     align-items: center;
+    position: relative;
+    }
+    
+    &-hot-text {
       position: absolute;
-      top: -33px;
-      left: 15px;
-      z-index: 11;
+      left:85px;
+      font-family: PingFangSC, PingFang SC;
+      font-weight: 600;
+      font-size: 20px;
+      color: #FFFFFF;
+      line-height: 28px;
+      text-align: justify;
+    }
+    
+    &-inner {
       display: flex;
-      flex-direction: row;
-      align-items: center;
-     }
-
-     &-hot-text {
-       position: absolute;
-       left:65px;
-       font-family: PingFangSC, PingFang SC;
-       font-weight: 600;
-       font-size: 20px;
-       color: #FFFFFF;
-       line-height: 28px;
-       text-align: justify;
-     }
-
-     &-inner {
-       display: flex;
-       flex-direction:column;
-       border-radius: 10px;
-       overflow: hidden;
-     }
-   
+      flex-direction:column;
+      border-radius: 10px;
+      overflow: hidden;
+      background: #FFFFFF;
+      position: relative;
+    }
      &-img {
        width:150px;
        height:150px;

+ 1 - 1
pages_index/course.vue

@@ -285,7 +285,7 @@ export default {
 		},
 		async getCategoryList() {
 			try {
-				const res = await listPublicCourseCategory({ pageNum: 1, pageSize: 50 })
+				const res = await listPublicCourseCategory({ pageNum: 1, pageSize: 50 ,yxxTag:0})
 				const list = (res && res.data && res.data.list) || []
 				this.categoryRows = [{ cateId: null, cateName: '全部' }, ...list]
 				this.categories = this.categoryRows.map(item => item.cateName || '')

+ 0 - 1
pages_index/courseSearch.vue

@@ -253,7 +253,6 @@ export default {
 			}
 			const currentPageNum = this.coursePageNum
 			const params = {
-				yxxTag: 3,
 				pageNum: currentPageNum,
 				pageSize: this.coursePageSize
 			}

+ 22 - 6
pages_index/video.vue

@@ -194,7 +194,7 @@
 </template>
 
 <script>
-import { listPublicCourseCategory, listPublicCourse } from '@/api/home.js'
+import { listPublicCourseCategory, listPublicCourse,getHisStoreConfig } from '@/api/home.js'
 import { getCourseStudyList } from '@/api/class.js'
 export default {
 	data() {
@@ -239,11 +239,12 @@ export default {
 				// { title: '邹方斌讲《毛笔书法修心课》', views: '10.8w', cover: '' },
 				// { title: '张斌《元气八段锦》系列课', views: '2.5w', cover: '' },
 				// { title: '翔哥精讲摄影课-手机微距拍摄技巧...', views: '100w+', cover: '' }
-			]
+			],
+			yxy:{}
 		}
 	},
 	onLoad() {
-		this.initPublicVideoData()
+		this.loadConfig()
 		this.getNewCourseList()
 	},
 	methods: {
@@ -254,9 +255,24 @@ export default {
 			const subCateId = cat.cateId === 0 || cat.cateId == null ? null : cat.cateId
 			this.getPublicVideoList({ subCateId })
 		},
+		async loadConfig() {
+		  try {
+		    // 1. 先拿配置(必须等它完成)
+		    const res = await getHisStoreConfig({ name: 'moduleShow' })
+		    const list = res?.courseChannels || []
+		    const y = list.filter(item => item.dictLabel == '原乡行')
+		    this.yxy = y[0] || {}
+		
+		    // 2. 配置拿完,再加载视频(关键!)
+		    await this.initPublicVideoData()
+		  } catch (err) {
+		    console.error('加载配置失败', err)
+		    this.yxy = {}
+		  }
+		},
 		async initPublicVideoData() {
 			try {
-				const res = await listPublicCourseCategory({ yxxTag: 1, pageNum: 1, pageSize: 50 });
+				const res = await listPublicCourseCategory({ yxxTag:this.yxy.dictValue||1, pageNum: 1, pageSize: 50 });
 				const list = (res && res.data && res.data.list) || [];
 				this.categories = [{ cateId: 0, cateName: '全部' }].concat(list);
 				if (this.categories.length > 0) {
@@ -330,7 +346,7 @@ export default {
 			}
 			const currentPageNum = this.recentPageNum
 			const params = {
-				courseType: 1,
+				courseType:1,
 				pageNum: currentPageNum,
 				pageSize: this.recentPageSize
 			}
@@ -387,7 +403,7 @@ export default {
 			}
 			const currentPageNum = this.coursePageNum
 			const params = {
-				yxxTag: 1,
+				yxxTag:this.yxy.dictValue||1,
 				pageNum: currentPageNum,
 				pageSize: this.coursePageSize
 			}