From f543f68bace7186c5c375d72d26acd29cbecfca5 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Wed, 09 Jun 2021 17:56:19 +0800
Subject: [PATCH] 搜索弹框 细节优化
---
widgets/searchL/Widget.js | 36 ++++++++++++++++++++++++++++++------
widgets/searchL/Widget.html | 4 ++--
2 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/widgets/searchL/Widget.html b/widgets/searchL/Widget.html
index 621d4e4..1d79f04 100644
--- a/widgets/searchL/Widget.html
+++ b/widgets/searchL/Widget.html
@@ -6,9 +6,9 @@
<input id="local_data" autocomplete="off" data-provide="typeahead" type="text" class="input-sms"
placeholder="输入关键字以搜索: 鄱阳湖" />
<div id="inputTwo">
- <input id="local_data1" autocomplete="off" data-provide="typeahead" type="text" class="input-sms1"
+ <input id="local_data1" autocomplete="off" data-provide="typeahead" type="number" class="input-sms1"
placeholder="经度:115.5" />
- <input id="local_data2" autocomplete="off" data-provide="typeahead" type="text" class="input-sms1"
+ <input id="local_data2" autocomplete="off" data-provide="typeahead" type="number" class="input-sms1"
placeholder="纬度:25.5" />
</div>
<img class="input_img searchImg" src="images/addL/sous.png">
diff --git a/widgets/searchL/Widget.js b/widgets/searchL/Widget.js
index 991a89e..cb9525f 100644
--- a/widgets/searchL/Widget.js
+++ b/widgets/searchL/Widget.js
@@ -58,12 +58,35 @@
// console.log(2324345)
that.getInputData();
// console.log(that.searchDatas)
- var han = /^[\u4e00-\u9fa5]+$/;
- if (han.test(that.searchDatas)) {
- that.getData(0, that.searchDatas);
- $('.searchLMain').show();
- } else {
- $('.searchLMain').hide();
+ if(typeof that.searchDatas == 'string'){
+ var han = /^[\u4e00-\u9fa5]+$/;
+ if (han.test(that.searchDatas) || that.searchDatas == ' ') {
+ that.getData(0, that.searchDatas);
+ $('.searchLMain').show();
+ } else {
+ layui.use(function () { //亦可加载特定模块:layui.use(['layer', 'laydate', function(){
+ //得到各种内置组件
+ var layer = layui.layer //弹层
+ // layer.msg('请先填写关键字', { icon: 1, time: 1000, shift: 6 });
+ layer.tips('请先填写关键字', '.searchImg',{
+ tips: [2,'#FF5722']
+ });
+ })
+ $('.searchLMain').hide();
+ }
+ }else{
+ if(that.searchDatas[0] && that.searchDatas[1]){
+ console.log(that.searchDatas);
+ }else{
+ layui.use(function () { //亦可加载特定模块:layui.use(['layer', 'laydate', function(){
+ //得到各种内置组件
+ var layer = layui.layer //弹层
+ // layer.msg('请先填写关键字', { icon: 1, time: 1000, shift: 6 });
+ layer.tips('请先填写完整坐标', '.searchImg',{
+ tips: [2,'#FF5722']
+ });
+ })
+ }
}
})
$(".searchColce").click(function () {
@@ -79,6 +102,7 @@
}
},
getData: function (index, val) {
+ val = val == ' '? '': val;
var d = $('.searchLMain').find('.layui-tab-item').hide;
// console.log(d)
var that = this,
--
Gitblit v1.9.3