溯源操作详情修改

This commit is contained in:
jia 2023-11-29 18:11:21 +08:00
parent b2c5c27e2f
commit 812fc0778d
16 changed files with 283 additions and 174 deletions

View File

@ -3,7 +3,6 @@ import http from "@/utils/http.js";
//登录
export const login = (data) => syhttp.post('/login/account', data)
//验证码
@ -36,6 +35,9 @@ export const addaction = (data) => syhttp.post('/action/add', data)
//添加操作
export const binddevice = (data) => syhttp.post('/land/bind', data)
//操作具体
export const listForType = (data) => syhttp.get('/action/listForType', data)
//首页
export const lindexist = (data) => syhttp.get('/index/index', data)
//产品列表

View File

@ -124,6 +124,14 @@
"navigationBarBackgroundColor": "#F4F4F4",
"navigationBarTextStyle": "black"
}
},{
"path": "pages/husbandryForm/detail",
"style": {
"navigationBarTitleText": "操作详情",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#F4F4F4",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/updatePassword/updatePassword",
@ -144,9 +152,7 @@
"style": {
"navigationStyle": "custom"
}
}
, {
}, {
"path": "pages/Login/resgier",
"style": {
"navigationStyle": "custom"

View File

@ -7,34 +7,34 @@
<u-form-item label="简介" prop="intro"><u-input v-model="data.formData.intro" /></u-form-item> -->
<u-form-item label="土地名称" prop="title" borderBottom ref='item1' required>
<up-input placeholder="请输入土地名称" border="surround" v-model="data.formData.title"></up-input>
<up-input placeholder="请输入土地名称" border="surround" v-model="data.formData.title" ></up-input>
</u-form-item>
<u-form-item label="土地面积" prop="area" borderBottom required>
<up-input placeholder="请输入土地面积" border="surround" v-model="data.formData.area"></up-input>
</u-form-item>
<u-form-item label="所在省份" prop="province_code" borderBottom required>
<up-input placeholder="请选择所在省份" border="surround" v-model="province_name" :disabled="true"
@click="isshow1"></up-input>
<u-form-item label="所在省份" prop="province_code" borderBottom required @click="isshow1">
<up-input placeholder="请选择所在省份" border="surround" v-model="province_name" readonly
style="pointer-events: none;"></up-input>
</u-form-item>
<u-form-item label="所在城市" prop="city_code" borderBottom required>
<up-input placeholder="请选择所在城市" border="surround" v-model="city_name" @click="isshow2"
:disabled="true"></up-input>
<u-form-item label="所在城市" prop="city_code" borderBottom required @click="isshow2">
<up-input placeholder="请选择所在城市" border="surround" v-model="city_name"
readonly style="pointer-events: none;"></up-input>
</u-form-item>
<u-form-item label="所在区县" prop="county_code" borderBottom required>
<up-input placeholder="请选择所在区县" border="surround" v-model="county_name" @click="isshow3"
:disabled="true"></up-input>
<u-form-item label="所在区县" prop="county_code" borderBottom required @click="isshow3">
<up-input placeholder="请选择所在区县" border="surround" v-model="county_name"
readonly style="pointer-events: none;"></up-input>
</u-form-item>
<u-form-item label="所在镇街" prop="town_code" borderBottom required>
<up-input placeholder="请选择所在镇街" border="surround" v-model="town_name" @click="isshow4"
:disabled="true"></up-input>
<u-form-item label="所在镇街" prop="town_code" borderBottom required @click="isshow4">
<up-input placeholder="请选择所在镇街" border="surround" v-model="town_name"
readonly style="pointer-events: none;"></up-input>
</u-form-item>
<u-form-item label="所在乡村" prop="village_code" borderBottom required>
<up-input placeholder="请选择所在乡村" border="surround" v-model="village_name" @click="isshow5"
:disabled="true"></up-input>
<u-form-item label="所在乡村" prop="village_code" borderBottom required @click="isshow5">
<up-input placeholder="请选择所在乡村" border="surround" v-model="village_name"
readonly style="pointer-events: none;"></up-input>
</u-form-item>
<u-form-item label="所在小队" prop="group_code" borderBottom required>
<up-input placeholder="请选择所在小队" border="surround" v-model="group_name" @click="isshow6"
:disabled="true"></up-input>
<u-form-item label="所在小队" prop="group_code" borderBottom required @click="isshow6">
<up-input placeholder="请选择所在小队" border="surround" v-model="group_name"
readonly style="pointer-events: none;"></up-input>
</u-form-item>
<u-form-item label="土地负责人" prop="master_name" borderBottom required>
<up-input placeholder="请输入土地负责人名称" border="surround" v-model="data.formData.master_name"></up-input>

View File

@ -18,22 +18,22 @@
<view class="" v-if="mode=='add'">
<u-form-item label="开始日期" @click="openDate" prop="start_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.start_date"></up-input>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.start_date" style="pointer-events: none;"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="end_date" @click="openDate1" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.end_date"></up-input>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.end_date" style="pointer-events: none;"></up-input>
</u-form-item>
</view>
<view class="" v-else>
<u-form-item label="开始日期" prop="start_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.start_date"></up-input>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.start_date" style="pointer-events: none;"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="end_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.end_date"></up-input>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.end_date" style="pointer-events: none;"></up-input>
</u-form-item>
</view>
<u-form-item label="作业面积" prop="area" borderBottom required>

View File

@ -18,22 +18,22 @@
<view class="" v-if="mode=='add'">
<u-form-item label="开始日期" @click="openDate" prop="start_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.start_date"></up-input>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.start_date" style="pointer-events: none;"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="end_date" @click="openDate1" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.end_date"></up-input>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.end_date" style="pointer-events: none;"></up-input>
</u-form-item>
</view>
<view class="" v-else>
<u-form-item label="开始日期" prop="start_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.start_date"></up-input>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.start_date" style="pointer-events: none;"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="end_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.end_date"></up-input>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.end_date" style="pointer-events: none;"></up-input>
</u-form-item>
</view>
<u-form-item label="作业面积" prop="area" borderBottom required>

View File

@ -6,28 +6,28 @@
<u-form-item label="灌溉方式" prop="type" borderBottom required @click="showggai">
<!-- <uni-data-select v-model="formData.type" :disabled="mode=='detail'"
:localdata="range"></uni-data-select> -->
<up-input placeholder="请选择灌溉方式" :disabled="true" border="surround"
v-model="formDatatype"></up-input>
<up-input placeholder="请选择灌溉方式" readonly border="surround"
v-model="formDatatype" style="pointer-events: none;"></up-input>
</u-form-item>
<view class="" v-if="mode=='add'">
<u-form-item label="开始日期" @click="openDate" prop="start_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.start_date"></up-input>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.start_date" style="pointer-events: none;"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="end_date" @click="openDate1" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.end_date"></up-input>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.end_date" style="pointer-events: none;"></up-input>
</u-form-item>
</view>
<view class="" v-else>
<u-form-item label="开始日期" prop="start_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.start_date"></up-input>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.start_date" style="pointer-events: none;"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="end_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.end_date"></up-input>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.end_date" style="pointer-events: none;"></up-input>
</u-form-item>
</view>
<u-form-item label="灌溉面积" prop="area" borderBottom required>

View File

@ -11,9 +11,9 @@
<up-input placeholder="请输入品种" :disabled="mode=='detail'" border="surround"
v-model="data.formData.breed"></up-input>
</u-form-item>
<u-form-item label="开始日期" prop="date" borderBottom required>
<up-input placeholder="请选择日期" @click="openDate" :disabled="true" border="surround"
v-model="data.formData.date"></up-input>
<u-form-item label="开始日期" prop="date" borderBottom required @click="openDate">
<up-input placeholder="请选择日期" readonly border="surround"
v-model="data.formData.date" style="pointer-events: none;"></up-input>
</u-form-item>
<u-form-item label="种植面积" prop="area" borderBottom required>

View File

@ -18,22 +18,22 @@
<view class="" v-if="mode=='add'">
<u-form-item label="开始日期" @click="openDate" prop="start_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.start_date"></up-input>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.start_date" style="pointer-events: none;"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="end_date" @click="openDate1" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.end_date"></up-input>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.end_date" style="pointer-events: none;"></up-input>
</u-form-item>
</view>
<view class="" v-else>
<u-form-item label="开始日期" prop="start_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.start_date"></up-input>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.start_date" style="pointer-events: none;"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="end_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.end_date"></up-input>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.end_date" style="pointer-events: none;"></up-input>
</u-form-item>
</view>
<u-form-item label="作业面积" prop="area" borderBottom required>
@ -303,7 +303,7 @@
onLoad((options) => {
if (options.task) {
let data = options.task ? JSON.parse(decodeURIComponent(options.task)) : null;
console.log(data, data.detail)
// console.log(data, data.detail)
Object.assign(formData, data.detail);
pic.splice(0, pic.length, ...data.detail.pic);

View File

@ -116,21 +116,18 @@
}
const getlist = () => {
landlist(fomData).then((res) => {
if (res.code == 1) {
datalist.splice(0, datalist.length, ...res.data);
fomData.page_no += fomData.page_no
}
})
}
const search = () => {
getlist()
}
@ -184,7 +181,7 @@
.custom-style {
color: #606266;
width: 120rpx;
width: 140rpx;
border-radius: 30rpx;
margin-top: 10rpx;
margin-right: 20rpx;

View File

@ -23,6 +23,7 @@
<view class="nav">
</view>
</view>
<view class="content" v-if="true">
<!-- 土地信息 -->
<view class="">
@ -47,7 +48,7 @@
</view>
<view class="card" v-else>
<view class="" @click="navgo">
<view class="">
<view class="">
暂无信息
</view>
@ -57,6 +58,9 @@
</view>
</view>
<view class="add-thing" @click="showPicker1=true" v-if="columns2.length>0">
记农事
</view>
<!-- 苗情监测 -->
<view class="">
<view class="live-video soil-monitor">
@ -74,9 +78,11 @@
<!-- <u--image :src="url" width="100%" height="300rpx"></u--image> -->
<u-swiper :list="dataobj.pic" width="100%" height="300rpx"></u-swiper>
</view>
</view>
<!-- 土壤监测 -->
<!-- v-if="dataobj&&dataobj.monitor&&dataobj.monitor.length>0" -->
<view class="">
<view class="soil-monitor">
@ -89,7 +95,8 @@
<text>刷新时间: {{getNowTimeFn()}} </text>
</view>
</view>
<view class="monitor-content">
<view class="monitor-content"
v-if="dataobj&&dataobj.monitor&&dataobj.soil_monitor_data&&Object.keys(dataobj.soil_monitor_data).length>0">
<view class="monitor-card" v-for="(item,index) in soilList" :key="index">
<view class="name">
<view class="">
@ -106,6 +113,16 @@
</view>
</view>
</view>
<view class="coneng-detail" v-else>
<view class="">
<image src="@/static/img/zw.png" mode="aspectFit"></image>
<view class="">
暂无数据
</view>
</view>
</view>
</view>
<!-- 环境监测 -->
<view class="soil-monitor">
@ -118,7 +135,8 @@
<text>刷新时间: {{getNowTimeFn()}} </text>
</view>
</view>
<view class="monitor-content">
<view class="monitor-content"
v-if="dataobj&&dataobj.monitor&&dataobj.monitor.air_monitor_data&&Object.keys(dataobj.monitor.air_monitor_data).length>0">
<view class="monitor-card" v-for="(item,index) in environmentList" :key="index">
<view class="name">
<view class="">
@ -135,16 +153,22 @@
</view>
</view>
</view>
</view>
</view>
<!-- <view class="coneng-detail" v-else>
<view class="">
<image src="@/static/img/zw.png" mode="aspectFit"></image>
<view class="">
暂无数据
<view class="coneng-detail" v-else>
<view class="">
<image src="@/static/img/zw.png" mode="aspectFit"></image>
<view class="">
暂无数据
</view>
</view>
</view>
</view>
</view> -->
</view>
<!-- 组件 -->
<u-loading-page :loading="showLoading"></u-loading-page>
@ -171,8 +195,8 @@
<u-popup :show="showModal" mode="center" @close="closeModal" :round="10">
<view class="Modal">
<text> 产品编号:</text>
<uni-data-select v-model="equipmentId"
style="width: 300rpx;margin-left: 30rpx;" :localdata="range"></uni-data-select>
<uni-data-select v-model="equipmentId" style="width: 300rpx;margin-left: 30rpx;"
:localdata="range"></uni-data-select>
</view>
<view class="Modal-btn">
@ -186,7 +210,11 @@
</u-popup>
</view>
<u-picker keyName="name" :show="showPicker1" @cancel="showPicker1=false" @confirm="confirm1"
:columns="columns2"></u-picker>
<u-picker keyName="label" :show="showPicker" @cancel="showPicker=false" @confirm="confirm2"
:columns="columns1"></u-picker>
</view>
</template>
@ -203,12 +231,33 @@
bindproduct,
lindexist,
landlist,
plantlist,
landproduct
} from '@/api/api.js'
const showPicker = ref(false)
const showPicker1 = ref(false)
const showModal = ref(false)
const columns1 = reactive([
[{
label: '施肥',
route: "/pages/husbandryForm/fertilize"
}, {
label: '除草',
route: "/pages/husbandryForm/weeding"
}, {
label: '灌溉',
route: "/pages/husbandryForm/irrigate"
}, {
label: '除虫',
route: "/pages/husbandryForm/Pest"
}, {
label: '收获',
route: "/pages/husbandryForm/harvest"
}]
]);
const columns2 = reactive([])
const range = reactive([])
//
const url = ref('https://ceshi-worker-task.lihaink.cn//uploads//images//20231121//202311211336582b7920656.jpg')
@ -259,7 +308,7 @@
])
const dataobj = reactive({})
const tdId = ref('')
const palntId = ref('')
//
const equipmentId = ref("")
const bindFn = () => {
@ -273,7 +322,7 @@
// console.log('' + res.scanType);
console.log('条码内容:' + res.result.split('='));
uni.navigateTo({
url:'/pages/landDetail/results?id='+res.result.split('=')[1]
url: '/pages/landDetail/results?id=' + res.result.split('=')[1]
})
}
});
@ -335,9 +384,7 @@
])
onShow(() => {
getlist()
getlist1()
getlist2()
})
@ -350,7 +397,7 @@
}).then((res) => {
if (res.code == 1) {
getlist3(res.data.id)
Object.assign(dataobj, res.data);
if (res.data && res.data.monitor && res.data.monitor.soil_monitor_data) {
@ -417,7 +464,30 @@
}
})
}
const getlist3 = (id) => {
plantlist({
land_id: id
}).then((res) => {
if (res.code == 1) {
columns2.splice(0)
let arr1 = []
arr1.splice(0, arr1.length, ...res.data.map((step, index) => {
return {
name: step.kind + '-' + step.id,
id: step.id,
};
}));
columns2.push(arr1)
}
})
}
//
const closeModal = () => {
showModal.value = false
@ -440,6 +510,18 @@
console.log(res)
})
}
const confirm2 = (e) => {
showPicker.value = false
uni.navigateTo({
url: e.value[0].route + '?id=' + palntId.value
})
}
const confirm1 = (e) => {
palntId.value = e.value[0].id
showPicker1.value = false
showPicker.value = true
}
const confirm = (e) => {
// console.log(e)
tdId.value = e.id
@ -475,7 +557,7 @@
}
getNowTimeFn()
</script>
<style lang="scss" >
<style lang="scss">
page {
background-color: $theme-bg-color;
}
@ -514,6 +596,17 @@
}
}
.add-thing {
width: 266.36rpx;
height: 66.59rpx;
border-radius: 42.06rpx 42.06rpx 42.06rpx 42.06rpx;
border: 1px solid $theme-main-color;
margin: 20rpx auto;
line-height: 66rpx;
text-align: center;
color: $theme-main-color;
}
.Modal {
padding: 60rpx 40rpx;
display: flex;

View File

@ -45,7 +45,7 @@
种植品种: {{item.breed}}
</view>
<view class="">
种植面积: {{item.area}}
种植面积: {{item.area}}
</view>
<view class="">
参与人员: {{item.user}}
@ -162,8 +162,7 @@
onLoad((option) => {
typeID.value = option.id;
getlist();
getlist1();
});
onShow(() => {

View File

@ -59,7 +59,8 @@
{{item.type_text.slice(0, -2)}}用量
</view>
<view class="detail">
{{item.detail.dosage}}
{{item.detail.dosage}}<text v-if='item.type==4'></text>
<text v-if='item.type!=4&&item.type!=5'></text>
</view>
</view>
<view class="action-detail">
@ -75,7 +76,7 @@
{{item.type_text.slice(0, -2)}}图片
</view>
<view class="detail-img">
<u-swiper :list="dataobj.pic" width="100%" height="529rpx"></u-swiper>
<u-swiper :list="item.detail.pic" width="100%" height="529rpx"></u-swiper>
</view>
</view>
</view>
@ -94,7 +95,7 @@
灌溉面积
</view>
<view class="detail">
{{item.detail.area}}
{{item.detail.area}}
</view>
</view>
<view class="action-detail">
@ -110,7 +111,7 @@
灌溉图片
</view>
<view class="detail-img">
<u-swiper :list="dataobj.pic" width="100%" height="529rpx"></u-swiper>
<u-swiper :list="item.detail.pic" width="100%" height="529rpx"></u-swiper>
</view>
</view>
</view>
@ -137,7 +138,7 @@
收获图片
</view>
<view class="detail-img">
<u-swiper :list="dataobj.pic" width="100%" height="529rpx"></u-swiper>
<u-swiper :list="item.detail.pic" width="100%" height="529rpx"></u-swiper>
</view>
</view>
</view>
@ -175,7 +176,7 @@
//
const getlist1 = (id) => {
suYuan({
plant_id: id
plant_id: 5
}).then((res) => {
if (res.code == 1) {

View File

@ -32,8 +32,8 @@
<view class="card_body">
<view class="left">
<u--image @click="perviewFn(item.detail.pic[0])" radius='10' :src="item.detail.pic[0]" width="200rpx"
height="200rpx"></u--image>
<u--image @click="perviewFn(item.detail.pic[0])" radius='10' :src="item.detail.pic[0]"
width="200rpx" height="200rpx"></u--image>
</view>
<view class="right">
<view class="" v-if="item.type==5">
@ -42,15 +42,23 @@
</view>
</view>
<view class="" v-else>
<view class="" v-if="!item.detail.type">
<view class="" v-if="!item.detail.type">
<view class="">
{{item.type_text.slice(0, -2)}}种类:{{item.detail.kind}}
</view>
<view class="">
{{item.type_text.slice(0, -2)}}品种: {{item.detail.breed}}
</view>
<view class="" v-if='item.detail.dosage'>
{{item.type_text.slice(0, -2)}}用量: {{item.detail.dosage}}
<text v-if='item.type==4'></text>
<text v-if='item.type!=4&&item.type!=5'></text>
</view>
<view class="">
{{item.type_text.slice(0, -2)}}面积: {{item.detail.area}}
{{item.type_text.slice(0, -2)}}面积: {{item.detail.area}}
</view>
</view>
<view class="" v-if="item.detail.type&&item.detail.type==1">
@ -184,14 +192,14 @@
getlist2();
})
const getlist1 = (id,a,b) => {
const getlist1 = (id, a, b) => {
landdetail({
land_id: id
}).then((res) => {
if (res.code == 1) {
res.data.kind = a
res.data.datapic=b
res.data.datapic = b
Object.assign(dataobj, res.data);
@ -203,7 +211,7 @@
plant_id: typeID.value
}).then((res) => {
if (res.code == 1) {
getlist1(res.data.id, res.data.kind,res.data.pic)
getlist1(res.data.land_id, res.data.kind, res.data.pic)
}
});
};
@ -224,45 +232,50 @@
})
}
const navtoForm = (item, type) => {
uni.navigateTo({
url: '/pages/husbandryForm/detail?land_id=' + dataobj.id + "&plant_id=" + typeID.value + "&type=" +
type
})
// console.log(item, type)
switch (type) {
// switch (type) {
//
case 1:
// //
// case 1:
uni.navigateTo({
url: '/pages/husbandryForm/fertilize?task=' + encodeURIComponent(JSON.stringify(item))
})
break;
//
case 2:
uni.navigateTo({
url: '/pages/husbandryForm/weeding?task=' + encodeURIComponent(JSON.stringify(item))
})
break;
// uni.navigateTo({
// url: '/pages/husbandryForm/fertilize?task=' + encodeURIComponent(JSON.stringify(item))
// })
// break;
// //
// case 2:
// uni.navigateTo({
// url: '/pages/husbandryForm/weeding?task=' + encodeURIComponent(JSON.stringify(item))
// })
// break;
//
case 3:
uni.navigateTo({
url: '/pages/husbandryForm/irrigate?task=' + encodeURIComponent(JSON.stringify(item))
})
// //
// case 3:
// uni.navigateTo({
// url: '/pages/husbandryForm/irrigate?task=' + encodeURIComponent(JSON.stringify(item))
// })
break;
//
case 4:
uni.navigateTo({
url: '/pages/husbandryForm/Pest?task=' + encodeURIComponent(JSON.stringify(item))
})
// break;
// //
// case 4:
// uni.navigateTo({
// url: '/pages/husbandryForm/Pest?task=' + encodeURIComponent(JSON.stringify(item))
// })
break;
//
case 5:
uni.navigateTo({
url: '/pages/husbandryForm/harvest?task=' + encodeURIComponent(JSON.stringify(item))
})
// break;
// //
// case 5:
// uni.navigateTo({
// url: '/pages/husbandryForm/harvest?task=' + encodeURIComponent(JSON.stringify(item))
// })
break;
}
// break;
// }
}
const confirm = (e) => {
showPicker.value = false

View File

@ -3,11 +3,8 @@
<view :style="'width: '+ windowWidth +'px; height: '+ boxStyle.height +'px;z-inde:-1;'">
<view class="root">
<video ref="videoPlayer"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/media/af4b9202306121644508620.mp4" controls
autoplay="true"
@ended="playNext" :object-fit="object_fit" @loadedmetadata="onVideoLoaded"
:style="'width: '+ windowWidth +'px; height: '+ boxStyle.height +'px;z-inde:-1;'"></video>
<video ref="videoPlayer" :src="currentSrc" controls :object-fit="object_fit" autoplay="true"
:style="'width: '+ windowWidth +'px; height: '+ boxStyle.height +'px;'"></video>
</view>
@ -23,7 +20,7 @@
export default {
data() {
return {
rtmpSources: ["https://lihai001.oss-cn-chengdu.aliyuncs.com/media/af4b9202306121644508620.mp4"],
rtmpSources: [],
currentIndex: 0,
room: {},
wHeight: 0, //获取的屏幕高度🌟💗
@ -47,7 +44,7 @@
this.boxStyle.width = this.windowWidth + 'px' //给宽度加px
this.wHeight = uni.getSystemInfoSync().screenHeight; //获取屏幕高度
this.boxStyle.height = this.wHeight; //改变视频高度
this.get()
},
mounted() {
@ -58,41 +55,36 @@
},
methods: {
onVideoLoaded() {
console.log(this.$refs.videoPlayer)
playCurrent() {
console.log(this.$refs.videoPlayer)
if (this.$refs.videoPlayer) {
// this.$refs.videoPlayer.load();
this.$refs.videoPlayer.load();
this.$refs.videoPlayer.play();
}
},
playNext() {
if (this.rtmpSources.length > 0) {
this.currentIndex++;
if (this.currentIndex >= this.rtmpSources.length) {
this.currentIndex = 0; // 回到第一个源
}
this.playCurrent();
this.currentIndex++;
if (this.currentIndex >= this.rtmpSources.length) {
this.currentIndex = 0; // 回到第一个源
}
this.playCurrent();
},
get() {
let that = this
console.log(this.room)
playbackDetail({
app_name: 'shop',
live_stream_id: this.room.live_stream_id
}).then((res) => {
console.log(res.data, '1111')
this.rtmpSources = ["https://lihai001.oss-cn-chengdu.aliyuncs.com/media/af4b9202306121644508620.mp4"]
// playbackDetail({
// app_name: 'shop',
// live_stream_id: this.room.live_stream_id
// }).then((res) => {
// console.log(res.data, '1111')
this.rtmpSources = res.data.playback_url;
// this.rtmpSources = res.data.playback_url;
})
// })
},

View File

@ -14,11 +14,13 @@ function baseRequest(url, method, data, {
onReLogin = false
}) {
let Url = config.HTTP_REQUEST_URL,
header = config.HEADER;
if (store.state.userInfo) {
header.TOKEN = store.state.userInfo.token
}else{
uni.redirectTo({
url:'/pages/Login/login'
})
}
return new Promise((reslove, reject) => {
@ -49,7 +51,7 @@ function baseRequest(url, method, data, {
return reject();
}
} else if (res.data.code == 0) {
if (res.data.msg != '无登录信息') {
if (res.data.msg != '用户信息不存在') {
uni.showToast({
title: res.data.msg || '请检查网络',
icon: 'none',

View File

@ -14,7 +14,11 @@ function baseRequest(url, method, data, {
header = config.HEADER;
if(store.state.userInfo){
header.TOKEN = store.state.userInfo.token
}
}else{
uni.redirectTo({
url:'/pages/Login/login'
})
}
return new Promise((reslove, reject) => {
@ -43,7 +47,7 @@ function baseRequest(url, method, data, {
return reject();
}
} else if (res.data.code == 0) {
if (res.data.msg != '无登录信息') {
if (res.data.msg != '用户信息不存在') {
uni.showToast({
title: res.data.msg || '请检查网络',
icon: 'none',