Procházet zdrojové kódy

新增公开视频

LinWuTai před 11 měsíci
rodič
revize
e463a82d25
6 změnil soubory, kde provedl 103 přidání a 16 odebrání
  1. 6 0
      App.vue
  2. 7 0
      api/visitor.js
  3. 9 0
      pages.json
  4. 4 3
      pages/menus/menu/menu.vue
  5. 74 11
      pages/visitor/index.vue
  6. 3 2
      utils/baseurl.js

+ 6 - 0
App.vue

@@ -26,4 +26,10 @@
 	uni-modal{
 		z-index: 19999 !important;
 	}
+	page{
+	color: rgba(0, 0, 0, 0.8);
+	font-family: "阿里妈妈东方大楷 Regular";
+	src: url("https://at.alicdn.com/wf/webfont/SvVWOIfU0QFS/uL71WQsTF0hJ.woff2") format("woff2");
+	// font-display: swap;
+}
 </style>

+ 7 - 0
api/visitor.js

@@ -34,4 +34,11 @@ export function getImage(src) {
 
 export function playerVideo(url) {
   return `${baseUrl}/asset/demoVideo/player?name=${url}`
+}
+
+export function demoVideo(x, y) {
+	return request.get('/visitor/demo/video', {
+		pageNum:x,
+		pageSize:y
+	})
 }

+ 9 - 0
pages.json

@@ -146,6 +146,15 @@
 						"enablePullDownRefresh": false
 					}
 				}
+        ,{
+            "path" : "pages/visitor/modeVideo/modeVideo",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "开放视频",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",

+ 4 - 3
pages/menus/menu/menu.vue

@@ -3,8 +3,8 @@
 		<image style="width: 100%;" mode="aspectFill" :src="imgSrc('/profile/logo/menuBackgroundImage.png')"></image>
 		<view class="big-circle"></view>
 		<view class="avatar-area z10" >
-			<view class="img-boxs">
-				<image :src="avatar.length > 0 ? imgSrc(avatar) : src" @click="handleUpImg"></image>
+			<view class="img-boxs" @click="handleUpImg">
+				<image :src="imgSrc(avatar)"></image>
 				<cover-view>修改头像</cover-view>
 			</view>
 			<!-- <u-avatar :src="avatar.length > 0 ? imgSrc(avatar) : src" size="80" shape="circle"></u-avatar> -->
@@ -122,6 +122,7 @@
 									formData: {// 额外的请求数据
 									},
 									success: (response) => {// 成功后的回调
+										console.log('修改成功');
 										const data = JSON.parse(response.data)
 										cache.session.setJSON('avatar', data.imgUrl)
 										this.avatar = data.imgUrl
@@ -326,7 +327,7 @@
 		height: 30px;
 		text-align: center;
 		color: #fff;
-		background-color: rgba(107, 96, 99, .4);
+		// background-color: rgba(107, 96, 99, .4);
 		position: absolute;
 		left: 50%;
 		top: 76%;

+ 74 - 11
pages/visitor/index.vue

@@ -41,7 +41,7 @@
 				更多
 			</view>
 		</view>
-		<view class="asset-box">
+		<view class="asset-box" v-show="assetList.length > 0">
 			<view class="title">
 				公开设备
 			</view>
@@ -57,24 +57,39 @@
 							{{asset.name}}
 						</view>
 						<view class="introduce">
-							<text>{{asset.introduce}}</text>
+							<text>简介:{{asset.introduce === null ? '暂无' : asset.introduce}}</text>
 						</view>
 					</view>
 				</view>
 			</view>
 		</view>
+		
+		<view class="asset-box" v-show="videoList.length > 0">
+			<view class="title">
+				公开视频
+				<view class="right" @click="toMoreVideo">更多&gt;&gt;&gt;</view>
+			</view>
+			
+			<view class="list">
+				<view class="video" v-for="(video, index) in videoList" :key="video.id">
+					<video :src="playerURL(video.url)" controls :id="video.id" :data-id="video.id" :title="video.name" @play="videoPlay" :type="video.type"></video>
+					<view class="info">{{video.name}}</view>
+				</view>
+			</view>
+		</view>
 	</view>
 </template>
 
 <script>
-	import { assetList, studyNew, getImage } from '@/api/visitor.js'
+	import { assetList, studyNew, getImage, demoVideo, playerVideo } from '@/api/visitor.js'
 	export default {
 		name: 'Visitor-Index',
 		data() {
 			return {
 				studyNumber: 3,
 				assetList: [],
-				studyList: []
+				studyList: [],
+				videoList: []
 			}
 		},
 		methods: {
@@ -86,9 +101,30 @@
 			getNewStudy() {
 				studyNew(this.studyNumber).then(res => {
 					this.studyList = res
-					console.log('研究成果数据', res);
 				})
 			},
+			getDemoVideo() {
+				demoVideo(1, 3).then(res => {
+					this.videoList = res.data.rows
+				})
+			},
+			playerURL(url) {
+				return playerVideo(url)
+			},
+			videoPlay(e) {
+				// 获取当前视频id
+				let currentId = e.currentTarget.dataset.id;
+				// uni.createVideoContext获取视频上下文对象
+				this.videoContent = uni.createVideoContext(currentId);
+				// 获取json对象并遍历, 停止非当前视频
+				let videoList = this.videoList;
+				for (let i = 0; i < videoList.length; i++) {
+					let temp = videoList[i].id;
+					if (temp !== currentId) {
+						uni.createVideoContext(temp).pause();
+					}
+				}
+			},
 			imgSrc(src) {
 				return getImage(src)
 			},
@@ -103,7 +139,6 @@
 				});
 			},
 			toDetail(asset) {
-				console.log('资产信息', asset);
 				uni.navigateTo({
 					url: '/pages/visitor/assetDetail/assetDetail?barCode=' + asset.barCode
 				});
@@ -112,11 +147,17 @@
 				uni.navigateTo({
 					url:'/pages/notice/notice?id='+id,
 				})
+			},
+			toMoreVideo() {
+				uni.navigateTo({
+					url: '/pages/visitor/modeVideo/modeVideo'
+				});
 			}
 		},
 		onLoad() {
 			this.getNewStudy()
 			this.getAssetList()
+			this.getDemoVideo()
 		}
 	}
 </script>
@@ -134,12 +175,12 @@
 			background-color: #fff;
 			border-radius: 20rpx;
 			padding: 10rpx 20rpx;
-			box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;
+			// box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;
 			
 			.title{
 				width: 100%;
 				text-align: center;
-				font-weight: bold;
+				// font-weight: bold;
 				font-size: $uni-title-font-size;
 				margin-bottom: 40rpx;
 			}
@@ -179,9 +220,18 @@
 			margin-top: 40rpx;
 			
 			.title{
-				font-weight: bold;
+				font-weight: 500;
 				font-size: $uni-title-font-size;
 				margin-bottom: 20rpx;
+				position: relative;
+				
+				.right{
+					position: absolute;
+					font-size: 28rpx;
+					font-weight: 400;
+					right: 20rpx;
+					top: 25%;
+				}
 			}
 			
 			.list{
@@ -191,7 +241,7 @@
 					align-items: center;
 					height: 260rpx;
 					border-radius: 20rpx;
-					box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;
+					// box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;
 					
 					padding: 60rpx 30rpx;
 					margin-bottom: 45rpx;
@@ -216,11 +266,24 @@
 							font-size: $uni-font-size;
 							display: -webkit-box;
 							-webkit-box-orient: vertical;
-							-webkit-line-clamp: 4;
+							-webkit-line-clamp: 3;
 							overflow: hidden;
 						}
 					}
 				}
+				
+				.video {
+					text-align: center;
+					// box-shadow: rgba(17, 17, 26, 0.1) 0px 1px 0px;
+					margin-bottom: 50rpx;
+					
+					&:last-child {
+						margin-bottom: 20rpx;
+					}
+					.info {
+						padding: 10rpx;
+					}
+				}
 			}
 		}
 	}

+ 3 - 2
utils/baseurl.js

@@ -1,7 +1,8 @@
-//let devUrl = 'https://primeforcetech.cn:16061/prod-api';
 let devUrl = 'https://equipmgt.primeforcetech.cn/prod-api';
-// let devUrl = 'http://localhost:80/dev-api';
 let prodUrl = 'https://equipmgt.primeforcetech.cn/prod-api';  //  443
+
+// let devUrl = 'http://localhost/dev-api';
+
 let baseUrl = process.env.NODE_ENV === 'development' ? devUrl : prodUrl;
 
 export default baseUrl;