Compare commits

..

2 Commits

Author SHA1 Message Date
lxz 0813c46109 s 2024-01-09 13:39:17 +08:00
lxz 792c85c05c yemian 2024-01-08 18:28:46 +08:00
12 changed files with 78 additions and 47 deletions

View File

@ -2,8 +2,8 @@
"name": "种植溯源", "name": "种植溯源",
"appid": "__UNI__D087881", "appid": "__UNI__D087881",
"description": "", "description": "",
"versionName": "1.0.3", "versionName": "1.0.4",
"versionCode": 103, "versionCode": 104,
"transformPx": false, "transformPx": false,
/* 5+App */ /* 5+App */
"app-plus": { "app-plus": {

View File

@ -101,7 +101,7 @@
{ {
"path": "pages/live/live", "path": "pages/live/live",
"style": { "style": {
"navigationBarTitleText": "苗情檢察", "navigationBarTitleText": "苗情监测",
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#35D190", "navigationBarBackgroundColor": "#35D190",
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",
@ -124,16 +124,7 @@
} }
}, },
{
"path": "pages/live/live1",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "苗情监测",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#35D190",
"navigationBarTextStyle": "white"
}
},
{ {
"path": "pages/addLand/addLand", "path": "pages/addLand/addLand",
"style": { "style": {

View File

@ -460,8 +460,8 @@
userInfo.value = res.data userInfo.value = res.data
video_url.value = res.data.video_url video_url.value = res.data.video_url
testUser() testUser()
videoCover.value = userInfo.value.videoCover || "/static/main/index/videoCover.png" videoCover.value = userInfo.value.video_cover || "/static/main/index/videoCover.png"
uni.getStorageSync('SY_VIDEO_POSTS') || "/static/main/index/videoCover.png" // uni.getStorageSync('SY_VIDEO_POSTS') || "/static/main/index/videoCover.png"
threshold = res.data?.monitor?.threshold || "" threshold = res.data?.monitor?.threshold || ""
if (Object.keys(res.data).length > 0) { if (Object.keys(res.data).length > 0) {
getlist3(res.data.id) getlist3(res.data.id)

View File

@ -12,8 +12,7 @@
</view> </view>
</view> </view>
<view class="video" style="position: relative;"> <view class="video" style="position: relative;">
<u--image src="https://ceshi-worker-task.lihaink.cn/uploads/images/20231223/20231223092144475437017.png" <u--image :src="videoCover" width="100%" height="500rpx" @click="goLive" v-if="videoUrl"></u--image>
width="100%" height="500rpx" @click="goLive" v-if="videoUrl"></u--image>
<u--image :src="u('K')" v-else width="100%" height="510rpx"></u--image> <u--image :src="u('K')" v-else width="100%" height="510rpx"></u--image>
<view class="" <view class=""
style="width: 100%;height: 100%;background-color: rgba(0, 0, 0, .5);position: absolute;top: 1px;" style="width: 100%;height: 100%;background-color: rgba(0, 0, 0, .5);position: absolute;top: 1px;"
@ -191,6 +190,7 @@
}] }]
]); ]);
const userInfo = ref("") const userInfo = ref("")
const videoCover = ref("")
onLoad((option) => { onLoad((option) => {
typeID.value = option.id; typeID.value = option.id;
lindexist({ lindexist({
@ -198,7 +198,8 @@
}).then(res => { }).then(res => {
userInfo.value = res.data userInfo.value = res.data
videoUrl.value = res.data.video_url videoUrl.value = res.data.video_url
console.log(videoUrl.value, 25545) videoCover.value = userInfo.value.video_cover || "/static/main/index/videoCover.png"
console.log(userInfo.value, 25545)
// console.log(userInfo.value) // console.log(userInfo.value)
}) })

View File

@ -5,8 +5,6 @@
:autoplay="true" :style="'width: '+ windowWidth +'px; height: '+ boxStyle.height +'px;'" :src="videoUrl" :autoplay="true" :style="'width: '+ windowWidth +'px; height: '+ boxStyle.height +'px;'" :src="videoUrl"
id="video"></video> id="video"></video>
</view> </view>
<!-- <image :src="imgSrc" mode=""></image> -->
<!-- <button @click="setUrl(videoUrl)">设置链接</button> -->
</view> </view>
</template> </template>
@ -32,6 +30,10 @@
windowWidth: '', windowWidth: '',
deviceId: "", deviceId: "",
shwovideo: false, shwovideo: false,
shwovideoTimer: "",
initFailTimer: "",
flag: true
} }
}, },
@ -39,8 +41,6 @@
this.deviceId = option.device this.deviceId = option.device
this.videoUrl = option.url this.videoUrl = option.url
this.videoUrl = this.replaceLastThreeChars(this.videoUrl, "mp4"); this.videoUrl = this.replaceLastThreeChars(this.videoUrl, "mp4");
console.log(this.videoUrl)
this.subNvue = uni.getSubNVueById('subNvue'); // this.subNvue = uni.getSubNVueById('subNvue'); //
this.subNvue.show() // this.subNvue.show() //
let data = { let data = {
@ -49,19 +49,44 @@
scene: 'app', scene: 'app',
} }
this.openScoket(data) this.openScoket(data)
this.canplay(option.device)
this.platform = uni.getSystemInfoSync().platform this.platform = uni.getSystemInfoSync().platform
this.windowWidth = uni.getSystemInfoSync().screenWidth // this.windowWidth = uni.getSystemInfoSync().screenWidth //
this.boxStyle.width = this.windowWidth + 'px' //px this.boxStyle.width = this.windowWidth + 'px' //px
this.wHeight = uni.getSystemInfoSync().screenHeight; // this.wHeight = uni.getSystemInfoSync().screenHeight; //
this.boxStyle.height = this.wHeight; // this.boxStyle.height = this.wHeight; //
this.initFailTimer = setTimeout(() => {
setTimeout(() => { if (this.flag) {
this.shwovideo = true uni.$u.toast("初始化失败,请重新进入")
console.log("showvideo") setTimeout(() => {
}, 2000) uni.navigateBack()
}, 1000)
}
}, 60000)
}, },
methods: { methods: {
canplay(id) {
let that = this
this.shwovideoTimer = setInterval(() => {
uni.request({
url: `http://rtsp.lihaink.cn/index/api/getMediaInfo?secret=YwDtp2llj80HA19JhMXL4Po99nsMAyNT&schema=rtsp&vhost=__defaultVhost__&app=live&stream=lihai_lot_walnutpi_dev_${id}`, //
success: (res) => {
console.log("res", res.data.code);
if (res.data.code == 0) {
that.shwovideo = true
clearInterval(this.shwovideoTimer)
}
},
fail: (err) => {
console.log(err, "err")
}
});
}, 2500)
},
replaceLastThreeChars(str, replacement) { replaceLastThreeChars(str, replacement) {
if (str.length < 3) { if (str.length < 3) {
return replacement + str; return replacement + str;
@ -90,9 +115,7 @@
// base64 // base64
receiveImg(data) { receiveImg(data) {
this.imgSrc = (data.test) this.imgSrc = (data.test)
console.log(this.imgSrc) console.log(this.imgSrc)
console.log(this.deviceId)
videoCover({ videoCover({
device_id: this.deviceId, device_id: this.deviceId,
image: this.imgSrc image: this.imgSrc
@ -105,8 +128,8 @@
// //
setUrl(url) { setUrl(url) {
let options = {}; let options = {};
options.width = 300; options.width = 400;
options.height = 300; options.height = 280;
options.src = url; options.src = url;
this.vsrc = options; this.vsrc = options;
}, },
@ -115,19 +138,13 @@
url: 'wss://iot.lihaink.cn/test' url: 'wss://iot.lihaink.cn/test'
}); });
uni.onSocketOpen(function(res) { uni.onSocketOpen(function(res) {
console.log("scoket打开")
uni.sendSocketMessage({ uni.sendSocketMessage({
data: JSON.stringify(scoketData) data: JSON.stringify(scoketData)
}); });
uni.onSocketMessage(function(res) { uni.onSocketMessage(function(res) {
console.log(res); console.log(res);
}); });
}); });
uni.onSocketError(function(res) { uni.onSocketError(function(res) {
console.log('WebSocket连接打开失败请检查'); console.log('WebSocket连接打开失败请检查');
@ -138,8 +155,8 @@
}, },
playVedio() { playVedio() {
this.subNvue.hide() this.subNvue.hide()
this.flag = false
uni.createVideoContext('video', this).requestFullScreen(); uni.createVideoContext('video', this).requestFullScreen();
setTimeout(() => { setTimeout(() => {
this.setUrl(this.videoUrl) this.setUrl(this.videoUrl)
}, 2000) }, 2000)
@ -159,6 +176,8 @@
, ,
onUnload() { onUnload() {
uni.closeSocket(); uni.closeSocket();
clearTimeout(this.initFailTimer)
clearInterval(this.shwovideoTimer)
}, },
} }
</script> </script>

20
pages/live/live2.vue Normal file
View File

@ -0,0 +1,20 @@
<template>
<view class="" v-if="show">
<video :controls="true" src="http://rtsp.lihaink.cn/live/lihai_lot_walnutpi_dev_5.live.mp4" :autoplay="true"
id="video"></video>
</view>
<view class="">
sdfsdf
</view>
</template>
<script setup>
import {
ref
} from "vue"
const show = ref(false)
</script>
<style>
</style>

View File

@ -2,7 +2,7 @@
<view id="subNvue"> <view id="subNvue">
<view class="" style="background-color: white;width: 750rpx;height:1000px;position: relative;"> <view class="" style="background-color: white;width: 750rpx;height:1000px;position: relative;">
<view class="" style="margin-top: 350px;"> <view class="" style="margin-top: 350px;">
<u-loading-icon mode="semicircle" text="狂加载中..." textSize="18"></u-loading-icon> <u-loading-icon mode="semicircle" text="狂加载中..." textSize="18"></u-loading-icon>
</view> </view>
</view> </view>

View File

@ -1,7 +1,7 @@
Promise.resolve("./pages/live/live.js").then((res) => { Promise.resolve("./pages/addLand/select_address_n.js").then((res) => {
res.length; res.length;
}); });
Promise.resolve("./pages/addLand/select_address_n.js").then((res) => { Promise.resolve("./pages/live/loading.js").then((res) => {
res.length; res.length;
}); });
Promise.resolve("./app.css.js").then(() => { Promise.resolve("./app.css.js").then(() => {

View File

@ -17,7 +17,7 @@
<div id="app"></div> <div id="app"></div>
<script src="uni-app-view.umd.js"></script> <script src="uni-app-view.umd.js"></script>
<script src="app-renderjs.js"></script>
</body> </body>
</html> </html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -7,8 +7,8 @@
"id": "__UNI__D087881", "id": "__UNI__D087881",
"name": "种植溯源", "name": "种植溯源",
"version": { "version": {
"name": "1.0.3", "name": "1.0.4",
"code": 103 "code": 104
}, },
"description": "", "description": "",
"developer": { "developer": {