浏览代码

视频对接

lilei 4 年之前
父节点
当前提交
aecb8acbcd

+ 1 - 1
App.vue

@@ -1,7 +1,7 @@
 <script>
 	// const uat_URL = 'http://md.test.zyucgj.com/at-employee/' // 预发布
 	// const uat_URL = 'http://192.168.16.107:7300/mock/5f5af637cb0f492ad4ee858f/app/at-employee/' // mock
-	const uat_URL = 'http://192.168.16.102:8203/at-employee/' // 本地
+	const uat_URL = 'http://192.168.16.100:8203/at-employee/' // 本地
 	const pro_URL = 'https://car.zyucgj.com/at-employee/'  // 生产
 	const buildType = 0 // 打包环境对应类型,1 生产 0 预发布
 	const buildURL = buildType ? pro_URL : uat_URL // 打包后实际对应的url

+ 8 - 1
api/store.js

@@ -14,7 +14,14 @@ export const findVsDeviceChannels = param => {
     method: 'get',
   })
 }
-// 拍照截图vs/stream/url/{streamId}/{outProtocol}
+//查询门店绑定设备
+export const findStoreVsDevice = param => {
+  return axios.request({
+    url: `storeVsDevice/findStoreVsDevice/${param.storeCode}`,
+    method: 'get',
+  })
+}
+// 拍照截图
 export const photoPaiZhao = param => {
   return axios.request({
     url: `vs/stream/streamSnapshot/${param.streamId}`,

+ 49 - 14
hybrid/html/video.html

@@ -45,7 +45,7 @@
 							<div>
 								<a-dropdown>
 									<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-item v-for="item in videoList" :key="item.gbId"> {{item.name}} </a-menu-item>
 									</a-menu>
 									<a class="ant-dropdown-link" @click="e => e.preventDefault()">
 										{{curVideo&&curVideo.name}}
@@ -185,6 +185,7 @@
 				data: {
 					xdType: 'video', // 巡店类型
 					player: null, // 播放器对象
+					videoPlayerStatus:'',// 视频播放状态
 					videoList: [], // 播放通道
 					curVideo: null, // 当前播放的视频
 					showYt: false, // 显示云台控制
@@ -245,7 +246,7 @@
 					setVideoList(data) {
 						this.videoList = JSON.parse(data)
 						this.curVideo = this.videoList[0]
-						this.videoInit()
+						this.getVideoUrl()
 					},
 					// 获取任务详情
 					getTaskDetail(data) {
@@ -259,23 +260,31 @@
 							this.showLoading = false
 					},
 					// 选择机位
-					onVideoListClick({
-						key
-					}) {
-						let v = this.videoList.find(item => item.id == key)
+					onVideoListClick({key}) {
+						let v = this.videoList.find(item => item.gbId == key)
 						if (v) {
 							this.curVideo = v
-							// 重置播放器
-							this.showYt = false
-							this.showYtbtns = false
+							this.getVideoUrl()
+						}
+					},
+					// 获取当前设备流地址
+					getVideoUrl(){
+						this.sendMsg('getVideoUrl', JSON.stringify(this.curVideo))
+					},
+					// 获取视频地址成功
+					getVideoUrlSuccess(url){
+						console.log(url)
+						// 重置播放器
+						this.showYt = false
+						this.showYtbtns = false
+						if(this.player){
 							this.player.dispose()
-							this.videoInit()
 						}
+						this.videoInit(url)
 					},
 					// 初始化播放器
-					videoInit() {
+					videoInit(videoSrc) {
 						const _this = this
-						const videoSrc = this.curVideo.videoSrc
 						// 初始化播放器
 						_this.player = new Aliplayer({
 							'id': 'player-con',
@@ -336,7 +345,8 @@
 						})
 						// 控制栏
 						_this.player.on('playing', function() {
-							_this.showYt = true
+							// _this.showYt = true
+							_this.videoPlayerStatus = 'playing'
 						})
 						_this.player.on('error', function(e) {
 							console.log(JSON.stringify(e), 'error')
@@ -367,7 +377,6 @@
 					},
 					// 打开抓拍照片弹框
 					openCamera(index) {
-						this.showPz = true
 						this.activeZbIndex = index
 						this.sendMsg('getWinStatus', JSON.stringify({
 							key: 'showPz',
@@ -376,6 +385,32 @@
 						// 当前查看的指标对象
 						let obj = this.zbItem[this.activeZbIndex]
 						this.curZbItem = JSON.parse(JSON.stringify(obj))
+						// 抓拍
+						this.takePhotos()
+					},
+					// 抓拍
+					takePhotos(){
+						this.sendMsg('takePhotos',JSON.stringify({
+							streamId: this.curVideo.streamId,
+							videoPlayerStatus: this.videoPlayerStatus,
+							type: 1
+						}))
+					},
+					// 拍照成功后,返回图片地址
+					takePhotoSuccess(url){
+						let obj = {
+							id: new Date().getTime(),
+							photoPath: url
+						}
+						console.log(this.curZbItem.taskTargetPhotoVOList)
+						if(this.curZbItem.taskTargetPhotoVOList){
+							this.curZbItem.taskTargetPhotoVOList = [obj]
+						}else{
+							this.curZbItem.taskTargetPhotoVOList.push(obj)
+						}
+						
+						// 显示弹框
+						this.showPz = true
 					},
 					// 关闭抓拍弹框
 					onClosePz() {

+ 45 - 5
pages/shopTour/shopTour.vue

@@ -9,7 +9,7 @@
 	import {taskStart,submitTask,updateTaskItem,getTaskDetail} from '@/api/task'
 	import {getTaskItem,delTaskItem} from '@/api/taskItem'
 	import {taskTargetSave,taskCommentsSave} from '@/api/taskTarget'
-	import {findVsDeviceChannels,photoPaiZhao,getVideoUrl} from '@/api/store'
+	import {findVsDeviceChannels,findStoreVsDevice,photoPaiZhao,getVideoUrl} from '@/api/store'
 	export default {
 		data() {
 			return {
@@ -34,6 +34,14 @@
 					let d = JSON.parse(data.msg)
 					this[d.key] = d.val
 				}
+				// 获取视频地址
+				if(data.action == 'getVideoUrl'){
+					this.getStoreVideoUrl(JSON.parse(data.msg))
+				}
+				// 抓拍图片
+				if(data.action == 'takePhotos'){
+					this.takePhotos(JSON.parse(data.msg))
+				}
 				// 保存编辑后的图片
 				if(data.action == 'saveEditImg'){
 					this.uploadImg(data.msg)
@@ -93,6 +101,32 @@
 					})
 				})
 			},
+			// 拍照截图,data.type 1 是列表按钮触发的,2 是弹框里触发的
+			takePhotos(data){
+				if(data.videoPlayerStatus == 'playing'){
+					uni.showLoading({
+						mask: true,
+						title: '正在抓拍图片...'
+					})
+					photoPaiZhao({streamId:data.streamId}).then(res=>{
+						console.log(res)
+						if(res.data){
+							this.wv.evalJS("vm.takePhotoSuccess('"+res.data.url+"')")
+						}else{
+							uni.showToast({
+								icon:'none',
+								title: res.message || '拍照截图失败,稍后重试'
+							})
+						}
+						uni.hideLoading()
+					})
+				}else{
+					uni.showToast({
+						icon:'none',
+						title: '开始播放视频后才可以拍照截图'
+					})
+				}
+			},
 			// 删除图片
 			delImgs(index){
 				const _this = this;
@@ -198,10 +232,16 @@
 			},
 			// 获取视频列表
 			getVideoList(){
-				findVsDeviceChannels({storeId:this.storeId}).then(res=>{
-					console.log(res,'----')
-					if(res.status==200){
-						this.wv.evalJS("vm.setVideoList('"+JSON.stringify(res.data)+"')")
+				let list = this.$store.state.vuex_storeVideoList
+				this.wv.evalJS("vm.setVideoList('"+JSON.stringify(list)+"')")
+			},
+			// 获取视频地址
+			getStoreVideoUrl(item){
+				console.log({streamId:item.streamId,outProtocol:"hls"})
+				getVideoUrl({streamId:item.streamId,outProtocol:"hls"}).then(res=>{
+					console.log(res)
+					if(res.status == 200&&res.data){
+						this.wv.evalJS("vm.getVideoUrlSuccess('"+res.data.url+"')")
 					}
 				})
 			},

+ 4 - 0
pages/spotCheckConfigure/evaluateStore.vue

@@ -33,6 +33,10 @@
 				type: ''  // 单选或多选
 			}
 		},
+		onUnload() {
+			this.value = []
+			this.list = []
+		},
 		onLoad(opts) {
 			this.value = opts.item&&JSON.parse(opts.item)||[]
 			console.log(this.value)

+ 2 - 2
pages/spotCheckConfigure/spotCheckDetail/spotCheckDetail.vue

@@ -7,11 +7,11 @@
 			</view>
 			<view class="content-item">
 				<text>任务周期</text>
-				<view>{{pageData.cycleType}}</view>
+				<view>{{pageData.cycleTypeDictValue}}</view>
 			</view>
 			<view class="content-item">
 				<text>执行日期</text>
-				<view>{{pageData.buildDateDay||pageData.buildDateWeekList}}</view>
+				<view>{{pageData.buildDateDay||pageData.buildDateWeekDictValue}}</view>
 			</view>
 			<view class="content-item">
 				<text>执行时间</text>

+ 22 - 4
pages/videoShopTour/videoShopTour.vue

@@ -33,7 +33,7 @@
 
 <script>
 	import { clzConfirm } from '@/libs/tools.js'
-	import { findStoreList } from '@/api/store.js'
+	import { findStoreList,findStoreVsDevice } from '@/api/store.js'
 	import { queryCurrentTaskUsing } from '@/api/task.js'
 	export default{
 		data(){
@@ -51,7 +51,7 @@
 			init(){
 				this.status = 'loading'
 				// 获取门店列表
-				findStoreList().then(res => {
+				findStoreList({}).then(res => {
 					if(res.status == 200){
 						this.list = res.data || []
 						this.noDataText = '暂无数据'  //  有列表数据时不显示,因此只用默认设置为无数据时所需显示的'暂无数据'即可
@@ -76,8 +76,26 @@
 			},
 			//  开始巡店
 			goPage(item){
-				//  校验是否有历史巡店记录
-				//  type  VIDEO_INSPECTION:视频巡店、SPOT_INSPECTION:现场巡店、POINT_INSPECTION:点检任务
+				console.log(item)
+				// 判断当前门店是否已绑定设备
+				findStoreVsDevice({storeCode:item.code}).then(res=>{
+					console.log(res)
+					if(res.data.length){
+						// 门店下的设备
+						this.$u.vuex('vuex_storeVideoList',res.data)
+						//  校验是否有历史巡店记录
+						this.queryHasTaskUsing(item)
+					}else{
+						uni.showToast({
+							icon: 'none',
+							title: '当前门店没用绑定设备,暂时不能视频巡店'
+						})
+					}
+				})
+			},
+			// 判断当前门店是否已绑定设备
+			// type  VIDEO_INSPECTION:视频巡店、SPOT_INSPECTION:现场巡店、POINT_INSPECTION:点检任务
+			queryHasTaskUsing(item){
 				queryCurrentTaskUsing({ storeId: item.id, type: 'VIDEO_INSPECTION' }).then(res => {
 					if(res.status == 200){
 						if(res.data){  //  为true有历史巡店记录

+ 1 - 0
store/index.js

@@ -98,6 +98,7 @@ const store = new Vuex.Store({
 		vuex_heartInterId: null, // 心跳id
 		vuex_reConnectId: null, // 重连id
 		vuex_messagUnReadCount: 0, // 消息未读数
+		vuex_storeVideoList: [], // 视频巡店时的当前门店设备信息
 	},
 	mutations: {
 		$uStore(state, payload) {

文件差异内容过多而无法显示
+ 0 - 0
unpackage/dist/dev/app-plus/app-service.js


+ 49 - 14
unpackage/dist/dev/app-plus/hybrid/html/video.html

@@ -45,7 +45,7 @@
 							<div>
 								<a-dropdown>
 									<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-item v-for="item in videoList" :key="item.gbId"> {{item.name}} </a-menu-item>
 									</a-menu>
 									<a class="ant-dropdown-link" @click="e => e.preventDefault()">
 										{{curVideo&&curVideo.name}}
@@ -185,6 +185,7 @@
 				data: {
 					xdType: 'video', // 巡店类型
 					player: null, // 播放器对象
+					videoPlayerStatus:'',// 视频播放状态
 					videoList: [], // 播放通道
 					curVideo: null, // 当前播放的视频
 					showYt: false, // 显示云台控制
@@ -245,7 +246,7 @@
 					setVideoList(data) {
 						this.videoList = JSON.parse(data)
 						this.curVideo = this.videoList[0]
-						this.videoInit()
+						this.getVideoUrl()
 					},
 					// 获取任务详情
 					getTaskDetail(data) {
@@ -259,23 +260,31 @@
 							this.showLoading = false
 					},
 					// 选择机位
-					onVideoListClick({
-						key
-					}) {
-						let v = this.videoList.find(item => item.id == key)
+					onVideoListClick({key}) {
+						let v = this.videoList.find(item => item.gbId == key)
 						if (v) {
 							this.curVideo = v
-							// 重置播放器
-							this.showYt = false
-							this.showYtbtns = false
+							this.getVideoUrl()
+						}
+					},
+					// 获取当前设备流地址
+					getVideoUrl(){
+						this.sendMsg('getVideoUrl', JSON.stringify(this.curVideo))
+					},
+					// 获取视频地址成功
+					getVideoUrlSuccess(url){
+						console.log(url)
+						// 重置播放器
+						this.showYt = false
+						this.showYtbtns = false
+						if(this.player){
 							this.player.dispose()
-							this.videoInit()
 						}
+						this.videoInit(url)
 					},
 					// 初始化播放器
-					videoInit() {
+					videoInit(videoSrc) {
 						const _this = this
-						const videoSrc = this.curVideo.videoSrc
 						// 初始化播放器
 						_this.player = new Aliplayer({
 							'id': 'player-con',
@@ -336,7 +345,8 @@
 						})
 						// 控制栏
 						_this.player.on('playing', function() {
-							_this.showYt = true
+							// _this.showYt = true
+							_this.videoPlayerStatus = 'playing'
 						})
 						_this.player.on('error', function(e) {
 							console.log(JSON.stringify(e), 'error')
@@ -367,7 +377,6 @@
 					},
 					// 打开抓拍照片弹框
 					openCamera(index) {
-						this.showPz = true
 						this.activeZbIndex = index
 						this.sendMsg('getWinStatus', JSON.stringify({
 							key: 'showPz',
@@ -376,6 +385,32 @@
 						// 当前查看的指标对象
 						let obj = this.zbItem[this.activeZbIndex]
 						this.curZbItem = JSON.parse(JSON.stringify(obj))
+						// 抓拍
+						this.takePhotos()
+					},
+					// 抓拍
+					takePhotos(){
+						this.sendMsg('takePhotos',JSON.stringify({
+							streamId: this.curVideo.streamId,
+							videoPlayerStatus: this.videoPlayerStatus,
+							type: 1
+						}))
+					},
+					// 拍照成功后,返回图片地址
+					takePhotoSuccess(url){
+						let obj = {
+							id: new Date().getTime(),
+							photoPath: url
+						}
+						console.log(this.curZbItem.taskTargetPhotoVOList)
+						if(this.curZbItem.taskTargetPhotoVOList){
+							this.curZbItem.taskTargetPhotoVOList = [obj]
+						}else{
+							this.curZbItem.taskTargetPhotoVOList.push(obj)
+						}
+						
+						// 显示弹框
+						this.showPz = true
 					},
 					// 关闭抓拍弹框
 					onClosePz() {

部分文件因为文件数量过多而无法显示