Commit f8475937 authored by 冯超鹏's avatar 冯超鹏

新模块

parent 8bc844d1
...@@ -6,15 +6,15 @@ Vue.component('basics',basics) ...@@ -6,15 +6,15 @@ Vue.component('basics',basics)
import components from './pages/component/home.vue' import components from './pages/component/home.vue'
Vue.component('components',components) Vue.component('components',components)
import plugin from './pages/plugin/home.vue'
Vue.component('plugin',plugin)
import adddevice from './pages/adddevice/home.vue' import adddevice from './pages/adddevice/home.vue'
Vue.component('adddevice',adddevice) Vue.component('adddevice',adddevice)
import userme from './pages/userme/userme.vue' import userme from './pages/userme/userme.vue'
Vue.component('userme',userme) Vue.component('userme',userme)
import search from './pages/search/home.vue'
Vue.component('search',search)
import cuCustom from './colorui/components/cu-custom.vue' import cuCustom from './colorui/components/cu-custom.vue'
Vue.component('cu-custom',cuCustom) Vue.component('cu-custom',cuCustom)
......
...@@ -5,33 +5,29 @@ ...@@ -5,33 +5,29 @@
"style": { "style": {
"navigationBarTitleText": "登入" "navigationBarTitleText": "登入"
} }
},{ }, {
"path": "pages/main/main", "path": "pages/main/main",
"style": { "style": {
"navigationBarTitleText": "泽宏云设备监测" "navigationBarTitleText": "泽宏云设备监测"
} }
},{
"path": "pages/reg/reg",
"style": {
"navigationBarTitleText": "注册"
}
}, {
"path": "pages/pwd/pwd",
"style": {
"navigationBarTitleText": "找回密码"
}
}, { }, {
"path": "pages/user/user",
"style": {
"navigationBarTitleText": "我的"
}
},{
"path": "pages/basics/deviceinfo", "path": "pages/basics/deviceinfo",
"style": {}
}, {
"path": "pages/basics/devicerecording",
"style": {}
}, {
"path": "pages/userme/userpolice",
"style": {}
}, {
"path": "pages/userme/userlist",
"style": { "style": {
"enablePullDownRefresh": true
} }
},{ }, {
"path": "pages/basics/devicerecording", "path": "pages/userme/userdevicelist",
"style": { "style": {
"enablePullDownRefresh": true
} }
} }
], ],
...@@ -69,7 +65,6 @@ ...@@ -69,7 +65,6 @@
"name": "表单", //模式名称 "name": "表单", //模式名称
"path": "pages/main/main", //启动页面 "path": "pages/main/main", //启动页面
"query": "" //启动参数 "query": "" //启动参数
} }]
]
} }
} }
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<block slot="content">设备记录</block> <block slot="content">设备记录</block>
</cu-custom> </cu-custom>
<view> <view>
<view class="cu-timeline" v-for="(item,index) in devicedata"> <view class="cu-timeline" v-for="(item,index) in devicedata" :key="index">
<view class="cu-item"> <view class="cu-item">
<view class="content"> <view class="content">
<view class="cu-capsule radius"> <view class="cu-capsule radius">
...@@ -22,6 +22,12 @@ ...@@ -22,6 +22,12 @@
</view> </view>
</view> </view>
</view> </view>
<!-- 返回首页 -->
<view v-if="ishome">
<view @click="hoishome">
<image class="ishome" src="../../static/ishome.png"></image>
</view>
</view>
</view> </view>
</template> </template>
...@@ -31,10 +37,14 @@ ...@@ -31,10 +37,14 @@
data() { data() {
return { return {
devicedata: [], devicedata: [],
ishome: false,
} }
}, },
methods: { methods: {
deviceinfo(total, device_num) { deviceinfo(total, device_num) {
uni.showLoading({
title: '加载数据中...'
});
let data = { let data = {
currentPage: 1, currentPage: 1,
deviceNum: device_num, deviceNum: device_num,
...@@ -49,10 +59,16 @@ ...@@ -49,10 +59,16 @@
}; };
http.httpRequest(opts, data).then(res => { http.httpRequest(opts, data).then(res => {
this.devicedata = res.data.data.list this.devicedata = res.data.data.list
uni.hideLoading();
}, error => { }, error => {
console.log(error); console.log(error);
}) })
}, },
hoishome() {
uni.reLaunch({
url: '../main/main',
});
},
}, },
filters: { filters: {
timeStamp: function(str) { timeStamp: function(str) {
...@@ -68,9 +84,23 @@ ...@@ -68,9 +84,23 @@
onLoad(e) { onLoad(e) {
var data = JSON.parse(e.data); var data = JSON.parse(e.data);
this.deviceinfo(data.total, data.list[0].device_num); this.deviceinfo(data.total, data.list[0].device_num);
},
onShow() {
let pages = getCurrentPages(); //当前页面栈
if (pages.length >= 4) {
this.ishome = true;
} }
},
} }
</script> </script>
<style> <style>
.ishome{
width: 90upx;
height: 90upx;
position:fixed;
z-index: 99999;
left: 640upx;
bottom: 200upx;
}
</style> </style>
<template name="components"> <template name="components">
<view> <view>
我是设备状态 <cu-custom bgColor="bg-gradual-blue" :isBack="false">>
<!-- <scroll-view scroll-y class="page"> <block slot="content">设备记录</block>
<image src="/static/componentBg.png" mode="widthFix" class="response"></image> </cu-custom>
<view class="nav-list"> <view class="cu-bar bg-white solid-bottom">
<navigator hover-class='none' :url="'/pages/component/' + item.name" class="nav-li" navigateTo :class="'bg-'+item.color" <view class="action">
:style="[{animation: 'show ' + ((index+1)*0.2+1) + 's 1'}]" v-for="(item,index) in elements" :key="index"> <text class="cuIcon-title text-orange"></text>{{ tagname }}
<view class="nav-title">{{item.title}}</view>
<view class="nav-name">{{item.name}}</view>
<text :class="'cuIcon-' + item.cuIcon"></text>
</navigator>
</view> </view>
<view class="cu-tabbar-height"></view> </view>
</scroll-view> --> <scroll-view scroll-x class="bg-white nav text-center">
<view class="cu-item" :class="index==TabCur?'text-blue cur':''" v-for="(item,index) in tagdata" :key="index" @tap="tabSelect"
:data-id="index" :data-tagname="item">
{{item}}
</view>
</scroll-view>
</view> </view>
</template> </template>
...@@ -20,74 +21,22 @@ ...@@ -20,74 +21,22 @@
export default { export default {
data() { data() {
return { return {
elements: [{ TabCur: 0,
title: '操作条', tagdata: ['危化监测','消防监测'],
name: 'bar', tagname: '危化监测',
color: 'purple', };
cuIcon: 'vipcard'
},
{
title: '导航栏 ',
name: 'nav',
color: 'mauve',
cuIcon: 'formfill'
},
{
title: '列表',
name: 'list',
color: 'pink',
cuIcon: 'list'
},
{
title: '卡片',
name: 'card',
color: 'brown',
cuIcon: 'newsfill'
},
{
title: '表单',
name: 'form',
color: 'red',
cuIcon: 'formfill'
},
{
title: '时间轴',
name: 'timeline',
color: 'orange',
cuIcon: 'timefill'
},
{
title: '聊天',
name: 'chat',
color: 'green',
cuIcon: 'messagefill'
}, },
{ methods: {
title: '轮播', tabSelect(e) {
name: 'swiper', this.TabCur = e.currentTarget.dataset.id;
color: 'olive', this.tagname = e.currentTarget.dataset.tagname;
cuIcon: 'album' }
}, },
{ created() {
title: '模态框', // this.
name: 'modal',
color: 'grey',
cuIcon: 'squarecheckfill'
}, },
{
title: '步骤条',
name: 'steps',
color: 'cyan',
cuIcon: 'roundcheckfill'
}
],
};
}
} }
</script> </script>
<style> <style>
.page {
height: 100vh;
}
</style> </style>
...@@ -2,15 +2,9 @@ ...@@ -2,15 +2,9 @@
<view> <view>
<basics v-if="PageCur=='basics'"></basics> <basics v-if="PageCur=='basics'"></basics>
<components v-if="PageCur=='component'"></components> <components v-if="PageCur=='component'"></components>
<plugin v-if="PageCur=='plugin'"></plugin>
<adddevice v-if="PageCur=='adddevice'"></adddevice> <adddevice v-if="PageCur=='adddevice'"></adddevice>
<userme v-if="PageCur=='userme'"></userme> <userme v-if="PageCur=='userme'"></userme>
<!-- <view class="action" @click="NavChange" data-cur="basics"> <search v-if="PageCur=='search'"></search>
<view class='cuIcon-cu-image'>
<image :src="'/static/tabbar/basics' + [PageCur=='basics'?'_cur':''] + '.png'"></image>
</view>
<view :class="PageCur=='basics'?'text-green':'text-gray'">元素</view>
</view> -->
<view class="cu-bar tabbar bg-black shadow foot"> <view class="cu-bar tabbar bg-black shadow foot">
<view :class="PageCur=='basics'?'action text-green':'action text-gray'" @click="NavChange" data-cur="basics"> <view :class="PageCur=='basics'?'action text-green':'action text-gray'" @click="NavChange" data-cur="basics">
<view class="cuIcon-homefill"></view> 首页 <view class="cuIcon-homefill"></view> 首页
...@@ -22,38 +16,17 @@ ...@@ -22,38 +16,17 @@
<button class="cu-btn cuIcon-add bg-green shadow" @click="NavChange" data-cur="adddevice"></button> <button class="cu-btn cuIcon-add bg-green shadow" @click="NavChange" data-cur="adddevice"></button>
添加设备 添加设备
</view> </view>
<view class="action text-gray"> <view :class="PageCur=='search'?'action text-green':'action text-gray'" @click="NavChange" data-cur="search">
<view class="cuIcon-search"> <view class="cuIcon-search">
</view> </view>
搜索设备 搜索设备
</view> </view>
<view :class="PageCur=='userme'?'action text-green':'action text-gray'" @click="NavChange" data-cur="userme"> <view :class="PageCur=='userme'?'action text-green':'action text-gray'" @click="NavChange" data-cur="userme">
<view class="cuIcon-my"> <view class="cuIcon-my">
<view class="cu-tag badge"></view>
</view> </view>
我的 我的
</view> </view>
</view> </view>
<!-- <view class="cu-bar tabbar bg-white shadow foot">
<view class="action" @click="NavChange" data-cur="basics">
<view class='cuIcon-cu-image'>
<image :src="'/static/tabbar/basics' + [PageCur=='basics'?'_cur':''] + '.png'"></image>
</view>
<view :class="PageCur=='basics'?'text-green':'text-gray'">元素</view>
</view>
<view class="action" @click="NavChange" data-cur="component">
<view class='cuIcon-cu-image'>
<image :src="'/static/tabbar/component' + [PageCur == 'component'?'_cur':''] + '.png'"></image>
</view>
<view :class="PageCur=='component'?'text-green':'text-gray'">组件</view>
</view>
<view class="action" @click="NavChange" data-cur="plugin">
<view class='cuIcon-cu-image'>
<image :src="'/static/tabbar/plugin' + [PageCur == 'plugin'?'_cur':''] + '.png'"></image>
</view>
<view :class="PageCur=='plugin'?'text-green':'text-gray'">扩展</view>
</view>
</view> -->
</view> </view>
</template> </template>
......
<template>
<view>
<cu-custom bgColor="bg-gradual-blue" :isBack="false">
<block slot="content">搜索设备</block>
</cu-custom>
<view class="cu-bar bg-white">
<view class="action">
<text class="cuIcon-title text-green"></text>
<text>搜索设备</text>
</view>
<view class="action">
<text class="cuIcon-deletefill text-gray"></text>清空历史
</view>
</view>
<view class="cu-bar search bg-white margin-top">
<view class="search-form round">
<text class="cuIcon-search"></text>
<input @focus="InputFocus" @blur="InputBlur" @input="devicedata" :adjust-position="false" type="text"
placeholder="搜索设备号、名称" confirm-type="search"></input>
</view>
<view class="action">
<button class="cu-btn bg-green shadow-blur round" @click="postseachdata">搜索</button>
</view>
</view>
<view class="cu-list menu-avatar" style="margin-top: 12upx;margin-bottom: 120upx;">
<view class="cu-item" v-for="(item,index) in seardevicedata" :key="index" @click="devicceinfo(item.id)">
<view class="cu-avatar round lg" :style="item.status_name === '正常' ? icon_device_li_green : icon_device_li "></view>
<view class="content">
<view class="text-grey">{{item.usernickname}}</view>
<view class="text-gray text-sm">设备编号:{{item.devicenum}}</view>
</view>
<view class="action" :style="item.status_name.length === 5 ? 'margin-right:60upx;' : (item.status_name.length === 4 ? 'margin-right:30upx;' : '')"
style="margin-top:25upx;">
<view :class="item.status_name === '正常'? 'cu-tag bg-green' : 'cu-tag bg-red' ">{{item.status_name}}</view>
</view>
</view>
</view>
<!-- <view class="history">
<view class="cu-tag bg-grey" style="margin-top: 20upx;margin-left: 12upx;" v-for="(item,index) in 30" :key="index">324324</view>
</view> -->
</view>
</template>
<script>
import http from '@/components/utils/http.js';
export default {
data() {
return {
InputBottom: 0,
searchdata: '',
seardevicedata: [],
icon_device_li_green: 'background-image: url(../../static/img/icon_device_li_green.png)',
icon_device_li: 'background-image:url(../../static/img/icon_device_li.png)',
};
},
methods: {
InputFocus(e) {
this.InputBottom = e.detail.height
},
InputBlur(e) {
this.InputBottom = 0
},
//设备搜索
devicedata(e) {
this.searchdata = e.detail.value;
this.imitation();
},
//请求搜索
postseachdata() {
let opts = {
url: 'huinapphome/setseachdata',
method: 'post'
};
let data = {
setseachdata: this.searchdata,
};
http.httpRequest(opts, data).then(res => {
if(res.data.data.length >= 1){
this.seardevicedata = res.data.data
}
}, error => {
console.log(error);
})
// this.setseachdata();
},
//缓存搜索历史
setseachdata() {
const value = uni.getStorageSync('setseachdata');
if (value === undefined || value === '') {
uni.setStorageSync('setseachdata', this.searchdata);
} else {
// arr.map((val, index, value) => {
// this.deviceList.push(val);
// })
}
uni.setStorageSync('setseachdata', []);
},
//模糊列表
imitation() {
let opts = {
url: 'huinapphome/imitation',
method: 'post'
};
let data = {
imitationdata: this.searchdata,
};
http.httpRequest(opts, data).then(res => {
if(res.data.data.length >= 1){
this.seardevicedata = res.data.data
}
}, error => {
console.log(error);
})
},
//跳转设备详情
devicceinfo(id){
let opts = {
url: 'huinapphome/devicedatainfo/' + id,
method: 'get'
};
http.httpRequest(opts).then(res => {
if (res.data.code === 200) {
uni.navigateTo({
url: '/pages/basics/deviceinfo?data=' + JSON.stringify(res.data.data),
});
}
}, error => {
console.log(error);
})
}
}
}
</script>
<style>
.history {
width: 90%;
height: 550upx;
margin-left: 32upx;
margin-top: 70upx;
}
</style>
<template>
<view>
<cu-custom bgColor="bg-gradual-blue" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">{{ username }}设备列表</block>
</cu-custom>
<view class="cu-bar bg-white solid-bottom">
<view class="action">
<text class="cuIcon-title text-orange "></text> 用户设备列表
</view>
</view>
<view class="cu-list menu-avatar">
<view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''" v-for="(item,index) in userlistdata"
:key="index" @touchstart="ListTouchStart" @touchmove="ListTouchMove" @touchend="ListTouchEnd" :data-target="'move-box-' + index">
<view class="cu-avatar round lg" :style="item.status_name === '正常' ? icon_device_li_green : icon_device_li "></view>
<view class="content">
<view class="text-grey">位置:{{item.deviceinfo}}</view>
<view class="text-gray text-sm">设备编号:{{item.devicenum}}</view>
<view class="text-gray text-sm">值:{{item.nd}}</view>
</view>
<view class="action" :style="item.status_name.length === 5 ? 'margin-right:60upx;' : (item.status_name.length === 4 ? 'margin-right:30upx;' : '')"
style="margin-top:25upx;">
<view :class="item.status_name === '正常'? 'cu-tag bg-green' : 'cu-tag bg-red' ">{{item.status_name}}</view>
</view>
<view class="move">
<view class="bg-grey" @click="devicedatainfo(item.id)">查详情</view>
<view class="bg-red" @click="devicerecording(item.devicenum)">查记录</view>
</view>
</view>
</view>
</view>
</template>
<script>
import http from '@/components/utils/http.js';
export default {
data() {
return {
username: '',
icon_device_li_green: 'background-image: url(../../static/img/icon_device_li_green.png)',
icon_device_li: 'background-image:url(../../static/img/icon_device_li.png)',
uid: '',
userlistdata: [],
modalName: null,
listTouchStart: 0,
}
},
methods: {
userlist() {
uni.showLoading({
title: '加载数据中...'
});
let opts = {
url: 'devices/deviceLocation',
method: 'get'
};
let data = {
uid: this.uid,
};
http.httpRequest(opts, data).then(res => {
this.userlistdata = res.data.data;
uni.hideLoading();
}, error => {
console.log(error);
})
},
//获取设备详情
devicedatainfo(id) {
let opts = {
url: 'huinapphome/devicedatainfo/' + id,
method: 'get'
};
http.httpRequest(opts).then(res => {
if (res.data.code === 200) {
uni.navigateTo({
url: '/pages/basics/deviceinfo?data=' + JSON.stringify(res.data.data),
});
}
}, error => {
console.log(error);
})
},
devicerecording(id) {
let data = {
currentPage: 1,
deviceNum: id,
deviceStatus: 0,
pageSize: 1,
timeRange: '',
total: 1,
};
let opts = {
url: 'devices/detedevice',
method: 'post'
};
http.httpRequest(opts, data).then(res => {
if (res.data.data.total > 0) {
if (res.data.code === 200) {
uni.navigateTo({
url: '/pages/basics/devicerecording?data=' + JSON.stringify(res.data.data),
});
}
} else {
uni.showToast({
icon: 'none',
title: '暂无记录',
duration: 2000
});
}
}, error => {
console.log(error);
})
},
// ListTouch触摸开始
ListTouchStart(e) {
this.listTouchStart = e.touches[0].pageX - 120
},
// ListTouch计算方向
ListTouchMove(e) {
this.listTouchDirection = e.touches[0].pageX - this.listTouchStart > 0 ? 'right' : 'left'
},
// ListTouch计算滚动
ListTouchEnd(e) {
if (this.listTouchDirection == 'left') {
this.modalName = e.currentTarget.dataset.target
} else {
this.modalName = null
}
this.listTouchDirection = null
},
},
filters: {
timeStamp: function(value) {
if (!value) return '';
var date = new Date(value * 1000); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
var year = date.getFullYear();
var month = ("0" + (date.getMonth() + 1)).slice(-2);
var sdate = ("0" + date.getDate()).slice(-2);
var hour = ("0" + date.getHours()).slice(-2);
var minute = ("0" + date.getMinutes()).slice(-2);
var second = ("0" + date.getSeconds()).slice(-2);
// 拼接
var result = year + "." + month + "." + sdate + " " + hour + ":" + minute //+ ":" + second;
// 返回
return result;
},
},
onLoad(e) {
this.uid = e.id;
this.username = e.name;
},
created() {
//获取报警记录
this.userlist();
},
}
</script>
<style>
</style>
<template>
<view>
<cu-custom bgColor="bg-gradual-blue" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">用户列表</block>
</cu-custom>
<view class="cu-bar bg-white solid-bottom">
<view class="action">
<text class="cuIcon-title text-orange "></text> 用户列表
</view>
</view>
<view class="cu-bar search bg-white">
<view class="search-form round">
<text class="cuIcon-search"></text>
<input @focus="InputFocus" @blur="InputBlur" @input="value" :adjust-position="false" type="text" placeholder="用户名称"
confirm-type="search"></input>
</view>
<view class="action">
<button class="cu-btn bg-green shadow-blur round" @click="userSeek">搜索</button>
</view>
</view>
<view class="cu-list menu-avatar margin-top">
<view class="cu-item" v-for="(item,index) in userlistdata" :key="index" @click="userdevicelist(item.id,item.username)">
<view class="cu-avatar round lg" style="background-image: url(../../static/user.png);">
</view>
<view class="content">
<view class="text-grey">
<view class="text-cut">{{ item.username }}</view>
<view class="cu-tag round bg-orange sm" :class="item.state === 1 ? 'bg-red' : (item.state === 2 ? 'bg-green' : 'bg-red')">{{ item.state === 1 ? '禁用' : (item.state === 2 ? '正常' : '逻辑删除') }}</view>
</view>
<view class="text-gray text-sm flex">
用户邮箱:{{ item.email }}
</view>
<view class="text-gray text-sm flex">
用户地址:{{ item.province }}-{{ item.area }}-{{ item.city}}
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import http from '@/components/utils/http.js';
export default {
data() {
return {
userlistdata: [],
page: 1,
limit: 10,
InputBottom: 0,
userpront: '',
}
},
methods: {
//获取报警
userlist() {
let opts = {
url: 'user/HUserList',
method: 'get'
};
let data = {
page: this.page,
limit: this.limit
};
http.httpRequest(opts, data).then(res => {
this.userlistdata = res.data.data.users;
}, error => {
console.log(error);
})
},
//用户搜索
userSeek() {
let opts = {
url: 'user/userSeek',
method: 'post'
};
let data = {
page: this.page,
limit: this.limit,
name: this.userpront,
};
http.httpRequest(opts, data).then(res => {
if (res.data.data.users.length < 1) {
uni.showToast({
title: '搜索暂无数据!',
duration: 2000
});
} else {
this.userlistdata = res.data.data.users;
}
}, error => {
console.log(error);
})
},
InputFocus(e) {
this.InputBottom = e.detail.height
},
InputBlur(e) {
this.InputBottom = 0
},
value(e) {
this.userpront = e.detail.value
},
//跳转到用户设备列表
userdevicelist(id,name){
uni.navigateTo({
url: '/pages/userme/userdevicelist?id=' + id + '&name=' + name,
});
}
},
computed: {},
//下拉加载
onReachBottom() {
++this.page;
let opts = {
url: 'user/HUserList',
method: 'get'
};
let data = {
page: this.page,
limit: this.limit
};
http.httpRequest(opts, data).then(res => {
var isLoadding = res.data.data.users.length >= 1 ? true : false;
let arr = res.data.data.users
arr.map((val, index, arr) => {
this.userlistdata.push(val);
})
}, error => {
console.log(error);
})
},
filters: {
timeStamp: function(value) {
if (!value) return '';
var date = new Date(value * 1000); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
var year = date.getFullYear();
var month = ("0" + (date.getMonth() + 1)).slice(-2);
var sdate = ("0" + date.getDate()).slice(-2);
var hour = ("0" + date.getHours()).slice(-2);
var minute = ("0" + date.getMinutes()).slice(-2);
var second = ("0" + date.getSeconds()).slice(-2);
// 拼接
var result = year + "." + month + "." + sdate //+ " " + hour + ":" + minute //+ ":" + second;
// 返回
return result;
},
},
created() {
//获取报警记录
this.userlist();
},
}
</script>
<style>
</style>
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
<!-- <text>Amibition</text> --> <!-- <text>Amibition</text> -->
</view> </view>
<view class="margin-top-sm"> <view class="margin-top-sm">
<text class="radius text-center shadow-blur bg-black" >{{ username }}</text> <text class="radius text-center shadow-blur bg-black">{{ username }}</text>
</view> </view>
<image src="https://raw.githubusercontent.com/weilanwl/ColorUI/master/demo/images/wave.gif" mode="scaleToFill" <!-- <image src="https://raw.githubusercontent.com/weilanwl/ColorUI/master/demo/images/wave.gif" mode="scaleToFill"
class="gif-wave"></image> class="gif-wave"></image> -->
</view> </view>
<!-- 用户信息end --> <!-- 用户信息end -->
...@@ -37,35 +37,33 @@ ...@@ -37,35 +37,33 @@
<!-- 设置详细 --> <!-- 设置详细 -->
<view class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg radius"> <view class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg radius">
<view class="cu-item arrow"> <view class="cu-item arrow">
<view class="content" @tap="toIssue_page"> <navigator class="content" hover-class="none" url='/pages/userme/userpolice'>
<text class="cuIcon-moneybagfill text-red"></text> <text class="cuIcon-moneybagfill text-red"></text>
<text class="text-grey">报警设备</text> <text class="text-grey">报警记录</text>
<text class='num'>19</text> <!-- <text class='num'>19</text> -->
</view> </navigator>
</view> </view>
<view class="cu-item arrow"> <!-- <view class="cu-item arrow">
<navigator class="content" hover-class="none" url='/pages/my/my_sale/my_sale'> <navigator class="content" hover-class="none" url='/pages/my/my_sale/my_sale'>
<text class="cuIcon-titles text-green"></text> <text class="cuIcon-titles text-green"></text>
<text class="text-grey">我的设备</text> <text class="text-grey">我的设备</text>
<text class='num'>99</text>
</navigator> </navigator>
</view> </view>
<view class="cu-item arrow"> <view class="cu-item arrow">
<navigator class="content" hover-class="none" url="/pages/my/my_buy/my_buy"> <navigator class="content" hover-class="none" url="/pages/my/my_buy/my_buy">
<text class="cuIcon-formfill text-green"></text> <text class="cuIcon-formfill text-green"></text>
<text class="text-grey">用户设备</text> <text class="text-grey">用户设备</text>
<text class='num'>1</text>
</navigator> </navigator>
</view> </view> -->
<view class="cu-item arrow"> <view class="cu-item arrow">
<view class="content" bindtap="CopyLink" data-link="https://github.com/weilanwl/ColorUI"> <navigator class="content" hover-class="none" url="/pages/userme/userlist">
<text class="cuIcon-locationfill text-grey"></text> <text class="cuIcon-locationfill text-grey"></text>
<text class="text-grey">用户列表</text> <text class="text-grey">用户列表</text>
</navigator>
</view> </view>
</view> <view class="cu-item">
<view class="cu-item arrow"> <view class="content" bindtap="toCollect" @click="service">
<view class="content" bindtap="toCollect">
<text class="cuIcon-appreciatefill text-red"></text> <text class="cuIcon-appreciatefill text-red"></text>
<text class="text-grey">客服</text> <text class="text-grey">客服</text>
</view> </view>
...@@ -94,7 +92,7 @@ ...@@ -94,7 +92,7 @@
}; };
http.httpRequest(opts).then(res => { http.httpRequest(opts).then(res => {
this.userdata = res.data.data; this.userdata = res.data.data;
this.devicetype = this.devicestatus(res.data.data) ; this.devicetype = this.devicestatus(res.data.data);
}, error => { }, error => {
console.log(error); console.log(error);
}) })
...@@ -110,6 +108,8 @@ ...@@ -110,6 +108,8 @@
} }
return devicecount <= 0 ? "0" : (Math.round(devicepolice / devicecount * 10000) / 100.00); return devicecount <= 0 ? "0" : (Math.round(devicepolice / devicecount * 10000) / 100.00);
}, },
//客服
service() {}
}, },
created() { created() {
// 获取信息 // 获取信息
......
<template>
<view>
<cu-custom bgColor="bg-gradual-pink" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">报警设备</block>
</cu-custom>
<view class="cu-bar bg-white solid-bottom">
<view class="action">
<text class="cuIcon-titles text-orange "></text> 报警记录
</view>
</view>
<view class="cu-card dynamic">
<view class="cu-item shadow">
<view class="cu-list menu-avatar comment solids-top">
<view class="cu-item" v-for="(item,index) in policedata" :key="index" @click="deviceinfo(item.deid)">
<view class="cu-avatar round" :style="item.status === 1 ? icon_device_li : icon_device_li_green"></view>
<view class="content">
<view class="text-grey" @click="deviceclone(item.devicenumber)">设备号:{{ item.devicenumber }}</view>
<view class="text-gray text-content text-df">
<view class="text-gray text-df">开始报警时间: {{ item.starttime | timeStamp}}</view>
</view>
<view class="text-gray text-content text-df">
报警浓度: {{ item.concentration }}
</view>
<view class="text-gray text-content text-df">
报警位置: {{ item.location }}
</view>
<view class="padding-sm radius margin-top-sm text-sm shadow-blur" :class="item.status === 1 ? 'bg-red' :'bg-green' ">
<view class="flex">
<view class="flex-sub">当前设备状态:{{ item.status === 1 ? ' 报警 ' : ' 正常 '}}</view>
</view>
<view class="flex">
<view class="flex-sub">设备是否当前报警:{{ item.status === 1 ? ' 当前正在报警 ' : ' 已结束报警 ' }}</view>
</view>
</view>
<view class="margin-top-sm flex justify-between" v-if="item.endtime != '' ">
<view class="text-gray text-df">报警结束时间: {{ item.endtime | timeStamp}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import http from '@/components/utils/http.js';
export default {
data() {
return {
policedata: [],
icon_device_li_green: 'background-image: url(../../static/img/icon_device_li_green.png)',
icon_device_li: 'background-image:url(../../static/img/icon_device_li.png)',
}
},
methods: {
//获取报警
police() {
let opts = {
url: 'devices/police',
method: 'get'
};
http.httpRequest(opts).then(res => {
this.policedata = res.data.data
}, error => {
console.log(error);
})
},
//复制设备号
deviceclone(data) {
uni.getSystemInfo({
success: function(res) {
if (res.model === undefined) {
uni.showToast({
title: '当前设备不支持复制',
duration: 2000
});
} else {
uni.setClipboardData({
data: data,
success: () => {
uni.showToast({
title: '复制成功'
})
}
});
}
}
});
},
deviceinfo(deid){
let opts = {
url: 'huinapphome/devicedatainfo/' + deid,
method: 'get'
};
http.httpRequest(opts).then(res => {
if (res.data.code === 200) {
uni.navigateTo({
url: '/pages/basics/deviceinfo?data=' + JSON.stringify(res.data.data),
});
}
}, error => {
console.log(error);
})
},
},
computed: {
},
filters: {
timeStamp: function(value) {
if (!value) return '';
var date = new Date(value * 1000); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
var year = date.getFullYear();
var month = ("0" + (date.getMonth() + 1)).slice(-2);
var sdate = ("0" + date.getDate()).slice(-2);
var hour = ("0" + date.getHours()).slice(-2);
var minute = ("0" + date.getMinutes()).slice(-2);
var second = ("0" + date.getSeconds()).slice(-2);
// 拼接
var result = year + "." + month + "." + sdate + " " + hour + ":" + minute //+ ":" + second;
// 返回
return result;
},
},
created() {
//获取报警记录
this.police();
},
}
</script>
<style>
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment