Bläddra i källkod

video auto play

yichael 4 år sedan
förälder
incheckning
68449c2d42
3 ändrade filer med 103 tillägg och 13 borttagningar
  1. 74 11
      components/home/sy.vue
  2. 12 1
      components/leftMenu.vue
  3. 17 1
      pages/home.vue

+ 74 - 11
components/home/sy.vue

@@ -52,11 +52,30 @@
 			
 			
 			<img src="../../assets/home/homeBG.jpg" />
-
-			<video class="myVideo" src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20200317.mp4"
-			                    @error="videoErrorCallback" :danmu-list="danmuList" enable-danmu danmu-btn controls>
+<!-- controls="{{false}}" -->
+			<video class="myVideo" 
+				:src="src"
+				:controls="controls"
+			     preload="auto"
+			     autoplay
+			     loop muted>
 			</video>
-		
+			
+			<!-- <video v-show="os!=='iOS'"
+			               class="myVideo"
+			               preload="auto"
+			               autoplay
+			               loop muted
+			               webkit-playsinline="true"
+			               playsinline="true"
+			               @loadstart="videoLoadStart"
+			               @canplaythrough="videoLoaded"
+			               poster="./images/cover.png"
+			               ref="videoEle"
+			               id="android"
+			        >
+				<source :src="src" type="video/mp4">
+			</video> -->
 		<!-- 	<view class = 'theoryLearn' @click="onTheoryLearn()">理论学习</view>
 			<view class = 'startExperiment' @click="onStartExperiment()">开始实验</view> -->
 		</view>
@@ -68,7 +87,8 @@
 		data() {
 			return {
 				showIndex: -1,
-		
+				src:'https://zhongchuan1.oss-cn-beijing.aliyuncs.com/Video/home.MP4?Expires=1623941426&OSSAccessKeyId=TMP.3KfofQDcTSN872xnqTfavvRpfHDZskzYZaTN3RG8rHBboCaYW5Mo28TFeDo1GaJLtVjvEk6wA2zyo2kGiL8BtdKmhJLSb7&Signature=ZtisB%2Fpuzozl6r%2BHlbNXgcYMsqk%3D&versionId=CAEQDxiBgIDmyO_o0BciIGExNjQ1ZmJkNTVkOTRlMWRhNGRkZjAxNTEzZTMxOTll&response-content-type=application%2Foctet-stream',
+				controls:false,
 				menu: [{
 						"title": '虚拟仿真资产库',
 						"text": '科学实验,是指根据一定目的,运用一定的仪器、设备等物质手'
@@ -95,14 +115,36 @@
 			},
 			onClick_menu(index) {
 				if(!getApp().globalData.bLogin) {
-					alert('请先登录')
+					uni.showModal({
+							title: '提示',
+							showCancel: false,
+							content: '请先点击右上角登录?',
+							success: function(res) {
+							if (res.confirm) {
+								console.log('点击了确认')
+							} else {
+								console.log('点击了取消')
+							}
+						}
+					})
 					return
 				};
 				this.showIndex = index;
 			},
 			onClick_menu_btn(index) {
 				if(!getApp().globalData.bLogin) {
-					alert('请先登录')
+					uni.showModal({
+							title: '提示',
+							showCancel: false,
+							content: '请先点击右上角登录?',
+							success: function(res) {
+							if (res.confirm) {
+								console.log('点击了确认')
+							} else {
+								console.log('点击了取消')
+							}
+						}
+					})
 					return
 				};
 				
@@ -110,7 +152,18 @@
 			},
 			onTheoryLearn(){
 				if(!getApp().globalData.bLogin) {
-					alert('请先登录')
+					uni.showModal({
+							title: '提示',
+							showCancel: false,
+							content: '请先点击右上角登录?',
+							success: function(res) {
+							if (res.confirm) {
+								console.log('点击了确认')
+							} else {
+								console.log('点击了取消')
+							}
+						}
+					})
 					return
 				};
 				
@@ -118,7 +171,17 @@
 			},
 			onStartExperiment(){
 				if(!getApp().globalData.bLogin) {
-					alert('请先登录')
+					uni.showModal({
+							title: '提示',
+							content: '请先点击右上角登录?',
+							success: function(res) {
+							if (res.confirm) {
+								console.log('点击了确认')
+							} else {
+								console.log('点击了取消')
+							}
+						}
+					})
 					return
 				};
 				
@@ -323,8 +386,8 @@
 		left: px2vw(770);
 		top: px2vw(371);
 		
-		// width: px2vw(361);
-		// height: px2vw(143);
+		width: px2vw(360);
+		height: px2vw(203);
 		
 		// display: flex;
 		// justify-content: center;

+ 12 - 1
components/leftMenu.vue

@@ -99,7 +99,18 @@
 			},
 			show(indexArr) {
 				if(!getApp().globalData.bLogin) {
-					alert('请先登录')
+					uni.showModal({
+							title: '提示',
+							showCancel: false,
+							content: '请先点击右上角登录?',
+							success: function(res) {
+							if (res.confirm) {
+								console.log('点击了确认')
+							} else {
+								console.log('点击了取消')
+							}
+						}
+					})
 					return
 				};
 				this.isShow = true;

+ 17 - 1
pages/home.vue

@@ -226,7 +226,23 @@
 		methods: {
 			onTopSYClick(index) {
 				if (!getApp().globalData.bLogin) {
-					alert('请先登录')
+					// uni.showToast({
+					// 	title: '请先点击右上角登录',
+					// 	duration: 2000,
+					// 	mask: true //是否有透明蒙层,默认为false 
+					// })
+					uni.showModal({
+							title: '提示',
+							showCancel: false,
+							content: '请先点击右上角登录?',
+							success: function(res) {
+							if (res.confirm) {
+								console.log('点击了确认')
+							} else {
+								console.log('点击了取消')
+							}
+						}
+					})
 					return
 				};
 				// console.log("点击了首页标题", index, myData_QXZB_SYQY.length);