This commit is contained in:
weipengfei 2024-01-23 19:52:15 +08:00
parent c71b624a71
commit 2c6ba3959f
19 changed files with 1473 additions and 1080 deletions

View File

@ -9,6 +9,8 @@ export const login = (data) => syhttp.post('/login/account', data)
export const xinregister = (data) => syhttp.post('/index/code', data)
//用户注册
export const logregister = (data) => syhttp.post('/login/register', data)
//用户注册验证码
export const registerCode = (data) => syhttp.post('/sms/sendCode', data)
//修改密码
export const changePassword = (data) => syhttp.post('/user/changePassword', data)
//退出登录
@ -64,4 +66,9 @@ export const villages = (data) => http.get('/common/geo/villages', data)
//小组
export const groups = (data) => http.get('/common/geo/groups', data)
//视频推流
export const videoPush = (data) => http.get('/video', data)
//上传视频封面
export const videoCover = (data) => http.post('api/upload/uploadVideoCover', data)

10
api/dict.js Normal file
View File

@ -0,0 +1,10 @@
import syhttp from "@/utils/syhttp.js";
import http from "@/utils/http.js";
// 通用字典
//养殖基地类型
export const farmTypeLists = () => syhttp.get('/common/dict_data_lists_by_type_value', {type_value: 'farm_type'});
//养殖种类
export const breedTypeLists = () => syhttp.get('/common/dict_data_lists_by_type_value', {type_value: 'breed_type'});

26
api/index.js Normal file
View File

@ -0,0 +1,26 @@
import syhttp from "@/utils/syhttp.js";
import http from "@/utils/http.js";
//登录
export const login = (data) => syhttp.post('/login/account', data)
//验证码
export const xinregister = (data) => syhttp.post('/index/code', data)
//用户注册
export const logregister = (data) => syhttp.post('/login/register', data)
//修改密码
export const changePassword = (data) => syhttp.post('/user/changePassword', data)
//退出登录
export const logout = (data) => syhttp.get('/login/logout', data)
//养殖基地列表
export const farmLists = (data) => syhttp.get('/farm/list', data);
//养殖基地类型
export const farmTypeLists = (data) => syhttp.get('/farm_type', data);
//新增养殖基地
export const farmAdd = (data) => syhttp.post('/farm/add', data);

View File

@ -8,7 +8,8 @@ let env = "dev"
let HTTP_REQUEST_URL
let HEADER
if (env == 'dev') {
BASE_URL = 'http://ceshi-suyuan.lihaink.cn/'
// BASE_URL = 'http://ceshi-suyuan.lihaink.cn/'
BASE_URL = 'http://192.168.1.6:8084/'
} else if (env = 'prod') {
BASE_URL = 'http://ceshi-suyuan.lihaink.cn/'
}

View File

@ -101,30 +101,75 @@
{
"path": "pages/live/live",
"style": {
"navigationBarTitleText": "栏舍监控",
"navigationBarTitleText": "苗情监测",
// "navigationStyle": "custom",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#35D190",
"navigationBarTextStyle": "white",
"app-plus": {
"subNVues": [{
"path": "pages/live/loading", //
"id": "subNvue", //id
// "type": "popup"
//
"style": {
"width": "100%",
"height": "100%",
"position": "absolute"
}
}]
}
}
},
{
"path": "pages/live/liveIos",
"style": {
"navigationBarTitleText": "苗情监测",
// "navigationStyle": "custom",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#35D190",
"navigationBarTextStyle": "white",
"app-plus": {
"subNVues": [{
"path": "pages/live/loading", //
"id": "subNvueIos", //id
// "type": "popup"
//
"style": {
"width": "100%",
"height": "100%",
"position": "absolute"
}
}]
}
}
},
{
"path": "pages/addPlant/addPlant",
"style": {
"navigationBarTitleText": "添加养殖基地信息",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#feb048",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/addPlant/addPlant",
"path": "pages/addPlant/select_address_n",
"style": {
"navigationBarTitleText": "添加养殖场信息",
"navigationBarTitleText": "选择位置",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#feb048",
"navigationBarTextStyle": "white"
}
},
// {
// "path": "pages/addPlant/select_address_n",
// "style": {
// "navigationBarTitleText": "选择位置",
// "enablePullDownRefresh": false,
// "navigationBarBackgroundColor": "#feb048",
// "navigationBarTextStyle": "white"
// }
// },
{
"path": "pages/equipment/index",
"style": {

View File

@ -1,3 +1,435 @@
<template>
<view class="box">
<view class="" style="height: var(--status-bar-height);">
</view>
<Myindex style="float: right;"></Myindex>
<view class="" v-show="false">
<image src="/static/tabs-icon/dk.png"></image>
</view>
<view class="content">
<view class="tit">
您好
</view>
<view class="tit" style="margin-bottom: 60rpx;">
欢迎进入吟龙土壤墒情监测系统!
</view>
<view class="input-card">
<view class="card-head">
<!-- <view class="triangle top" />
<view class="triangle bottom" /> -->
<view class="code-login" @click="changeLoginType(0)" :class="{act_code:loginType==0}">
<span>验证码登录</span>
</view>
<view class="password-login" @click="changeLoginType(320)" :class="{act_password:loginType==1}">
密码登录
</view>
<view class="line" :style="{transform: 'translateX('+lineX+'rpx)'}" />
<!-- <view class="" style="background-color: #feb048;color: white;width: 100%;height: 100rpx;
text-align: center;line-height: 100rpx;">
账号登录
</view> -->
</view>
<!-- <view class="" style="height: 90rpx;">
</view> -->
<view class="login-content"
style="position: absolute;width: 680rpx;height: 900rpx;background-color: white;top: 85rpx;z-index: 99999;">
<view class="code">
<view class="" v-if="loginType==1" style="margin-bottom: 20rpx;">
<view class="" style="display: flex;margin-bottom: 10rpx;">
<up-image :src="u('sj')" width="30rpx" height="44rpx"
style="margin-right: 20rpx;"></up-image>
</view>
<u-input placeholder="请输入用户账号"
customStyle="background:#F5F5F5;height:80rpx;padding-left:40rpx;border:none"
shape='circle' border="surround" v-model="formData.account"></u-input>
<view class="" style="display: flex;margin-top: 30rpx;margin-bottom: 10rpx;">
<up-image :src="u('mm')" width="30rpx" height="44rpx"
style="margin-right: 20rpx;"></up-image>
</view>
<u-input :password="!pwdShow" shape='circle'
customStyle="background:#F5F5F5;height:80rpx;padding-left:40rpx;border:none"
placeholder="请输入密码" border="surround" v-model="formData.password">
</u-input>
</view>
<view class="" v-else>
<view class="" style="display: flex;margin-bottom: 10rpx;">
<up-image :src="u('sj')" width="30rpx" height="44rpx"
style="margin-right: 20rpx;"></up-image>
</view>
<u-input placeholder="请输入账号"
customStyle="background:#F5F5F5;height:80rpx;padding-left:40rpx;border:none"
shape='circle' border="surround" v-model="formData.account"></u-input>
<view class="" style="display: flex;margin-top: 30rpx;margin-bottom: 10rpx;">
<up-image :src="u('yzm')" width="30rpx" height="44rpx"
style="margin-right: 20rpx;"></up-image>
</view>
<view class="" style="position: relative;">
<u-input type="number" shape='circle'
customStyle="background:#F5F5F5;height:80rpx;padding-left:40rpx;border:none;margin-bottom:15rpx"
placeholder="请输入验证码" border="surround" v-model="formData.code"></u-input>
<view class="get-code" :style="{color: countDown?'#ADADAD':''}" @click="getCode"><text
class="lineY"></text>
获取验证码 <text v-if='countDown'>{{countDown}}s</text> </view>
</view>
</view>
<view class="" style="font-size: 26rpx;">
<text>还没有账号点击</text> <text @click="resgiter"
style="color: #feb048;text-decoration: underline;">注册</text>
</view>
<view class="sub-btn">
<u-button @click="submitFn" type="primary"
customStyle="border:none;height:90rpx;border-radius: 50rpx;" color="#feb048"
text="登录"></u-button>
</view>
</view>
</view>
<!-- <>old -->
<!-- <view class="login-type" v-for="(item,i) in arr1.list" :key="i" @click="aclick(i)">
{{item.name}}
<view class="line" v-if="i==num" />
</view>
<view class="" style="margin: 30rpx 0;">
<u-input placeholder="请输入账号"
customStyle="background:#F5F5F5;height:80rpx;padding-left:40rpx;border:none" shape='circle'
border="surround" v-model="formData.account"></u-input>
</view>
<view class="yanzm" v-if="num==0">
<u-input type="number" shape='circle'
customStyle="background:#F5F5F5;height:80rpx;padding-left:40rpx;border:none;width:120rpx;"
placeholder="请输入验证码" border="surround" v-model="formData.code"></u-input>
<view @tap="getCode" class="code" v-if="!isshow">{{tips}}</view>
<view class="code" v-else>{{countDown}}s</view>
</view>
<view class="" v-if="num==1">
<u-input :password="!pwdShow" shape='circle'
customStyle="background:#F5F5F5;height:80rpx;;padding-left:40rpx;border:none"
placeholder="请输入密码" border="surround" v-model="formData.password">
<template #suffix>
<u-icon :name="pwdShow?'eye-off':'eye-fill'" @click="pwdShow=!pwdShow" size="25"></u-icon>
</template>
</u-input>
</view>
<view class="resgiter" @click="resgiter">
用户注册
</view>
<view class="sub-btn">
<u-button @click="submitFn" type="primary" customStyle="border:none;height:90rpx" color="#feb048"
text="登录"></u-button>
</view> -->
</view>
</view>
<!-- <view class="agreement">
<text>登录代表您已经同意</text> <text style="color:#2D94FE ;">服务协议隐私政策</text>
</view> -->
</view>
</template>
<style lang="scss" scoped>
.box {
width: 100vw;
height: 100vh;
background-image: url('/static/main/login/bg.png');
background-size: 100% 100%;
position: relative;
}
.content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 750rpx;
padding: 0 25rpx;
box-sizing: border-box;
margin: 0 auto;
.tit {
color: white;
font-size: 44rpx;
margin-bottom: 18rpx;
// margin-bottom: 30rpx;
margin-left: 23rpx;
}
.input-card {
width: 680rpx;
margin: 0 auto;
box-sizing: border-box;
border-radius: 20rpx;
overflow: hidden;
box-shadow: 0.5rpx 0.5rpx 200rpx 0.5rpx rgba(0, 0, 0, 0.1);
position: relative;
min-height: 680rpx;
// background-color: white;
.card-head {
// background-color: #fff;
display: flex;
position: relative;
.triangle {
position: absolute;
width: 0;
height: 0;
border-left: 12rpx solid transparent;
border-right: 12rpx solid transparent;
left: 50%;
}
.top {
border-top: 50rpx solid #31BE89;
top: -1rpx;
transform: translateX(-50%);
}
.bottom {
border-bottom: 50rpx solid white;
bottom: -1rpx;
transform: translateX(-50%);
}
.code-login {
height: 50px;
background-color: transparent;
box-sizing: border-box;
background-image: url("/static/main/index/white_bg.png");
background-size: 100% 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
padding: 20rpx;
transition: 500ms;
color: black;
font-weight: bold;
position: absolute;
width: 360rpx;
z-index: 5;
}
.password-login {
width: 360rpx;
height: 50px;
// background-color: white;
// background-image: url("/static/main/index/login_r.png");
right: 0;
z-index: 4;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
padding: 20rpx;
transition: 200ms;
color: white;
position: absolute;
}
.line {
width: 100rpx;
background-color: #feb048;
height: 3px;
border-radius: 100rpx;
transition: 500ms;
z-index: 999999;
margin-top: 70rpx;
margin-left: 130rpx;
}
.act_code {
// background-color: white;
// color: white;
color: black;
font-weight: normal;
// background-image: url('/static/main/index/login_ad.png');
// background-image: url('/static/main/index/white_bg.png');
}
.act_password {
font-weight: bold;
// background-color: white;
color: black;
z-index: 9;
background-image: url('/static/main/index/white_bg_r.png');
// background-image: url('/static/main/index/white_bg.png');
}
}
.login-content {
// background-color: #fff;
padding: 40rpx 40rpx;
// // transform: translateY(-1rpx);
// color: #7A7A7A;
// min-height: 380rpx;
// position: absolute;
// z-index: 999;
// height: 500rpx;
// background-color: red;
// // height: 380rpx;
// top: 0;
.code {
.get-code {
color: $theme-main-color;
font-size: 28rpx;
position: absolute;
right: 30rpx;
top: 20rpx;
.lineY {
width: 1px;
height: 20rpx;
background-color: $theme-main-color;
display: inline-block;
margin-right: 10rpx;
}
}
}
.password {}
.sub-btn {
margin-top: 80rpx;
// margin-bottom: 30rpx;
}
// box-sizing: b;
}
// .login-type {
// display: flex;
// display: inline-block;
// margin-right: 50rpx;
// flex-direction: column;
// // align-items: center;
// justify-content: flex-start;
// .line {
// border-top: 3px solid #feb048;
// margin: 0 auto;
// margin-top: 10rpx;
// width: 60rpx;
// }
// }
// .yanzm {
// display: flex;
// justify-content: space-between;
// .u-input {
// margin-right: 60rpx;
// }
// }
// .code {
// width: 120rpx;
// height: 80rpx;
// background-color: #feb048;
// line-height: 80rpx;
// text-align: center;
// border-radius: 20rpx 20rpx;
// font-size: 20rpx;
// padding: 0rpx 20rpx;
// color: #fff;
// margin-top: 10rpx;
// }
// .resgiter {
// font-size: 30rpx;
// margin-top: 40rpx;
// }
}
}
.agreement {
position: absolute;
bottom: 100rpx;
margin: 0 auto;
font-size: 24rpx;
color: white;
width: auto;
left: 50%;
transform: translateX(-50%);
width: 700rpx;
text-align: center;
white-space: nowrap;
}
</style>
<script setup>
import Myindex from '@/components/return/index.vue';
import {
@ -13,19 +445,18 @@
reactive,
ref
} from 'vue';
import store from "@/store/index.js"
const store = useStore()
const stores = useStore()
const num = ref(0)
const isshow = ref(false)
const pwdShow = ref(false)
const tips = ref('获取验证码')
const countDown = ref(0); //
const formData = reactive({
account: "19130550023",
password: "a123456",
account: "15680975703",
password: "123456",
code: '',
scene: "2",
terminal: ''
@ -128,13 +559,14 @@
uni.showLoading({
title: '登陆中'
})
store.dispatch('saveUserInfo', res.data)
stores.dispatch('saveUserInfo', res.data)
setTimeout(() => {
uni.hideLoading()
uni.reLaunch({
store.dispatch('changeTabbar', 0)
uni.switchTab({
url: '/pages/index/massif'
})
console.log(store.state.tabbrIndex, "tabbar")
uni.$u.toast('登录成功');
}, 500)
@ -177,373 +609,3 @@
})
</script>
<template>
<view class="box">
<view class="" style="height: var(--status-bar-height);">
</view>
<Myindex style="float: right;"></Myindex>
<view class="content">
<view class="tit" style="margin: 0;">
您好
</view>
<view class="tit">
欢迎进入吟龙养殖溯源系统!
</view>
<view class="input-card">
<view class="card-head">
<view class="triangle top" />
<view class="triangle bottom" />
<view class="code-login" @click="changeLoginType(0)" :class="{act:loginType==2}">
<span>验证码登录</span>
<view class="line" :style="{transform: 'translateX('+lineX+'rpx)'}" />
</view>
<view class="password-login" @click="changeLoginType(350)" :class="{act:loginType==1}">
密码登录
</view>
</view>
<view class="login-content">
<view class="code">
<view class="" v-if="loginType==1" style="margin-bottom: 20rpx;">
<view class="" style="display: flex;margin-bottom: 10rpx;">
<up-image :src="u('sj')" width="30rpx" height="44rpx"
style="margin-right: 20rpx;"></up-image>
</view>
<u-input placeholder="请输入用户账号"
customStyle="background:#F5F5F5;height:80rpx;padding-left:40rpx;border:none"
shape='circle' border="surround" v-model="formData.account"></u-input>
<view class="" style="display: flex;margin-top: 30rpx;margin-bottom: 10rpx;">
<up-image :src="u('mm')" width="30rpx" height="44rpx"
style="margin-right: 20rpx;"></up-image>
</view>
<u-input :password="!pwdShow" shape='circle'
customStyle="background:#F5F5F5;height:80rpx;padding-left:40rpx;border:none"
placeholder="请输入密码" border="surround" v-model="formData.password">
</u-input>
</view>
<view class="" v-else>
<view class="" style="display: flex;margin-bottom: 10rpx;">
<up-image :src="u('sj')" width="30rpx" height="44rpx"
style="margin-right: 20rpx;"></up-image>
</view>
<u-input placeholder="请输入账号"
customStyle="background:#F5F5F5;height:80rpx;padding-left:40rpx;border:none"
shape='circle' border="surround" v-model="formData.account"></u-input>
<view class="" style="display: flex;margin-top: 30rpx;margin-bottom: 10rpx;">
<up-image :src="u('yzm')" width="30rpx" height="44rpx"
style="margin-right: 20rpx;"></up-image>
</view>
<view class="" style="position: relative;">
<u-input type="number" shape='circle'
customStyle="background:#F5F5F5;height:80rpx;padding-left:40rpx;border:none;margin-bottom:15rpx"
placeholder="请输入验证码" border="surround" v-model="formData.code"></u-input>
<view class="get-code" :style="{color: countDown?'#feb048':''}" @click="getCode"><text
class="lineY"></text>
获取验证码 <text v-if='countDown'>{{countDown}}s</text> </view>
</view>
</view>
<view class="" style="font-size: 26rpx;">
<text>还没有账号点击</text> <text @click="resgiter"
style="color: #feb048;text-decoration: underline;">注册</text>
</view>
<view class="sub-btn">
<u-button @click="submitFn" type="primary"
customStyle="border:none;height:90rpx;border-radius: 50rpx;" color="#feb048"
text="登录"></u-button>
</view>
</view>
</view>
<!-- <>old -->
<!-- <view class="login-type" v-for="(item,i) in arr1.list" :key="i" @click="aclick(i)">
{{item.name}}
<view class="line" v-if="i==num" />
</view>
<view class="" style="margin: 30rpx 0;">
<u-input placeholder="请输入账号"
customStyle="background:#F5F5F5;height:80rpx;padding-left:40rpx;border:none" shape='circle'
border="surround" v-model="formData.account"></u-input>
</view>
<view class="yanzm" v-if="num==0">
<u-input type="number" shape='circle'
customStyle="background:#F5F5F5;height:80rpx;padding-left:40rpx;border:none;width:120rpx;"
placeholder="请输入验证码" border="surround" v-model="formData.code"></u-input>
<view @tap="getCode" class="code" v-if="!isshow">{{tips}}</view>
<view class="code" v-else>{{countDown}}s</view>
</view>
<view class="" v-if="num==1">
<u-input :password="!pwdShow" shape='circle'
customStyle="background:#F5F5F5;height:80rpx;;padding-left:40rpx;border:none"
placeholder="请输入密码" border="surround" v-model="formData.password">
<template #suffix>
<u-icon :name="pwdShow?'eye-off':'eye-fill'" @click="pwdShow=!pwdShow" size="25"></u-icon>
</template>
</u-input>
</view>
<view class="resgiter" @click="resgiter">
用户注册
</view>
<view class="sub-btn">
<u-button @click="submitFn" type="primary" customStyle="border:none;height:90rpx" color="#feb048"
text="登录"></u-button>
</view> -->
</view>
</view>
<view class="agreement">
<text>登录代表您已经同意</text> <text style="color:#2D94FE ;">服务协议隐私政策</text>
</view>
</view>
</template>
<style lang="scss" scoped>
.box {
width: 100vw;
height: 100vh;
background-image: url('/static/main/login/bg.png');
background-size: 100% 100%;
position: relative;
}
.content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 700rpx;
.tit {
color: white;
font-size: 44rpx;
margin-bottom: 30rpx;
}
.input-card {
width: 700rpx;
box-sizing: border-box;
.card-head {
background-color: #fff;
display: flex;
position: relative;
.triangle {
position: absolute;
width: 0;
height: 0;
border-left: 12rpx solid transparent;
border-right: 12rpx solid transparent;
left: 50%;
}
.top {
border-top: 50rpx solid #ffae48;
top: -1rpx;
transform: translateX(-50%);
}
.bottom {
border-bottom: 50rpx solid white;
bottom: -1rpx;
transform: translateX(-50%);
}
.code-login {
width: 50%;
height: 50px;
background-color: #feb048;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
padding: 20rpx;
transition: 500ms;
color: white;
.line {
width: 100rpx;
background-color: #feb048;
height: 3px;
border-radius: 100rpx;
transition: 500ms;
}
}
.password-login {
width: 50%;
height: 50px;
background-color: #feb048;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
padding: 20rpx;
transition: 500ms;
color: white;
}
.act {
background-color: white;
color: black;
font-weight: bold;
}
}
.login-content {
background-color: #fff;
padding: 10rpx 40rpx;
transform: translateY(-1rpx);
color: #7A7A7A;
.code {
.get-code {
color: $theme-main-color;
font-size: 28rpx;
position: absolute;
right: 30rpx;
top: 20rpx;
.lineY {
width: 1px;
height: 20rpx;
background-color: $theme-main-color;
display: inline-block;
margin-right: 10rpx;
}
}
}
.password {}
.sub-btn {
margin-top: 80rpx;
margin-bottom: 30rpx;
}
// box-sizing: b;
}
// .login-type {
// display: flex;
// display: inline-block;
// margin-right: 50rpx;
// flex-direction: column;
// // align-items: center;
// justify-content: flex-start;
// .line {
// border-top: 3px solid #feb048;
// margin: 0 auto;
// margin-top: 10rpx;
// width: 60rpx;
// }
// }
// .yanzm {
// display: flex;
// justify-content: space-between;
// .u-input {
// margin-right: 60rpx;
// }
// }
// .code {
// width: 120rpx;
// height: 80rpx;
// background-color: #feb048;
// line-height: 80rpx;
// text-align: center;
// border-radius: 20rpx 20rpx;
// font-size: 20rpx;
// padding: 0rpx 20rpx;
// color: #fff;
// margin-top: 10rpx;
// }
// .resgiter {
// font-size: 30rpx;
// margin-top: 40rpx;
// }
}
}
.agreement {
position: absolute;
bottom: 100rpx;
margin: 0 auto;
font-size: 24rpx;
color: white;
width: auto;
left: 50%;
transform: translateX(-50%);
width: 700rpx;
text-align: center;
white-space: nowrap;
}
</style>

View File

@ -15,7 +15,7 @@
您好
</view>
<view class="tit">
欢迎进入吟龙养殖溯源系统!
欢迎进入吟龙土壤墒情监测溯系统!
</view>
<view class="input-card" style="color: #7A7A7A;">
<view class="login-type" style="color: black;font-weight: bold;">
@ -37,12 +37,12 @@
<view class="" style="position: relative;">
<u-input type="number" shape='circle'
customStyle="background:#F5F5F5;height:80rpx;padding-left:40rpx;border:none;margin-bottom:15rpx"
placeholder="请输入验证码" border="surround" v-model="formData.code"></u-input>
placeholder="请输入验证码" border="surround" v-model="formData.verify_code"></u-input>
<view class="get-code" :style="{color: countDown?'grey':''}" @click="getCode"><text
<view class="get-code" :style="{color: countDown?'#ADADAD':''}" @click="getCode"><text
class="lineY"></text>
获取验证码 <text v-if='countDown'>{{countDown}}s</text> </view>
验证码 <text v-if='countDown'>{{countDown}}s</text> </view>
</view>
<view class="" style="margin: 30rpx 0;">
@ -84,7 +84,8 @@
<script setup>
import Myindex from '@/components/return/index.vue';
import {
logregister
logregister,
registerCode
} from '@/api/api.js';
import {
reactive,
@ -93,30 +94,43 @@
const pwdShow = ref(false)
const pwdShow1 = ref(false)
const formData = reactive({
mobile: "",
mobile: "19130550023",
verify_code: "",
password: "",
password_confirm: "",
})
const countDown = ref(0)
const u = (name) => {
return `/static/main/login/${name}.png`
}
//
const startCountDown = () => {
countDown.value = 60
const timer = setInterval(() => {
countDown.value -= 1; //
if (countDown.value <= 0) {
clearInterval(timer); //
}
}, 1000);
};
const getCode = () => {
if (countDown.value) return
if (!formData.account) return uni.$u.toast('账号不能为空');
let data = {
phone: formData.account,
scene: 101
}
xinregister(data).then((res) => {
if (!formData.mobile) return uni.$u.toast('账号不能为空');
let data = {
mobile: formData.mobile,
scene: 'YZMDL'
}
registerCode(data).then((res) => {
if (res.code == 1) {
isshow.value = true
uni.$u.toast('验证码已发送');
//
startCountDown()
@ -155,7 +169,7 @@
}
const back=()=>{
const back = () => {
uni.navigateBack()
}
</script>
@ -164,8 +178,7 @@
.box {
width: 100vw;
height: 100vh;
background-image: url('/static/main/login/bg.png');
background-size: 100% 100%;
background-color: $theme-main-color;
position: relative;
}

View File

@ -3,56 +3,63 @@
<view class="card">
<up-form labelWidth='130' :model="data.formData" ref="form1">
<!-- <up-form-item label="姓名" prop="name"><u-input v-model="data.formData.name" /></up-form-item>
<up-form-item label="简介" prop="intro"><u-input v-model="data.formData.intro" /></up-form-item> -->
<view class="c-title">养殖场信息</view>
<view class="c-title">养殖基地信息</view>
<view class="c-box">
<up-form-item label="养殖场名称" prop="title" borderBottom required>
<up-input input-align="right" placeholder="请输入养殖名称" border="none"
v-model="data.formData.title"></up-input>
<up-form-item label="养殖基地名称" prop="farm_name" borderBottom required>
<up-input input-align="right" placeholder="请输入养殖基地名称" border="none"
v-model="data.formData.farm_name"></up-input>
</up-form-item>
<up-form-item label="养殖场类型" prop="title" borderBottom required>
<up-input input-align="right" placeholder="请输入养殖场类型" border="none"
v-model="data.formData.title"></up-input>
<!-- <up-form-item label="养殖基地类型" prop="farm_type" borderBottom required>
<up-input input-align="right" placeholder="请输入养殖基地类型" border="none"
v-model="data.formData.farm_type"></up-input>
</up-form-item> -->
<up-form-item label="养殖基地类型" prop="farm_type" borderBottom required @click="isshowFarm">
<up-input input-align="right" placeholder="请选择养殖基地类型" suffixIcon="arrow-down"
suffix-icon-style="color: #b6b6b6;" border="none" v-model="farm_type_name" readonly
style="pointer-events: none;"></up-input>
</up-form-item>
<up-form-item label="养殖种类" prop="area" borderBottom required>
<!-- <up-form-item label="养殖种类" prop="breed_type" borderBottom required>
<up-input input-align="right" placeholder="请输入养殖种类" border="none"
v-model="data.formData.area"></up-input>
v-model="data.formData.breed_type"></up-input>
</up-form-item> -->
<up-form-item label="养殖种类" prop="farm_type" borderBottom required @click="isshowBreed">
<up-input input-align="right" placeholder="请选择养殖种类" suffixIcon="arrow-down"
suffix-icon-style="color: #b6b6b6;" border="none" v-model="breed_type_name" readonly
style="pointer-events: none;"></up-input>
</up-form-item>
<up-form-item label="养殖场规模(亩)" prop="master_name" borderBottom required>
<up-input input-align="right" placeholder="请输入养殖场规模" border="none"
v-model="data.formData.master_name"></up-input>
<up-form-item label="养殖基地规模(亩)" prop="form_scale" borderBottom required>
<up-input input-align="right" placeholder="请输入养殖基地规模" border="none"
v-model="data.formData.form_scale"></up-input>
</up-form-item>
<up-form-item label="负责人" prop="master_phone" borderBottom required>
<up-input input-align="right" placeholder="请输入负责人姓名" type="number" border="none"
v-model="data.formData.master_phone"></up-input>
<up-form-item label="负责人" prop="master" borderBottom required>
<up-input input-align="right" placeholder="请输入负责人姓名" border="none"
v-model="data.formData.master"></up-input>
</up-form-item>
<up-form-item label="负责人电话" prop="master_phone" borderBottom required>
<up-form-item label="负责人电话" prop="master_contact" borderBottom required>
<up-input input-align="right" placeholder="请输入负责人电话" type="number" border="none"
v-model="data.formData.master_phone"></up-input>
v-model="data.formData.master_contact"></up-input>
</up-form-item>
</view>
<view class="c-title">地址信息</view>
<view class="c-box">
<up-form-item label="所在省份" prop="province_code" borderBottom required @click="isshow1">
<up-form-item label="所在省份" prop="province" borderBottom required @click="isshow1">
<up-input input-align="right" placeholder="请选择所在省份" suffixIcon="arrow-down"
suffix-icon-style="color: #b6b6b6;" border="none" v-model="province_name" readonly
style="pointer-events: none;"></up-input>
</up-form-item>
<up-form-item label="所在城市" prop="city_code" borderBottom required @click="isshow2">
<up-form-item label="所在城市" prop="city" borderBottom required @click="isshow2">
<up-input input-align="right" placeholder="请选择所在城市" suffixIcon="arrow-down"
suffix-icon-style="color: #b6b6b6;" border="none" v-model="city_name" readonly
style="pointer-events: none;"></up-input>
</up-form-item>
<up-form-item label="所在区县" prop="county_code" borderBottom required @click="isshow3">
<up-form-item label="所在区县" prop="area" borderBottom required @click="isshow3">
<up-input input-align="right" placeholder="请选择所在区县" suffixIcon="arrow-down"
suffix-icon-style="color: #b6b6b6;" border="none" v-model="county_name" readonly
suffix-icon-style="color: #b6b6b6;" border="none" v-model="area_name" readonly
style="pointer-events: none;"></up-input>
</up-form-item>
<up-form-item label="养殖场详细地址" prop="town_code" style="position: relative;" borderBottom required>
<up-input input-align="right" placeholder="请输入养殖详细地址" suffixIcon="map"
<up-form-item label="养殖基地详细地址" prop="address" style="position: relative;" borderBottom required>
<up-input input-align="right" placeholder="请输入养殖基地详细地址" suffixIcon="map"
suffix-icon-style="color: #b6b6b6;" border="none" v-model="data.formData.address">
</up-input>
<view style="position: absolute;right: 0;width: 50rpx; height: 100%; " @click="location">
@ -62,7 +69,7 @@
<view class="card-li">
<view class="c-title">养殖图片</view>
<view class="c-title">养殖基地图片</view>
<view class="c-box c-box-p">
<view class="code-img1">
<view class="" v-if="pic.length>0"
@ -94,7 +101,6 @@
</up-form>
<u-action-sheet :show="show" keyName="name" closeOnClickOverlay :actions="columns" title="请选择"
@close="show = false" @select="leavaType1">
</u-action-sheet>
<u-action-sheet :show="show1" keyName="name" :actions="columns1" title="请选择" @close="show1 = false"
@select="leavaType2">
@ -102,14 +108,11 @@
<u-action-sheet :show="show2" keyName="name" :actions="columns2" title="请选择" @close="show2 = false"
@select="leavaType3">
</u-action-sheet>
<u-action-sheet :show="show3" keyName="name" :actions="columns3" title="请选择" @close="show3 = false"
@select="leavaType4">
<u-action-sheet :show="showFarm" keyName="name" :actions="farm_tpye_list" title="请选择" @close="showFarm = false"
@select="selectFarmType">
</u-action-sheet>
<u-action-sheet :show="show4" keyName="name" :actions="columns4" title="请选择" @close="show4 = false"
@select="leavaType5">
</u-action-sheet>
<u-action-sheet :show="show5" keyName="name" :actions="columns5" title="请选择" @close="show5 = false"
@select="leavaType6">
<u-action-sheet :show="showBreed" keyName="name" :actions="breed_tpye_list" title="请选择" @close="showBreed = false"
@select="selectBreedType">
</u-action-sheet>
<u-button class="btn" @click="submit">提交</u-button>
</view>
@ -133,69 +136,77 @@
Uploads
} from "@/api/upload.js"
import {
addland,
province,
city,
county,
towns,
villages,
groups
} from '@/api/api.js'
} from '@/api/api.js';
import {
farmAdd
} from '@/api/index.js';
import {
breedTypeLists,
farmTypeLists
} from '@/api/dict.js';
const form1 = ref(null);
const data = reactive({
formData: {
title: '',
farm_name: '',
farm_type: '',
breed_type: '',
form_scale: '',
master: '',
master_contact: '',
province: '',
city: '',
area: '',
province_code: '',
city_code: '',
county_code: '',
address: '',
lat: "",
lon: "",
master_name: '',
master_phone: '',
pic: ['https://img0.baidu.com/it/u=1717510975,3258230326&fm=253&fmt=auto?w=120&h=80',
'https://img0.baidu.com/it/u=1717510975,3258230326&fm=253&fmt=auto?w=120&h=80'
]
pic: []
},
rules: {
// name: [{
// required: true,
// message: '',
// //
// trigger: ['change', 'blur'],
// }],
// intro: [{
// min: 5,
// message: '5',
// trigger: 'change'
// }],
title: [{
farm_name: [{
type: 'string',
required: true,
message: '请填写养殖名称',
message: '请填写养殖基地名称',
trigger: ['blur', 'change']
}],
area: [{
farm_type: [{
type: 'string',
required: true,
message: '请填写养殖场面积',
message: '请填写养殖基地类型',
trigger: ['blur', 'change']
}],
province_code: [{
breed_type: [{
type: 'string',
required: true,
message: '请填写养殖基地种类',
trigger: ['blur', 'change']
}],
form_scale: [{
type: 'string',
required: true,
message: '请填写养殖基地规模',
trigger: ['blur', 'change']
}],
province: [{
type: 'string',
required: true,
message: '请请选择所在省份',
trigger: 'change'
}],
city_code: [{
city: [{
type: 'string',
required: true,
message: '请选择所在城市',
trigger: 'change'
}],
county_code: [{
area: [{
type: 'string',
required: true,
message: '请选择所在区县',
@ -204,16 +215,16 @@
address: [{
type: 'string',
required: true,
message: '请输入养殖详细地址',
message: '请输入养殖基地详细地址',
trigger: ['blur', 'change']
}],
master_name: [{
master: [{
type: 'string',
required: true,
message: '请输入养殖场负责人名称',
message: '请输入养殖基地负责人姓名',
trigger: ['blur', 'change']
}],
master_phone: [{
master_contact: [{
required: true,
message: '请输入手机号',
trigger: ['change', 'blur'],
@ -235,14 +246,20 @@
const pic = reactive([]);
const province_name = ref(null)
const city_name = ref(null)
const county_name = ref(null)
const area_name = ref(null)
const farm_type_name = ref(null)
const breed_type_name = ref(null)
const show = ref(false)
const show1 = ref(false)
const show2 = ref(false)
const showFarm = ref(false)
const showBreed = ref(false)
const columns = reactive([])
const columns1 = reactive([])
const columns2 = reactive([])
const farm_tpye_list = reactive([])
const breed_tpye_list = reactive([])
const provincen = () => {
@ -262,7 +279,7 @@
city({
province_code: id
}).then((res) => {
columns1.splice(0, columns.length, ...res.data.map((step, index) => {
columns1.splice(0, columns1.length, ...res.data.map((step, index) => {
return {
name: step.city_name,
id: step.city_code,
@ -274,19 +291,53 @@
const countyn = (id) => {
county({
city_code: id
}).then((res) => {
columns2.splice(0, columns.length, ...res.data.map((step, index) => {
columns2.splice(0, columns2.length, ...res.data.map((step, index) => {
return {
name: step.county_name,
id: step.county_code,
};
}));
});
}
const farmTypeListsn = (id) => {
farmTypeLists().then((res) => {
farm_tpye_list.splice(0, farm_tpye_list.length, ...res.data.map((step, index) => {
return {
name: step.name,
value: step.value,
id: step.id
};
}));
});
}
const selectFarmType = (e)=>{
farm_type_name.value = e.name;
data.formData.farm_type = e.value;
}
const breedTypeListsn = (id) => {
breedTypeLists().then((res) => {
breed_tpye_list.splice(0, breed_tpye_list.length, ...res.data.map((step, index) => {
return {
name: step.name,
value: step.value,
id: step.id
};
}));
});
}
const selectBreedType = (e)=>{
breed_type_name.value = e.name;
data.formData.breed_type = e.value;
}
//
const delimg = (i) => {
pic.splice(i, 1);
@ -335,73 +386,52 @@
show.value = true
}
const isshow2 = () => {
show1.value = true
}
const isshow3 = () => {
show2.value = true
}
const isshow4 = () => {
show3.value = true
}
const isshow5 = () => {
show4.value = true
const isshowFarm = () =>{
showFarm.value = true
}
const isshow6 = () => {
show5.value = true
const isshowBreed = () =>{
showBreed.value = true
}
const leavaType1 = (e) => {
console.log(e);
province_name.value = e.name
data.formData.province_code = e.id
data.formData.province = e.id
cityn(e.id)
}
const leavaType2 = (e) => {
city_name.value = e.name
data.formData.city_code = e.id
data.formData.city = e.id
countyn(e.id)
}
const leavaType3 = (e) => {
county_name.value = e.name
data.formData.county_code = e.id
area_name.value = e.name
data.formData.area = e.id
}
const location = () => {
uni.showLoading({
title: '获取位置中'
uni.navigateTo({
url: '/pages/addPlant/select_address_n',
success: (res)=>{
uni.$once('setData', (e)=>{
e = JSON.parse(e||'{}');
console.log('选择地址', e);
data.formData.address = e.address;
data.formData.lat = e.lat;
data.formData.lon = e.lon;
})
uni.getLocation({
type: 'gcj02',
geocode: true,
isHighAccuracy: true,
success: async (res) => {
console.log(res)
data.formData.lat = res.latitude
data.formData.lon = res.longitude
data.formData.address = res.address.street + res
.address.streetNum + res.address.poiName
uni.hideLoading();
console.log(data.formData)
},
fail: (err) => {
// uni.hideLoading();
console.log(err)
console.log("erer")
}
});
})
}
@ -420,15 +450,13 @@
if (valid) {
// console.log('', data.formData);
if (pic.length == 0) {
uni.$u.toast('请上传图片')
return
}
data.formData.pic = JSON.stringify(pic)
//
addland(data.formData).then((res) => {
farmAdd(data.formData).then((res) => {
console.log(res)
if (res.code == 1) {
uni.navigateBack({
@ -449,9 +477,9 @@
}
onLoad((options) => {
provincen()
provincen();
farmTypeListsn();
breedTypeListsn();
})
</script>

View File

@ -4,8 +4,8 @@
<view class="head_top">
<!-- <u-search placeholder="搜索小区、办公楼等" @custom="searchMap"></u-search>
<view style="height: 20rpx;"></view> -->
<u-tabs :list="tabsList" itemStyle="font-size: 32rpx;height: 74rpx;" :current="current"
@change="changeCurrent" lineColor="#FF6D20" lineWidth="105rpx" height="7rpx">
<u-tabs :list="tabsList" itemStyle="font-size: 32rpx;height: 74rpx;" :current="current" @change="changeCurrent"
lineColor="#FF6D20" lineWidth="105rpx" height="7rpx">
</u-tabs>
</view>
</u-sticky>
@ -17,65 +17,26 @@
<view class="re-location">
<view style="width: 120rpx;"><text class="text">当前位置: </text></view>
<view style="flex: 1;">
<text
class="text">{{locationInfo.formatted_addresses?locationInfo.formatted_addresses.recommend:locationInfo.address}}</text>
<text class="text">{{address}}</text>
</view>
</view>
<view class="re-btn" @click="reGetLocation">
<image class="re-address-img" src="@/static/images/re_address.png"></image><text
class="text">重新定位</text>
<text class="text">重新定位</text>
</view>
</view>
<u-button text="确认" @click="submitAddress"></u-button>
</view>
<view class="address-box" v-if="current==1">
<view class="head_item_tips">
<view><text class="text">泸州区县</text></view>
</view>
<view class="area">
<view class="area-item" :class="{'area-item-on': item.code==area_change}"
v-for="(item, index) in areaList" :key="index" @click="changeArea(item)">
<text class="text">{{item.name}}</text>
</view>
</view>
<view class="head_item_tips">
<view><text class="text">选择街道/镇</text></view>
</view>
<view class="street">
<view class="letter-item" v-for="key in mapKey" :key="key">
<view class="letter"><text class="text">{{key}}</text></view>
<view class="item-box">
<view class="street-item" v-for="item in mapList[key]" :key="item.code"
@click="changeStreet(item)">
<text class="text">{{item.name}}</text>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
getGeocoder,
merClassifly,
getProductslist
} from '@/api/store.js';
import {
getArea,
getStreet
} from "@/api/article.js";
import {
Toast
} from '@/libs/uniApi';
export default {
data() {
return {
tabsList: [{
name: '地图定位',
}, {
name: '泸州区县',
}],
current: 0,
latitude: '28.87',
@ -88,20 +49,14 @@
width: 28,
height: 28
},
address: "",
locationInfo: {},
town: '',
street_id: '',
street: '',
areaList: [],
streetList: [],
mapList: {},
area_change: '',
street_change: '',
}
},
onLoad(options) {
this.getLoaction();
this.loadArea();
},
onShow() {},
computed: {
@ -114,104 +69,46 @@
this.current = e.index;
},
getLoaction() {
let that = this
this.street = '定位中'
this.locationInfo = {};
this.locationInfo.formatted_addresses = {};
this.locationInfo.formatted_addresses.recommend = '定位中'
uni.getLocation({
type: 'wgs84',
timeout: '4',
geocode: true,
isHighAccuracy: true,
success: (res) => {
let latitude, longitude;
latitude = res.latitude.toString();
longitude = res.longitude.toString();
this.latitude = res.latitude.toFixed(6);
this.longitude = res.longitude.toFixed(6);
this.$store.commit('setLocation', {
lat: res.latitude.toFixed(6),
long: res.longitude.toFixed(6),
uni.request({
url: `https://restapi.amap.com/v3/geocode/regeo?output=JSON&location=${res.longitude},${res.latitude}&key=976a447183ed0d384e1c5b6448b8a75d&radius=1000&extensions=all`, //仅为示例,并非真实接口地址。
success: (res) => {
that.address = res.data.regeocode.formatted_address
// console.log();
}
});
getGeocoder({
lat: latitude,
long: longitude
}).then(res => {
this.locationInfo = res.data;
this.town = res.data.address_reference.town.title
this.street_id = res.data.address_reference.town.id
this.street = res.data.address_reference.town.title;
}).catch(err => {
uni.showToast({
title: err,
icon: 'none'
})
this.street = '定位失败'
})
},
fail: (err) => {
console.log('定位失败');
this.isshow = false
Toast('定位失败,请检查定位权限是否开启')
// Toast('定位失败,请检查定位权限是否开启')
this.street = '定位失败'
this.locationInfo.formatted_addresses.recommend = '定位失败'
// uni.showToast({
// title: "获取定位超时",
// icon: 'none',
// duration: 2000
// });
}
});
},
reGetLocation() {
this.getLoaction()
},
loadArea() {
getArea({
city_code: 510500
}).then((res) => {
this.areaList = res.data;
this.changeArea(this.areaList[0]);
})
},
loadStreet(area_code) {
this.street_change = '';
getStreet({
area_code
}).then((res) => {
this.streetList = res.data;
this.initPinyin();
})
},
initPinyin() {
this.mapList = {};
this.streetList.forEach((item) => {
let str = item.pinyin?.toUpperCase();
str = str ? str : '#';
if (this.mapList[str]) {
this.mapList[str].push(item);
} else {
this.mapList[str] = [];
this.mapList[str].push(item)
}
})
},
changeArea(item) {
this.area_change = item.code;
this.loadStreet(this.area_change);
},
// 选择位置
changeStreet(item) {
uni.navigateBack({
success: () => {
uni.$emit('changeAddress', {
area: this.area_change,
street: item
})
}
})
},
// 点击地图
handleMapTap(e) {
let that = this
// console.log('点击地图', e);
// #ifdef H5
return Toast('H5暂不支持选择坐标');
@ -220,49 +117,25 @@
let latitude = e.detail.latitude;
this.markers.longitude = longitude;
this.markers.latitude = latitude;
// console.log('修改成功', this.markers);
getGeocoder({
lat: latitude,
long: longitude
}).then(res => {
// console.log(res);
this.locationInfo = res.data;
}).catch(err => {
uni.showToast({
title: err,
icon: 'none'
})
this.locationInfo = {};
this.locationInfo.formatted_addresses = {};
this.locationInfo.formatted_addresses.recommend = '定位失败'
})
this.longitude = longitude
this.latitude = latitude
uni.request({
url: `https://restapi.amap.com/v3/geocode/regeo?output=JSON&location=${longitude},${latitude}&key=976a447183ed0d384e1c5b6448b8a75d&radius=1000&extensions=all`, //仅为示例,并非真实接口地址。
success: (res) => {
console.log(res)
that.address = res.data.regeocode.formatted_address
}
});
},
submitAddress() {
console.log(this.locationInfo);
try {
this.town = this.locationInfo.address_reference.town.title;
this.street_id = this.locationInfo.address_reference.town.id;
this.street = this.locationInfo.address_reference.town.title;
let obj = {
area: this.locationInfo.ad_info.adcode,
street: {
name: this.street,
code: this.street_id
},
latitude: this.latitude,
longitude: this.longitude
}
console.log({
...obj
});
uni.navigateBack({
success: () => {
uni.$emit('changeAddress', obj)
}
})
} catch (e) {
return Toast('地址有误,请重新选择')
let data = {
lat: this.latitude,
lon: this.longitude,
address: this.address
}
uni.$emit('setData', JSON.stringify(data));
uni.navigateBack()
},
searchMap() {
uni.request({

View File

@ -6,11 +6,11 @@
</view>
<view class="nav-con" style="justify-content: space-between;">
<view class="" v-if="Object.keys(dataobj).length>0"
<view class="" v-if="columns.length>0"
style="padding-left: 20rpx;display: flex;color: white;" @click="show=true">
<u--image :src="u('qhtd')" width="38.55rpx" @click="scanFn" height="38.55rpx"
<u--image :src="u('qhtd')" width="38.55rpx" height="38.55rpx"
style="margin-right: 20rpx;"></u--image>
{{dataobj.title}}
<!-- {{dataobj.farm_name}} -->
</view>
<view v-else></view>
@ -48,19 +48,19 @@
</view>
<view class="content" v-if="true">
<!-- 养殖信息 -->
<!-- 养殖基地信息 -->
<view class="">
<view class="empty-land" v-if="Object.keys(dataobj).length<=0">
<text>没有养殖信息</text>
<view class="empty-land" v-if="columns.length<=0">
<text>没有养殖基地信息</text>
<text @click="navto('/pages/addPlant/addPlant')">去新增</text>
</view>
<view class="land-info">
<view class="land-area">
<view class="land-title">养殖规模</view>
<view class="land-title">养殖基地规模</view>
<view class="">
{{dataobj.total_area|| "--"}}
{{dataobj.form_scale|| "--"}}
</view>
</view>
@ -85,7 +85,7 @@
</view> -->
<view class="live-tit" style="color: #1A1A1A;">
<view class="tit" style="">
养殖监控数据
养殖基地监控数据
</view>
<view class="" style="font-size: 24rpx;color: #ACACAC;display: flex;align-items: center;">
<u-icon name="clock" style="margin-right: 5rpx;"></u-icon> {{getNowTimeFn()}}
@ -93,8 +93,20 @@
</view>
<view class="live">
<!-- <view class="live">
<u--image :src="u('K')" width="100%"></u--image>
</view> -->
<view class="live">
<u--image :src="videoCover" v-if="video_url" width="100%" height="450rpx"></u--image>
<u--image :src="u('K')" v-else width="100%"></u--image>
<view class=""
style="width: 100%;height: 100%;background-color: rgba(0, 0, 0, .5);position: absolute;top: 1px;"
@click="goLive" v-if="video_url">
<u-icon name="play-circle" size="40" color="white" v-if="video_url"
style="position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);"></u-icon>
</view>
</view>
<view class="">
@ -126,7 +138,7 @@
<view class="empty" v-else>
<view class="addPlant">
<view class="">
你还没有养殖信息
你还没有养殖基地信息
</view>
<view class="addBtn" @click="navto('/pages/addPlant/addPlant')">
去添加
@ -180,6 +192,8 @@
plantlist,
landproduct
} from '@/api/api.js'
import {farmLists} from "@/api/index.js"
import {farmTypeLists} from "@/api/dict.js"
import store from "@/store/index.js"
const showPicker = ref(false)
const showPicker1 = ref(false)
@ -270,11 +284,29 @@
});
}
const goLive = () => {
let system = uni.getSystemInfoSync().platform;
uni.navigateTo({
url: `/pages/live/${system == 'ios'?'liveIos':'live'}?url=${video_url.value }&user=${userInfo.value.master_phone}&device=${userInfo.value.device_id} `
})
}
const video_url = ref()
const testUser = () => {
if (uni.getStorageSync("SY_USER").mobile == '19130550023' || uni.getStorageSync("SY_USER").mobile ==
'19330904744') {
video_url.value =
"http://rtsp.lihaink.cn/live/lihai_lot_walnutpi_dev_6.live.mp4"
userInfo.value.master_phone = "lihai_lot_land_1"
userInfo.value.device_id = "6"
// console.log("19130550023")
}
}
const show = ref(false)
const showLoading = ref(false)
const columns = reactive([]);
onShow(() => {
getlist1()
getlist2()
})
@ -283,26 +315,6 @@
}
const getlist1 = () => {
landlist({
page_no: 1,
page_size: 99995,
keyword: ''
}).then((res) => {
if (res.code == 1) {
if (res.data.length > 0) {
columns.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.title,
id: step.id,
};
}));
}
}
})
}
const getlist2 = () => {
landproduct().then((res) => {
if (res.code == 1) {
@ -350,7 +362,85 @@
equipmentId.value = ''
}
const farm_lists = ref([]);
const farm_types_lists = ref([]);
const initFarmLists = ()=>{
farmTypeLists().then(res=>{
farm_types_lists.value = res.data
})
farmLists().then(res=>{
farm_lists.value = res.data;
columns.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.farm_name,
id: step.id,
};
}));
if(res.data.length>0) dataobj.value = res.data[0];
else dataobj.value = {};
getlist();
}).catch(err=>{
console.log(err);
})
}
initFarmLists();
//
const getlist = () => {
// lindexist({
// land_id: tdId.value
// }).then((res) => {
// if (res.code == 1) {
// userInfo.value = res.data
// video_url.value = res.data.video_url
// testUser()
// 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)
// Object.assign(dataobj, res.data);
// if (res.data && res.data.monitor && res.data.monitor.soil_monitor_data) {
// soilList[0].num = res.data.monitor.soil_monitor_data.soil_temperature
// soilList[1].num = res.data.monitor.soil_monitor_data.soil_moisture
// soilList[2].num = res.data.monitor.soil_monitor_data.conductivity
// soilList[3].num = res.data.monitor.soil_monitor_data.ph
// soilList[4].num = res.data.monitor.soil_monitor_data.n_content
// soilList[5].num = res.data.monitor.soil_monitor_data.p_content
// soilList[6].num = res.data.monitor.soil_monitor_data.k_content
// thresholdFn(soilList[0], threshold.soil_temp_min, threshold.soil_temp_max)
// thresholdFn(soilList[1], threshold.soil_mois_min, threshold.soil_mois_max)
// thresholdFn(soilList[3], threshold.soil_ph_min, threshold.soil_ph_max)
// thresholdFn(soilList[4], threshold.soil_n_content_min, threshold.soil_n_content_max)
// thresholdFn(soilList[5], threshold.soil_p_content_min, threshold.soil_p_content_max)
// thresholdFn(soilList[6], threshold.soil_k_content_min, threshold.soil_k_content_max)
// }
// if (res.data && res.data.monitor && res.data.monitor.air_monitor_data) {
// environmentList[0].num = res.data.monitor.air_monitor_data.wind_speed
// environmentList[1].num = res.data.monitor.air_monitor_data.wind_direction
// environmentList[2].num = res.data.monitor.air_monitor_data.air_temperature
// environmentList[3].num = res.data.monitor.air_monitor_data.air_moisture
// environmentList[4].num = res.data.monitor.air_monitor_data.co2_content
// environmentList[5].num = res.data.monitor.air_monitor_data.pressure
// environmentList[6].num = res.data.monitor.air_monitor_data.rainfall
// environmentList[7].num = res.data.monitor.air_monitor_data.light_intensity
// thresholdFn(environmentList[0], threshold.wind_speed_min, threshold.wind_speed_max)
// // thresholdFn(environmentList[1], threshold.wind_speed_min, threshold.wind_speed_max)
// thresholdFn(environmentList[2], threshold.air_temp_min, threshold.air_temp_max)
// thresholdFn(environmentList[3], threshold.air_mois_min, threshold.air_mois_max)
// thresholdFn(environmentList[4], threshold.air_co2_content_min, threshold
// .air_co2_content_max)
// thresholdFn(environmentList[5], threshold.ambient_air_pressure_min, threshold
// .ambient_air_pressure_max)
// // thresholdFn(environmentList[6], threshold.ambient_air_pressure_min, threshold.ambient_air_pressure_max)
// // thresholdFn(environmentList[6], threshold.ambient_air_pressure_min, threshold.ambient_air_pressure_max)
// }
// }
// }
// })
}
//
const biproduct = () => {
@ -391,8 +481,8 @@
}
const confirm = (e) => {
// console.log(e)
tdId.value = e.id
tdId.value = e.id;
dataobj.value = farm_lists.value.find(item=>item.id==e.id);
show.value = false
showLoading.value = true
setTimeout(() => {

View File

@ -1,99 +0,0 @@
<template>
<view class="container">
<view :style="'width: '+ windowWidth +'px; height: '+ boxStyle.height +'px;z-inde:-1;'">
<view class="root">
<video ref="videoPlayer"
src="http://192.168.1.27/live/test.live.flv?secret=gqig2yFKkDpIMic1uWZY1L5MsIo0eflm" controls
:object-fit="object_fit" autoplay="true"
:style="'width: '+ windowWidth +'px; height: '+ boxStyle.height +'px;'"></video>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
rtmpSources: [],
currentIndex: 0,
room: {},
wHeight: 0, //获取的屏幕高度🌟💗
boxStyle: { //视频,图片封面样式🌟💗
'height': 0,
'width': 0,
},
object_fit: 'contain', //视频样式默认包含🌟
windowWidth: '',
}
},
computed: {
currentSrc() {
return this.rtmpSources[this.currentIndex];
}
},
onLoad() {
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; //改变视频高度
this.get()
},
mounted() {
// 初始化时播放第一个源
// this.playCurrent();
},
methods: {
playCurrent() {
console.log(this.$refs.videoPlayer)
if (this.$refs.videoPlayer) {
this.$refs.videoPlayer.load();
this.$refs.videoPlayer.play();
}
},
playNext() {
this.currentIndex++;
if (this.currentIndex >= this.rtmpSources.length) {
this.currentIndex = 0; // 回到第一个源
}
this.playCurrent();
},
get() {
let that = this
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;
// })
},
},
}
</script>
<style lang="scss" scoped>
</style>

197
pages/live/live.vue Normal file
View File

@ -0,0 +1,197 @@
<template>
<view>
<view :vsrc="vsrc" :change:vsrc="renderScript.getVideoImg">
<video v-if="shwovideo" @play="playVedio" @fullscreenchange="fullscreenchange" :controls="true"
:autoplay="true" style="width: 100vw;height: 100vh;" :src="videoUrl" id="video"></video>
</view>
</view>
</template>
<script>
import {
videoCover
} from "@/api/api.js"
import {
Uploads
} from "@/api/upload.js"
export default {
data() {
return {
vsrc: {}, //renderjs
imgSrc: "",
subNvue: "",
videoUrl: "",
boxStyle: { //🌟💗
'height': 0,
'width': 0,
},
object_fit: 'contain', //🌟
windowWidth: '',
deviceId: "",
shwovideo: false,
initFailTimer: "",
flag: true,
SocketTask: "",
}
},
onLoad(option) {
this.deviceId = option.device
this.videoUrl = option.url
this.videoUrl = this.replaceLastThreeChars(this.videoUrl, "mp4");
// #ifndef H5
this.subNvue = uni.getSubNVueById('subNvue'); //
this.subNvue.show() //
// #endif
let datas = {
username: option.user,
device: 'lihai_lot_walnutpi_dev_' + option.device,
scene: 'app',
}
this.openScoket(datas)
this.platform = uni.getSystemInfoSync().platform
},
methods: {
replaceLastThreeChars(str, replacement) {
if (str.length < 3) {
return replacement + str;
} else {
return str.slice(0, -3) + replacement;
}
},
// base64
receiveImg(data) {
this.imgSrc = (data.test)
videoCover({
device_id: this.deviceId,
image: this.imgSrc
}).then(res => {
console.log(res)
}).catch(err => {
console.log(err)
})
},
//
setUrl(url) {
let options = {};
options.width = 400;
options.height = 280;
options.src = url;
this.vsrc = options;
},
openScoket(datas) {
let that = this
this.SocketTask = uni.connectSocket({
url: 'wss://iot.lihaink.cn/test',
complete: () => {
console.log(that.socket, "socketTASK")
}
});
this.SocketTask.onOpen(function(res) {
that.SocketTask.send({
data: JSON.stringify(datas)
});
that.SocketTask.onMessage(function(res) {
console.log(res, "收到消息")
if (JSON.parse(res.data).code == 200) {
that.shwovideo = true
}
});
});
this.SocketTask.onError(function(res) {
console.log('WebSocket连接打开失败请检查');
});
this.SocketTask.onClose(function(res) {
console.log('WebSocket 已关闭!');
});
},
playVedio() {
// #ifndef H5
this.subNvue.hide()
// #endif
uni.createVideoContext('video', this).requestFullScreen();
this.flag = false
setTimeout(() => {
this.setUrl(this.videoUrl)
}, 2000)
},
fullscreenchange(e) {
if (!e.detail.fullScreen) { // 退
plus.screen.lockOrientation('portrait-primary');
}
},
},
onUnload() {
this.SocketTask.close();
this.SocketTask = null
console.log(this.socket, 'sosddsdsd')
},
}
</script>
<script module="renderScript" lang="renderjs">
export default {
data() {
return {
test: ""
}
},
methods: {
//
getVideoImg(newValue, oldValue, ownerInstance, vm) {
if (newValue == null)
return;
let that = this;
// video
let video = document.createElement("VIDEO")
//
// video.setAttribute('muted', true)
video.muted = true
// setAttributevideo dom
video.autoplay = true;
//访
video.crossOrigin = 'anonymous';
// videosourcescr
video.innerHTML = '<source src=' + newValue.src + ' type="audio/mp4">'
// canvas
let canvas = document.createElement('canvas');
let ctx = canvas.getContext('2d');
// videocanplay
video.addEventListener('canplay', function() {
// PX
let anw = document.createAttribute("width");
anw.nodeValue = newValue.width;
let anh = document.createAttribute("height");
anh.nodeValue = newValue.height;
canvas.setAttributeNode(anw);
canvas.setAttributeNode(anh);
//
ctx.drawImage(video, 0, 0, newValue.width, newValue.height);
//
that.test = canvas.toDataURL('image/png') // base64
//
video.pause()
// base64
ownerInstance.callMethod('receiveImg', {
test: that.test
})
}, false)
},
}
}
</script>
<style lang="scss">
.vdo {
width: 100vw;
height: 100%;
}
</style>

111
pages/live/liveIos.nvue Normal file
View File

@ -0,0 +1,111 @@
<template>
<view>
<view>
<!-- :style="`width: ${videoHidth}px;height:${videoHeight}px;top:${videoOffset}px;left:${-videoOffset}px`" -->
<!-- style="width: 770px;height: 414px;top: 147px;left: -147px;" -->
<video v-if="shwovideo" @play="playVedio" @fullscreenchange="fullscreenchange" :controls="true"
:autoplay="true" :show-fullscreen-btn='false' :muted="true" :src="videoUrl" id="video" :style="`
width: ${videoWidth};
height: ${videoHeight};`"></video>
</view>
</view>
</template>
<script>
export default {
data() {
return {
imgSrc: "",
subNvue: "",
videoUrl: "",
videoUrl1: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4",
videoWidth: "",
videoHeight: "",
videoOffset: "",
object_fit: 'contain', //视频样式默认包含🌟
windowWidth: '',
deviceId: "",
shwovideo: false,
flag: true,
SocketTask: "",
}
},
onLoad(option) {
this.deviceId = option.device
this.videoUrl = option.url
this.subNvue = uni.getSubNVueById('subNvueIos'); //获取
let datas = {
username: option.user,
device: 'lihai_lot_walnutpi_dev_' + option.device,
scene: 'app',
}
this.openScoket(datas)
let platform = uni.getSystemInfoSync()
this.videoHeight = platform.windowHeight
this.videoWidth = platform.windowWidth
this.videoOffset = platform.screenHeight - platform.windowHeight + platform.statusBarHeight
},
methods: {
openScoket(datas) {
let that = this
this.SocketTask = uni.connectSocket({
url: 'wss://iot.lihaink.cn/test',
complete: () => {
console.log(that.socket, "socketTASK")
}
});
this.SocketTask.onOpen(function(res) {
that.SocketTask.send({
data: JSON.stringify(datas)
});
that.SocketTask.onMessage(function(res) {
console.log(res, "收到消息")
if (JSON.parse(res.data).code == 200) {
that.shwovideo = true
}
});
});
this.SocketTask.onError(function(res) {
console.log('WebSocket连接打开失败请检查');
});
this.SocketTask.onClose(function(res) {
console.log('WebSocket 已关闭!');
});
},
playVedio() {
this.subNvue.hide()
this.flag = false
},
fullscreenchange(e) {
if (!e.detail.fullScreen) { // 退出全屏,锁定竖屏
plus.screen.lockOrientation('portrait-primary');
}
},
}
,
onUnload() {
this.SocketTask.close();
this.SocketTask = null
console.log(this.socket, 'sosddsdsd')
},
}
</script>
<style lang="scss">
.video {
// transform: rotate(90deg);
// position: absolute;
// width: 770;
// height: 414;
// top: 174px;
// left: -174px;
// transform: translate(-50%, -50%);
}
</style>

20
pages/live/loading.nvue Normal file
View File

@ -0,0 +1,20 @@
<template>
<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>
</view>
</view>
</view>
</template>
<script>
export default {
}
</script>
<style>
</style>

View File

@ -72,7 +72,7 @@
<view class="card-li">
<view class="c-title">养殖图片</view>
<view class="c-title">养殖基地图片</view>
<view class="c-box c-box-p">
<view class="code-img1">
<view class="" v-if="pic.length>0"
@ -146,19 +146,19 @@
title: [{
type: 'string',
required: true,
message: '请填写养殖名称',
message: '请填写养殖基地名称',
trigger: ['blur', 'change']
}],
area: [{
type: 'string',
required: true,
message: '请填写养殖面积',
message: '请填写养殖基地面积',
trigger: ['blur', 'change']
}],
master_name: [{
type: 'string',
required: true,
message: '请输入养殖负责人名称',
message: '请输入养殖基地负责人名称',
trigger: ['blur', 'change']
}],
master_phone: [{

View File

@ -34,7 +34,7 @@
<view class="card-li">
<view class="c-title">养殖图片</view>
<view class="c-title">养殖基地图片</view>
<view class="c-box c-box-p">
<view class="code-img1">
<view class="" v-if="pic.length>0"
@ -146,13 +146,13 @@
title: [{
type: 'string',
required: true,
message: '请填写养殖名称',
message: '请填写养殖基地名称',
trigger: ['blur', 'change']
}],
area: [{
type: 'string',
required: true,
message: '请填写养殖面积',
message: '请填写养殖基地面积',
trigger: ['blur', 'change']
}],
province_code: [{
@ -176,13 +176,13 @@
address: [{
type: 'string',
required: true,
message: '请输入养殖详细地址',
message: '请输入养殖基地详细地址',
trigger: ['blur', 'change']
}],
master_name: [{
type: 'string',
required: true,
message: '请输入养殖负责人名称',
message: '请输入养殖基地负责人名称',
trigger: ['blur', 'change']
}],
master_phone: [{

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

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