Browse Source

添加库点视频

wangchao 3 years ago
parent
commit
3906ade074

+ 9 - 0
pages.json

@@ -1080,6 +1080,15 @@
             
         }
         
+        ,{
+            "path" : "pages/user/depotMonitoring",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "库点监控",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"subpackages": [{
 			"root": "pageA",

+ 254 - 0
pages/user/depotMonitoring.vue

@@ -0,0 +1,254 @@
+<template>
+	<view class="wrap">
+		<view class='title'>库点监控管理</view>
+		<view class="dropdown">
+			<view class="left">仓库名称</view>
+			<view class="right" @click='show1=true'>
+				<view>{{warehouseName}}</view>
+				<u-icon name="arrow-right" color=""></u-icon>
+				<u-picker @confirm="warehousechange" range-key='warehouseName' mode="selector" v-model="show1"
+					:range="warehouseList"></u-picker>
+			</view>
+		</view>
+		<view class="content">
+			<view class='title'>监控视频</view>
+			<view class="video-list">
+				<view class="video-list-item" v-for="(item,index) in videoList" :key="index">
+					<view class="img-content" v-show="!item.isPlay">
+						<image class="img play" src="../../static/img/play-btn.png" mode=""  @click="playVideo(item)"></image>
+					</view>
+					<iframe class='video-iframe' v-show="item.isPlay"  :src="item.src" width="" height="" allowfullscreen="true"
+						webkitallowfullscreen="true" mozallowfullscreen="true"
+						allow="autoplay; fullscreen; microphone;"></iframe>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+<script>
+	import {
+		mapState
+	} from 'vuex';
+
+	export default {
+		components: {
+
+		},
+		data() {
+			return {
+				show1: false,
+				warehouseName: '',
+				warehouseList: [],
+				monitorUrl2:'',
+				videoList:[
+					{
+					src:'123',
+					isPlay:false
+				},
+				{
+					src:'123',
+					isPlay:false
+				},
+				{
+					src:'123',
+					isPlay:false
+				},
+				{
+					src:'123',
+					isPlay:false
+				},
+				]
+			}
+		},
+
+		onLoad() {
+
+		},
+		// #ifndef MP
+		onNavigationBarButtonTap(e) {
+			const index = e.index;
+			if (index === 0) {
+				this.navTo('/pages/set/set');
+			} else if (index === 1) {
+				// #ifdef APP-PLUS
+				const pages = getCurrentPages();
+				const page = pages[pages.length - 1];
+				const currentWebview = page.$getAppWebview();
+				currentWebview.hideTitleNViewButtonRedDot({
+					index
+				});
+				// #endif
+				uni.navigateTo({
+					url: '/pages/notice/notice'
+				})
+			}
+		},
+		// #endif
+		computed: {
+			...mapState(['hasLogin', 'userInfo']),
+		},
+		onShow() {
+			this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
+				console.log("checkSession", res)
+				if (res.data.data == "INVALID") {
+					uni.showModal({
+						title: '登录提示',
+						content: '当前登入信息验证失败,是否重新登录?',
+						showCancel: true,
+						confirmText: '登录',
+						success: (e) => {
+							if (e.confirm) {
+								uni.navigateTo({
+									url: '/pages/public/login'
+								})
+							}
+						},
+						fail: () => {},
+						complete: () => {}
+					})
+				}
+			})
+			this.$api.doRequest('get', '/openServiceInfo/selectCommonCompany', {
+				phone: this.userInfo.phone
+			}).then(res => {
+				if (res.data.code == 200) {
+					debugger
+					this.init(res.data.data[0].compId)
+				}
+			})
+			console.log("hasLogin", this.hasLogin)
+		},
+		methods: {
+			/**
+			 * 统一跳转接口,拦截未登录路由
+			 * navigator标签现在默认没有转场动画,所以用view
+			 */
+			navTo(url) {
+				if (!this.hasLogin) {
+					url = '/pages/public/login';
+				}
+				uni.navigateTo({
+					url
+				})
+			},
+			init(compId) {
+				console.log(this.userInfo)
+				this.$api.doRequest('get', '/warehouseBaseInfo/selectWarehouseSelf', {
+					compId: compId,
+				}).then(res => {
+					if (res.data.data.length != 0) {
+						console.log('res', res.data.data)
+						this.warehouseName = res.data.data[0].warehouseName
+						// 			let _showData = uni.getStorageSync("erpSelectWarehous")
+						// 			let _showCWData = uni.getStorageSync("erpSelectWarehousCW")
+						// 			this.allWarehouse = res.data.data
+						this.warehouseList = res.data.data;
+						// 			if (_showData) {
+						// 				this.warehouseName = _showData.warehouseName
+						// 				this.compId = _showData.compId
+						// 				this.agent = _showData.agent
+						// 				this.binNumber = _showCWData.binNumber
+						// 				this.warehouseCWList = _showData.positionInfos
+						// 				this.warehouseId = _showData.id
+						// 				this.baseId = _showCWData.baseId
+						// 				this.positionId = _showCWData.id
+						// 				this.personCharge = _showData.personCharge
+						// 			} else {
+						// 				this.allWarehouse = res.data.data
+						// 				this.warehouseName = res.data.data[0].warehouseName
+						// 				this.warehouseList = res.data.data;
+						// 				this.compId = res.data.data[0].compId
+						// 				this.agent = res.data.data[0].agent
+						// 				this.binNumber = res.data.data[0].positionInfos[0].binNumber
+						// 				this.warehouseCWList = res.data.data[0].positionInfos
+						// 				this.warehouseId = res.data.data[0].id
+						// 				this.baseId = res.data.data[0].positionInfos[0].baseId
+						// 				this.positionId = res.data.data[0].positionInfos[0].id
+						// 				this.personCharge = res.data.data[0].personCharge
+						// 			}
+
+					} else {
+						this.warehouseList = []
+						this.warehouseCWList = []
+						this.warehouseName = '暂无仓库'
+						this.binNumber = '暂无'
+					}
+				})
+			},
+			warehousechange(e) {
+				this.warehouseName = this.warehouseList[e[0]].warehouseName
+				console.log(this.warehouseName)
+			},
+			playVideo(item){
+				console.log(item)
+				item.isPlay = true
+			}
+		}
+	}
+</script>
+<style lang='scss' scoped>
+	page {
+		background: #F5F6FA;
+	}
+
+	.wrap {
+		background: #fff;
+		margin: 10px;
+		border-radius: 10px;
+		padding: 10px;
+
+		.title {
+			font-size: 16px;
+			font-weight: 700;
+		}
+
+		.dropdown {
+			display: flex;
+			margin: 20rpx 0;
+			justify-content: space-between;
+			/* border-bottom: 1px solid #EEEEEE; */
+			padding-bottom: 20rpx;
+
+			.left,
+			.right {
+				display: flex;
+				align-items: center;
+			}
+		}
+	}
+	.video-list{
+		position: relative;
+		.video-list-item{
+			position: relative;
+			height: 400rpx;
+			margin: 20rpx 0;
+			.img-content{
+				position: relative;
+				width: 100%;
+				height: 400rpx;
+				background: green;
+				.play{
+					position: absolute;
+					width: 100rpx;
+					height: 100rpx;
+					top: 0;
+					bottom: 0;
+					left: 0;
+					right: 0;
+					margin: auto;
+					z-index: 3;
+				}
+			}
+			.img{
+				
+			}
+			.video-iframe{
+				position: absolute;
+				width: 100%;
+				height: 100%;
+				z-index: 1;
+				border: 0;
+			}
+		}
+	}
+</style>

+ 30 - 3
pages/user/user.vue

@@ -31,7 +31,7 @@
 				<view style='font-size:16px;padding-left:14px;'>我的功能</view>
 				<view class="cu-list grid" :class="['col-' + gridCol,gridBorder?'':'no-border']">
 					<view class="cu-item" style='text-align:center;' v-for="(item,index) in gridList1" :key="index"
-						@click="gridClick(item, index)" v-if="index<gridCol*2">
+						@click="gridClick(item, index)" v-if="index<gridCol*2" v-show="item.show">
 						<view :class="['cuIcon-' + item.cuIcon,'text-' + item.color]">
 							<text v-if='item.num==4&&taskTip' class='badge_user'>{{taskTip}}</text>
 							<image :src="item.src" class="sign1"></image>
@@ -204,10 +204,19 @@
 						num: 6,
 						name: '数据报表',
 						// icon: 'cuIcon-edit',
-						src: '../../static/img/sign/myContract@2x.png',
+						src: '../../static/img/sign/shujubaobiao@2x.png',
 						tips: 0,
 						url: `/pages/user/report`,
 						show: true
+					},
+					{
+						num: 6,
+						name: '库点监控',
+						// icon: 'cuIcon-edit',
+						src: '../../static/img/sign/kudianjiankong@2x.png',
+						tips: 0,
+						url: `/pages/user/depotMonitoring`,
+						show: true
 					}
 				],
 				showTran: true,
@@ -249,7 +258,7 @@
 			this.scrollTop = e.scrollTop;
 		},
 		onShow() {
-
+			this.isShow();
 			uni.hideKeyboard()
 			uni.showTabBar()
 			this.loadData()
@@ -299,6 +308,24 @@
 			console.log("this.userInfo", this.userInfo)
 		},
 		methods: {
+			getRoles: function(role) {
+				let _roles = uni.getStorageSync('rolesList')
+				for (let i = 0; i < _roles.length; i++) {
+					if (_roles[i] == role) {
+						 return true
+					} 
+				}
+				return false
+			},
+			isShow(){debugger
+				for(let k = 0;k<this.gridList1.length;k++){
+					if(k==6){
+						this.gridList1[k].show = this.getRoles('reportData.view')
+					}else if (k==7){
+						this.gridList1[k].show = this.getRoles('monitoring.view')
+					}
+				}
+			},
 			smBtnClick() {
 				console.log(2)
 				if (!this.hasLogin) {

BIN
static/img/play-btn.png


BIN
static/img/sign/kudianjiankong@2x.png


BIN
static/img/sign/shujubaobiao@2x.png