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

新模块

parent 8bc844d1
......@@ -6,15 +6,15 @@ Vue.component('basics',basics)
import components from './pages/component/home.vue'
Vue.component('components',components)
import plugin from './pages/plugin/home.vue'
Vue.component('plugin',plugin)
import adddevice from './pages/adddevice/home.vue'
Vue.component('adddevice',adddevice)
import userme from './pages/userme/userme.vue'
Vue.component('userme',userme)
import search from './pages/search/home.vue'
Vue.component('search',search)
import cuCustom from './colorui/components/cu-custom.vue'
Vue.component('cu-custom',cuCustom)
......
{
"pages": [ //pages数组中第一项表示应用启动页,
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登入"
}
},{
"path": "pages/main/main",
"style": {
"navigationBarTitleText": "泽宏云设备监测"
}
},{
"path": "pages/reg/reg",
"style": {
"navigationBarTitleText": "注册"
}
}, {
"path": "pages/pwd/pwd",
"style": {
"navigationBarTitleText": "找回密码"
}
}, {
"path": "pages/user/user",
"style": {
"navigationBarTitleText": "我的"
}
},{
"path": "pages/basics/deviceinfo",
"style": {
}
},{
"path": "pages/basics/devicerecording",
"style": {
}
}
],
// "tabBar": {
// "color": "#7a7e83",
// "selectedColor": "#0066ff",
// "backgroundColor": "#ffffff",
// "list": [{
// "pagePath": "pages/main/main",
// "text": "首页",
// "iconPath": "static/img/home.png",
// "selectedIconPath": "static/img/homeHL.png"
// }, {
// "pagePath": "pages/user/user",
// "text": "我的",
// "iconPath": "static/img/user.png",
// "selectedIconPath": "static/img/userHL.png"
// }]
// },
"globalStyle": {
"mp-alipay": {
/* 支付宝小程序特有相关 */
"transparentTitle": "always",
"allowsBounceVertical": "NO"
},
"navigationBarBackgroundColor": "#0081ff",
"navigationBarTitleText": "泽宏云科技",
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
},
"usingComponts": true,
"condition": { //模式配置,仅开发期间生效
"current": 0, //当前激活的模式(list 的索引项)
"list": [{
"name": "表单", //模式名称
"path": "pages/main/main", //启动页面
"query": "" //启动参数
}
]
"pages": [ //pages数组中第一项表示应用启动页,
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登入"
}
}, {
"path": "pages/main/main",
"style": {
"navigationBarTitleText": "泽宏云设备监测"
}
}, {
"path": "pages/basics/deviceinfo",
"style": {}
}, {
"path": "pages/basics/devicerecording",
"style": {}
}, {
"path": "pages/userme/userpolice",
"style": {}
}, {
"path": "pages/userme/userlist",
"style": {
"enablePullDownRefresh": true
}
}, {
"path": "pages/userme/userdevicelist",
"style": {
"enablePullDownRefresh": true
}
}
],
// "tabBar": {
// "color": "#7a7e83",
// "selectedColor": "#0066ff",
// "backgroundColor": "#ffffff",
// "list": [{
// "pagePath": "pages/main/main",
// "text": "首页",
// "iconPath": "static/img/home.png",
// "selectedIconPath": "static/img/homeHL.png"
// }, {
// "pagePath": "pages/user/user",
// "text": "我的",
// "iconPath": "static/img/user.png",
// "selectedIconPath": "static/img/userHL.png"
// }]
// },
"globalStyle": {
"mp-alipay": {
/* 支付宝小程序特有相关 */
"transparentTitle": "always",
"allowsBounceVertical": "NO"
},
"navigationBarBackgroundColor": "#0081ff",
"navigationBarTitleText": "泽宏云科技",
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
},
"usingComponts": true,
"condition": { //模式配置,仅开发期间生效
"current": 0, //当前激活的模式(list 的索引项)
"list": [{
"name": "表单", //模式名称
"path": "pages/main/main", //启动页面
"query": "" //启动参数
}]
}
}
......@@ -5,7 +5,7 @@
<block slot="content">设备记录</block>
</cu-custom>
<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="content">
<view class="cu-capsule radius">
......@@ -22,6 +22,12 @@
</view>
</view>
</view>
<!-- 返回首页 -->
<view v-if="ishome">
<view @click="hoishome">
<image class="ishome" src="../../static/ishome.png"></image>
</view>
</view>
</view>
</template>
......@@ -31,10 +37,14 @@
data() {
return {
devicedata: [],
ishome: false,
}
},
methods: {
deviceinfo(total, device_num) {
uni.showLoading({
title: '加载数据中...'
});
let data = {
currentPage: 1,
deviceNum: device_num,
......@@ -49,9 +59,15 @@
};
http.httpRequest(opts, data).then(res => {
this.devicedata = res.data.data.list
uni.hideLoading();
}, error => {
console.log(error);
})
},
hoishome() {
uni.reLaunch({
url: '../main/main',
});
},
},
filters: {
......@@ -59,7 +75,7 @@
if (!str) return '';
var result;
var reg = /[a-zA-Z]+/;
while (result = str.match(reg)) {
while (result = str.match(reg)) {
str = str.replace(result[0], ' ');
}
return str;
......@@ -68,9 +84,23 @@
onLoad(e) {
var data = JSON.parse(e.data);
this.deviceinfo(data.total, data.list[0].device_num);
}
},
onShow() {
let pages = getCurrentPages(); //当前页面栈
if (pages.length >= 4) {
this.ishome = true;
}
},
}
</script>
<style>
<style>
.ishome{
width: 90upx;
height: 90upx;
position:fixed;
z-index: 99999;
left: 640upx;
bottom: 200upx;
}
</style>
<template name="components">
<view>
我是设备状态
<!-- <scroll-view scroll-y class="page">
<image src="/static/componentBg.png" mode="widthFix" class="response"></image>
<view class="nav-list">
<navigator hover-class='none' :url="'/pages/component/' + item.name" class="nav-li" navigateTo :class="'bg-'+item.color"
:style="[{animation: 'show ' + ((index+1)*0.2+1) + 's 1'}]" v-for="(item,index) in elements" :key="index">
<view class="nav-title">{{item.title}}</view>
<view class="nav-name">{{item.name}}</view>
<text :class="'cuIcon-' + item.cuIcon"></text>
</navigator>
</view>
<view class="cu-tabbar-height"></view>
</scroll-view> -->
</view>
</template>
<script>
export default {
data() {
return {
elements: [{
title: '操作条',
name: 'bar',
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'
},
{
title: '轮播',
name: 'swiper',
color: 'olive',
cuIcon: 'album'
},
{
title: '模态框',
name: 'modal',
color: 'grey',
cuIcon: 'squarecheckfill'
},
{
title: '步骤条',
name: 'steps',
color: 'cyan',
cuIcon: 'roundcheckfill'
}
],
};
}
}
</script>
<style>
.page {
height: 100vh;
}
<template name="components">
<view>
<cu-custom bgColor="bg-gradual-blue" :isBack="false">>
<block slot="content">设备记录</block>
</cu-custom>
<view class="cu-bar bg-white solid-bottom">
<view class="action">
<text class="cuIcon-title text-orange"></text>{{ tagname }}
</view>
</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>
</template>
<script>
export default {
data() {
return {
TabCur: 0,
tagdata: ['危化监测','消防监测'],
tagname: '危化监测',
};
},
methods: {
tabSelect(e) {
this.TabCur = e.currentTarget.dataset.id;
this.tagname = e.currentTarget.dataset.tagname;
}
},
created() {
// this.
},
}
</script>
<style>
</style>
<template>
<view>
<basics v-if="PageCur=='basics'"></basics>
<components v-if="PageCur=='component'"></components>
<plugin v-if="PageCur=='plugin'"></plugin>
<components v-if="PageCur=='component'"></components>
<adddevice v-if="PageCur=='adddevice'"></adddevice>
<userme v-if="PageCur=='userme'"></userme>
<!-- <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> -->
<search v-if="PageCur=='search'"></search>
<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="cuIcon-homefill"></view> 首页
......@@ -22,38 +16,17 @@
<button class="cu-btn cuIcon-add bg-green shadow" @click="NavChange" data-cur="adddevice"></button>
添加设备
</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>
搜索设备
</view>
<view :class="PageCur=='userme'?'action text-green':'action text-gray'" @click="NavChange" data-cur="userme">
<view class="cuIcon-my">
<view class="cu-tag badge"></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>
</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 @@
<!-- <text>Amibition</text> -->
</view>
<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>
<image src="https://raw.githubusercontent.com/weilanwl/ColorUI/master/demo/images/wave.gif" mode="scaleToFill"
class="gif-wave"></image>
<!-- <image src="https://raw.githubusercontent.com/weilanwl/ColorUI/master/demo/images/wave.gif" mode="scaleToFill"
class="gif-wave"></image> -->
</view>
<!-- 用户信息end -->
......@@ -37,35 +37,33 @@
<!-- 设置详细 -->
<view class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg radius">
<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="text-grey">报警设备</text>
<text class='num'>19</text>
</view>
<text class="text-grey">报警记录</text>
<!-- <text class='num'>19</text> -->
</navigator>
</view>
<view class="cu-item arrow">
<!-- <view class="cu-item arrow">
<navigator class="content" hover-class="none" url='/pages/my/my_sale/my_sale'>
<text class="cuIcon-titles text-green"></text>
<text class="text-grey">我的设备</text>
<text class='num'>99</text>
</navigator>
</view>
<view class="cu-item arrow">
<navigator class="content" hover-class="none" url="/pages/my/my_buy/my_buy">
<text class="cuIcon-formfill text-green"></text>
<text class="text-grey">用户设备</text>
<text class='num'>1</text>
</navigator>
</view>
</view> -->
<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="text-grey">用户列表</text>
</view>
</navigator>
</view>
<view class="cu-item arrow">
<view class="content" bindtap="toCollect">
<view class="cu-item">
<view class="content" bindtap="toCollect" @click="service">
<text class="cuIcon-appreciatefill text-red"></text>
<text class="text-grey">客服</text>
</view>
......@@ -82,7 +80,7 @@
data() {
return {
username: uni.getStorageSync('islogin').name,
userdata: [],
userdata: [],
devicetype: '',
}
},
......@@ -94,7 +92,7 @@
};
http.httpRequest(opts).then(res => {
this.userdata = res.data.data;
this.devicetype = this.devicestatus(res.data.data) ;
this.devicetype = this.devicestatus(res.data.data);
}, error => {
console.log(error);
})
......@@ -110,6 +108,8 @@
}
return devicecount <= 0 ? "0" : (Math.round(devicepolice / devicecount * 10000) / 100.00);
},
//客服
service() {}
},
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