jsy-app-static/pages/index.vue
2024-09-29 11:05:04 +08:00

945 lines
22 KiB
Vue

<template>
<uni-nav-bar :statusBar="true" :fixed="true" backgroundColor="#39ac4f" :border="false" color="#fff">
<block v-slot:left>
<view @click="openLand">地块</view>
</block>
<view>西安设备测试</view>
<block v-slot:right>
<view class="fixed">
<view align="right" class="iconfont icon-liebiao icon" @click="toList"></view>
<view align="right" class="iconfont icon-scan icon" @click="toQRCode"></view>
</view>
</block>
</uni-nav-bar>
<custom-select-land ref="refLand" :data="landList" @select=""></custom-select-land>
<view class="content">
<view class="header-section">
<u-row justify="space-between" gutter="10">
<u-col span="8">
<u-search shape="square" :animation="true" :showAction="false"></u-search>
</u-col>
<u-col span="4">
<view class="demo-layout bg-purple-light">
<u-checkbox-group placement="row">
<u-checkbox :checked="false" label="工作(256)" labelColor="#ffffff"></u-checkbox>
</u-checkbox-group>
</view>
</u-col>
</u-row>
</view>
<view class="content-section">
<view v-if="isSticky" class="grey-box ceiling"
:style="[isSticky ? 'position: sticky;':'','z-index: 10','top: 50px']">
<u-grid :border="false" col="4">
<u-grid-item class="click">
<view class="flex">
<view class="iconfont icon-threshold"></view>
<u-badge numberType="overflow" type="success" max="999" value="155"></u-badge>
</view>
</u-grid-item>
<u-grid-item>
<view class="flex">
<view class="iconfont icon-jizhan"></view>
<u-badge numberType="overflow" type="success" max="999" value="15"></u-badge>
</view>
</u-grid-item>
<u-grid-item>
<view class="flex">
<view class="iconfont icon-lixian"></view>
<u-badge numberType="overflow" type="success" max="999" value="15"></u-badge>
</view>
</u-grid-item>
<u-grid-item>
<view class="flex">
<view class="iconfont icon-shangqing"></view>
<u-badge numberType="overflow" type="success" max="999" value="15"></u-badge>
</view>
</u-grid-item>
</u-grid>
</view>
<view v-else class="grey-box normal">
<u-grid :border="false" col="4">
<u-grid-item class="click">
<view class="iconfont icon-threshold"></view>
<u-badge numberType="overflow" type="success" max="999" value="155"></u-badge>
<text class="text">总设备</text>
</u-grid-item>
<u-grid-item>
<view class="iconfont icon-jizhan"></view>
<u-badge numberType="overflow" type="success" max="999" value="15"></u-badge>
<text class="text">在线设备</text>
</u-grid-item>
<u-grid-item>
<view class="iconfont icon-lixian"></view>
<u-badge numberType="overflow" type="success" max="999" value="15"></u-badge>
<text class="text">离线设备</text>
</u-grid-item>
<u-grid-item>
<view class="iconfont icon-shangqing"></view>
<u-badge numberType="overflow" type="success" max="999" value="15"></u-badge>
<text class="text">土壤墒情</text>
</u-grid-item>
</u-grid>
</view>
<view class="grey-box" style="border-radius: 0 0 15px 15px;">
<view class="card">
<u-collapse accordion>
<u-collapse-item>
<template #title>
<view class="jz-title fixed">
<view style="width:30%;">
<view class="iconfont icon-plume icon"></view>
<text>基站</text>
</view>
<view class="fixed" style="width:calc(100% - 30%); justify-content: flex-end;">
<view class="iconfont icon-xh icon"></view>
<view @click.stop="">
<u-button type="success" size="small" text="一键刷新" />
</view>
<view @click.stop="">
<u-button type="success" size="small" text="批量控制" />
</view>
</view>
</view>
</template>
<view class="u-collapse-content">
<u-row>
<u-col span="3">
<view class="fixed">
<text class="font-red">●</text>
<view>E0000104</view>
</view>
</u-col>
<u-col span="4" style="align-items: center;">
<view class="fixed">
<view class="signal">
<view class="bar"></view>
<view class="bar"></view>
<view class="bar"></view>
<view class="bar"></view>
<view class="bar"></view>
<view class="bar-no">
<u-icon name="close"></u-icon>
</view>
</view>
<text>(12)</text>
<view class="battery-container">
<text>{{ 10 }}</text>
<view class="battery-level" :style="[`width:${10}%`]" />
</view>
</view>
</u-col>
<u-col span="5">
<view class="fixed">
<u-button type="success" size="mini" text="手持基站"></u-button>
<u-button type="success" size="mini" text="刷新" icon="reload"></u-button>
</view>
</u-col>
</u-row>
<u-row>
<u-col span="3">
<view class="fixed">
<text class="font-green">●</text>
<view>E0000104</view>
</view>
</u-col>
<u-col span="4" style="align-items: center;">
<view class="fixed">
<view class="signal">
<view class="bar green"></view>
<view class="bar green"></view>
<view class="bar green"></view>
<view class="bar green"></view>
<view class="bar"></view>
<view class="bar-no" style="display: none;">
<u-icon name="close"></u-icon>
</view>
</view>
<text>(12)</text>
<view class="battery-container">
<text>{{ 60 }}</text>
<view class="battery-level" :style="[`width:${60}%`]" />
</view>
</view>
</u-col>
<u-col span="5">
<view class="fixed">
<u-button type="success" size="mini" text="手持基站"></u-button>
<u-button type="success" size="mini" text="刷新" icon="reload"></u-button>
</view>
</u-col>
</u-row>
</view>
</u-collapse-item>
</u-collapse>
</view>
<view class="card">
<u-collapse accordion>
<u-collapse-item>
<template #title>
<view class="sf-title fixed">
<view class="iconfont icon-diefa icon"></view>
<view class="text">A1</view>
<view style="margin:0 10px;">出水口数量</view>
<u-badge numberType="overflow" type="info" max="999" value="155"></u-badge>
</view>
</template>
<view class="u-collapse-content">
<u-row>
<u-col span="4">
<view class="fixed">
<view>A1</view>
<text class="font-green">●在线</text>
</view>
</u-col>
<u-col span="5">
<view class="battery-container">
<text>60</text>
<view class="battery-level battery-level-60">
</view>
</view>
</u-col>
<u-col span="3" style="align-items: flex-end;">
<u-switch v-model="value" @change="change" size="20"
activeColor="#39ac4f"></u-switch>
</u-col>
</u-row>
<view class="card-grey">
<view class="card-title">
<u-row>
<u-col span="2">
<view><text class="font-green">●</text>1-1</view>
</u-col>
<u-col span="5">
<view class="fixed">
<view class="battery-container">
<text>60</text>
<view class="battery-level battery-level-60">
</view>
</view>
<view>
<view class="iconfont icon-wendu icon"></view>26.2
</view>
</view>
</u-col>
<u-col span="5" style="align-items: flex-end;">
<view class="fixed">
<u-button type="success" size="mini" text="刷新"
icon="reload"></u-button>
</view>
</u-col>
</u-row>
</view>
<view class="control">
<u-row>
<u-col span="3" style=" align-items: flex-end;">
<view class="buttons">
<view class="btn fixed active">
<text>①</text>
<text>0.00</text>
<view class="iconfont icon-suoding icon"></view>
</view>
</view>
<u-line-progress height="8" :showText="false" :percentage="60" activeColor="#74ffd4"
inactiveColor="#c7c7c7" style="width: 75px;margin-top: 5px;"
@click="show = true">
</u-line-progress>
<view>
<u-popup :show="show" :mode="mode">
<view class="dialog-container">
<view class="dialog-title">
<view>1-2</view>
<view>①开</view>
<view class="close-btn">
<u-icon name="close" color="#333"
size="20"></u-icon>
</view>
</view>
<view class="dialog-body">
<view class="grid">
<view class="grid-time">
<view>-</view>
</view>
<view class="grid-time">
<view class="logs-data-box">
<view class="content" style="height: 100%;">
<view>
<view style="text-align: center;">
52%</view>
<view style="width: 100%;">
<u-slider :value="value"
height="100" blockSize="28"
min="0" max="100"
activeColor="#15d99b"
:step="step"
:showValue="false"
@changing="changing"
@change="change"></u-slider>
</view>
</view>
</view>
</view>
</view>
<view class="grid-time">
<view>+</view>
</view>
</view>
<view class="buttons">
<u-button type="success" size="large"
text="确定"></u-button>
<u-button type="info" size="large"
text="取消"></u-button>
</view>
</view>
</view>
</u-popup>
</view>
</u-col>
<u-col span="6">
<view class="valve">
<view>
<view class="btn fixed">
<text>全开</text>
</view>
</view>
<view class="btn-img">
<view class="text">
<view class="left">-99.63</view>
<view class="top">-99.63</view>
<view class="middle">离线</view>
<view class="right">-99.63</view>
<view class="bottom">-99.63</view>
</view>
<image src="../static/images/valves/valve3-all.gif"
mode="widthFix">
</image>
</view>
<view>
<view class="btn fixed">
<text>全关</text>
</view>
</view>
</view>
</u-col>
<u-col span="3">
<view class="buttons">
<view class="btn fixed">
<text></text>
<text>0.00</text>
<view class="iconfont icon-suoding icon"></view>
</view>
</view>
</u-col>
</u-row>
<view class="font-red">
<view class="iconfont icon-guzhang icon"></view>角度4故障
</view>
</view>
</view>
<view class="card-grey">
<view class="card-title">
<u-row>
<u-col span="2">
<view><text class="font-green"></text>1-1</view>
</u-col>
<u-col span="5">
<view class="fixed">
<view class="battery-container">
<text>60</text>
<view class="battery-level battery-level-60">
</view>
</view>
<view>
<view class="iconfont icon-wendu icon"></view>26.2
</view>
</view>
</u-col>
<u-col span="5" style="align-items: flex-end;">
<view class="fixed">
<u-button type="success" size="mini" text="刷新"
icon="reload"></u-button>
</view>
</u-col>
</u-row>
</view>
<view class="control">
<u-row>
<u-col span="3" style=" align-items: flex-end;">
<view class="buttons">
<view class="btn fixed active">
<text></text>
<text>0.00</text>
<view class="iconfont icon-suoding icon"></view>
</view>
</view>
</u-col>
<u-col span="6">
<view class="valve">
<view>
<view class="btn fixed">
<text>全开</text>
</view>
</view>
<view class="btn-img">
<view class="text5">
<view class="left">-99.63</view>
<view class="top">-99.63</view>
<view class="middle">离线</view>
<view class="right">-99.63</view>
<view class="bottom">-99.63</view>
</view>
<image src="../static/images/fiveValves/valve5.png"
mode="widthFix">
</image>
</view>
<view>
<view class="btn fixed">
<text>全关</text>
</view>
</view>
</view>
</u-col>
<u-col span="3">
<view class="buttons">
<view class="btn fixed">
<text></text>
<text>0.00</text>
<view class="iconfont icon-suoding icon"></view>
</view>
</view>
</u-col>
</u-row>
</view>
</view>
</view>
</u-collapse-item>
</u-collapse>
</view>
</view>
</view>
</view>
</template>
<script>
import store from "@/store"
export default {
data() {
return {
isSticky: false,
show: false,
landList: [1, 2, 3],
value: false,
}
},
onLoad() {
// uni.$emit("mqtt-link");
},
onShow() {
// #ifdef APP-PLUS
plus.screen.lockOrientation("portrait-primary");
plus.navigator.setFullscreen(false);
// #endif
},
onPageScroll(e) {
// 页面滚动触发事件的处理函数
// console.log(e.scrollTop); // 输出滚动位置的垂直距离
if (e.scrollTop >= 100) {
this.isSticky = true;
} else {
this.isSticky = false;
}
},
methods: {
ceshi(e) {
console.error("ceshi:", e);
// e.stopPropagation();
},
openLand() {
this.$refs.refLand.open();
},
change(e) {
console.log('change', e);
},
toList() {
uni.navigateTo({
url: `/pages/index-list`
})
},
toQRCode() {},
},
}
</script>
<style lang="scss" scoped>
// .content {
// display: flex;
// flex-direction: column;
// align-items: center;
// justify-content: center;
// }
page {
background-color: #ffffff;
}
// 箭头隐藏
::v-deep.u-cell__right-icon-wrap {
display: none;
}
// nav
::v-deep.uni-navbar__header-container {
align-items: center;
justify-content: center;
&>view {
font-size: 36rpx;
}
}
::v-deep.uni-navbar__header-btns-left {
font-size: 27rpx;
}
::v-deep.uni-navbar__header-btns-right .icon {
font-size: 44rpx;
margin-left: 10px;
}
.header-section {
padding: 0px 10px 102px 10px;
background-color: #39ac4f;
color: white;
border-radius: 0 0 30px 30px;
::v-deep.u-search__content,
::v-deep.u-search__content__input {
background-color: white !important;
border-radius: 8px !important;
.u-icon__icon {
color: #39ac4f !important;
}
}
// 复选框
::v-deep .u-checkbox__icon-wrap {
background-color: transparent !important;
border-color: #ffffff !important;
}
}
.content {
background-color: #fff;
min-height: 100%;
}
.content-section {
position: relative;
top: -92px;
.grey-box.normal {
border-radius: 15px 15px 0 0;
padding-bottom: 0;
.u-grid {
margin-bottom: 0;
}
}
.grey-box.ceiling {
border-radius: 0;
padding-bottom: 0px;
margin: 0;
box-shadow: 0 1px 9px rgba(209, 209, 209, 0.5);
.u-grid {
padding-bottom: 10px;
.u-grid-item {
padding-bottom: 5px;
box-shadow: none;
.flex {
&>view {
margin: -2px 5px 0 0;
color: #39ac4f;
font-size: 50rpx;
}
::v-deep.u-badge {
position: relative;
right: auto;
top: auto;
height: 10px;
}
}
}
.click {
.flex {
&>view {
color: #fff;
}
}
}
}
}
.grey-box {
background-color: #f3f3f3;
margin: 0 10px;
border-radius: 15px;
padding: 15px 10px;
.u-grid {
margin-bottom: 15px;
.u-grid-item {
margin: auto 5px;
width: calc(25% - 10px) !important;
background-color: #ffffff !important;
padding: 10px 0;
border-radius: 10px;
box-shadow: 0 1px 9px rgb(209, 209, 209, 0.5);
&>view {
color: #39ac4f;
font-size: 60rpx;
}
&>.text {
color: #999999;
display: block;
font-size: 28rpx;
margin-top: 8px;
}
::v-deep.u-badge {
position: absolute;
right: 3px;
top: 3px;
}
}
.click {
background-color: #39ac4f !important;
&>view {
color: #fff;
}
&>.text {
color: #fff;
}
::v-deep.u-badge {
background-color: #ffffff !important;
color: #39ac4f;
}
}
}
}
.card {
::v-deep.u-cell__body {
padding: 10px;
}
::v-deep.u-collapse-item__content__text {
padding: 10px 10px 0;
.u-collapse-content {
.u-row {
margin-bottom: 10px;
}
}
}
.u-button {
margin: 0 0 0 5px;
}
.jz-title {
.icon {
vertical-align: top;
margin-right: 5px;
font-size: 44rpx;
color: #39ac4f;
}
text {
font-size: 32rpx;
}
}
.sf-title {
font-size: 24rpx;
color: #999999;
.text {
font-size: 32rpx;
color: #333;
}
.icon {
vertical-align: top;
margin-right: 5px;
font-size: 44rpx;
color: #39ac4f;
}
}
}
}
// 信号
.signal {
position: relative;
display: flex;
align-items: flex-end;
height: 17px;
.bar {
width: 2px;
background-color: #999;
border-radius: 2px;
margin-right: 2px;
}
.bar:nth-child(1) {
height: 4px;
}
.bar:nth-child(2) {
height: 7px;
}
.bar:nth-child(3) {
height: 10px;
}
.bar:nth-child(4) {
height: 13px;
}
.bar:nth-child(5) {
height: 16px;
}
.bar.red {
background-color: #e60012;
}
.bar.orange {
background-color: #ffa200;
}
.bar.green {
background-color: #39ac4f;
}
.bar-no {
position: absolute;
left: -2px;
bottom: 3px;
::v-deep.u-icon__icon {
font-weight: bold;
font-size: 18rpx !important;
}
}
}
// 电池
.battery-container {
margin: 0 0 0 10px;
position: relative;
width: 31px;
height: 16px;
line-height: 14px;
background-color: #fff;
border-radius: 3px;
border: 1px solid #333;
text-align: center;
text {
position: relative;
z-index: 2;
}
}
.battery-container::after {
content: "";
position: absolute;
top: 4px;
right: -2px;
width: 1px;
height: 5px;
background-color: #333;
border-radius: 4px;
}
.battery-level {
height: 12px;
position: absolute;
top: 1px;
bottom: 0;
left: 1px;
width: 90%;
max-width: 90%;
background-color: #4CAF50;
border-radius: 2px;
transition: width 0.5s;
}
/* 不同的电量级别 */
.battery-level-100 {
width: 100%;
}
.battery-level-80 {
width: 80%;
}
.battery-level-60 {
width: 60%;
}
.battery-level-40 {
width: 40%;
}
.battery-level-20 {
width: 20%;
}
.battery-level-0 {
width: 0%;
}
/* 弹出进度条 */
.dialog-container {
min-width: 300px;
.dialog-title {
position: relative;
text-align: center;
height: 34px;
line-height: 34px;
border-bottom: 1px solid #ddd;
&>uni-view {
display: inline-block;
font-weight: bold;
font-size: 16px;
}
&>uni-view:nth-child(2) {
font-size: 14px;
color: #5bc724;
margin-left: 10px;
}
.close-btn {
position: absolute;
top: 50%;
right: 10px;
transform: translateY(-50%);
}
}
movable-area {
height: 30rpx;
width: 210px;
margin: auto;
border-radius: 5px;
background-color: #D8D8D8;
overflow: hidden;
}
movable-view {
display: flex;
align-items: center;
justify-content: center;
width: 10px;
height: 100%;
background-color: #15d99b;
color: #fff;
text-align: center;
}
::v-deep .uni-slider-handle-wrapper {
height: 30px !important;
}
::v-deep .uni-slider-thumb {
width: 24px !important;
height: 24px !important;
box-shadow: 0 0 0px 4px #74ffd4 !important;
margin-top: -12px !important;
}
::v-deep uni-slider {
margin: 10px 18px 0 18px !important;
}
::v-deep uni-slider .uni-slider-tap-area {
padding: 0 !important;
}
.dialog-body {
.grid {
margin: 20px;
display: grid;
grid-template-columns: 0.5fr 2fr 0.5fr;
.grid-time:first-child,
.grid-time:last-child {
display: grid;
justify-items: end;
align-items: end;
&>uni-view {
width: 35px;
height: 30px;
background-color: #eaecf0;
text-align: center;
font-size: 30px;
line-height: 26px;
color: #564556;
}
}
.grid-time:last-child {
justify-items: left;
}
}
.buttons {
margin: 40px 10px 10px;
display: flex;
justify-content: center;
}
}
}
</style>