Browse Source

机位切换

lilei 4 years ago
parent
commit
2899863f8a

+ 27 - 12
hybrid/html/video.html

@@ -6,7 +6,6 @@
 <title>远程巡店</title>
 <script src="js/vue@2.6.11"></script>
 <script src="js/uni.webview.1.5.2.js"></script>
-<script src="js/axios.min.js"></script>
 <!-- antd ui -->
 <script type="text/javascript" charset="utf-8" src="js/moment.min.js"></script>
 <script type="text/javascript" charset="utf-8" src="js/moment-with-locales.min.js"></script>
@@ -46,15 +45,11 @@
 			<div></div>
             <div>
               <a-dropdown>
-                <a-menu slot="overlay">
-                  <a-menu-item key="1"> 收银台 </a-menu-item>
-                  <a-menu-item key="2"> 接车区 </a-menu-item>
-                  <a-menu-item key="3"> 洗车工位 </a-menu-item>
-                  <a-menu-item key="4"> 维修工位 </a-menu-item>
-                  <a-menu-item key="5"> 客户休息区 </a-menu-item>
+                <a-menu selectable slot="overlay" @click="onVideoListClick">
+                  <a-menu-item v-for="item in videoList" :key="item.id"> {{item.name}} </a-menu-item>
                 </a-menu>
 				<a class="ant-dropdown-link" @click="e => e.preventDefault()">
-				  收银台 <a-icon type="down" />
+				  {{curVideo&&curVideo.name}} <a-icon type="down" />
 				</a>
               </a-dropdown>
             </div>
@@ -196,6 +191,8 @@
 	  data: {
 		  xdType:'video', // 巡店类型
 		  player: null, // 播放器对象
+		  videoList: [], // 播放通道
+		  curVideo: null, // 当前播放的视频
 		  showYt: false, // 显示云台控制
 		  showYtbtns: false,
 		  showPz: false,// 显示拍照弹框
@@ -219,7 +216,6 @@
 		mounted () {
 		  let _this = this
 		  moment.locale('zh-cn');
-		  this.videoInit()
 		  // 耗时计算
 		  this.hsID = setInterval(function(){
 		  	_this.haoshi()
@@ -238,11 +234,17 @@
 			  this.isDelItem = false
 			  this.showPz = false
 		  },
-		  // 设置类型
+		  // 设置巡店类型
 		  setTyps(type){
 			  console.log(type)
 			  this.xdType = type
 		  },
+		  // 设置视频列表
+		  setVideoList(data){
+			  this.videoList = JSON.parse(data)
+			  this.curVideo = this.videoList[0]
+			  this.videoInit()
+		  },
 		  // 获取任务详情
 		  getTaskDetail(data){
 			  this.kptj = JSON.parse(data)
@@ -253,15 +255,28 @@
 			  this.kpItem = JSON.parse(data)
 			  this.zbItem = this.kpItem[this.activeIndex].taskTargetVOList
 		  },
+		  // 选择机位
+		  onVideoListClick({ key }){
+			  let v = this.videoList.find(item=>item.id == key)
+			  if(v){
+				  this.curVideo = v
+				  // 重置播放器
+				  this.showYt = false
+				  this.showYtbtns = false
+				  this.player.dispose()
+				  this.videoInit()
+			  }
+		  },
 		  // 初始化播放器
 		  videoInit(){
-			  const _this = this
 			  // 设置标题
 			  document.title = '远程巡店'
+			  const _this = this
+			  const videoSrc = this.curVideo.videoSrc
 			  // 初始化播放器
 			  _this.player = new Aliplayer({
 			    'id': 'player-con',
-			    'source': 'https://player.alicdn.com/video/aliyunmedia.mp4',
+			    'source': videoSrc,
 			    'width': '100%',
 			    'height': '240px',
 			    'autoplay': false,

+ 11 - 2
pages/shopTour/shopTour.vue

@@ -7,9 +7,9 @@
 <script>
 	import { clzConfirm,saveBase64ToAliOss } from '@/libs/tools'
 	import {taskStart,submitTask,updateTaskItem,getTaskDetail} from '@/api/task'
-	import {getTaskItem,delTaskItem} from '@/api/taskItem.js'
+	import {getTaskItem,delTaskItem} from '@/api/taskItem'
 	import {taskTargetSave,taskCommentsSave} from '@/api/taskTarget'
-	
+	import {findVsDeviceChannels} from '@/api/store'
 	export default {
 		data() {
 			return {
@@ -180,6 +180,14 @@
 						})
 					}
 				})
+			},
+			// 获取视频列表
+			getVideoList(){
+				findVsDeviceChannels({storeId:this.storeId}).then(res=>{
+					if(res.status==200){
+						this.wv.evalJS("vm.setVideoList('"+JSON.stringify(res.data)+"')")
+					}
+				})
 			}
 		},
 		onLoad(options) {
@@ -198,6 +206,7 @@
 			 setTimeout(function() {
 				_this.wv = currentWebview.children()[0]
 				_this.wv.evalJS("vm.setTyps('"+_this.types+"')")
+				_this.getVideoList() // 获取视频列表
 				if(_this.restart == 1){ // 重新开始
 					_this.creatTask(1)
 				}else if(_this.restart == 0){ // 继续上次巡店

File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/dev/app-plus/app-service.js


+ 27 - 12
unpackage/dist/dev/app-plus/hybrid/html/video.html

@@ -6,7 +6,6 @@
 <title>远程巡店</title>
 <script src="js/vue@2.6.11"></script>
 <script src="js/uni.webview.1.5.2.js"></script>
-<script src="js/axios.min.js"></script>
 <!-- antd ui -->
 <script type="text/javascript" charset="utf-8" src="js/moment.min.js"></script>
 <script type="text/javascript" charset="utf-8" src="js/moment-with-locales.min.js"></script>
@@ -46,15 +45,11 @@
 			<div></div>
             <div>
               <a-dropdown>
-                <a-menu slot="overlay">
-                  <a-menu-item key="1"> 收银台 </a-menu-item>
-                  <a-menu-item key="2"> 接车区 </a-menu-item>
-                  <a-menu-item key="3"> 洗车工位 </a-menu-item>
-                  <a-menu-item key="4"> 维修工位 </a-menu-item>
-                  <a-menu-item key="5"> 客户休息区 </a-menu-item>
+                <a-menu selectable slot="overlay" @click="onVideoListClick">
+                  <a-menu-item v-for="item in videoList" :key="item.id"> {{item.name}} </a-menu-item>
                 </a-menu>
 				<a class="ant-dropdown-link" @click="e => e.preventDefault()">
-				  收银台 <a-icon type="down" />
+				  {{curVideo&&curVideo.name}} <a-icon type="down" />
 				</a>
               </a-dropdown>
             </div>
@@ -196,6 +191,8 @@
 	  data: {
 		  xdType:'video', // 巡店类型
 		  player: null, // 播放器对象
+		  videoList: [], // 播放通道
+		  curVideo: null, // 当前播放的视频
 		  showYt: false, // 显示云台控制
 		  showYtbtns: false,
 		  showPz: false,// 显示拍照弹框
@@ -219,7 +216,6 @@
 		mounted () {
 		  let _this = this
 		  moment.locale('zh-cn');
-		  this.videoInit()
 		  // 耗时计算
 		  this.hsID = setInterval(function(){
 		  	_this.haoshi()
@@ -238,11 +234,17 @@
 			  this.isDelItem = false
 			  this.showPz = false
 		  },
-		  // 设置类型
+		  // 设置巡店类型
 		  setTyps(type){
 			  console.log(type)
 			  this.xdType = type
 		  },
+		  // 设置视频列表
+		  setVideoList(data){
+			  this.videoList = JSON.parse(data)
+			  this.curVideo = this.videoList[0]
+			  this.videoInit()
+		  },
 		  // 获取任务详情
 		  getTaskDetail(data){
 			  this.kptj = JSON.parse(data)
@@ -253,15 +255,28 @@
 			  this.kpItem = JSON.parse(data)
 			  this.zbItem = this.kpItem[this.activeIndex].taskTargetVOList
 		  },
+		  // 选择机位
+		  onVideoListClick({ key }){
+			  let v = this.videoList.find(item=>item.id == key)
+			  if(v){
+				  this.curVideo = v
+				  // 重置播放器
+				  this.showYt = false
+				  this.showYtbtns = false
+				  this.player.dispose()
+				  this.videoInit()
+			  }
+		  },
 		  // 初始化播放器
 		  videoInit(){
-			  const _this = this
 			  // 设置标题
 			  document.title = '远程巡店'
+			  const _this = this
+			  const videoSrc = this.curVideo.videoSrc
 			  // 初始化播放器
 			  _this.player = new Aliplayer({
 			    'id': 'player-con',
-			    'source': 'https://player.alicdn.com/video/aliyunmedia.mp4',
+			    'source': videoSrc,
 			    'width': '100%',
 			    'height': '240px',
 			    'autoplay': false,

Some files were not shown because too many files changed in this diff