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": "种植溯源",
"appid": "__UNI__D087881",
"description": "",
"versionName": "1.0.3",
"versionCode": 103,
"versionName": "1.0.4",
"versionCode": 104,
"transformPx": false,
/* 5+App */
"app-plus": {

View File

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

View File

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

View File

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

View File

@ -5,8 +5,6 @@
:autoplay="true" :style="'width: '+ windowWidth +'px; height: '+ boxStyle.height +'px;'" :src="videoUrl"
id="video"></video>
</view>
<!-- <image :src="imgSrc" mode=""></image> -->
<!-- <button @click="setUrl(videoUrl)">设置链接</button> -->
</view>
</template>
@ -32,6 +30,10 @@
windowWidth: '',
deviceId: "",
shwovideo: false,
shwovideoTimer: "",
initFailTimer: "",
flag: true
}
},
@ -39,8 +41,6 @@
this.deviceId = option.device
this.videoUrl = option.url
this.videoUrl = this.replaceLastThreeChars(this.videoUrl, "mp4");
console.log(this.videoUrl)
this.subNvue = uni.getSubNVueById('subNvue'); //
this.subNvue.show() //
let data = {
@ -49,19 +49,44 @@
scene: 'app',
}
this.openScoket(data)
this.canplay(option.device)
this.platform = uni.getSystemInfoSync().platform
this.windowWidth = uni.getSystemInfoSync().screenWidth //
this.boxStyle.width = this.windowWidth + 'px' //px
this.wHeight = uni.getSystemInfoSync().screenHeight; //
this.boxStyle.height = this.wHeight; //
setTimeout(() => {
this.shwovideo = true
console.log("showvideo")
}, 2000)
this.initFailTimer = setTimeout(() => {
if (this.flag) {
uni.$u.toast("初始化失败,请重新进入")
setTimeout(() => {
uni.navigateBack()
}, 1000)
}
}, 60000)
},
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) {
if (str.length < 3) {
return replacement + str;
@ -90,9 +115,7 @@
// base64
receiveImg(data) {
this.imgSrc = (data.test)
console.log(this.imgSrc)
console.log(this.deviceId)
videoCover({
device_id: this.deviceId,
image: this.imgSrc
@ -105,8 +128,8 @@
//
setUrl(url) {
let options = {};
options.width = 300;
options.height = 300;
options.width = 400;
options.height = 280;
options.src = url;
this.vsrc = options;
},
@ -115,19 +138,13 @@
url: 'wss://iot.lihaink.cn/test'
});
uni.onSocketOpen(function(res) {
console.log("scoket打开")
uni.sendSocketMessage({
data: JSON.stringify(scoketData)
});
uni.onSocketMessage(function(res) {
console.log(res);
});
});
uni.onSocketError(function(res) {
console.log('WebSocket连接打开失败请检查');
@ -138,8 +155,8 @@
},
playVedio() {
this.subNvue.hide()
this.flag = false
uni.createVideoContext('video', this).requestFullScreen();
setTimeout(() => {
this.setUrl(this.videoUrl)
}, 2000)
@ -159,6 +176,8 @@
,
onUnload() {
uni.closeSocket();
clearTimeout(this.initFailTimer)
clearInterval(this.shwovideoTimer)
},
}
</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 class="" style="background-color: white;width: 750rpx;height:1000px;position: relative;">
<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 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;
});
Promise.resolve("./pages/addLand/select_address_n.js").then((res) => {
Promise.resolve("./pages/live/loading.js").then((res) => {
res.length;
});
Promise.resolve("./app.css.js").then(() => {

View File

@ -17,7 +17,7 @@
<div id="app"></div>
<script src="uni-app-view.umd.js"></script>
<script src="app-renderjs.js"></script>
</body>
</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",
"name": "种植溯源",
"version": {
"name": "1.0.3",
"code": 103
"name": "1.0.4",
"code": 104
},
"description": "",
"developer": {