#用户注册修改
This commit is contained in:
parent
24bcc589b4
commit
3c976c69d8
|
@ -71,14 +71,14 @@
|
||||||
<p style="display: inline-block">
|
<p style="display: inline-block">
|
||||||
<div class="input-group main-search">
|
<div class="input-group main-search">
|
||||||
<input type="text" class="form-control" placeholder="请输入关键字"
|
<input type="text" class="form-control" placeholder="请输入关键字"
|
||||||
style="height: 40px;width: 230px;opacity: 1 " name="organization">
|
style="height: 40px;width: 550px;opacity: .9 " name="organization">
|
||||||
<div class="input-group-btn" style="display: none">
|
<div class="input-group-btn" style="display: none">
|
||||||
<button class="btn btn-default" type="button">
|
<button class="btn btn-default" type="button">
|
||||||
<span class="glyphicon glyphicon-search"></span>
|
<span class="glyphicon glyphicon-search"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="autocomplete-panel" style="margin-left: 50px;z-index: 999">
|
<div class="autocomplete-panel" style="z-index: 9999">
|
||||||
</div>
|
</div>
|
||||||
{# <div class="result-panel">#}
|
{# <div class="result-panel">#}
|
||||||
{# <div class="panel panel-default">#}
|
{# <div class="panel panel-default">#}
|
||||||
|
@ -225,45 +225,11 @@
|
||||||
}).show();
|
}).show();
|
||||||
}).blur(function (e) {
|
}).blur(function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
resetAutoCompletePanel();
|
|
||||||
}).on('input', function (e) {
|
}).on('input', function (e) {
|
||||||
var val = $(this).val();
|
var val = $(this).val();
|
||||||
var params = {keyword: val}
|
var params = {keyword: val}
|
||||||
$('.autocomplete-panel').load('/get/organization/' + '?' + $.param(params))
|
$('.autocomplete-panel').load('/get/organization/' + '?' + $.param(params))
|
||||||
});
|
});
|
||||||
|
|
||||||
function search(value) {
|
|
||||||
console.log('search');
|
|
||||||
$('.main-search input').val(value);
|
|
||||||
{#resetAutoCompletePanel();#}
|
|
||||||
{#showFilterPanel();#}
|
|
||||||
{#resetResultPanel();#}
|
|
||||||
{#showResultPanel(value);#}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function showFilterPanel() {
|
|
||||||
$('.filter-panel').show();
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetFilterCompletePanel() {
|
|
||||||
$('.filter-panel').hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetAutoCompletePanel() {
|
|
||||||
$('.autocomplete-panel').html("<div style='padding: 10px; text-align: center'>loading...</div>").hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
function showResultPanel(name) {
|
|
||||||
$('.result-panel').show();
|
|
||||||
$('.result-panel').load('{% url "get-organization" %}' + '?keyword=' + encodeURIComponent(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetResultPanel() {
|
|
||||||
$('.result-panel').html(" <div class=\"panel panel-default\">\n" +
|
|
||||||
" <div style=\"padding: 10px; text-align: center\">loading...</div>\n" +
|
|
||||||
" </div>")
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
{% for topten in topten_list %}
|
{% for topten in topten_list %}
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<a href="#" class="autocomplete-panel-item" data-name="{{ topten.name }},{{ topten.province }},{{ topten.cities }},{{ topten.district }}" style="color: #16a085">
|
<a href="#" class="autocomplete-panel-item" data-name="{{ topten.name }}" style="color: #16a085">
|
||||||
{{ topten.name }}- (<span id="lat">{{ topten.province }}</span>,<span
|
{{ topten.name }}- (<span id="lat">{{ topten.province }}</span>,<span
|
||||||
id="lon">{{ topten.cities }}</span>,<span id="lon">{{ topten.district }}</span>)
|
id="lon">{{ topten.cities }}</span>,<span id="lon">{{ topten.district }}</span>)
|
||||||
</a>
|
</a>
|
||||||
|
@ -17,7 +17,10 @@
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var name = $(this).data('name');
|
var name = $(this).data('name');
|
||||||
console.log(name+"11111111111111111111111111111111")
|
console.log(name+"11111111111111111111111111111111")
|
||||||
$('.main-search input').val(value)
|
$('.main-search input').val(name)
|
||||||
|
$('.filter-panel').hide();
|
||||||
|
$('.list-group').hide();
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -219,26 +219,25 @@ def get_village(request):
|
||||||
|
|
||||||
|
|
||||||
def get_organization(request):
|
def get_organization(request):
|
||||||
# q = request.GET.get('q')
|
|
||||||
# organization = Organization.objects.filter(name__contains=q)[:20]
|
|
||||||
# res = []
|
|
||||||
# for o in organization:
|
|
||||||
# d = dict()
|
|
||||||
# d['name'] = o.name
|
|
||||||
# d['province'] = Area_code_2020.objects.get(code=o.province).name
|
|
||||||
# if o.cities:
|
|
||||||
# d['cities'] = Area_code_2020.objects.get(code=o.cities).name
|
|
||||||
# else:
|
|
||||||
# d['cities'] = ''
|
|
||||||
# if o.district:
|
|
||||||
# d['district'] = Area_code_2020.objects.get(code=o.district).name
|
|
||||||
# else:
|
|
||||||
# d['district'] = ''
|
|
||||||
# res.append(d)
|
|
||||||
# print(res)
|
|
||||||
# return HttpResponse(json.dumps(res))
|
|
||||||
keywords = request.GET.get('keyword')
|
keywords = request.GET.get('keyword')
|
||||||
if len(keywords) != 0:
|
if len(keywords) != 0:
|
||||||
topten_list = Organization.objects.filter(Q(name__contains=keywords))
|
o = Organization.objects.filter(Q(name__contains=keywords))[:10]
|
||||||
|
topten_list = []
|
||||||
|
for i in o:
|
||||||
|
d = dict()
|
||||||
|
d['name'] = i.name
|
||||||
|
if i.province:
|
||||||
|
d['province'] = Area_code_2020.objects.get(code=i.province).name
|
||||||
|
else:
|
||||||
|
d['province'] = ''
|
||||||
|
if i.cities:
|
||||||
|
d['cities'] = Area_code_2020.objects.get(code=i.cities).name
|
||||||
|
else:
|
||||||
|
d['cities'] = ''
|
||||||
|
if i.district:
|
||||||
|
d['district'] = Area_code_2020.objects.get(code=i.district).name
|
||||||
|
else:
|
||||||
|
d['district'] = ''
|
||||||
|
topten_list.append(d)
|
||||||
print(str(topten_list))
|
print(str(topten_list))
|
||||||
return render(request, 'dashboard/results_by_keywords.html', {'topten_list': topten_list})
|
return render(request, 'dashboard/results_by_keywords.html', {'topten_list': topten_list})
|
||||||
|
|
Loading…
Reference in New Issue