This commit is contained in:
2025-06-19 17:33:18 +08:00
commit f8f31dc4d9
437 changed files with 103080 additions and 0 deletions
@@ -0,0 +1,7 @@
{
"usingComponents": {
"van-empty": "@vant/weapp/empty/index",
"van-popup": "@vant/weapp/popup/index"
},
"navigationBarTitleText": "搜索车辆"
}
@@ -0,0 +1,71 @@
/* pages/vehicleMonitoring/component/vehicleSearch/vehicleSearch.wxss */
.container {
>.search {
width: calc(100% - 16px);
height: 36px;
padding: 8px;
margin: 8px auto;
box-sizing: border-box;
border-radius: 4px;
background: #F6F7F9;
border: 1px solid #E6EAF2;
display: flex;
align-items: center;
.icon {
width: 20px;
height: 20px;
margin-right: 8px;
image {
width: 100%;
height: 100%;
}
}
input {
flex: 1;
font-size: 14px;
}
}
.search-list {
padding: 0 18rpx;
.item {
padding: 22rpx 18rpx;
border-bottom: 2rpx solid #E6EAF2;
display: flex;
justify-content: space-between;
align-items: center;
.company {
font-size: 40rpx;
color: #2B3A51;
display: flex;
.hight-light {
color: #3977F7;
}
}
.priority {
color: #888888;
font-size: 36rpx;
display: flex;
align-items: center;
.common-use {
width: 34rpx;
height: 34rpx;
margin-left: 14rpx;
display: inline-block;
border-radius: 50%;
border: 2rpx solid #A2A2A2;
color: #A2A2A2;
font-size: 22rpx;
display: flex;
align-items: center;
justify-content: center;
}
.iscommon {
border: 2rpx solid #3D7EEA;
background: #3D7EEA;
color: #fff;
}
}
}
}
}
@@ -0,0 +1,111 @@
// pages/vehicleMonitoring/component/vehicleSearch/vehicleSearch.ts
import { getAction } from '../../../../api/base';
Page({
/**
* 页面的初始数据
*/
data: {
plateNumber: '',
searchList: []
},
getPlateNumber(e: any) {
let val = e.detail.value;
let parms = {
plateNumber: val
};
getAction('api/monitor/vehicle/listByAll', parms)
.then((res: any) => {
if (res.code == 200) {
console.log(res.result);
let tmpArr = res.result;
for (let i = 0; i < tmpArr.length; i++) {
let item: any = tmpArr[i];
item.valueTxt = this.getHilightStrArray(item.plateNumber, val);
}
this.setData({
searchList: tmpArr,
plateNumber: val
});
} else {
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
this.setData({
loading: false
});
wx.showToast({
title: err.message,
icon: 'none'
});
});
},
// 返回一个使用key切割str后的数组,key仍在数组中
getHilightStrArray(str: string, key: string) {
return str.replace(new RegExp(`${key}`, 'g'), `%%${key}%%`).split('%%');
},
selectOption(e: any) {
console.log(e.currentTarget.dataset);
if (wx.getStorageSync('isGlobal') == 1) {
wx.setStorageSync('selectCar', e.currentTarget.dataset.item);
wx.navigateTo({
url: '../../realtime/realtime',
fail: e => {
console.log(e);
}
});
} else {
// 传参,跳转
wx.setStorageSync('selectCarInf', e.currentTarget.dataset.item);
wx.navigateBack({
delta: 1,
fail: e => {
console.log(e);
}
});
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});
@@ -0,0 +1,30 @@
<!--pages/vehicleMonitoring/component/vehicleSearch/vehicleSearch.wxml-->
<view class="container">
<view class="search">
<view class="icon">
<image src="../../../../images/icon_search.png" mode=""/>
</view>
<input
type="text"
placeholder="搜索车辆"
placeholder-style="color:#949CB5; font-size: 28rpx; font-weight: 400;"
value="{{plateNumber}}"
bindinput="getPlateNumber" />
</view>
<view class="search-list">
<view class="item" wx:for="{{searchList}}" wx:key="index" data-item="{{item}}" catchtap="selectOption">
<view class="company">
<view wx:for="{{item.valueTxt}}" wx:for-item="nameItem" wx:key="index" class="{{nameItem == plateNumber ? 'hight-light' : ''}}">{{nameItem}}</view>
</view>
<!-- <view class="priority">
{{item.orgName}}
<view class="common-use {{item.topping ? 'iscommon' : ''}}" data-item="{{item}}" catchtap="setrouteTop">
<van-icon name="down" style="transform: rotate(180deg);" />
</view>
</view> -->
</view>
<view class="no-data" wx:if="{{searchList.length == 0}}">
<van-empty description="无数据" />
</view>
</view>
</view>