| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- <template>
- <view>
- <view style="position: fixed;z-index: 100;width: 100%;">
- <uni-nav-bar right-icon="search" title="设备列表" @clickRight="clickRight"></uni-nav-bar>
- </view>
- <view class="utabs">
- <u-tabs :list="list" :is-scroll="true" :current="current" @change="change" item-width="140" font-size="24" gutter="20"
- bar-width="60" active-color="#42b983"></u-tabs>
- </view>
- <view class="list">
- <view class="list_item" v-for="(item,index) in eqlistdata" :key="index">
- <view class="list_item_top">
- <p class="p1">
- <image :src="images[current].path" mode=""></image>
- {{item.device_name}}
- </p>
- <p :class="[item.device_status?'p2':'p_out']">{{item.device_status?"在线":"离线"}}</p>
- </view>
- <view class="list_item_text">
- <p>设备ID:{{item.device_id}}</p>
- <p>适配用户:无</p>
- <p>添加设备时间:{{item.status_time|timeFormat()}}</p>
- </view>
- <view class="list_item_btn" @click="modification(item)">
- 修改名称
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- list: [{
- name: "杀虫灯"
- }, {
- name: "测报灯"
- }, {
- name: "智能性诱"
- }, {
- name: "环境检测"
- }, {
- name: "监控设备"
- }, {
- name: "孢子仪"
- }],
- current: 0,
- page:1,
- size:10,
- images: [{
- path: "../../static/image/fourMoodBase/杀虫灯.png",
- id: 2
- },
- {
- path: "../../static/image/fourMoodBase/测报灯.png",
- id: 3
- }, {
- path: "../../static/image/fourMoodBase/性诱测报.png",
- id: 4
- }, {
- path: "../../static/image/fourMoodBase/环境监测.png",
- id: 5
- }, {
- path: "../../static/image/fourMoodBase/监控.png",
- id: 6
- }, {
- path: "../../static/image/fourMoodBase/孢子仪.png",
- id: 7
- }
- ],
- eqlistdata:[]
- }
- },
- methods: {
- async eqlist() { //设备列表
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
- data: {
- device_type_id: this.current+2,
- page:this.page,
- size:this.size,
- }
- })
- this.eqlistdata=this.eqlistdata.concat(res.data)
- console.log(this.eqlistdata)
- },
- change(index) { //头部导航栏的点击
- console.log(index)
- this.page=1
- this.eqlistdata=[]
- this.current = index
- this.eqlist()
- },
- clickRight(){//搜索
- uni.navigateTo({
- url:"./search"
- })
- },
- modification(item){
- uni.navigateTo({
- url:"./modification?data="+JSON.stringify(item)
- })
- }
- },
- onLoad(){
- this.eqlist()
- },
- onReachBottom() {
- this.page++
- this.eqlist()
- }
- }
- </script>
- <style lang="scss">
- .utabs {
- width: 95%;
- position: fixed;
- top: 44px;
- z-index: 100;
- }
- .list{
- width: 100%;
- background-color: #FDFDFD;
- position: absolute;
- top: 180rpx;
- margin-bottom: 100rpx;
- .list_item{
- width: 95%;
- margin: 20rpx auto;
- padding: 10rpx 20rpx;
- position: relative;
- background-color: #FFFFFF;
- .list_item_top{
- display: flex;
- justify-content: space-between;
- .p1{
- height: 60rpx;
- line-height: 60rpx;
- font-size: 28rpx;
- image{
- width: 40rpx;
- height: 40rpx;
- vertical-align:text-top;
- margin-right: 20rpx;
- }
- }
- .p2{
- height: 60rpx;
- line-height: 60rpx;
- font-size: 28rpx;
- color: #42b983;
- }
- .p_out{
- height: 60rpx;
- line-height: 60rpx;
- font-size: 28rpx;
- color: red;
- }
- }
- .list_item_text{
- margin-top: 20rpx;
- p{
- font-size: 24rpx;
- color: #636363;
- margin-top: 10rpx;
- }
- p:first-child{
- font-size: 28rpx;
- font-weight: 700;
- }
- }
- .list_item_btn{
- width: 126rpx;
- color: #42b983;
- height: 40rpx;
- text-align: center;
- border: 1rpx solid #42b983;
- border-radius: 25rpx;
- font-size: 24rpx;
- line-height: 35rpx;
- position: absolute;
- top: 136rpx;
- right: 20rpx;
- }
- }
- }
- </style>
|