Browse Source

修改详情页面

wangxy 2 weeks ago
parent
commit
eb5a26fd56
3 changed files with 25 additions and 280 deletions
  1. 13 0
      api/chanpinneirong.js
  2. 10 14
      pages/chanpinneirong/chanpin4.vue
  3. 2 266
      pages/ziranpindu/components/danyuanInfo.vue

+ 13 - 0
api/chanpinneirong.js

@@ -59,6 +59,19 @@ export function shuxueSave2(data = {}) {
   })
 }
 
+
+export function yingyuPinduSave(data = {}) {
+  return request({
+    'url': '/app/pindu/chanpin/save',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}
+
 export function yingyuPinduInfo(data = {}) {
   return request({
     'url': '/app/pindu/chanpin/dengji/info',

+ 10 - 14
pages/chanpinneirong/chanpin4.vue

@@ -85,7 +85,7 @@
 	import cacheManager from "@/utils/cacheManager.js";
 	import {
 		yingyuPinduInfo,
-		shuxueSave
+		yingyuPinduSave
 	} from "@/api/chanpinneirong.js"
 	import {
 		onLoad,
@@ -93,7 +93,7 @@
 		onHide,
 		onUnload
 	} from "@dcloudio/uni-app"
-	import danyuanInfoVue from '@/pages/xinshuxue/components/danyuanInfo.vue';
+	import danyuanInfoVue from '@/pages/ziranpindu/components/danyuanInfo.vue';
 	import {
 		toast
 	} from '../../utils/common';
@@ -101,7 +101,7 @@
 		updateChanpin4Process
 	} from "./useNeirongChanpin4"
 	import tipSmallDialog from "@/components/dialog/tipSmallDialog.vue";
-	
+
 	export default {
 		data() {
 			return {
@@ -112,7 +112,6 @@
 				dengjiId: '',
 				danyuanId: '',
 				chanpinId: '',
-				dengjiId: '',
 				curProcess: '',
 				existData: false,
 				isShow: false,
@@ -145,7 +144,7 @@
 			handleConfirmBtn() {
 				// 加锁视频需要购买
 				uni.navigateTo({
-					url: "/pages/chanpinShop/cp1/dingdan"
+					url: "/pages/chanpinShop/cp3/dingdan"
 				})
 			},
 			initData(dengjiId) {
@@ -264,9 +263,6 @@
 			},
 
 			async saveAndNavigate(jieId, type, da, code) {
-
-				console.log('this.dengjiId', this.dengjiId);
-				console.log('this.danyuanIddanyuanId', da.danyuanId);
 				console.log('da', da);
 				if (code == 'jixu') {
 					if (!this.dengjiId || !da.danyuanId) {
@@ -276,12 +272,12 @@
 				}
 
 				let req = {
-					"dengjiId": this.dengjiId,
+          "dengjiId": da.dengjiId,
 					"danyuanId": da.danyuanId,
 					"jieId": jieId
 				}
 				console.log('req', req);
-				const res = await shuxueSave(req);
+				const res = await yingyuPinduSave(req);
 				if (res.code == 0) {
 					let curJieAndDanyuan = this.getJieAndDanyuan(this.banbenInfo, jieId);
 					if (!curJieAndDanyuan) {
@@ -299,11 +295,11 @@
 
 					if (type == 1) {
 						uni.navigateTo({
-							url: `/pages/xinshuxue/lookShipin?jieId=${jieId}`
+							url: `/pages/ziranpindu/lookShipin?jieId=${jieId}`
 						})
 					} else {
 						uni.navigateTo({
-							url: `/pages/xinshuxue/unitTest?jieId=${jieId}`
+							url: `/pages/ziranpindu/unitTest?jieId=${jieId}`
 						})
 					}
 				} else {
@@ -313,9 +309,9 @@
 			handlePlay(da, code) {
 
 				if (da.lock && code == 'play') {
-					
+
 					this.$refs.gmtRef.handleShow();
-					
+
 					// 加锁视频需要购买
 					// uni.navigateTo({
 					// 	url: "/pages/chanpinShop/cp1/dingdan"

+ 2 - 266
pages/ziranpindu/components/danyuanInfo.vue

@@ -8,16 +8,6 @@
 					<icon @click="goUpPage"></icon>
 				</view>
 				<view class="xuexi-dagang-body">
-					<view class="ezy-video-box course-video-box">
-						<view ref="videoContent" id="wgy-player-test" :playAuth="playAuth"
-							:change:playAuth="renderScript.receiveMsg" :videoId="videoId"
-							:change:videoId="renderScript.videoIdFun" :hideFlag="hideFlag"
-							:change:hideFlag="renderScript.hideFlagFun" :progressMarkers="progressMarkers"
-							:change:progressMarkers="renderScript.progressMarkersMsg" :seekTime="seekTime"
-							:change:seekTime="renderScript.seekTimeFun" class="ezy-video">
-						</view>
-					</view>
-
 					<!-- 您将学会 -->
 					<view class="dagang-xh-box">
 						<view class="xh-title">您将学会</view>
@@ -68,7 +58,7 @@
 		convertTimeToSeconds
 	} from "@/utils/common";
 	import cacheManager from "@/utils/cacheManager.js";
-	import * as httpApi from "@/api/chanpinShuxue.js";
+	import * as httpApi from "@/api/chanpinZiRanPinDu.js";
 	export default {
 		data() {
 			return {
@@ -88,7 +78,6 @@
 				hideFlag: 'show',
 				videoId: "", //阿里云视频id
 				seekTime: '',
-				danyuanId: '',
 				shipinTitle: '',
 			}
 		},
@@ -121,271 +110,18 @@
 				return 'static/images/course/shuxue-icon.png'
 			},
 			getDataInfo() {
-				httpApi.getShuxueChanpinDanyuanInfo({
+				httpApi.getPinduChanpinDanyuanInfo({
 					danyuanId: this.danyuanId
 				}).then(res => {
 					// 重新赋值
 					Object.assign(this.danyuanInfo, res.data)
 					this.$refs.popupRef.open();
-					nextTick(() => {
-						// 	针对视频进行赋值
-						this.videoId = this.danyuanInfo.video;
-						// 执行方法
-						this.getLive(); //获取播放凭证
-					})
 				})
 			},
 			init(options) {
 				this.danyuanId = options.danyuanId;
 				this.getDataInfo()
 			},
-			playEnd(data) {
-				// #ifdef APP-PLUS
-				plus.screen.lockOrientation('portrait-primary');
-				// #endif
-			},
-			getLive() {
-				if (!this.videoId) {
-					toast("video缺失!")
-					return false
-				}
-				let req = {
-					videoId: this.videoId
-				}
-				getVideoAuth(req).then(res => {
-					this.playAuth = res.data
-				})
-			},
-			markersClick(data) {
-				this.seekTime = ""
-				this.$nextTick(() => {
-					this.seekTime = data.offset
-				});
-			},
-
 		},
 	}
 </script>
-
-
-
-<script module="renderScript" lang="renderjs">
-	export default {
-		mounted() {
-			console.log("renderScript1")
-			// 在适合的生命周期,通过script和link标签引入播放器sdk、css
-			//	this.loadWebPlayerSDK()
-		},
-		data() {
-			return {
-				player: null,
-				playAuth: '',
-				videoId: '',
-				progressMarkers: [],
-				isFullScreen: false,
-				seekTime: ''
-
-			}
-		},
-		methods: {
-
-			receiveMsg(newValue, oldValue, ownerInstance, instance) {
-				// console.log('service层中的options发生变化')
-				// console.log('新值', newValue)
-				// console.log('旧值', oldValue)
-				// ownerInstance和this.$ownerInstance一样,可用来向service层通信
-				// instance和ownerInstance的区别是:
-				// instance.$el指向的是触发事件的那个节点;ownerInstance.$el指向当前vue文件中的根节点;
-				// instance的作用目前尚不明确,官方没有给出用法
-				if (newValue) {
-					this.playAuth = ''
-					this.playAuth = newValue
-					this.loadWebPlayerSDK()
-
-				}
-			},
-			videoIdFun(newValue, oldValue, ownerInstance, instance) {
-				if (newValue) {
-					this.videoId = ''
-					this.videoId = newValue
-				}
-			},
-			hideFlagFun(newValue, oldValue, ownerInstance, instance) {
-				if (this.player) {
-					this.player.pause()
-				}
-			},
-			progressMarkersMsg(newValue, oldValue, ownerInstance, instance) {
-
-				if (newValue) {
-					this.progressMarkers = newValue
-				}
-			},
-			seekTimeFun(newValue, oldValue, ownerInstance, instance) {
-				if (newValue) {
-					this.player.play()
-					this.player.seek(newValue)
-					// switch (this.player.getStatus()) {
-					// 	case 'init':
-					// 		break;
-					// 	case 'ready':
-					// 		break;
-					// 	case 'loading':
-					// 	this.player.play()
-					// 	this.player.seek(newValue)
-					// 		break;
-					// 	case 'play':
-					// 		this.player.seek(newValue)
-					// 		break;
-					// 	case 'pause':
-					// 	this.player.play()
-					// 	this.player.seek(newValue)
-					// 		break;
-					// 	case 'playing':
-					// 	this.player.seek(newValue)
-					// 		break;
-					// 	case 'waiting':
-					// 		break;
-					// 	case 'error':
-					// 		break;
-					// 	case 'ended':
-					// 		break;
-					// 	default:
-					// 		break;
-					// }
-					//	this.player.seek(newValue)
-				}
-			},
-			playAli() {
-				let that = this
-				// console.log(this.videoId);
-				// console.log(this.playAuth);
-				//配置播放器
-				if (!this.playAuth) {
-					return false;
-				}
-				var player = new Aliplayer({
-					id: "wgy-player-test",
-					"vid": this.videoId,
-					"playauth": this.playAuth,
-					extraInfo: {
-						poster: 'noposter'
-					},
-					fullscreenEvents: {
-						fullscreenChange: (isFull) => {
-							this.isFullScreen = isFull
-						}
-					},
-					//cover: 'https://img.alicdn.com/tps/TB1EXIhOFXXXXcIaXXXXXXXXXXX-760-340.jpg',
-					// "vid": '',
-					// "playauth": '',
-					// "playConfig": {
-					// 	"EncryptType": 'AliyunVoDEncryption'
-					// },
-					"skinLayout": [{
-							"name": "bigPlayButton",
-							"align": "blabs",
-							"x": 30,
-							"y": 80
-						},
-						{
-							"name": "H5Loading",
-							"align": "cc"
-						},
-						{
-							"name": "controlBar",
-							"align": "blabs",
-							"x": 0,
-							"y": 0,
-							"children": [{
-									"name": "progress",
-									"align": "blabs",
-									"x": 0,
-									"y": 44
-								},
-								{
-									"name": "playButton",
-									"align": "tl",
-									"x": 15,
-									"y": 12
-								},
-								{
-									"name": "fullScreenButton",
-									"align": "tr",
-									"x": 10,
-									"y": 12
-								},
-								{
-									"name": "timeDisplay",
-									"align": "tr",
-									"x": 10,
-									"y": 5
-								}
-							]
-						}
-					],
-					"qualitySort": "asc",
-					"format": "mp4",
-					"mediaType": "video",
-					"encryptType": 1,
-					"progressMarkers": this.progressMarkers,
-					"autoplay": false,
-					"isLive": false,
-					"rePlay": false,
-					"playsinline": true,
-					"preload": false,
-					"controlBarVisibility": "hover",
-					"useH5Prism": true
-
-				}, function(player) {});
-				this.player = player;
-				player.on('canplay', function() {
-					console.log('canplay', this.player.tag);
-					player.tag.play();
-
-				});
-
-				player.on('ended', function(data) {
-					that.exitFullScreen();
-					that.$ownerInstance.callMethod('playEnd', {
-						data: 'end'
-					})
-					// uni.$emit('playEnd', {
-					// 	data: 'end'
-					// });
-				});
-			},
-			exitFullScreen() {
-				if (document.exitFullscreen) {
-					document.exitFullscreen(); // 标准方法
-				} else if (document.mozCancelFullScreen) { // Firefox
-					document.mozCancelFullScreen();
-				} else if (document.webkitExitFullscreen) { // Chrome, Safari & Opera
-					document.webkitExitFullscreen();
-				} else if (document.msExitFullscreen) { // IE/Edge
-					document.msExitFullscreen();
-				}
-			},
-
-			loadWebPlayerSDK() {
-				return new Promise((resolve, reject) => {
-					const s_tag = document.createElement('script'); // 引入播放器js
-					s_tag.type = 'text/javascript';
-					s_tag.src = 'https://g.alicdn.com/de/prismplayer/2.9.6/aliplayer-min.js';
-					s_tag.charset = 'utf-8';
-					s_tag.onload = () => {
-						//	console.log(this.playAuth);
-						this.playAli()
-						resolve();
-					}
-					document.body.appendChild(s_tag);
-					const l_tag = document.createElement('link'); // 引入播放器css
-					l_tag.rel = 'stylesheet';
-					l_tag.href =
-						'https://g.alicdn.com/de/prismplayer/2.9.6/skins/default/aliplayer-min.css';
-					document.body.appendChild(l_tag);
-				});
-			},
-		}
-	}
-</script>