Compare commits
2 Commits
7e38ca26c7
...
d737bee569
Author | SHA1 | Date |
---|---|---|
qweasdzxc227 | d737bee569 | 6 months ago |
qweasdzxc227 | 618ebdb791 | 6 months ago |
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module type="PYTHON_MODULE" version="4">
|
<module type="PYTHON_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$" />
|
<content url="file://$MODULE_DIR$" />
|
||||||
<orderEntry type="jdk" jdkName="Python 3.9 (article_spider)" jdkType="Python SDK" />
|
<orderEntry type="jdk" jdkName="Python 3.9 (article_spider)" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
@ -1,64 +1,86 @@
|
|||||||
# Define here the models for your scraped items
|
# Define here the models for your scraped items
|
||||||
#
|
#
|
||||||
# See documentation in:
|
# See documentation in:
|
||||||
# https://docs.scrapy.org/en/latest/topics/items.html
|
# https://docs.scrapy.org/en/latest/topics/items.html
|
||||||
import re
|
import re
|
||||||
import scrapy
|
import scrapy
|
||||||
from scrapy.loader.processors import MapCompose, TakeFirst, Identity, Join
|
from scrapy.loader.processors import MapCompose, TakeFirst, Identity, Join
|
||||||
from scrapy.loader import ItemLoader
|
from scrapy.loader import ItemLoader
|
||||||
from ArticleSpider.models.es_types import ArticleType
|
from ArticleSpider.models.es_types import ArticleType
|
||||||
from w3lib.html import remove_tags
|
from w3lib.html import remove_tags
|
||||||
|
from elasticsearch_dsl.connections import connections
|
||||||
class ArticlespiderItem(scrapy.Item):
|
|
||||||
# define the fields for your item here like:
|
es = connections.create_connection(ArticleType._doc_type.using)
|
||||||
# name = scrapy.Field()
|
|
||||||
pass
|
|
||||||
|
class ArticlespiderItem(scrapy.Item):
|
||||||
|
# define the fields for your item here like:
|
||||||
def date_convert(value):
|
# name = scrapy.Field()
|
||||||
match_re = re.match('.*?(\d+.*)', value)
|
pass
|
||||||
if match_re:
|
|
||||||
return match_re.group(1)
|
|
||||||
else:
|
def gen_suggests(index, info_tuple):
|
||||||
return '1970-07-01'
|
# 根据字符串生成字符串搜索建议数组
|
||||||
|
used_words = set() # 去重
|
||||||
|
suggests = []
|
||||||
class ArticleItemLoader(ItemLoader):
|
for text, weight in info_tuple:
|
||||||
default_output_processor = TakeFirst()
|
if text:
|
||||||
|
# 调用es的analyze接口分析字符串
|
||||||
|
words = es.indices.analyze(index=index, analyzer='ik_max_word', params={'filter': ['lowercase']}, body=text)
|
||||||
class JobBoleArticleItem(scrapy.Item):
|
anylyzed_words = set([r['token'] for r in words['tokens'] if len(r['token']) > 1])
|
||||||
title = scrapy.Field() # 标题
|
new_words = anylyzed_words - used_words
|
||||||
create_date = scrapy.Field(
|
else:
|
||||||
input_processor=MapCompose(date_convert)
|
new_words = set()
|
||||||
) # 发布时间
|
if new_words:
|
||||||
url = scrapy.Field() # 链接
|
suggests.append({'input': list(new_words), 'weight': weight})
|
||||||
url_object_id = scrapy.Field() # 链接id
|
return suggests
|
||||||
front_image_url = scrapy.Field(
|
|
||||||
output_processor=Identity()
|
|
||||||
) # 封面图
|
def date_convert(value):
|
||||||
front_image_path = scrapy.Field() # 封面图路径
|
match_re = re.match('.*?(\d+.*)', value)
|
||||||
praise_nums = scrapy.Field() # 点赞数
|
if match_re:
|
||||||
comment_nums = scrapy.Field() # 评论数
|
return match_re.group(1)
|
||||||
fav_nums = scrapy.Field() # 收藏数
|
else:
|
||||||
tags = scrapy.Field(
|
return '1970-07-01'
|
||||||
output_processor=Join(separator=',')
|
|
||||||
) # 标签
|
|
||||||
content = scrapy.Field() # 内容
|
class ArticleItemLoader(ItemLoader):
|
||||||
|
default_output_processor = TakeFirst()
|
||||||
def save_to_es(self):
|
|
||||||
article = ArticleType()
|
|
||||||
article.title = self['title']
|
class JobBoleArticleItem(scrapy.Item):
|
||||||
article.create_date = self['create_date']
|
title = scrapy.Field() # 标题
|
||||||
article.content = remove_tags(self['content'])
|
create_date = scrapy.Field(
|
||||||
article.front_image_url = self['front_image_url']
|
input_processor=MapCompose(date_convert)
|
||||||
if 'front_image_path' in self:
|
) # 发布时间
|
||||||
article.front_image_path = self['front_image_path']
|
url = scrapy.Field() # 链接
|
||||||
article.praise_nums = self['praise_nums']
|
url_object_id = scrapy.Field() # 链接id
|
||||||
article.fav_nums = self['fav_nums']
|
front_image_url = scrapy.Field(
|
||||||
article.comment_nums = self['comment_nums']
|
output_processor=Identity()
|
||||||
article.url = self['url']
|
) # 封面图
|
||||||
article.tags = self['tags']
|
front_image_path = scrapy.Field() # 封面图路径
|
||||||
article.meta.id = self['url_object_id']
|
praise_nums = scrapy.Field() # 点赞数
|
||||||
article.save()
|
comment_nums = scrapy.Field() # 评论数
|
||||||
return
|
fav_nums = scrapy.Field() # 收藏数
|
||||||
|
tags = scrapy.Field(
|
||||||
|
output_processor=Join(separator=',')
|
||||||
|
) # 标签
|
||||||
|
content = scrapy.Field() # 内容
|
||||||
|
|
||||||
|
def save_to_es(self):
|
||||||
|
article = ArticleType()
|
||||||
|
article.title = self['title']
|
||||||
|
article.create_date = self['create_date']
|
||||||
|
article.content = remove_tags(self['content'])
|
||||||
|
article.front_image_url = self['front_image_url']
|
||||||
|
if 'front_image_path' in self:
|
||||||
|
article.front_image_path = self['front_image_path']
|
||||||
|
article.praise_nums = self['praise_nums']
|
||||||
|
article.fav_nums = self['fav_nums']
|
||||||
|
article.comment_nums = self['comment_nums']
|
||||||
|
article.url = self['url']
|
||||||
|
article.tags = self['tags']
|
||||||
|
article.meta.id = self['url_object_id']
|
||||||
|
article.suggest = gen_suggests(ArticleType._doc_type.index, ((article.title, 10), (article.tags, 7)))
|
||||||
|
article.save()
|
||||||
|
return
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
__author__ = 'bobby'
|
__author__ = 'bobby'
|
||||||
|
|
||||||
from scrapy.cmdline import execute
|
from scrapy.cmdline import execute
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||||
execute(["scrapy", "crawl", "jobbole"])
|
execute(["scrapy", "crawl", "jobbole"])
|
||||||
# execute(["scrapy", "crawl", "zhihu"])
|
|
||||||
# execute(["scrapy", "crawl", "lagou"])
|
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="django" name="Django">
|
||||||
|
<configuration>
|
||||||
|
<option name="rootFolder" value="$MODULE_DIR$" />
|
||||||
|
<option name="settingsModule" value="LcvSearch/settings.py" />
|
||||||
|
<option name="manageScript" value="$MODULE_DIR$/manage.py" />
|
||||||
|
<option name="environment" value="<map/>" />
|
||||||
|
<option name="doNotUseTestRunner" value="false" />
|
||||||
|
<option name="trackFilePattern" value="migrations" />
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
<component name="TemplatesService">
|
||||||
|
<option name="TEMPLATE_CONFIGURATION" value="Django" />
|
||||||
|
<option name="TEMPLATE_FOLDERS">
|
||||||
|
<list>
|
||||||
|
<option value="$MODULE_DIR$/../LcvSearch\templates" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</module>
|
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Black">
|
||||||
|
<option name="sdkName" value="Python 3.9 (lcv_search) (2)" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (lcv_search) (2)" project-jdk-type="Python SDK" />
|
||||||
|
</project>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/LcvSearch.iml" filepath="$PROJECT_DIR$/.idea/LcvSearch.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,16 @@
|
|||||||
|
"""
|
||||||
|
ASGI config for LcvSearch project.
|
||||||
|
|
||||||
|
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.core.asgi import get_asgi_application
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'LcvSearch.settings')
|
||||||
|
|
||||||
|
application = get_asgi_application()
|
@ -0,0 +1,127 @@
|
|||||||
|
"""
|
||||||
|
Django settings for LcvSearch project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 4.2.13.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/4.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/4.2/ref/settings/
|
||||||
|
"""
|
||||||
|
import os.path
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
|
|
||||||
|
# Quick-start development settings - unsuitable for production
|
||||||
|
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = 'django-insecure-8vd6v)mxnxee#^3_n12)o3^4w$fg-1g@9p3y$_pa!&wh*@4pih'
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = True
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = []
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'search.apps.SearchConfig',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'LcvSearch.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [BASE_DIR / 'templates']
|
||||||
|
,
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.debug',
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'LcvSearch.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': BASE_DIR / 'db.sqlite3',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/4.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/4.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
STATICFILES_DIRS = [
|
||||||
|
os.path.join(BASE_DIR, 'static')
|
||||||
|
]
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
@ -0,0 +1,24 @@
|
|||||||
|
"""
|
||||||
|
URL configuration for LcvSearch project.
|
||||||
|
|
||||||
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||||
|
https://docs.djangoproject.com/en/4.2/topics/http/urls/
|
||||||
|
Examples:
|
||||||
|
Function views
|
||||||
|
1. Add an import: from my_app import views
|
||||||
|
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||||
|
Class-based views
|
||||||
|
1. Add an import: from other_app.views import Home
|
||||||
|
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||||
|
Including another URLconf
|
||||||
|
1. Import the include() function: from django.urls import include, path
|
||||||
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||||
|
"""
|
||||||
|
from django.contrib import admin
|
||||||
|
from django.urls import path
|
||||||
|
from django.views.generic import TemplateView
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
path('', TemplateView.as_view(template_name='index.html'), name='index'),
|
||||||
|
]
|
@ -0,0 +1,16 @@
|
|||||||
|
"""
|
||||||
|
WSGI config for LcvSearch project.
|
||||||
|
|
||||||
|
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'LcvSearch.settings')
|
||||||
|
|
||||||
|
application = get_wsgi_application()
|
@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
"""Django's command-line utility for administrative tasks."""
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Run administrative tasks."""
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'LcvSearch.settings')
|
||||||
|
try:
|
||||||
|
from django.core.management import execute_from_command_line
|
||||||
|
except ImportError as exc:
|
||||||
|
raise ImportError(
|
||||||
|
"Couldn't import Django. Are you sure it's installed and "
|
||||||
|
"available on your PYTHONPATH environment variable? Did you "
|
||||||
|
"forget to activate a virtual environment?"
|
||||||
|
) from exc
|
||||||
|
execute_from_command_line(sys.argv)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
@ -0,0 +1,3 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class SearchConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'search'
|
@ -0,0 +1,3 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
# Create your models here.
|
@ -0,0 +1,3 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
@ -0,0 +1,3 @@
|
|||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
# Create your views here.
|
@ -0,0 +1,50 @@
|
|||||||
|
@charset "utf-8";
|
||||||
|
html{*overflow:auto;}
|
||||||
|
#hd{padding:20px 10px;}
|
||||||
|
.logo{float:left;margin-right:30px; height:33px;}
|
||||||
|
/*input搜索区域*/
|
||||||
|
.inputArea{float:left;position:relative;}
|
||||||
|
.inputArea .searchInput{border:1px solid #bfbfbf;padding:0 15px;outline:none;height:35px;*line-height:38px;width:350px; background:url(../img/inputbg.png);font-size:14px;}
|
||||||
|
.inputArea .searchButton{position:absolute;left:382px;top:0;*top:1px;*left:381px;width:106px;height:38px;background:url(../img/btn_min.png) no-repeat;border:none; cursor:pointer;}
|
||||||
|
|
||||||
|
/*返回搜索*/
|
||||||
|
.inputArea .back{position:absolute;font-size:14px;left:500px;top:12px;width:60px;text-decoration:underline;}
|
||||||
|
|
||||||
|
/*分界区域*/
|
||||||
|
.divsion{margin-bottom:24px;height:36px;background:#f9f9f9;border-bottom:1px solid #e0e0e0;}
|
||||||
|
|
||||||
|
/*高级搜索区域*/
|
||||||
|
.subfield{border-left:4px solid #9cc813;font-size:14px;font-weight:bold;padding:2px 0 2px 20px;}
|
||||||
|
.subfieldContent{padding-left:140px;padding-bottom:40px;}
|
||||||
|
.subfieldContent .advanceItem{padding-left:350px;margin-bottom:15px;padding-top:8px;padding-bottom:3px;}
|
||||||
|
.subfieldContent .advanceItem.keyWords{background:#f4f4f4;padding-top:18px;padding-bottom:3px;}
|
||||||
|
.subfieldContent .advanceItem dd{float:left;margin-left:-320px;}
|
||||||
|
.subfieldContent .advanceItem dd label{float:left;margin-right:40px;width:75px;font-weight:bold;}
|
||||||
|
.subfieldContent .advanceItem dd .impInfo{ font-weight:bold;}
|
||||||
|
.subfieldContent .advanceItem dd .tips{float:left;}
|
||||||
|
.subfieldContent .advanceItem dd p, .subfieldContent .advanceItem dt p{margin-bottom:10px;height:26px;}
|
||||||
|
.subfieldContent .advanceItem dt p input[type=text]{position:relative;top:-5px;line-height:26px;}
|
||||||
|
|
||||||
|
.subfieldContent .advanceItem dt{float:left;width:100%;}
|
||||||
|
.subfieldContent .advanceItem.keyWords dt input[type=text]{width:290px;height:26px;border:1px solid #bfbfbf;outline:none;}
|
||||||
|
/*自定义*/
|
||||||
|
.subfieldContent .advanceItem.time{height:30px;}
|
||||||
|
.subfieldContent .advanceItem .define{display:none;position:relative;*top:-3px;}
|
||||||
|
.subfieldContent .advanceItem.time input[type=text]{width:80px;height:18px;line-height:18px;border:1px solid #bfbfbf;outline:none;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*更多按钮*/
|
||||||
|
.more {float:left;}
|
||||||
|
.more:hover{text-decoration:none;}
|
||||||
|
.more .moreIcon{display:inline-block;position:relative;top:-1px;*top:-3px;left:2px;*left:-1px;width:9px;height:5px;background:url(../img/more.png);}
|
||||||
|
.more.show .moreIcon{background:url(../img/down.png);top:-2px;}
|
||||||
|
|
||||||
|
/*立即搜索样式*/
|
||||||
|
.subfieldContent .search{margin:45px 0 0 145px;width:130px;height:36px;background:url(../img/btnbg.png); font-weight:bold;border:none;border:1px solid #bfbfbf;line-height:36px;cursor:pointer;font-size:14px;}
|
||||||
|
/*联想下拉区域*/
|
||||||
|
.inputArea .dataList{display:none;position:absolute;left:0;top:42px;*top:43px;width:550px;padding:5px 0;background:#fff;border:1px solid #bfbfbf;border-top:none;}
|
||||||
|
.inputArea .dataList li{padding:2px 15px;font-size:14px;}
|
||||||
|
.inputArea .dataList li:hover{background:#f0f0f0;color:#0080cc;font-weight:bold;}
|
@ -0,0 +1,34 @@
|
|||||||
|
@charset "utf-8";
|
||||||
|
html{*overflow:auto;}
|
||||||
|
#main{width:730px;margin:75px auto 0;}
|
||||||
|
#main h1.title{width:600px;}
|
||||||
|
#bd{margin-bottom:20px;}
|
||||||
|
.logo.large{margin:0px auto 10px auto;width:342px;height:144px;background: url(../img/logo.png) no-repeat center center;}
|
||||||
|
|
||||||
|
/*nav样式*/
|
||||||
|
.nav{margin-bottom:10px;}
|
||||||
|
.searchList{float:left;padding-left:5px;}
|
||||||
|
.searchList .searchItem{float:left;margin-right:15px;font-size:14px;padding:0 0 2px 2px;cursor:pointer;height:18px;}
|
||||||
|
.searchList .searchItem.current{color:#0080cc;border-bottom:2px solid #9cc813;font-weight:bold;}
|
||||||
|
|
||||||
|
/*input搜索区域*/
|
||||||
|
.inputArea{position:relative;margin-bottom:65px;}
|
||||||
|
.inputArea .searchInput{border:1px solid #bfbfbf;padding:0 15px;outline:none;height:40px;*height:39px;*line-height:40px;width:520px; background:url(../img/inputbg.png);font-size:14px;}
|
||||||
|
.inputArea .searchButton{position:absolute;left:550px;*left:552px;*top:1px;width:106px;height:42px;*height:41px;background:url(../img/seachbtn.png) no-repeat;border:none;cursor:pointer;}
|
||||||
|
/*高级搜索*/
|
||||||
|
.inputArea .advanced{position:absolute;font-size:14px;left:674px;top:12px;text-decoration:underline;}
|
||||||
|
/*联想下拉区域*/
|
||||||
|
.inputArea .dataList{display:none;position:absolute;left:0;top:42px;*top:43px;width:550px;padding:5px 0;background:#fff;border:1px solid #bfbfbf;border-top:none;}
|
||||||
|
.inputArea .dataList li{padding:2px 15px;font-size:14px;}
|
||||||
|
.inputArea .dataList li:hover{background:#f0f0f0;color:#0080cc;font-weight:bold;}
|
||||||
|
|
||||||
|
/*搜索历史区域*/
|
||||||
|
.historyArea{margin:0 auto;width:485px;}
|
||||||
|
.historyArea .history {margin-bottom:5px;}
|
||||||
|
.historyArea .history label{font-weight:bold;}
|
||||||
|
.historyArea .history a{margin-right:12px;}
|
||||||
|
|
||||||
|
/*版权信息*/
|
||||||
|
.foot{position:absolute;bottom:0px;width:100%;}
|
||||||
|
.foot .wrap{margin:0 auto;}
|
||||||
|
.foot .copyright{position:relative;top:-35px;color:#ababab;text-align:center;}
|
@ -0,0 +1,104 @@
|
|||||||
|
@charset "utf-8";
|
||||||
|
html{*overflow:auto;}
|
||||||
|
#hd{padding:20px 10px;}
|
||||||
|
#bd{margin-bottom:40px;}
|
||||||
|
.logo{float:left;margin-right:30px; height:33px;}
|
||||||
|
/*input搜索区域*/
|
||||||
|
.inputArea{float:left;position:relative;}
|
||||||
|
.inputArea .searchInput{border:1px solid #bfbfbf;padding:0 15px;outline:none;height:35px;*line-height:35px;width:350px; background:url(../img/inputbg.png);font-size:14px;}
|
||||||
|
.inputArea .searchButton{position:absolute;left:382px;top:0;*top:1px;*left:381px;width:106px;height:38px;background:url(../img/btn_min.png) no-repeat;border:none;cursor:pointer;}
|
||||||
|
|
||||||
|
/*返回高级搜索*/
|
||||||
|
.inputArea .advanced{position:absolute;font-size:14px;left:500px;top:12px;width:60px;text-decoration:underline;}
|
||||||
|
|
||||||
|
/*分界区域,导航*/
|
||||||
|
.nav{margin-bottom:24px;height:31px;background:#f9f9f9;border-bottom:1px solid #e0e0e0;padding:5px 0 0 210px;}
|
||||||
|
.searchList{float:left;padding-left:5px;}
|
||||||
|
.searchList .searchItem{float:left;margin-right:15px;font-size:14px;padding:0 3px 2px 3px;cursor:pointer;height:26px; line-height:26px;}
|
||||||
|
.searchList .searchItem.current{color:#0080cc;border-bottom:3px solid #9cc813;font-weight:bold;}
|
||||||
|
.nav .tips{color:#969696;font-size:12px;line-height:24px;*line-height:26px;}
|
||||||
|
#container.sideBarHide .nav{padding-left:35px;}
|
||||||
|
|
||||||
|
/*#main区域样式*/
|
||||||
|
#main{padding:0 215px 0 182px;}
|
||||||
|
#main.sideBarHide{padding-left:10px;}
|
||||||
|
/*侧边栏搜索条件*/
|
||||||
|
.sideBar{position:relative;float:left;margin-left:-182px;width:182px;}
|
||||||
|
.sideBar .subfieldContext{margin-bottom:20px;padding-left:25px;}
|
||||||
|
.sideBar .subfieldContext li{margin-bottom:5px;cursor:pointer;}
|
||||||
|
.sideBar .subfieldContext input[type=text]{width:75px;}
|
||||||
|
.sideBar .unit{color:#787878;}
|
||||||
|
|
||||||
|
/*更多按钮*/
|
||||||
|
.sideBar .more a:hover{text-decoration:none;}
|
||||||
|
.sideBar .more .moreIcon{display:inline-block;position:relative;top:-1px;*top:-3px;left:2px;*left:-1px;width:9px;height:5px;background:url(../img/more.png);}
|
||||||
|
.sideBar .more.show .moreIcon{background:url(../img/down.png);top:-2px;}
|
||||||
|
|
||||||
|
.sideBar .reset{padding-left:25px;}
|
||||||
|
/*siderBar区域显隐控制*/
|
||||||
|
.sideBar .sideBarShowHide{position:absolute;right:0px;top:20px;height:177px;width:1px; background:url(../img/line.png) right;}
|
||||||
|
.sideBar .sideBarShowHide a{position:absolute;top:70px;left:-11px;display:inline-block;width:12px;height:31px;background:url(../img/lr.png);}
|
||||||
|
|
||||||
|
.sideBar .sideBarShowHide a:hover{background-position:0 -31px;}
|
||||||
|
|
||||||
|
/*左侧收起样式*/
|
||||||
|
#main.sideBarHide .sideBar{margin-left:-191px;*margin-left:-182px;}
|
||||||
|
#main.sideBarHide .sideBar .sideBarShowHide{-moz-transform:rotate(180deg); -o-transform:rotate(180deg); -webkit-transform:rotate(180deg); transform:rotate(180deg);}
|
||||||
|
#main.sideBarHide .sideBar .sideBarShowHide a{*background:url(../img/ll.png);}
|
||||||
|
#main.sideBarHide .sideBar .sideBarShowHide a:hover{*background-position:0 -31px;}
|
||||||
|
#main.sideBarHide .sideBar .sideBarShowHide{background:none;}
|
||||||
|
|
||||||
|
.resultArea{float:left;width:100%;}
|
||||||
|
.resultArea .resultTotal{position:relative;padding-left:30px;margin-bottom:20px;}
|
||||||
|
.resultArea .resultTotal .info{color:#9a9a9a;}
|
||||||
|
.resultArea .resultTotal .orderOpt{position:absolute;right:50px;}
|
||||||
|
.resultArea .resultTotal .orderOpt a{margin-right:10px;color:#0080cc;}
|
||||||
|
|
||||||
|
/*搜索结果列表区域*/
|
||||||
|
.resultArea .resultList{padding-left:30px;}
|
||||||
|
.resultArea .resultList .resultItem{margin-bottom:20px;}
|
||||||
|
.resultArea .resultList .resultItem{margin-bottom:30px;}
|
||||||
|
.resultArea .resultList .itemHead{margin-bottom:5px;color:#767676;}
|
||||||
|
.resultArea .resultList .itemHead .keyWord{color:#d90909;}
|
||||||
|
.resultArea .resultList .itemBody .keyWord{color:#d90909;}
|
||||||
|
.resultArea .resultList .itemHead a.title{font-size:16px;color:#0080cc;text-decoration:underline;}
|
||||||
|
.resultArea .resultList .itemHead .value{color:#008000;}
|
||||||
|
.resultArea .resultList .itemHead .divsion{margin:0 5px;}
|
||||||
|
.resultArea .resultList .itemHead .fileType{margin-right:10px;}
|
||||||
|
|
||||||
|
/*搜索内容主体*/
|
||||||
|
.resultArea .resultList .itemBody{margin-bottom:5px;line-height:18px;width:90%;}
|
||||||
|
.resultArea .resultList .itemFoot{color:#008000;}
|
||||||
|
.resultArea .resultList .itemFoot .info{margin-right:10px;}
|
||||||
|
|
||||||
|
.resultArea .pagination{margin-bottom:25px;padding-left:32px;}
|
||||||
|
/*相关搜索*/
|
||||||
|
.resultArea .dependSearch{margin-bottom:30px;padding-left:32px;font-size:14px;}
|
||||||
|
.resultArea .dependSearch h6{float:left;margin-right:15px;font-weight:bold;}
|
||||||
|
.resultArea .dependSearch p{margin-bottom:5px;}
|
||||||
|
.resultArea .dependSearch a{display:inline-block;margin-right:15px;text-decoration:underline;width:90px; white-space:nowrap; overflow:hidden;text-overflow:ellipsis;}
|
||||||
|
.resultArea .searchInResult{padding-left:35px;}
|
||||||
|
.resultArea .searchInResult .inResult{position:absolute;right:-190px;top:8px;font-size:14px;text-decoration:underline;}
|
||||||
|
.resultArea .searchInResult .searchButton{left:417px;}
|
||||||
|
/*历史搜索区域*/
|
||||||
|
.historyArea{float:right;margin-right:-212px;width:212px;}
|
||||||
|
.historyArea h6{margin-bottom:10px;font-weight:bold;}
|
||||||
|
.historyArea .historyList{margin-bottom:20px;}
|
||||||
|
.historyArea .historyList li{margin-bottom:5px;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*左侧分栏区域*/
|
||||||
|
.subfield{margin-bottom:5px;font-size:14px;font-weight:bold;padding:2px 0 2px 24px;}
|
||||||
|
.subfield:first-child{border-left:4px solid #9cc813;padding-left:20px;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*立即搜索样式*/
|
||||||
|
.subfieldContent .search{margin:45px 0 0 135px;width:130px;height:36px;background:url(../img/btnbg.png); font-weight:bold;border:none;border:1px solid #bfbfbf;line-height:36px;}
|
||||||
|
/*联想下拉区域*/
|
||||||
|
.inputArea .dataList{display:none;position:absolute;left:0;top:42px;*top:43px;width:550px;padding:5px 0;background:#fff;border:1px solid #bfbfbf;border-top:none;}
|
||||||
|
.inputArea .dataList li{padding:2px 15px;font-size:14px;}
|
||||||
|
.inputArea .dataList li:hover{background:#f0f0f0;color:#0080cc;font-weight:bold;}
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 5.0 KiB |
@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
// 去除虚线框(会影响效率)
|
||||||
|
$("a,input:checkbox,input:radio,button,input:button").live('focus',function(){$(this).blur();});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function hideElement(currentElement, targetElement) {
|
||||||
|
if (!$.isArray(targetElement)) {
|
||||||
|
targetElement = [ targetElement ];
|
||||||
|
}
|
||||||
|
$(document).on("click.hideElement", function(e) {
|
||||||
|
var len = 0, $target = $(e.target);
|
||||||
|
for (var i = 0, length = targetElement.length; i < length; i++) {
|
||||||
|
$.each(targetElement[i], function(j, n) {
|
||||||
|
if ($target.is($(n)) || $.contains($(n)[0], $target[0])) {
|
||||||
|
len++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ($.contains(currentElement[0], $target[0])) {
|
||||||
|
len = 1;
|
||||||
|
}
|
||||||
|
if (len == 0) {
|
||||||
|
currentElement.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
@ -0,0 +1,193 @@
|
|||||||
|
jQuery.fn.pagination = function(maxentries, opts) {
|
||||||
|
opts = jQuery.extend({
|
||||||
|
items_per_page : 10, // 每页显示多少条记录
|
||||||
|
current_page : 0, //当前页码
|
||||||
|
num_display_entries : 4, // 中间显示页码的个数
|
||||||
|
num_edge_entries : 2, // 末尾显示页码的个数
|
||||||
|
link_to : "javascript:;", //页码点击后的链接
|
||||||
|
prev_text : "上一页", //上一页的文字
|
||||||
|
next_text : "下一页", //下一页的文字
|
||||||
|
ellipse_text : "...", //页码之间的省略号
|
||||||
|
display_msg : true, // 是否显示记录信息
|
||||||
|
prev_show_always : true, //是否总是显示最前页
|
||||||
|
next_show_always : true,//是否总是显示最后页
|
||||||
|
setPageNo:false,//是否显示跳转第几页
|
||||||
|
callback : function() {
|
||||||
|
return false;
|
||||||
|
} // 回调函数
|
||||||
|
}, opts || {});
|
||||||
|
|
||||||
|
return this.each(function() {
|
||||||
|
// 总页数
|
||||||
|
function numPages() {
|
||||||
|
return Math.ceil(maxentries / opts.items_per_page);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 计算页码
|
||||||
|
*/
|
||||||
|
function getInterval() {
|
||||||
|
var ne_half = Math.ceil(opts.num_display_entries / 2);
|
||||||
|
var np = numPages();
|
||||||
|
var upper_limit = np - opts.num_display_entries;
|
||||||
|
var start = current_page > ne_half ? Math.max(Math.min(current_page
|
||||||
|
- ne_half, upper_limit), 0) : 0;
|
||||||
|
var end = current_page > ne_half ? Math.min(current_page + ne_half,
|
||||||
|
np) : Math.min(opts.num_display_entries, np);
|
||||||
|
return [start, end];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击事件
|
||||||
|
*/
|
||||||
|
function pageSelected(page_id, evt) {
|
||||||
|
var page_id = parseInt(page_id);
|
||||||
|
current_page = page_id;
|
||||||
|
drawLinks();
|
||||||
|
var continuePropagation = opts.callback(page_id, panel);
|
||||||
|
if (!continuePropagation) {
|
||||||
|
if (evt.stopPropagation) {
|
||||||
|
evt.stopPropagation();
|
||||||
|
} else {
|
||||||
|
evt.cancelBubble = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return continuePropagation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 链接
|
||||||
|
*/
|
||||||
|
function drawLinks() {
|
||||||
|
panel.empty();
|
||||||
|
var interval = getInterval();
|
||||||
|
var np = numPages();
|
||||||
|
var getClickHandler = function(page_id) {
|
||||||
|
return function(evt) {
|
||||||
|
return pageSelected(page_id, evt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var appendItem = function(page_id, appendopts) {
|
||||||
|
page_id = page_id < 0 ? 0 : (page_id < np ? page_id : np-1);
|
||||||
|
appendopts = jQuery.extend({
|
||||||
|
text : page_id+1,
|
||||||
|
classes : ""
|
||||||
|
}, appendopts || {});
|
||||||
|
if (page_id == current_page) {
|
||||||
|
var lnk = $("<span class='current'>" + (appendopts.text)
|
||||||
|
+ "</span>");
|
||||||
|
} else {
|
||||||
|
var lnk = $("<a>" + (appendopts.text) + "</a>").bind(
|
||||||
|
"click", getClickHandler(page_id)).attr('href',
|
||||||
|
opts.link_to.replace(/__id__/, page_id));
|
||||||
|
|
||||||
|
}
|
||||||
|
if (appendopts.classes) {
|
||||||
|
lnk.addClass(appendopts.classes);
|
||||||
|
}
|
||||||
|
panel.append(lnk);
|
||||||
|
}
|
||||||
|
// 上一页
|
||||||
|
if (opts.prev_text && (current_page > 0 || opts.prev_show_always)) {
|
||||||
|
appendItem(current_page - 1, {
|
||||||
|
text : opts.prev_text,
|
||||||
|
classes : "prev"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 点点点
|
||||||
|
if (interval[0] > 0 && opts.num_edge_entries > 0) {
|
||||||
|
var end = Math.min(opts.num_edge_entries, interval[0]);
|
||||||
|
for (var i = 0; i < end; i++) {
|
||||||
|
appendItem(i);
|
||||||
|
}
|
||||||
|
if (opts.num_edge_entries < interval[0] && opts.ellipse_text) {
|
||||||
|
jQuery("<span>" + opts.ellipse_text + "</span>")
|
||||||
|
.appendTo(panel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 中间的页码
|
||||||
|
for (var i = interval[0]; i < interval[1]; i++) {
|
||||||
|
appendItem(i);
|
||||||
|
}
|
||||||
|
// 最后的页码
|
||||||
|
if (interval[1] < np && opts.num_edge_entries > 0) {
|
||||||
|
if (np - opts.num_edge_entries > interval[1]
|
||||||
|
&& opts.ellipse_text) {
|
||||||
|
jQuery("<span>" + opts.ellipse_text + "</span>")
|
||||||
|
.appendTo(panel);
|
||||||
|
}
|
||||||
|
var begin = Math.max(np - opts.num_edge_entries, interval[1]);
|
||||||
|
for (var i = begin; i < np; i++) {
|
||||||
|
appendItem(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// 下一页
|
||||||
|
if (opts.next_text
|
||||||
|
&& (current_page < np - 1 || opts.next_show_always)) {
|
||||||
|
appendItem(current_page + 1, {
|
||||||
|
text : opts.next_text,
|
||||||
|
classes : "next"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 记录显示
|
||||||
|
if (opts.display_msg) {
|
||||||
|
if(!maxentries){
|
||||||
|
panel
|
||||||
|
.append('<div class="pxofy">暂时无数据可以显示</div>');
|
||||||
|
}else{
|
||||||
|
panel
|
||||||
|
.append('<div class="pxofy">显示第 '
|
||||||
|
+ ((current_page * opts.items_per_page) + 1)
|
||||||
|
+ ' 条到 '
|
||||||
|
+ (((current_page + 1) * opts.items_per_page) > maxentries
|
||||||
|
? maxentries
|
||||||
|
: ((current_page + 1) * opts.items_per_page))
|
||||||
|
+ ' 条记录,总共 ' + maxentries + ' 条</div>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//设置跳到第几页
|
||||||
|
if(opts.setPageNo){
|
||||||
|
panel.append("<div class='goto'><span class='text'>跳转到</span><input type='text'/><span class='page'>页</span><button type='button' class='ue-button long2'>确定</button></div>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 当前页
|
||||||
|
var current_page = opts.current_page;
|
||||||
|
maxentries = ( maxentries < 0) ? 0 : maxentries;
|
||||||
|
opts.items_per_page = (!opts.items_per_page || opts.items_per_page < 0)
|
||||||
|
? 1
|
||||||
|
: opts.items_per_page;
|
||||||
|
var panel = jQuery(this);
|
||||||
|
this.selectPage = function(page_id) {
|
||||||
|
pageSelected(page_id);
|
||||||
|
}
|
||||||
|
this.prevPage = function() {
|
||||||
|
if (current_page > 0) {
|
||||||
|
pageSelected(current_page - 1);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.nextPage = function() {
|
||||||
|
if (current_page < numPages() - 1) {
|
||||||
|
pageSelected(current_page + 1);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(maxentries==0){
|
||||||
|
panel.append('<span class="current prev">'+opts.prev_text+'</span><span class="current next">'+opts.next_text+'</span><div class="pxofy">暂时无数据可以显示</div>');
|
||||||
|
}else{
|
||||||
|
drawLinks();
|
||||||
|
}
|
||||||
|
$(this).find(".goto button").live("click",function(evt){
|
||||||
|
var setPageNo = $(this).parent().find("input").val();
|
||||||
|
if(setPageNo!=null && setPageNo!=""&&setPageNo>0&&setPageNo<=numPages()){
|
||||||
|
pageSelected(setPageNo-1, evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|