Commit cd869aa3 by 张杰

项目初始化

0 parents
Showing 162 changed files with 2869 additions and 0 deletions
//app.js
const wxrequest = require('./utils/wxrequest.js');
App({
onLaunch: function (options) {
wx.setStorageSync('scene', options.scene)
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
var that = this;
// 获取用户信息
/*wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: res => {console.log(res)
// 可以将 res 发送给后台解码出 unionId
this.globalData.userInfo = res.userInfo
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(res)
}
}
})
}
}
})*/
},
onShow(options){
wx.setStorageSync('scene', options.scene)
/*wx.switchTab({
url: '../../pages/loading/loading'
});*/
/*wx.showModal({
content: String(options.scene),
showCancel: false
});*/
},
globalData: {
userInfo: null,
serverUrl: 'http://localhost:8080/otmini/',
loginPromise: null
}
})
\ No newline at end of file
{
"pages": [
"pages/wxPublicPage/wxPublicPage",
"pages/loading/loading",
"pages/home/home",
"pages/authorize/authorize",
"pages/resident/resident",
"pages/freq/freq",
"pages/findCar/findCar",
"pages/findCarSearch/findCarSearch",
"pages/trace/trace",
"pages/monitor/monitor",
"pages/mine/mine",
"pages/deviceActiveChart/deviceActiveChart",
"pages/deviceOffChart/deviceOffChart",
"pages/logs/logs",
"pages/replay/replay",
"pages/fence/fence",
"pages/login/login",
"pages/collectCarSearch/collectCarSearch",
"pages/collectCarDetail/collectCarDetail",
"pages/collectCarLog/collectCarLog",
"pages/freqLogSearch/freqLogSearch",
"pages/freqLogDetail/freqLogDetail",
"pages/freqLogUserDetail/freqLogUserDetail",
"pages/map/findCar",
"pages/test/test"
],
"window": {
"backgroundColor": "#efeff4",
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "虎哥e盾",
"navigationBarTextStyle": "black"
},
"tabBar": {
"color": "#666",
"selectedColor": "#37c060",
"backgroundColor": "#fff",
"list": [
{
"pagePath": "pages/home/home",
"text": "首页",
"iconPath": "images/tab-home.png",
"selectedIconPath": "images/tab-home-active.png"
},
{
"pagePath": "pages/findCar/findCar",
"text": "找车",
"iconPath": "images/tab-findcar.png",
"selectedIconPath": "images/tab-findcar-active.png"
},
{
"pagePath": "pages/mine/mine",
"text": "我的",
"iconPath": "images/tab-mine.png",
"selectedIconPath": "images/tab-mine-active.png"
}
]
},
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于定位效果展示"
}
},
"sitemapLocation": "sitemap.json"
}
\ No newline at end of file
/**app.wxss**/
@import "weui.wxss";
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}
page{
background-color: #efeff4;
font-size: 16px;
font-family: -apple-system-font,Helvetica Neue,Helvetica,sans-serif;
}
.page__hd {
padding: 40px;
}
.page__bd {
padding-bottom: 40px;
background-color: #fff;
}
.page__bd_spacing {
padding-left: 15px;
padding-right: 15px;
}
.page__ft{
padding-bottom: 10px;
text-align: center;
}
.page__title {
text-align: left;
font-size: 20px;
font-weight: 400;
}
.page__desc {
margin-top: 5px;
color: #888888;
text-align: left;
font-size: 14px;
}
.weui-mask {
position: fixed;
z-index: 1000;
top: 0;
right: 0;
left: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.6);
}
.weui-dialog {
position: fixed;
z-index: 5000;
width: 80%;
max-width: 300px;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
background-color: #FFFFFF;
text-align: center;
border-radius: 3px;
overflow: hidden;
}
.weui-dialog__bd {
padding: 0 1.6em 0.8em;
min-height: 40px;
font-size: 15px;
line-height: 1.3;
word-wrap: break-word;
word-break: break-all;
color: #808080;
}
.weui-dialog__bd:first-child {
padding: 2.7em 20px 1.7em;
color: #353535;
}
.weui-dialog__ft {
position: relative;
line-height: 48px;
font-size: 18px;
display: -webkit-box;
display: -webkit-flex;
display: flex;
}
.weui-dialog__btn {
display: block;
-webkit-box-flex: 1;
-webkit-flex: 1;
flex: 1;
color: #09BB07;
text-decoration: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
position: relative;
}
.weui-dialog__btn_primary {
color: #09BB07;
}
images/u.png

1.76 KB

// pages/authorize/authorize.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
onGotUserInfo(e) {
console.log(e.detail.errMsg)
console.log(e.detail.userInfo)
console.log(e.detail.rawData)
}
})
\ No newline at end of file
{}
\ No newline at end of file
<button open-type="getUserInfo" lang="zh_CN" bindgetuserinfo="onGotUserInfo">获取用户信息</button>
/* pages/authorize/authorize.wxss */
\ No newline at end of file
const WXRequest = require('../../utils/wxrequest.js');
const moment = require('./../../utils/moment.min.js');
Page({
/**
* 页面的初始数据
*/
data: {
infoModalHidden: true,
isDisabled: true,
startDate: '',
startTime: '',
endDate: '',
endTime: '',
todayDate: moment().format('YYYY-MM-DD'),
todayAfterTenYearsDate: moment().add(10, 'years').format('YYYY-MM-DD'),
list: [],
name: '',
standno: '',
sqbh: '',
wiredSn: '',
wiredlessSn: '',
vehicleId: '',
loginUserId: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {console.log(options)
const vehicleId = options.vehicleid;
const loginUserId = wx.getStorageSync('loginUserId');
var that = this;
that.setData({
name: options.name || '',
standno: options.standno || '',
sqbh: options.sqbh || '',
wiredSn: options.wiredSn || '',
wiredlessSn: options.wiredlessSn || '',
vehicleId,
loginUserId
})
WXRequest.get('vehicleshare/getvehicleshare',{
vehicleId,
loginUserId
}).then((res)=>{
if(res.returnCode == '0'){
const data = res.data;
const startTime = data.startTime;
const endTime = data.endTime;
that.setData({
startDate: moment(startTime).format('YYYY-MM-DD'),
startTime: moment(startTime).format('HH:mm'),
endDate: moment(endTime).format('YYYY-MM-DD'),
endTime: moment(endTime).format('HH:mm'),
isDisabled: data.status === 0 ? false: true
});
}
});
WXRequest.get('vehiclecollection/byVehicleId',{
vehicleId
}).then((res)=>{
console.log(res.data)
that.setData({
list: res.data
})
});
},
alertInfoModal(e){
this.setData({
infoModalHidden: false
});
},
closeInfoModal(e){
this.setData({
infoModalHidden: true
});
},
toggleStatus(e){
const _isDisabled = e.currentTarget.dataset.type === 'enable'?false:true;
if(_isDisabled === this.data.isDisabled) return;
this.setData({
isDisabled: _isDisabled
});
this.updateVehicleStatus()
},
redirectDetail(e){
const dataset = e.currentTarget.dataset;
wx.navigateTo({
url: `../../pages/collectCarLog/collectCarLog?id=${dataset.id}&nickname=${dataset.nickname}&avatarurl=${dataset.avatarurl}`
});
},
bindDateChange(e){
const oldEndDate = this.data.endDate;
if(moment(`${this.data.startDate} ${this.data.startTime}`).isAfter(moment(`${e.detail.value} ${this.data.endTime}`))){
wx.showModal({
content: '结束时间不能小于开始时间',
showCancel: false
});
this.setData({
endDate: oldEndDate
});
}else{
this.setData({
endDate: e.detail.value
});
this.updateVehicleStatus();
}
},
bindTimeChange(e){
const oldEndTime = this.data.endTime;
if(moment(`${this.data.startDate} ${this.data.startTime}`).isAfter(moment(`${this.data.endDate} ${e.detail.value}`))){
wx.showModal({
content: '结束时间不能小于开始时间',
showCancel: false
});
this.setData({
endTime: oldEndTime
});
}else{
this.setData({
endTime: e.detail.value
});
this.updateVehicleStatus()
}
},
updateVehicleStatus(){
const that = this;
if(that._timeoutId){
clearTimeout(that._timeoutId);
}
that._timeoutId = setTimeout(function(){
const data = that.data;
WXRequest.get('vehicleshare/savevehicleshare',{
vehicleId: data.vehicleId,
loginUserId: data.loginUserId,
startTime: moment(`${data.startDate} ${data.startTime}`).format('YYYY-MM-DD HH:mm:ss'),
endTime: moment(`${data.endDate} ${data.endTime}`).format('YYYY-MM-DD HH:mm:ss'),
status: data.isDisabled?1:0,
source: 1
}).then((res)=>{
});
},500)
},
redirectFreqDetail(){
const data = this.data;
const deviceinfo = [];
if(data.wiredSn){
deviceinfo.push({
sn: data.wiredSn,
type: '有线设备'
});
}
if(data.wiredlessSn){
deviceinfo.push({
sn: data.wiredlessSn,
type: '无线设备'
});
}
wx.navigateTo({
url: `../../pages/freqLogDetail/freqLogDetail?vehicleid=${data.vehicleId}&name=${data.name}&standno=${data.standno}&deviceinfo=${JSON.stringify(deviceinfo)}&sqbh=${data.sqbh}`
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
}
})
\ No newline at end of file
{
"navigationBarTitleText": "收车管理"
}
\ No newline at end of file
<!--pages/collectCarDetail/collectCarDetail.wxml-->
<view class="cc-box">
<view class="">
<view class="title"><text class="name">{{name}}</text> {{standno}}</view>
<view class="sub-title"><text class="label">申请单号:</text> {{sqbh}}</view>
<view class="sub-list" hidden="{{!wiredlessSn}}">
<text class="label">无线设备:</text>
<view class="sub-item">
<view>{{wiredlessSn}}</view>
</view>
</view>
<view class="sub-list" hidden="{{!wiredSn}}">
<text class="label">有线设备:</text>
<view class="sub-item">
<view>{{wiredSn}}</view>
</view>
</view>
<image class="info-icon" src="../../images/info.png" bindtap="alertInfoModal" data-type="week"></image>
</view>
</view>
<view class="cc-box">
<view class="freq-link" bindtap="redirectFreqDetail">调频记录</view>
<view class="form-item">
<view class="weui-flex">
<view class="weui-flex__item label-item">
<text>操作</text>
</view>
<view class="weui-flex__item">
<label bindtap="toggleStatus" data-type="enable" class="radio-wrap">
<image class="radio" src="../../images/radio-lg.png" hidden="{{!isDisabled}}"></image>
<image class="radio" src="../../images/radio-lg-checked.png" hidden="{{isDisabled}}"></image>
启用
</label>
</view>
<view class="weui-flex__item">
<label bindtap="toggleStatus" data-type="disable" class="radio-wrap">
<image class="radio" src="../../images/radio-lg.png" hidden="{{isDisabled}}"></image>
<image class="radio" src="../../images/radio-lg-checked.png" hidden="{{!isDisabled}}"></image>
禁用
</label>
</view>
</view>
</view>
<view class="form-item">
<view class="weui-flex">
<view class="weui-flex__item label-item">
<text>时效选择</text>
</view>
<view class="weui-flex__item">
<view class="lb">开始时间</view>
<view class="disabled-time">
<view class="picker">{{startDate}}</view>
</view>
<view class="disabled-time">
<view class="picker">{{startTime}}</view>
</view>
</view>
<view class="weui-flex__item" hidden="{{!isDisabled}}">
<view class="lb">结束时间</view>
<view class="disabled-time">
<view class="picker">{{endDate}}</view>
</view>
<view class="disabled-time">
<view class="picker">{{endTime}}</view>
</view>
</view>
<view class="weui-flex__item" hidden="{{isDisabled}}">
<view class="lb">结束时间</view>
<view class="enabled-time">
<picker
mode="date"
value="{{endDate}}"
bindchange="bindDateChange"
>
<view class="picker">{{endDate}}</view>
</picker>
</view>
<view class="enabled-time">
<picker
mode="time"
value="{{endTime}}"
bindchange="bindTimeChange"
>
<view class="picker">{{endTime}}</view>
</picker>
</view>
</view>
</view>
</view>
</view>
<view class="find-title">已分享找车</view>
<view class="cc-box" hidden="{{!list.length}}">
<view class="weui-cell" wx:for="{{list}}" wx:key="{{item.wxId}}" data-id="{{item.wxId}}" data-nickname="{{item.nickName}}" data-avatarurl="{{item.avatarUrl}}" bindtap="redirectDetail">
<view class="weui-cell__bd list-item">
<image class="user-image" src="{{item.avatarUrl}}" mode="aspectFit"></image>
<text>分享时间:{{item.shareTime}}</text>
</view>
<view class="weui-cell__ft weui-cell__ft_in-access"></view>
</view>
</view>
<view class="info-modal" hidden="{{infoModalHidden}}" bindtap="closeInfoModal">
<view class="info-text">分享找车有效时长默认3天,可在下方操作修改时长</view>
</view>
\ No newline at end of file
/* pages/collectCarDetail/collectCarDetail.wxss */
.cc-box{
background-color: #fff;
border: 1px solid #d9d9d9;
margin: 20rpx;
font-size: 28rpx;
color: #666;
padding: 20rpx;
}
.title{
color: #000;
}
.name{
margin-right: 20rpx;
}
.label{
margin-right: 20rpx;
float: left;
}
.sub-list{
overflow: hidden;
}
.sub-item{
float: left;
}
.sub-title{
overflow: hidden;
}
.info-icon{
width: 34rpx;
height: 34rpx;
position: absolute;
top: 40rpx;
right: 40rpx;
}
.info-modal{
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.info-modal .info-text{
position: absolute;
top: 50%;
left: 50%;
width: 80%;
padding: 10px;
color: #fff;
border-radius: 6px;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
background-color: rgba(0,0,0,0.7);
}
.radio{
width: 42rpx;
height: 42rpx;
vertical-align: middle;
}
.form-item{
padding: 20rpx 0;
}
.form-item+.form-item{
border-top: 1px solid #eee;
}
.form-item:last-child{
/*margin-bottom: 0rpx;*/
}
.label-item{
flex: 0 0 160rpx;
color: #333;
display: flex;
align-items:center;
}
.enabled-time{
color: #37c060;
}
.enabled-time, .disabled-time{
margin-top: 20rpx;
}
.disabled-time{
color: #999;
}
.user-image{
width: 80rpx;
height: 80rpx;
border: 1px solid #ccc;
border-radius: 40rpx;
margin-right: 20rpx;
}
.list-item{
display: flex;
align-items: center;
}
.find-title{
margin-left: 20rpx;
}
.radio-wrap{
height:50rpx;
display:inline-block;
}
.freq-link{
float: right;
color: #37c060;
}
const WXRequest = require('../../utils/wxrequest.js');
Page({
/**
* 页面的初始数据
*/
data: {
list: [],
avatarurl: '',
nickname: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
const that = this;
that.setData({
avatarurl: options.avatarurl,
nickname: options.nickname
})
WXRequest.get('vehiclecollection/byWxId', {
wxId: options.id
}).then((res)=>{
that.setData({
list: res.data
})
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
}
})
\ No newline at end of file
{
"navigationBarTitleText": "收车管理"
}
\ No newline at end of file
<!--pages/collectCarLog/collectCarLog.wxml-->
<view class="cc-box">
<image class="user-image" src="{{avatarurl}}" mode="aspectFit"></image>
<text>{{nickname}}</text>
</view>
<view class="log-list">
<view class="weui-cell" wx:for="{{list}}" wx:key="{{item.wxId}}">
<view class="weui-cell__bd well-info" >
<view>{{item.name}} {{item.standno}}</view>
<view class="sn">申请单号: {{item.sqbh}}</view>
<view class="time" hidden="{{!item.wiredlessSn}}">无线设备: {{item.wiredlessSn}}</view>
<view class="time" hidden="{{!item.wiredSn}}">有线设备: {{item.wiredSn}}</view>
<view class="time">分享时间: {{item.shareTime}}</view>
</view>
</view>
</view>
\ No newline at end of file
/* pages/collectCarLog/collectCarLog.wxss */
.cc-box{
background-color: #fff;
border: 1px solid #d9d9d9;
margin: 20rpx;
font-size: 28rpx;
color: #666;
display:flex;
align-items:center;
padding: 20rpx;
}
.user-image{
width: 80rpx;
height: 80rpx;
border: 1px solid #ccc;
border-radius: 40rpx;
margin-right: 20rpx;
}
.log-list{
background-color: #fff;
font-size: 28rpx;
}
.well-info>view{
color: #666;
}
.well-info>view:first-child{
color: #333;
}
\ No newline at end of file
const WXRequest = require('../../utils/wxrequest.js');
Page({
data: {
inputVal: '',
searchTypes: [{
label: '申请单号',
value: 'sqbh'
},{
label: '车架号',
value: 'standno'
},{
label: '设备号',
value: 'sn'
},{
label: '姓名',
value: 'name'
}],
placeholders: [
'请输入完整的申请单号',
'请输入车架号后六位',
'请输入设备SN',
'请输入客户姓名'
],
searchTypesIndex: 0,
list: [],
scrollTop: 0,
scrollHeight: 300,
page: 1,
maxPage: 0,
ing: false,
initSearch: false,
userStatus: ''
},
onLoad() {
var that = this;
wx.getSystemInfo({
success: function(res) {
that.setData({
scrollHeight: res.windowHeight-50
})
}
});
that.setData({
userStatus: wx.getStorageSync('userStatus')
});
that.loadData(true);
},
clearInput: function () {
this.setData({
inputVal: ""
});
},
inputTyping: function (e) {
this.setData({
inputVal: e.detail.value
});
},
searchConfirm(e){
this.setData({
ing: false,
page: 1,
scrollTop: 0
});
this.loadData();
},
loadData(isInit, isPullDown){
var that = this;
if(!isInit && !that.validate()) return;
that.setData({
ing: true
});
let params = {};
if(isInit){
params = {
pageSize: 50,
currentPage: 1
}
that.setData({
page: 5
})
}else{
params = {
pageSize: 10,
currentPage: that.data.page
}
params[that.data.searchTypes[that.data.searchTypesIndex].value] = that.data.inputVal;
}
if(that.data.userStatus === 0){
WXRequest.get('vehiclecollection/getList',params).then((res)=>{
if(!that.data.ing) return;
const _list = res.data;
const maxPage = Math.ceil(res.recordsTotal/10);console.log(maxPage)
if(_list){
/*_list.forEach((item)=>{
const deviceObj = {}
item.device&&item.device.forEach((deviceItem)=>{
if(!deviceObj[deviceItem.type]){
deviceObj[deviceItem.type] = [];
}
deviceObj[deviceItem.type].push(deviceItem.sn);
});
item.deviceList = [];
for(let type in deviceObj){
item.deviceList.push({
type,
sns: deviceObj[type]
});
}
});*/
that.setData({
list: that.data.page===1?_list:that.data.list.concat(_list),
ing: false,
maxPage,
initSearch: true
});
}else{
that.setData({
list: [],
ing: false,
maxPage
});
}
if(isPullDown){
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh();
}
});
}else if(that.data.userStatus === 1){
WXRequest.get('vehiclecollection/getListNoRole',params).then((res)=>{
if(!that.data.ing) return;
const _list = res.data;
const maxPage = Math.ceil(res.recordsTotal/10);console.log(maxPage)
if(_list){
/*_list.forEach((item)=>{
const deviceObj = {}
item.device&&item.device.forEach((deviceItem)=>{
if(!deviceObj[deviceItem.type]){
deviceObj[deviceItem.type] = [];
}
deviceObj[deviceItem.type].push(deviceItem.sn);
});
item.deviceList = [];
for(let type in deviceObj){
item.deviceList.push({
type,
sns: deviceObj[type]
});
}
});*/
that.setData({
list: that.data.page===1?_list:that.data.list.concat(_list),
ing: false,
maxPage,
initSearch: true
});
}else{
that.setData({
list: [],
ing: false,
maxPage
});
}
if(isPullDown){
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh();
}
});
}
},
searchTypeChange(e){
this.setData({
searchTypesIndex: e.detail.value
});
if(!this.data.inputVal) return;
this.setData({
ing: false,
page: 1,
scrollTop: 0
});
this.loadData()
},
bindDownLoad(){
if(this.data.ing) return;
const nextPage = this.data.page+1;
if(nextPage>this.data.maxPage) return;
this.setData({
page: nextPage
});
this.loadData();
},
bindScroll(){
},
validate(){
const type = this.data.searchTypes[this.data.searchTypesIndex].value;
const inputVal = this.data.inputVal;
if(type === 'name'){//姓名
if(inputVal.length<2){
wx.showModal({
content: '请输入正确的姓名,至少2位数',
showCancel: false
});
return false;
}
}else if(inputVal.length<6){
wx.showModal({
content: '请输入至少6位数',
showCancel: false
});
return false;
}
return true;
},
redirectDetail(e){
if(this.data.userStatus !== 0) return;
if(e.target.dataset.type === 'user'){
const dataset = e.target.dataset;
wx.navigateTo({
url: `../../pages/collectCarLog/collectCarLog?id=${dataset.id}&nickname=${dataset.nickname}&avatarurl=${dataset.avatarurl}`
});
}else{
const dataset = e.currentTarget.dataset;
wx.navigateTo({
url: `../../pages/collectCarDetail/collectCarDetail?vehicleid=${dataset.vehicleid}&name=${dataset.name}&standno=${dataset.standno}&wiredSn=${dataset.wiredsn}&wiredlessSn=${dataset.wiredlesssn}&sqbh=${dataset.sqbh}`
});
}
},
redirectUserDetail(e){
const dataset = e.currentTarget.dataset;
//console.log(e.currentTarget)
},
onPullDownRefresh: function () {
this.setData({
ing: false,
page: 1,
scrollTop: 0,
list: []
});
this.loadData(true, true);
}
})
\ No newline at end of file
{
"navigationBarTitleText": "收车管理",
"enablePullDownRefresh": true
}
\ No newline at end of file
<view class="serach-box">
<view class="weui-search-bar__form">
<view class="weui-search-bar__box search-wrap">
<icon class="weui-icon-search_in-box" type="search" size="14"></icon>
<input
type="text"
class="weui-search-bar__input"
placeholder="{{placeholders[searchTypesIndex]}}"
value="{{inputVal}}"
focus="{{inputShowed}}"
bindinput="inputTyping"
bindconfirm="searchConfirm"/>
<view class="weui-icon-clear" wx:if="{{inputVal.length > 0}}" bindtap="clearInput">
<icon type="clear" size="14"></icon>
</view>
<picker
class="search-picker"
bindchange="searchTypeChange"
value="{{searchTypesIndex}}"
range="{{searchTypes}}"
range-key="label">
<text>{{searchTypes[searchTypesIndex].label}}</text>
<view class="select-dropdown-icon"></view>
</picker>
</view>
</view>
</view>
<view class="result-list" hidden="{{!list.length}}">
<scroll-view
scroll-top="{{scrollTop}}"
scroll-y="true"
style="height:{{scrollHeight}}px;"
bindscrolltolower="bindDownLoad"
bindscroll="bindScroll">
<view class="weui-cell {{item.weight===0?'':'disabled'}}"
wx:for="{{list}}"
wx:key="{{item.vehicleId}}"
bindtap="redirectDetail"
data-standno="{{item.standno}}"
data-sqbh="{{item.sqbh}}"
data-wiredsn="{{item.wiredSn||''}}"
data-wiredlesssn="{{item.wiredlessSn||''}}"
data-sns="{{item.sns}}"
data-name="{{item.name}}"
data-vehicleid="{{item.vehicleId}}">
<view class="weui-cell__bd">
<view class="title"><text class="name">{{item.name}}</text> {{item.standno}}</view>
<view class="user-info">
<view class="user-info-main">
<view class="sub-title"><text class="label">申请单号:</text> {{item.sqbh}}</view>
<view class="sub-list" hidden="{{!item.wiredSn}}">
<text class="label">有线设备:</text>
<view class="sub-item">
<view>{{item.wiredSn}}</view>
</view>
</view>
<view class="sub-list" hidden="{{!item.wiredlessSn}}">
<text class="label">无线设备:</text>
<view class="sub-item">
<view>{{item.wiredlessSn}}</view>
</view>
</view>
<view class="sub-title" hidden="{{userStatus===0}}"><text class="label">分享时间:</text> {{item.shareTime}}</view>
</view>
<view class="user-info-image" hidden="{{userStatus!==0}}">
<image
wx:for="{{item.customInfo}}"
wx:key="{{item.wxId}}"
src="{{item.avatarUrl}}"
mode="aspectFit"
data-type="user"
data-nickname="{{item.nickName}}"
data-avatarurl="{{item.avatarUrl}}"
data-id="{{item.wxId}}">
</image>
</view>
<view class="weui-cell__ft weui-cell__ft_in-access" hidden="{{userStatus!==0}}"></view>
</view>
</view>
</view>
<view class="end-tip" hidden="{{page!=maxPage}}">
没有更多数据了~
</view>
</scroll-view>
</view>
<view class="none" hidden="{{!initSearch || list.length}}">
<image src="../../images/none.png"/>
<view>没有搜索到匹配的车辆数据</view>
</view>
/* pages/collectCarSearch/collectCarSearch.wxss */
.serach-box{
padding: 20rpx;
background-color: #fff;
}
.search-wrap{
position: relative;
padding-right: 120px;
}
.search-wrap input{
}
.search-picker{
position: absolute;
top: 0;
right: 0;
font-size: 28rpx;
}
.search-picker text{
position: absolute;
width: 60px;
right: 20px;
height: 56rpx;
line-height: 56rpx;
padding-left: 10px;
border-left: 1px solid #eee;
}
.select-dropdown-icon{
content: '';
display: inline-block;
border: 5px solid transparent;
border-top-color: #c9c9c9;
position: absolute;
right: 10px;
top: 10px;
}
.search-wrap .weui-icon-clear{
right: 90px;
z-index: 100;
}
.result-list{
background-color: #fff;
color: #666;
font-size: 14px;
}
.result-list .title{
color: #000;
}
.result-list .name{
margin-right: 20rpx;
}
.result-list .label{
margin-right: 20rpx;
float: left;
}
.sub-list{
overflow: hidden;
}
.sub-item{
float: left;
}
.sub-title{
overflow: hidden;
}
.result-list .weui-cell:first-child{
border-top: 1px solid #d9d9d9;
}
.result-list .weui-cell:last-child{
border-bottom: 1px solid #d9d9d9;
}
.none{
padding: 200rpx 0;
text-align: center;
color: #999;
}
.none image{
width: 400rpx;
height: 400rpx;
margin-bottom: 20rpx;
}
.end-tip{
text-align: center;
}
.user-info{
display: flex;
}
.user-info .weui-cell__ft_in-access{
width: 10rpx;
}
.user-info-main{
flex: 1;
}
.user-info-image{
/*width: 280rpx;
display: flex;
align-items: center;
justify-content: space-around;*/
}
.user-info-image image{
width: 70rpx;
height: 70rpx;
border-radius: 65rpx;
position: relative;
border: 1px solid #ccc;
margin-left: 20rpx;
}
.weui-cell.disabled{
background-color: #f9f9f9;
}
/*.user-info-image image:first-child{
left: 0;
}
.user-info-image image:nth-child(n+2){
left: -20rpx;
}
.user-info-image image:nth-child(n+3){
left: -40rpx;
}
.user-info-image image:nth-child(n+4){
left: -60rpx;
}
.user-info-image image:nth-child(n+5){
left: -80rpx;
}*/
\ No newline at end of file
const wxCharts = require('./../../utils/wxcharts-min.js');
const moment = require('./../../utils/moment.min.js');
const WXRequest = require('../../utils/wxrequest.js');
let windowWidth = 320;
Page({
/**
* 页面的初始数据
*/
data: {
dateRange: [],
dateRangeIndex: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getRecentFourWeek();
try {
let res = wx.getSystemInfoSync();
windowWidth = res.windowWidth;
} catch (e) {
// do something when get system info failed
}
this.loadData()
},
getRecentFourWeek(){
const recentWeekSTime = moment().startOf('week').add(1, 'day')//.format('YYYY-MM-DD');
const recentWeekETime = moment().endOf('week').add(1, 'day');
const dateRangeArr = [];
if(new Date().getDay() === 0){
const _sTime = recentWeekSTime.subtract(1, 'week');
const _eTime = recentWeekETime.subtract(1, 'week');
dateRangeArr.push({
label: `${_sTime.format('YYYY年M月D日')}~${_eTime.format('YYYY年M月D日')}`,
sTime: _sTime.format('YYYY-MM-DD'),
eTime: _eTime.format('YYYY-MM-DD')
});
}else{
dateRangeArr.push({
label: `${recentWeekSTime.format('YYYY年M月D日')}~${recentWeekETime.format('YYYY年M月D日')}`,
sTime: recentWeekSTime.format('YYYY-MM-DD'),
eTime: recentWeekETime.format('YYYY-MM-DD')
});
}
for(let i=0; i<3; i++){
const _sTime = recentWeekSTime.subtract(1, 'week');
const _eTime = recentWeekETime.subtract(1, 'week');
dateRangeArr.push({
label: `${_sTime.format('YYYY年M月D日')}~${_eTime.format('YYYY年M月D日')}`,
sTime: _sTime.format('YYYY-MM-DD'),
eTime: _eTime.format('YYYY-MM-DD')
});
}
this.setData({
dateRange: dateRangeArr
})
},
bindAccountChange: function(e) {
const index = e.detail.value;
this.setData({
dateRangeIndex: index
});
this.loadData();
},
loadData(){
var that = this;
var chosenDateRange = this.data.dateRange[this.data.dateRangeIndex];
WXRequest.get('report/getActiveDeviceWeekReport', {
sTime: chosenDateRange.sTime,
eTime: chosenDateRange.eTime
}).then((res)=>{
if(res.returnCode == '0'){
const arr = [];
res.data.forEach((item)=>{
arr.push(item.activeDeviceNumber)
});
that.drawChart(arr)
}
});
},
drawChart(dataArr){
const maxNum = Math.max.apply(Math, dataArr);
new wxCharts({
canvasId: 'areaCanvas',
type: 'column',
legend: false,
categories: ['一', '二', '三', '四', '五', '六', '日'],
series: [{
name: '激活量',
data: dataArr,
color: '#2fc2ff'
}],
xAxis: {
disableGrid: true
},
yAxis: {
format: function (val) {
return val + '个';
},
gridColor: '#eee',
min: 0,
max: maxNum<5?5:maxNum
},
dataItem: {
},
width: windowWidth-20, //减20为了最后一栏有部分被遮掉
height: windowWidth/2,
/*extra: {
column: {
width: '10'
}
}*/
});
}
})
\ No newline at end of file
{
"navigationBarTitleText": "设备激活周统计"
}
\ No newline at end of file
<view class="date-select">
<picker bindchange="bindAccountChange" value="{{dateRangeIndex}}" range-key="label" range="{{dateRange}}">
<button class="weui-btn" type="default" plain="true" size="mini">{{dateRange[dateRangeIndex].label}}</button>
<view class="select-dropdown-icon"></view>
</picker>
</view>
<view class="canvas-container">
<canvas class="canvas" canvas-id="areaCanvas"></canvas>
</view>
\ No newline at end of file
/* pages/home.wxss */
.canvas {
width: 100%;
height: 200px;
/*transform: scale(0.5)*/
}
.canvas-container{
background-color: #fff;
margin: 30rpx 15rpx 0rpx;
border-radius: 15rpx;
border: 2rpx solid #ddd;
padding: 30rpx 20rpx 0rpx 0rpx;
}
.date-select{
text-align: center;
background-color: #fff;
padding-bottom: 20rpx;
}
.date-select .weui-btn{
width: 260px;
border-color: #ddd !important;
vertical-align: middle;
}
.select-dropdown-icon{
content: '';
display: inline-block;
border: 10rpx solid transparent;
border-top-color: #c9c9c9;
position: relative;
left: -40rpx;
top: 10rpx;
}
picker{
font-size: 14px;
}
\ No newline at end of file
const wxCharts = require('./../../utils/wxcharts-min.js');
const moment = require('./../../utils/moment.min.js');
const WXRequest = require('../../utils/wxrequest.js');
let windowWidth = 320;
Page({
/**
* 页面的初始数据
*/
data: {
dateRange: [],
dateRangeIndex: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getRecentFourWeek();
try {
let res = wx.getSystemInfoSync();
windowWidth = res.windowWidth;
} catch (e) {
// do something when get system info failed
}
this.loadData()
},
getRecentFourWeek(){
const recentWeekSTime = moment().startOf('week').add(1, 'day')//.format('YYYY-MM-DD');
const recentWeekETime = moment().endOf('week').add(1, 'day');
const dateRangeArr = [];
if(new Date().getDay() === 0){
const _sTime = recentWeekSTime.subtract(1, 'week');
const _eTime = recentWeekETime.subtract(1, 'week');
dateRangeArr.push({
label: `${_sTime.format('YYYY年M月D日')}~${_eTime.format('YYYY年M月D日')}`,
sTime: _sTime.format('YYYY-MM-DD'),
eTime: _eTime.format('YYYY-MM-DD')
});
}else{
dateRangeArr.push({
label: `${recentWeekSTime.format('YYYY年M月D日')}~${recentWeekETime.format('YYYY年M月D日')}`,
sTime: recentWeekSTime.format('YYYY-MM-DD'),
eTime: recentWeekETime.format('YYYY-MM-DD')
});
}
for(let i=0; i<3; i++){
const _sTime = recentWeekSTime.subtract(1, 'week');
const _eTime = recentWeekETime.subtract(1, 'week');
dateRangeArr.push({
label: `${_sTime.format('YYYY年M月D日')}~${_eTime.format('YYYY年M月D日')}`,
sTime: _sTime.format('YYYY-MM-DD'),
eTime: _eTime.format('YYYY-MM-DD')
});
}
this.setData({
dateRange: dateRangeArr
})
},
bindAccountChange: function(e) {
const index = e.detail.value;
this.setData({
dateRangeIndex: index
});
this.loadData();
},
loadData(){
var that = this;
var chosenDateRange = this.data.dateRange[this.data.dateRangeIndex];
WXRequest.get('report/getOfflineDevcieReport', {
sTime: chosenDateRange.sTime,
eTime: chosenDateRange.eTime
}).then((res)=>{
if(res.returnCode == '0'){
const arr = [];
res.data.deviceOfflineRatio.split(',').forEach((item)=>{
arr.push(item.replace('%', ''))
});
that.drawChart(arr);
}
});
},
drawChart(dataArr){
const maxNum = Math.max.apply(Math, dataArr);
new wxCharts({
canvasId: 'areaCanvas',
type: 'line',
legend: false,
categories: ['一', '二', '三', '四', '五', '六', '日'],
series: [{
name: '激活量',
data: dataArr,
color: '#ffae2f',
format: function (val) {
return `${val}%`;
}
}],
xAxis: {
disableGrid: true
},
yAxis: {
format: function (val) {
return `${val}%`;
},
gridColor: '#eee',
min: 0,
max: maxNum<5?5:maxNum
},
dataItem: {
},
width: windowWidth-20, //减20为了最后一栏有部分被遮掉
height: windowWidth/2,
/*extra: {
column: {
width: '10'
}
}*/
});
}
});
{
"navigationBarTitleText": "设备离线率周统计"
}
\ No newline at end of file
<view class="date-select">
<picker bindchange="bindAccountChange" value="{{dateRangeIndex}}" range-key="label" range="{{dateRange}}">
<button class="weui-btn" type="default" plain="true" size="mini">{{dateRange[dateRangeIndex].label}}</button>
<view class="select-dropdown-icon"></view>
</picker>
</view>
<view class="canvas-container">
<canvas class="canvas" canvas-id="areaCanvas"></canvas>
</view>
\ No newline at end of file
/* pages/home.wxss */
.canvas {
width: 100%;
height: 200px;
/*transform: scale(0.5)*/
}
.canvas-container{
background-color: #fff;
margin: 30rpx 15rpx 0rpx;
border-radius: 15rpx;
border: 2rpx solid #ddd;
padding: 30rpx 20rpx 0rpx 0rpx;
}
.date-select{
text-align: center;
background-color: #fff;
padding-bottom: 20rpx;
}
.date-select .weui-btn{
width: 260px;
border-color: #ddd !important;
vertical-align: middle;
}
.select-dropdown-icon{
content: '';
display: inline-block;
border: 10rpx solid transparent;
border-top-color: #c9c9c9;
position: relative;
left: -40rpx;
top: 10rpx;
}
\ No newline at end of file
// pages/fence/fence.js
const WXRequest = require('../../utils/wxrequest.js');
Page({
/**
* 页面的初始数据
*/
data: {
url: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
const sessionid = /^JSESSIONID=(.+);Path=\/otmini$/g.exec(wx.getStorageSync('sessionid'))[1];
this.setData({
url: `${WXRequest.domain}h5/dist/fence.html?sn=${options.sn}&sessionid=${sessionid}`
})
}
})
\ No newline at end of file
{
"navigationBarTitleText": "电子围栏"
}
\ No newline at end of file
<web-view src="{{url}}"></web-view>
\ No newline at end of file
/* pages/fence/fence.wxss */
\ No newline at end of file
const WXRequest = require('../../utils/wxrequest.js');
const moment = require('./../../utils/moment.min.js');
Page({
/**
* 页面的初始数据
*/
data: {
url: '',
carInfo: null,
loginUserId: '',
ifUpdate: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log('test:'+options.test)
/* wx.showShareMenu({
withShareTicket: true
});*/
const sessionid = /^JSESSIONID=(.+);Path=\/otmini$/g.exec(wx.getStorageSync('sessionid'))[1];
this.setData({
url: encodeURI(`${WXRequest.domain}h5/dist/index.html?sessionid=${sessionid}`),
loginUserId: wx.getStorageSync('loginUserId'),
ifUpdate: true
});
},
onShow(options){
const carShareInfo = wx.getStorageSync('carShareInfo');
const carInfo = wx.getStorageSync('carInfo');
const sessionid = /^JSESSIONID=(.+);Path=\/otmini$/g.exec(wx.getStorageSync('sessionid'))[1];
/* this.setData({
ifUpdate: false
}) */
if(wx.getStorageSync('initFindCar')){
let _url = `${WXRequest.domain}h5/dist/index.html?sessionid=${sessionid}&sns=${carInfo.sns}&standno=${carInfo.standno}&name=${carInfo.name}&vehicleid=${carInfo.vehicleid}`;
if(carInfo.loginUserId){
_url += `&loginUserId=${carInfo.loginUserId}`;
this.setData({
loginUserId: carInfo.loginUserId
});
}
this.setData({
url: encodeURI(_url),
ifUpdate: true
});
wx.setStorageSync('initFindCar', false);
this.setData({
carInfo: carInfo
});
console.log(encodeURI(_url))
}else if(carShareInfo){
const _url = `${WXRequest.domain}h5/dist/index.html?sessionid=${sessionid}&sns=${carShareInfo.sns}&standno=${carShareInfo.standno}&name=${carShareInfo.name}&vehicleid=${carShareInfo.vehicleid}&loginUserId=${this.data.loginUserId}`;
this.setData({
url: encodeURI(_url),
ifUpdate: true
});
this.setData({
carShareInfo: null,
carInfo: carShareInfo
});
console.log(encodeURI(_url))
}
},
receiveMsg(){
wx.navigateBack()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function(options) {
var that = this;
var return_url = options.webViewUrl;
/*await new Promise((resolve, reject)=>{
setTimeout(()=>{
resolve()
},1000)
})*/
const startTime = moment().format('YYYY-MM-DD HH:mm:ss');
WXRequest.get('vehicleshare/savevehicleshare', {
loginUserId: that.data.loginUserId,
vehicleId: that.data.carInfo.vehicleid,
source: 0,
status: 0,
startTime: startTime,
endTime: moment(startTime).add(3, 'days').format('YYYY-MM-DD HH:mm:ss')
}).then((res)=>{
});
var opts = {
title: that.data.title,
path: '/pages/loading/loading',
success: function (res) {
console.log(arguments)
/*var shareTickets = res.shareTickets;
if (shareTickets.length == 0) {
return false;
}
wx.getShareInfo({
shareTicket: shareTickets[0],
success: function(res){
var encryptedData = res.encryptedData;
var iv = res.iv;
}
})*/
},
fail: function (res) {
// 转发失败
}
}
if(that.data.carInfo){
opts.path = opts.path + '?carShareInfo='+encodeURIComponent(JSON.stringify(that.data.carInfo))+'&loginUserId='+that.data.loginUserId;
}
return opts;
}
})
\ No newline at end of file
{
}
\ No newline at end of file
<web-view src="{{url}}" bindmessage="receiveMsg"></web-view>
\ No newline at end of file
.map-wrap{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.icon-wrap{
position: fixed;
}
.icon-wrap cover-image{
display: inline-block;
width: 100%;
height: 100%;
}
.icon-wrap cover-image.active{
display: none;
}
.icon-wrap.hover cover-image{
display: none;
}
.icon-wrap.hover cover-image.active{
display: inline-block;
}
.findcar-icon-wrap{
left: 50%;
bottom: 20rpx;
margin-left: -66rpx;
width: 132rpx;
height: 132rpx;
}
.locate-icon-wrap{
left: 30rpx;
bottom: 40rpx;
width: 98rpx;
height: 98rpx;
}
.refresh-icon-wrap{
left: 30rpx;
bottom: 160rpx;
width: 98rpx;
height: 98rpx;
}
.car-info-modal{
position: fixed;
top: 150rpx;
left: 50%;
width: 580rpx;
margin-left: -290rpx;
background: #fff;
border-radius: 10rpx;
border: 2rpx solid #eee;
}
.car-info-modal .main{
padding: 30rpx 30rpx 0;
}
.car-info-modal .title{
font-size: 34rpx;
padding-bottom: 30rpx;
border-bottom: 2rpx solid #eee;
}
.car-info-modal .info{
display: flex;
color: #666;
margin: 10rpx 0rpx;
font-size: 28rpx;
}
.car-info-modal .info cover-image{
width: 42rpx;
height: 42rpx;
margin-right: 10rpx;
}
.car-info-modal .info .text{
word-break: break-all;
word-wrap: break-word;
white-space: pre-line;
flex: 1;
line-height: 46rpx;
}
.car-info-modal .info .label{
}
.car-info-modal .nav{
display: flex;
color: #333;
font-size: 28rpx;
border-top: 1rpx solid #eee;
}
.car-info-modal .nav cover-view{
flex: 1;
padding: 20rpx 0;
text-align: center;
border-right: 1rpx solid #eee;
}
.car-info-modal .nav cover-view:last-child{
border-right: none;
}
.battery-icon{
position: absolute;
top: 80rpx;
right: 20rpx;
}
.battery-icon-bar{
margin-top: 20px;
display: inline-block;
width: 70rpx;
height: 38rpx;
border: 2rpx solid #37c060;
border-radius: 8rpx;
padding: 2rpx;
overflow:visible;
position: relative;
background-color:#fff;
z-index:100;
}
.battery-icon-out{
content: '';
display: inline-block;
width: 5rpx;
height: 24rpx;
border: 2rpx solid #37c060;
border-radius: 6rpx;
position: relative;
left: -2rpx;
top: -4rpx;
}
.battery-icon-bar-inn{
content: '';
display: inline-block;
width: 10%;
height: 100%;
border-radius: 8rpx 0 0 8rpx;
background-color: #d4f1dc;
}
.battery-icon-bar-num{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
font-size: 24rpx;
text-align: center;
line-height: 42rpx;
color: #37c060;
}
.battery-icon.full .battery-icon-inn{
border-radius: 8rpx;
}
.battery-icon.not-enough{
border-color: #df2222;
}
.battery-icon.not-enough .battery-icon-out{
border: 2rpx solid #df2222;
}
.battery-icon.not-enough .battery-icon-inn{
background-color: #f0d0d0;
}
.radio{
display: flex;
margin-right: 10px;
}
.radio cover-image{
flex: 1;
}
.radio cover-view{
line-height: 42rpx;
}
.sidebar{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
animation: sidebarShow 1s;
-webkit-animation:sidebarShow 1s; /* Safari 和 Chrome */
}
.sidebar.hidden{
left: -100%;
background: none;
animation: sidebarHide 1s;
-webkit-animation:sidebarHide 1s; /* Safari 和 Chrome */
}
.sidebar-nav{
width: 70%;
height: 100%;
background-color:#fff;
padding: 0;
display: flex;
flex-direction: column;
}
.sidebar-nav .cell{
display: flex;
padding: 24rpx;
align-items:center;
}
.sidebar-nav .left{
flex: 1;
}
.sidebar-nav .left cover-image{
display: inline-block;
width: 30rpx;
height: 30rpx;
margin-right: 10rpx;
vertical-align: middle;
}
.sidebar-nav .left cover-view{
display: inline-block;
}
.sidebar-nav .weui-cell__ft_in-access{
overflow: visible;
}
.sidebar-nav .longline{
display: inline-block;
width: 100%;
height: 2rpx;
background-color: #eee;
line-height: 2rpx;
}
.sidebar-nav .line{
display: inline-block;
width: 100%;
margin-left: 24rpx;
height: 2rpx;
background-color: #eee;
line-height: 2rpx;
}
.arrow-right{
display: inline-block;
width: 16rpx;
height: 25rpx;
margin-right: 10rpx;
}
@keyframes sidebarHide
{
from {
left: 0;
}
to {
left: -100%;
}
}
@-webkit-keyframes sidebarHide /* Safari 与 Chrome */
{
from {
left: 0;
}
to {
left: -100%;
}
}
@keyframes sidebarShow
{
0% {
left: -100%;
background: none;
}
25% {
left: 0;
background: none;
}
100%{
background: rgba(0,0,0,0.5);
}
}
@-webkit-keyframes sidebarShow /* Safari 与 Chrome */
{
0% {
left: -100%;
background: none;
}
25% {
left: 0;
background: none;
}
100%{
background: rgba(0,0,0,0.5);
}
}
\ No newline at end of file
const WXRequest = require('../../utils/wxrequest.js');
Page({
data: {
inputVal: '',
searchTypes: [{
label: '申请单号',
value: '4'
},{
label: '车架号',
value: '2'
},{
label: '设备号',
value: '1'
},{
label: '姓名',
value: '3'
}],
placeholders: [
'请输入完整的申请单号',
'请输入车架号后六位',
'请输入设备SN',
'请输入客户姓名'
],
searchTypesIndex: 0,
list: [],
scrollTop: 0,
scrollHeight: 300,
page: 1,
maxPage: 0,
ing: false,
initSearch: false
},
onLoad() {
var that = this;
wx.getSystemInfo({
success: function(res) {
that.setData({
scrollHeight: res.windowHeight-50
})
}
});
that.loadData(true);
},
clearInput: function () {
this.setData({
inputVal: ""
});
},
inputTyping: function (e) {
this.setData({
inputVal: e.detail.value
});
},
searchConfirm(e){
this.setData({
ing: false,
page: 1,
scrollTop: 0
});
this.loadData();
},
loadData(isInit){
var that = this;
if(!isInit && !that.validate()) return;
that.setData({
ing: true
});
let params = {};
if(isInit){
params = {
pageSize: 50,
currentPage: 1
}
that.setData({
page: 5
})
}else{
params = {
index: that.data.searchTypes[that.data.searchTypesIndex].value,
params: that.data.inputVal,
pageSize: 10,
currentPage: that.data.page
}
}
WXRequest.get('search/searchVehicle',params).then((res)=>{
if(!that.data.ing) return;
const _list = res.data;
const maxPage = Math.ceil(res.recordsTotal/10);
if(_list){
_list.forEach((item)=>{
const deviceObj = {}
item.device&&item.device.forEach((deviceItem)=>{
if(!deviceObj[deviceItem.type]){
deviceObj[deviceItem.type] = [];
}
deviceObj[deviceItem.type].push(deviceItem.sn);
});
item.deviceList = [];
for(let type in deviceObj){
item.deviceList.push({
type,
sns: deviceObj[type]
});
}
});
that.setData({
list: that.data.page===1?_list:that.data.list.concat(_list),
ing: false,
maxPage,
initSearch: true
});
}else{
that.setData({
list: [],
ing: false,
maxPage
});
}
})
},
searchTypeChange(e){
this.setData({
searchTypesIndex: e.detail.value
});
if(!this.data.inputVal) return;
this.setData({
ing: false,
page: 1,
scrollTop: 0
});
this.loadData()
},
bindDownLoad(){
if(this.data.ing) return;
const nextPage = this.data.page+1;
if(nextPage>this.data.maxPage) return;
this.setData({
page: nextPage
});
this.loadData();
},
bindScroll(){
},
validate(){
const type = this.data.searchTypes[this.data.searchTypesIndex].value;
const inputVal = this.data.inputVal;
if(type === '3'){//姓名
if(inputVal.length<2){
wx.showModal({
content: '请输入正确的姓名,至少2位数',
showCancel: false
});
return false;
}
}else if(inputVal.length<6){
wx.showModal({
content: '请输入至少6位数',
showCancel: false
});
return false;
}
return true;
},
redirectDetail(e){
const dataset = e.currentTarget.dataset;
const obj = {
name: dataset.name,
standno: dataset.standno,
sns: dataset.sns,
vehicleid: dataset.vehicleid
}
if(dataset.loginuserid){
obj.loginUserId = dataset.loginuserid;
}
wx.setStorageSync('carInfo', obj);
wx.setStorageSync('initFindCar', true);
wx.switchTab({
url: '../../pages/findCar/findCar'
});
}
})
\ No newline at end of file
{}
\ No newline at end of file
<view class="serach-box">
<view class="weui-search-bar__form">
<view class="weui-search-bar__box search-wrap">
<icon class="weui-icon-search_in-box" type="search" size="14"></icon>
<input
type="text"
class="weui-search-bar__input"
placeholder="{{placeholders[searchTypesIndex]}}"
value="{{inputVal}}"
focus="{{inputShowed}}"
bindinput="inputTyping"
bindconfirm="searchConfirm"/>
<view class="weui-icon-clear" wx:if="{{inputVal.length > 0}}" bindtap="clearInput">
<icon type="clear" size="14"></icon>
</view>
<picker
class="search-picker"
bindchange="searchTypeChange"
value="{{searchTypesIndex}}"
range="{{searchTypes}}"
range-key="label">
<text>{{searchTypes[searchTypesIndex].label}}</text>
<view class="select-dropdown-icon"></view>
</picker>
</view>
</view>
</view>
<view class="result-list" hidden="{{!list.length}}">
<scroll-view
scroll-top="{{scrollTop}}"
scroll-y="true"
style="height:{{scrollHeight}}px;"
bindscrolltolower="bindDownLoad"
bindscroll="bindScroll">
<view class="weui-cell"
wx:for="{{list}}"
bindtap="redirectDetail"
data-standno="{{item.standno}}"
data-sns="{{item.sns}}"
data-loginuserid="{{item.loginUserId}}"
data-name="{{item.name}}"
data-vehicleid="{{item.vehicleId}}">
<view class="weui-cell__bd">
<view class="title"><text class="name">{{item.name}}</text> {{item.standno}}</view>
<view class="sub-title"><text class="label">申请单号:</text> {{item.sqbh||''}}</view>
<view wx:for="{{item.deviceList}}" class="sub-list">
<text class="label">{{item.type}}:</text>
<view class="sub-item">
<view wx:for="{{item.sns}}">{{item}}</view>
</view>
</view>
</view>
</view>
<view class="end-tip" hidden="{{page!=maxPage}}">
没有更多数据了~
</view>
</scroll-view>
</view>
<view class="none" hidden="{{!initSearch || list.length}}">
<image src="../../images/none.png"/>
<view>没有搜索到匹配的车辆数据</view>
</view>
.serach-box{
padding: 20rpx;
background-color: #fff;
}
.search-wrap{
position: relative;
padding-right: 120px;
}
.search-wrap input{
}
.search-picker{
position: absolute;
top: 0;
right: 0;
font-size: 28rpx;
}
.search-picker text{
position: absolute;
width: 60px;
right: 20px;
height: 56rpx;
line-height: 56rpx;
padding-left: 10px;
border-left: 1px solid #eee;
}
.select-dropdown-icon{
content: '';
display: inline-block;
border: 5px solid transparent;
border-top-color: #c9c9c9;
position: absolute;
right: 10px;
top: 10px;
}
.search-wrap .weui-icon-clear{
right: 90px;
z-index: 100;
}
.result-list{
background-color: #fff;
color: #666;
font-size: 14px;
}
.result-list .title{
color: #000;
}
.result-list .name{
margin-right: 20rpx;
}
.result-list .label{
margin-right: 20rpx;
float: left;
}
.sub-list{
overflow: hidden;
}
.sub-item{
float: left;
}
.sub-title{
overflow: hidden;
}
.result-list .weui-cell:first-child{
border-top: 1px solid #d9d9d9;
}
.result-list .weui-cell:last-child{
border-bottom: 1px solid #d9d9d9;
}
.none{
padding: 200rpx 0;
text-align: center;
color: #999;
}
.none image{
width: 400rpx;
height: 400rpx;
margin-bottom: 20rpx;
}
.end-tip{
text-align: center;
}
\ No newline at end of file
{
"navigationBarTitleText": "设备调频"
}
\ No newline at end of file
<view>
<label class="switch-label" hidden="{{switchHidden}}"><switch checked="{{switchChecked}}" color="#37c060" bindchange="switchChange"/>{{switchChecked?'开启':'关闭'}}</label>
<!-- 追车模式 -->
<view class="mode-title">
<label bindtap="modeChange" data-type="catch">
<image class="radio" src="../../images/radio-lg.png" hidden="{{modeType=='catch'}}"></image>
<image class="radio" src="../../images/radio-lg-checked.png" hidden="{{modeType!='catch'}}"></image>
追车模式
</label><image class="info" src="../../images/info.png" bindtap="alertInfoModal" data-type="catch"></image>
</view>
<view class="catch-mode mode-box">
<label><input type="number" placeholder="{{snTypeHidden?'1~5':'1~999'}}" maxlength="3" value="{{catchTime}}" bindinput="catchTimeInput"/>分钟</label>
</view>
<view class="{{snTypeHidden?'fade-hide':''}}">
<!-- 闹钟模式 -->
<view class="mode-title" >
<label bindtap="modeChange" data-type="clock">
<image class="radio" src="../../images/radio-lg.png" hidden="{{modeType=='clock'}}"></image>
<image class="radio" src="../../images/radio-lg-checked.png" hidden="{{modeType!='clock'}}"></image>
闹钟模式
</label><image class="info" src="../../images/info.png" bindtap="alertInfoModal" data-type="clock"></image>
</view>
<view class="clock-mode mode-box">
<checkbox-group class="checkbox-group" bindchange="checkboxChange" data-type="clock">
<label class="weui-cell weui-check__label" wx:for="{{clockCheckboxItems}}" wx:key="value">
<checkbox class="weui-check" value="{{item.value}}" checked="{{item.checked}}"/>
<view class="weui-cell__hd weui-check__hd_in-checkbox">
<image class="checkbox" src="../../images/checkbox-checked.png" wx:if="{{item.checked}}"></image>
<image class="checkbox" src="../../images/checkbox.png" wx:if="{{!item.checked}}"></image>
</view>
<view class="weui-cell__bd">{{item.name}}</view>
</label>
</checkbox-group>
<view class="input-group">
<view class="weui-cell">
<view class="time-text" data-type="group1" bindtap="changeClockTime">{{times[0][group1[0]]}}:{{times[1][group1[1]]}}</view>
<image src="../../images/clock.png" class="clock-icon"></image>
</view>
<view class="weui-cell">
<view class="time-text" data-type="group2" bindtap="changeClockTime">{{times[0][group2[0]]}}:{{times[1][group2[1]]}}</view>
<image src="../../images/clock.png" class="clock-icon"></image>
</view>
<view class="weui-cell">
<view class="time-text" data-type="group3" bindtap="changeClockTime">{{times[0][group3[0]]}}:{{times[1][group3[1]]}}</view>
<image src="../../images/clock.png" class="clock-icon"></image>
</view>
<view class="weui-cell">
<view class="time-text" data-type="group4" bindtap="changeClockTime">{{times[0][group4[0]]}}:{{times[1][group4[1]]}}</view>
<image src="../../images/clock.png" class="clock-icon"></image>
</view>
</view>
</view>
<!-- 星期模式 -->
<view class="mode-title">
<label bindtap="modeChange" data-type="week">
<image class="radio" src="../../images/radio-lg.png" hidden="{{modeType=='week'}}"></image>
<image class="radio" src="../../images/radio-lg-checked.png" hidden="{{modeType!='week'}}"></image>
星期模式
</label><image class="info" src="../../images/info.png" bindtap="alertInfoModal" data-type="week"></image>
</view>
<view class="week-mode mode-box">
<view class="weui-cell">
<label>上点时间<view class="time-text" data-type="group5" bindtap="changeClockTime">{{times[0][group5[0]]}}:{{times[1][group5[1]]}}</view></label>
<image src="../../images/clock.png" class="clock-icon"></image>
</view>
<checkbox-group bindchange="checkboxChange" data-type="week">
<label class="weui-cell weui-check__label" wx:for="{{weekCheckboxItems}}" wx:key="value">
<checkbox class="weui-check" value="{{item.value}}" checked="{{item.checked}}"/>
<view class="weui-cell__hd weui-check__hd_in-checkbox">
<image class="checkbox" src="../../images/checkbox-checked.png" wx:if="{{item.checked}}"></image>
<image class="checkbox" src="../../images/checkbox.png" wx:if="{{!item.checked}}"></image>
</view>
<view class="weui-cell__bd">{{item.name}}</view>
</label>
</checkbox-group>
</view>
</view>
<view class="footer">
<button type="primary" bindtap="sure">确定</button>
</view>
<view class="time-picker-wrap {{timePickerShow?'':'hidden'}}">
<view class="time-picker-main">
<view class="time-picker-controls">
<button type="default" size="mini" plain="true" bindtap="closeTimePicker"> 取消 </button>
<button type="primary" size="mini" plain="true" bindtap="sureTimePicker"> 确定 </button>
</view>
<picker-view indicator-style="height: 50px;" indicator-class="time-picker-indicator" style="width: 100%; height: 300px;" value="{{chooseTimes}}" bindchange="timePickerChange">
<picker-view-column>
<view wx:for="{{times[0]}}" wx:key="{{item}}" style="line-height: 50px">{{item}}</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{times[1]}}" wx:key="{{item}}" style="line-height: 50px">{{item}}</view>
</picker-view-column>
</picker-view>
</view>
</view>
<view class="info-modal" hidden="{{infoModalHidden}}" bindtap="closeInfoModal">
<view class="info-text">{{infoModalText}}</view>
</view>
</view>
.checkbox{
width: 38rpx;
height: 38rpx;
vertical-align: middle;
}
.mode-box{
background-color: #fff;
margin: 10px;
border-radius: 6px;
padding: 10px 15px;
overflow: hidden;
}
.mode-title{
margin: 10px 15px;
}
.mode-title .radio{
width: 42rpx;
height: 42rpx;
vertical-align: middle;
}
.info{
width: 34rpx;
height: 34rpx;
vertical-align: middle;
}
.catch-mode{
padding-left: 30px;
}
.catch-mode input{
display: inline-block;
vertical-align: middle;
width: 80px;
height: 30px;
line-height: 30px;
border:1px solid #ececec;
border-radius:4px;
background-color:#efefef;
padding-left: 10px;
margin-right: 5px;
}
.clock-mode{
display: flex;
flex-direction: row;
padding-top: 0px;
padding-bottom: 0px;
}
.clock-mode .input-group{
flex: 1;
}
.time-text{
display: inline-block;
width: 80px;
height: 30px;
line-height: 30px;
border:1px solid #ececec;
border-radius:4px;
background-color:#efefef;
text-indent: 10px;
}
.weui-cell:before{
display: none;
}
.time-picker{
border:1px solid #ececec;
border-radius:4px;
background-color:#efefef;
width:80px;
text-indent:10px;
height:30px;
line-height:30px;
}
.clock-mode .checkbox-group .weui-cell{
padding: 13px 5px 14px 15px;
}
.clock-icon{
width: 46rpx;
height: 46rpx;
margin-left: 15px;
}
.time-picker-wrap{
position: fixed;
width: 100%;
height: 100%;
bottom: 0;
left: 0;
z-index: 1000;
background-color: rgba(0,0,0,0.3);
animation: pickershow 1s;
-webkit-animation: pickershow .5s; /* Safari 和 Chrome */
}
.time-picker-main{
position: absolute;
width: 100%;
background-color: #fff;
bottom: 0;
left: 0;
}
.time-picker-wrap.hidden{
background-color: transparent;
}
.time-picker-wrap.hidden{
bottom: -100%;
animation: pickerhide 1s;
-webkit-animation: pickerhide .5s; /* Safari 和 Chrome */
}
.time-picker-wrap picker-view{
display:flex;
justify-content:center;
}
.time-picker-wrap picker-view-column{
width: 100px;
flex: none;
}
.time-picker-wrap picker-view-column view{
text-align: center;
}
.time-picker-controls button{
border: none !important;
font-size: 16px;
}
.time-picker-controls{
border-bottom: 1px solid #eee;
overflow: hidden;
}
.time-picker-controls button:nth-child(1){
float: left;
}
.time-picker-controls button:nth-child(2){
float: right;
}
.time-picker-wrap picker-view-column:nth-child(2):before{
content: ':';
font-size: 18px;
color: #000;
vertical-align: middle;
line-height: 300px;
}
.week-mode{
padding-top: 0px;
}
.week-mode>checkbox-group>label{
float: left;
border: none;
padding: 10px 0px 0px 15px;
}
.week-mode .time-text{
margin-left: 5px;
}
.footer{
margin: 20px 10px 10px;
}
.info-modal{
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.info-modal .info-text{
position: absolute;
top: 50%;
left: 50%;
width: 80%;
padding: 10px;
color: #fff;
border-radius: 6px;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
background-color: rgba(0,0,0,0.7);
}
.switch-label{
float: right;
margin: -5px 10px;
}
@keyframes pickerhide
{
from {
bottom: 0;
background-color: transparent;
}
to {
bottom: -100%;
}
}
@-webkit-keyframes pickerhide /* Safari 与 Chrome */
{
from {
bottom: 0;
background-color: transparent;
}
to {
bottom: -100%;
}
}
@keyframes pickershow
{
from {
background-color: transparent;
bottom: -100%;
}
90%{
background-color: transparent;
}
to {
bottom: 0;
background-color: rgba(0,0,0,0.3);
}
}
@-webkit-keyframes pickershow /* Safari 与 Chrome */
{
from {
background-color: transparent;
bottom: -100%;
}
90%{
background-color: transparent;
}
to {
bottom: 0;
background-color: rgba(0,0,0,0.3);
}
}
.fade-hide{
position: relative;
}
.fade-hide:after{
content: '';
position: absolute;
background-color: rgba(255,255,255,0.3);
width: 100%;
height: 100%;
top: 0;
left: 0;
}
\ No newline at end of file
const WXRequest = require('../../utils/wxrequest.js');
Page({
/**
* 页面的初始数据
*/
data: {
infoModalHidden: true,
isDisabled: true,
date: '2016-09-01',
time: '08:00',
sqbh: '',
standno: '',
name: '',
deviceList: [],
vehicleid: '',
list: [],
sourceTypes: {
'1': 'APP',
'2': '虎哥E盾',
'3': 'FRMS',
'4': '小程序'
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
const deviceinfo = JSON.parse(options.deviceinfo);
const name = options.name;
const standno = options.standno;
const sqbh = options.sqbh;
const vehicleid= options.vehicleid;
const deviceObj = {}
deviceinfo&&deviceinfo.forEach((deviceItem)=>{
if(!deviceObj[deviceItem.type]){
deviceObj[deviceItem.type] = [];
}
deviceObj[deviceItem.type].push(deviceItem.sn);
});
const deviceList = [];
for(let type in deviceObj){
deviceList.push({
type,
sns: deviceObj[type]
});
}
this.setData({
name,
sqbh,
standno,
deviceList,
vehicleid
});
this.loadList()
},
loadList(){
const that = this;
WXRequest.get('adjFreq/adjFreqDetails',{vehicleId: that.data.vehicleid}).then((res)=>{
that.setData({
list: res.data
})
});
},
redirectDetail(e){
const dataset = e.currentTarget.dataset;
wx.navigateTo({
url: `../../pages/freqLogUserDetail/freqLogUserDetail?id=${dataset.id}&nickname=${dataset.nickname}&avatarurl=${dataset.avatarurl}`
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
}
})
\ No newline at end of file
{
"navigationBarTitleText": "调频记录"
}
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!