├── HPAdmin
├── __init__.py
├── admin.py
├── apps.py
├── ccode.py
├── models.py
├── plugins.py
├── redis_data.py
├── templates
│ ├── ADbanner.html
│ ├── ADbullhorn.html
│ ├── ADcase.html
│ ├── ADchartdata.html
│ ├── ADchartdatas.html
│ ├── ADdomanage.html
│ ├── ADindex.html
│ ├── ADlogin.html
│ ├── ADmenumanage.html
│ ├── ADmessage.html
│ ├── ADmovie.html
│ ├── ADnews.html
│ ├── ADoperationlog.html
│ └── ADusermanage.html
├── tests.py
└── views.py
├── HomePage
├── __init__.py
├── admin.py
├── apps.py
├── models.py
├── templates
│ ├── about.html
│ ├── case.html
│ ├── index.html
│ ├── information.html
│ └── news.html
├── tests.py
└── views.py
├── README.md
├── delpyc.bat
├── homepage.sql
├── kindeditor
├── __init__.py
├── admin.py
├── apps.py
├── models.py
├── templates
│ ├── jedate.html
│ ├── kindeditor.html
│ └── testviews.html
├── tests.py
└── views.py
├── manage.py
├── myapp
├── __init__.py
├── settings.py
├── urls.py
└── wsgi.py
├── static
├── css
│ ├── bootstrap-theme.css
│ ├── bootstrap-theme.css.map
│ ├── bootstrap-theme.min.css
│ ├── bootstrap-theme.min.css.map
│ ├── bootstrap.css
│ ├── bootstrap.css.map
│ ├── bootstrap.min.css
│ ├── bootstrap.min.css.map
│ ├── jedate.css
│ └── style.css
├── fonts
│ ├── glyphicons-halflings-regular.eot
│ ├── glyphicons-halflings-regular.svg
│ ├── glyphicons-halflings-regular.ttf
│ ├── glyphicons-halflings-regular.woff
│ └── glyphicons-halflings-regular.woff2
├── img
│ ├── 1.jpg
│ ├── 2.jpg
│ ├── 3.jpg
│ ├── 4.jpg
│ ├── Thumbs.db
│ ├── bg.jpg
│ ├── case1.jpg
│ ├── case2.jpg
│ ├── case3.jpg
│ ├── case4.jpg
│ ├── info1.jpg
│ ├── info2.jpg
│ ├── info3.jpg
│ ├── loding.gif
│ ├── movie1.jpg
│ ├── tab1-1.png
│ ├── tab1-2.png
│ ├── tab1-3.png
│ ├── tab1-4.png
│ ├── tab2.png
│ ├── tab3.png
│ └── welcome.gif
├── js
│ ├── Chart.js
│ ├── bootstrap-collapse.js
│ ├── bootstrap-treeview.js
│ ├── bootstrap.js
│ ├── bootstrap.min.js
│ ├── jquery-1.7.2.js
│ ├── jquery-3.1.1.min.js
│ ├── jquery.jedate.js
│ ├── jquery.min.js
│ ├── main.js
│ ├── map.js
│ └── npm.js
└── kindeditor
│ ├── kindeditor-all-min.js
│ ├── kindeditor-all.js
│ ├── lang
│ ├── ar.js
│ ├── en.js
│ ├── ko.js
│ ├── ru.js
│ ├── zh-CN.js
│ └── zh-TW.js
│ ├── license.txt
│ ├── plugins
│ ├── anchor
│ │ └── anchor.js
│ ├── autoheight
│ │ └── autoheight.js
│ ├── baidumap
│ │ ├── baidumap.js
│ │ ├── index.html
│ │ └── map.html
│ ├── clearhtml
│ │ └── clearhtml.js
│ ├── code
│ │ ├── code.js
│ │ ├── prettify.css
│ │ └── prettify.js
│ ├── emoticons
│ │ ├── emoticons.js
│ │ └── images
│ │ │ ├── 0.gif
│ │ │ ├── 1.gif
│ │ │ ├── 10.gif
│ │ │ ├── 100.gif
│ │ │ ├── 101.gif
│ │ │ ├── 102.gif
│ │ │ ├── 103.gif
│ │ │ ├── 104.gif
│ │ │ ├── 105.gif
│ │ │ ├── 106.gif
│ │ │ ├── 107.gif
│ │ │ ├── 108.gif
│ │ │ ├── 109.gif
│ │ │ ├── 11.gif
│ │ │ ├── 110.gif
│ │ │ ├── 111.gif
│ │ │ ├── 112.gif
│ │ │ ├── 113.gif
│ │ │ ├── 114.gif
│ │ │ ├── 115.gif
│ │ │ ├── 116.gif
│ │ │ ├── 117.gif
│ │ │ ├── 118.gif
│ │ │ ├── 119.gif
│ │ │ ├── 12.gif
│ │ │ ├── 120.gif
│ │ │ ├── 121.gif
│ │ │ ├── 122.gif
│ │ │ ├── 123.gif
│ │ │ ├── 124.gif
│ │ │ ├── 125.gif
│ │ │ ├── 126.gif
│ │ │ ├── 127.gif
│ │ │ ├── 128.gif
│ │ │ ├── 129.gif
│ │ │ ├── 13.gif
│ │ │ ├── 130.gif
│ │ │ ├── 131.gif
│ │ │ ├── 132.gif
│ │ │ ├── 133.gif
│ │ │ ├── 134.gif
│ │ │ ├── 14.gif
│ │ │ ├── 15.gif
│ │ │ ├── 16.gif
│ │ │ ├── 17.gif
│ │ │ ├── 18.gif
│ │ │ ├── 19.gif
│ │ │ ├── 2.gif
│ │ │ ├── 20.gif
│ │ │ ├── 21.gif
│ │ │ ├── 22.gif
│ │ │ ├── 23.gif
│ │ │ ├── 24.gif
│ │ │ ├── 25.gif
│ │ │ ├── 26.gif
│ │ │ ├── 27.gif
│ │ │ ├── 28.gif
│ │ │ ├── 29.gif
│ │ │ ├── 3.gif
│ │ │ ├── 30.gif
│ │ │ ├── 31.gif
│ │ │ ├── 32.gif
│ │ │ ├── 33.gif
│ │ │ ├── 34.gif
│ │ │ ├── 35.gif
│ │ │ ├── 36.gif
│ │ │ ├── 37.gif
│ │ │ ├── 38.gif
│ │ │ ├── 39.gif
│ │ │ ├── 4.gif
│ │ │ ├── 40.gif
│ │ │ ├── 41.gif
│ │ │ ├── 42.gif
│ │ │ ├── 43.gif
│ │ │ ├── 44.gif
│ │ │ ├── 45.gif
│ │ │ ├── 46.gif
│ │ │ ├── 47.gif
│ │ │ ├── 48.gif
│ │ │ ├── 49.gif
│ │ │ ├── 5.gif
│ │ │ ├── 50.gif
│ │ │ ├── 51.gif
│ │ │ ├── 52.gif
│ │ │ ├── 53.gif
│ │ │ ├── 54.gif
│ │ │ ├── 55.gif
│ │ │ ├── 56.gif
│ │ │ ├── 57.gif
│ │ │ ├── 58.gif
│ │ │ ├── 59.gif
│ │ │ ├── 6.gif
│ │ │ ├── 60.gif
│ │ │ ├── 61.gif
│ │ │ ├── 62.gif
│ │ │ ├── 63.gif
│ │ │ ├── 64.gif
│ │ │ ├── 65.gif
│ │ │ ├── 66.gif
│ │ │ ├── 67.gif
│ │ │ ├── 68.gif
│ │ │ ├── 69.gif
│ │ │ ├── 7.gif
│ │ │ ├── 70.gif
│ │ │ ├── 71.gif
│ │ │ ├── 72.gif
│ │ │ ├── 73.gif
│ │ │ ├── 74.gif
│ │ │ ├── 75.gif
│ │ │ ├── 76.gif
│ │ │ ├── 77.gif
│ │ │ ├── 78.gif
│ │ │ ├── 79.gif
│ │ │ ├── 8.gif
│ │ │ ├── 80.gif
│ │ │ ├── 81.gif
│ │ │ ├── 82.gif
│ │ │ ├── 83.gif
│ │ │ ├── 84.gif
│ │ │ ├── 85.gif
│ │ │ ├── 86.gif
│ │ │ ├── 87.gif
│ │ │ ├── 88.gif
│ │ │ ├── 89.gif
│ │ │ ├── 9.gif
│ │ │ ├── 90.gif
│ │ │ ├── 91.gif
│ │ │ ├── 92.gif
│ │ │ ├── 93.gif
│ │ │ ├── 94.gif
│ │ │ ├── 95.gif
│ │ │ ├── 96.gif
│ │ │ ├── 97.gif
│ │ │ ├── 98.gif
│ │ │ ├── 99.gif
│ │ │ └── static.gif
│ ├── filemanager
│ │ ├── filemanager.js
│ │ └── images
│ │ │ ├── file-16.gif
│ │ │ ├── file-64.gif
│ │ │ ├── folder-16.gif
│ │ │ ├── folder-64.gif
│ │ │ └── go-up.gif
│ ├── fixtoolbar
│ │ └── fixtoolbar.js
│ ├── flash
│ │ └── flash.js
│ ├── image
│ │ ├── image.js
│ │ └── images
│ │ │ ├── align_left.gif
│ │ │ ├── align_right.gif
│ │ │ ├── align_top.gif
│ │ │ └── refresh.png
│ ├── insertfile
│ │ └── insertfile.js
│ ├── lineheight
│ │ └── lineheight.js
│ ├── link
│ │ └── link.js
│ ├── map
│ │ ├── map.html
│ │ └── map.js
│ ├── media
│ │ └── media.js
│ ├── multiimage
│ │ ├── images
│ │ │ ├── image.png
│ │ │ ├── select-files-en.png
│ │ │ ├── select-files-zh-CN.png
│ │ │ └── swfupload.swf
│ │ └── multiimage.js
│ ├── pagebreak
│ │ └── pagebreak.js
│ ├── plainpaste
│ │ └── plainpaste.js
│ ├── preview
│ │ └── preview.js
│ ├── quickformat
│ │ └── quickformat.js
│ ├── table
│ │ └── table.js
│ ├── template
│ │ ├── html
│ │ │ ├── 1.html
│ │ │ ├── 2.html
│ │ │ └── 3.html
│ │ └── template.js
│ └── wordpaste
│ │ └── wordpaste.js
│ └── themes
│ ├── common
│ ├── anchor.gif
│ ├── blank.gif
│ ├── flash.gif
│ ├── loading.gif
│ ├── media.gif
│ └── rm.gif
│ ├── default
│ ├── background.png
│ ├── default.css
│ └── default.png
│ ├── qq
│ ├── editor.gif
│ └── qq.css
│ └── simple
│ └── simple.css
├── 后台模块.png
├── 留言模块.png
└── 首页.png
/HPAdmin/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/HPAdmin/__init__.py
--------------------------------------------------------------------------------
/HPAdmin/admin.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 |
4 | from django.contrib import admin
5 |
6 | # Register your models here.
7 |
--------------------------------------------------------------------------------
/HPAdmin/apps.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 |
4 | from django.apps import AppConfig
5 |
6 |
7 | class HpadminConfig(AppConfig):
8 | name = 'HPAdmin'
9 |
--------------------------------------------------------------------------------
/HPAdmin/ccode.py:
--------------------------------------------------------------------------------
1 | # -*- coding:utf-8 -*-
2 | from PIL import Image, ImageDraw, ImageFont, ImageFilter
3 | import random,time
4 |
5 | # img 存储过程
6 | def SaveImg(upimg):
7 | photoname = 'static/upload/%s.%s' % (str(time.time()).split('.')[0], str(upimg).decode('utf-8').split('.')[-1])
8 | img = Image.open(upimg)
9 | img.save(photoname)
10 | img = '/' + photoname
11 | return img
12 |
13 | class Picture(object):
14 | def __init__(self, text_str, size, background):
15 | '''
16 | text_str: 验证码显示的字符组成的字符串
17 | size: 图片大小
18 | background: 背景颜色
19 | '''
20 | self.text_list = list(text_str)
21 | self.size = size
22 | self.background = background
23 |
24 | def create_pic(self):
25 | '''
26 | 创建一张图片
27 | '''
28 | self.width, self.height = self.size
29 | self.img = Image.new("RGB", self.size, self.background)
30 | # 实例化画笔
31 | self.draw = ImageDraw.Draw(self.img)
32 |
33 | def create_point(self, num, color):
34 | '''
35 | num: 画点的数量
36 | color: 点的颜色
37 | 功能:画点
38 | '''
39 | for i in range(num):
40 | self.draw.point(
41 | (random.randint(0, self.width), random.randint(0, self.height)),
42 | fill=color
43 | )
44 |
45 | def create_line(self, num, color):
46 | '''
47 | num: 线条的数量
48 | color: 线条的颜色
49 | 功能:画线条
50 | '''
51 | for i in range(num):
52 | self.draw.line(
53 | [
54 | (random.randint(0, self.width), random.randint(0, self.height)),
55 | (random.randint(0, self.width), random.randint(0, self.height))
56 | ],
57 | fill=color
58 | )
59 |
60 | def create_text(self, font_type, font_size, font_color, font_num, start_xy):
61 | '''
62 | font_type: 字体
63 | font_size: 文字大小
64 | font_color: 文字颜色
65 | font_num: 文字数量
66 | start_xy: 第一个字左上角坐标,元组类型,如 (5,5)
67 | 功能: 画文字
68 | '''
69 | font = ImageFont.truetype(font_type, font_size)
70 | self.strs = random.sample(self.text_list, font_num)
71 | self.draw.text(start_xy, " ".join(self.strs), font=font, fill=font_color)
72 |
73 | def opera(self):
74 | '''
75 | 功能:给画出来的线条,文字,扭曲一下,缩放一下,位移一下,滤镜一下。
76 | 就是让它看起来有点歪,有点扭。
77 | '''
78 | params = [
79 | 1 - float(random.randint(1, 2)) / 100,
80 | 0,
81 | 0,
82 | 0,
83 | 1 - float(random.randint(1, 10)) / 100,
84 | float(random.randint(1, 2)) / 500,
85 | 0.001,
86 | float(random.randint(1, 2)) / 500
87 | ]
88 | self.img = self.img.transform(self.size, Image.PERSPECTIVE, params)
89 | self.img = self.img.filter(ImageFilter.EDGE_ENHANCE_MORE)
90 |
91 |
92 | # if __name__ == "__main__":
93 | def ccode():
94 | strings = "abcdefghjkmnpqrstwxyz23456789ABCDEFGHJKLMNPQRSTWXYZ"
95 | size = (150, 50)
96 | background = 'white'
97 | pic = Picture(strings, size, background)
98 | pic.create_pic()
99 | pic.create_point(500, (220, 220, 220))
100 | pic.create_line(30, (220, 220, 220))
101 | pic.create_text("simsun.ttc", 24, (0, 0, 205), 5, (7, 7))
102 | pic.opera()
103 | # pic.img.show()
104 | img,strs=pic.img,''.join(pic.strs)
105 | return img,strs
106 |
--------------------------------------------------------------------------------
/HPAdmin/models.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 | from django.db import models
4 |
5 |
6 | class IndexBanerInfo(models.Model):
7 | img = models.ImageField()
8 | a = models.CharField(max_length=100)
9 | title = models.CharField(max_length=100)
10 | p = models.CharField(max_length=100)
11 | status = models.SmallIntegerField(null=True)
12 |
13 | class IndexMovieInfo(models.Model):
14 | img = models.ImageField()
15 | a = models.CharField(max_length=100)
16 | title = models.CharField(max_length=100)
17 |
18 | class IndexBullhornInfo(models.Model):
19 | img = models.ImageField()
20 | title = models.CharField(max_length=100)
21 | content = models.CharField(max_length=5000)
22 | publisher = models.CharField(max_length=30)
23 | times = models.CharField(max_length=20)
24 | a_link = models.CharField(max_length=100)
25 | sort_id = models.SmallIntegerField(null=True)
26 | hot_id = models.SmallIntegerField(null=True)
27 |
28 | class IndexCaseInfo(models.Model):
29 | img = models.ImageField()
30 | title = models.CharField(max_length=100)
31 | content = models.CharField(max_length=5000)
32 | a_link = models.CharField(max_length=100)
33 |
34 |
35 | class UserManage(models.Model):
36 | username = models.CharField(max_length=30)
37 | password = models.CharField(max_length=30,default="123456")
38 | email = models.CharField(max_length=50)
39 | phone = models.CharField(max_length=20)
40 | status = models.SmallIntegerField(null=True)
41 | DoManage = models.ForeignKey('DoManage', null=True)
42 |
43 | class DoManage(models.Model):
44 | username = models.CharField(max_length=30)
45 | createtime = models.DateTimeField(auto_now_add=True)
46 | uptime = models.DateTimeField(auto_now=True)
47 | Permissions = models.CharField(max_length=50, null=True)
48 |
49 | class MenuTree(models.Model):
50 | title = models.CharField(max_length=30)
51 | url = models.CharField(max_length=50)
52 |
53 | class Permissions(models.Model):
54 | title = models.CharField(max_length=30)
55 | url = models.CharField(max_length=50)
56 | MenuTree = models.ForeignKey('MenuTree', null=True)
57 |
58 | class UserRole(models.Model):
59 | UserManage = models.ForeignKey("UserManage", null=True)
60 | DoManage = models.ForeignKey("DoManage", null=True)
61 |
62 | class MessageNum(models.Model):
63 | MessageNum = models.IntegerField()
64 | createtime = models.DateTimeField(auto_now_add=True)
65 |
66 | class News(models.Model):
67 | title = models.CharField(max_length=30)
68 | content = models.TextField(blank = True, null = True)
69 | author = models.CharField(max_length=30)
70 | uptime = models.CharField(max_length=30)
71 | createtime = models.DateTimeField(auto_now_add=True)
--------------------------------------------------------------------------------
/HPAdmin/plugins.py:
--------------------------------------------------------------------------------
1 | # -*- coding: UTF-8 -*-
2 |
3 | # 页码数据计算,start,end,page
4 | def PageSEP(page):
5 | if not page:
6 | page = 1
7 | else:
8 | page = int(page)
9 | start = (page - 1) * 5
10 | end = start + 5
11 | return start,end,page
12 |
13 |
14 | # 页码显示规则
15 | def PageNum(page,pagecount,apiname):
16 | page = int(page)
17 | # 计算数据总页数
18 | pagenum = 0
19 | if pagecount:
20 | pagenum=pagecount
21 | else:
22 | pagenum=1
23 | temp = divmod(pagenum,5)
24 | if temp[1]==0:
25 | all_pagenum = temp[0]
26 | else:
27 | all_pagenum = temp[0]+1
28 | all_pagenum = int(all_pagenum)
29 | # 计算页码,选中页面标记且居中处理
30 | if all_pagenum<7:
31 | startpg = 1
32 | endpg = all_pagenum
33 | if all_pagenum>=7:
34 | if page<4:
35 | startpg = 1
36 | endpg = 7
37 | if page>=4:
38 | if (page+3)>all_pagenum:
39 | startpg = all_pagenum-6
40 | endpg = all_pagenum
41 | else:
42 | startpg = page-3
43 | endpg = page+3
44 | pgup = int(page - 1)
45 | pgdn = int(page + 1)
46 | if pgup<=0:
47 | pgup = 1
48 | if pgdn>=all_pagenum:
49 | pgdn = all_pagenum
50 | # 增加页面标签
51 | pagedata = ''
52 | for i in range(startpg,endpg+1):
53 | if page == i:
54 | pagedata += ('
%s' % (i, i))
55 | else:
56 | pagedata += ('%s' % (i, i))
57 | data = '«%s»'%(pgdn)
58 | return data
59 |
60 |
61 | # csv 操作
62 | import csv
63 | from django.http import HttpResponse
64 |
65 | def copycsv(data):
66 |
67 | response = HttpResponse(content_type='text/csv')
68 | response['Content-Disposition'] = 'attachment; filename="order-export.csv"'
69 |
70 | # csvfile = open('order-export.csv', 'wb')
71 | # writer = csv.writer(csvfile)
72 | writer = csv.writer(response)
73 | writer.writerow(['ID'.decode('utf-8').encode('GB2312'), '用户名'.decode('utf-8').encode('GB2312'), '电话'.decode('utf-8').encode('GB2312'), '邮箱'.decode('utf-8').encode('GB2312'), '留言内容'.decode('utf-8').encode('GB2312'), '时间'.decode('utf-8').encode('GB2312')])
74 |
75 | # data = [ (),()]
76 | writer.writerows(data)
77 | # csvfile.close()
78 |
79 | return response
80 |
81 |
--------------------------------------------------------------------------------
/HPAdmin/redis_data.py:
--------------------------------------------------------------------------------
1 | # -*- coding: UTF-8 -*-
2 | import time
3 | import threading
4 | import json
5 | import redis
6 | from HPAdmin import models
7 | r = redis.Redis(host='192.168.31.250', port=6379,db=0)
8 |
9 | def moviedata():
10 | data = models.IndexMovieInfo.objects.all()
11 | list = []
12 | for i in data:
13 | a = {str("id"): str(i.id), str("img"): str(i.img), str("a"): str(i.a),str("title"): str(i.title.encode("utf-8"))}
14 | list.append(a)
15 | r.set("movie", json.dumps(list, encoding="UTF-8", ensure_ascii=False))
16 |
17 | def bannerdata():
18 | data = models.IndexBanerInfo.objects.filter(status=1)
19 | list = []
20 | for i in data:
21 | a = {str("id"): str(i.id), str("img"): str(i.img), str("a"): str(i.a),str("title"): str(i.title.encode("utf-8"))}
22 | list.append(a)
23 | r.set("banner", json.dumps(list, encoding="UTF-8", ensure_ascii=False))
24 |
25 | def informationdata():
26 | data = models.IndexBullhornInfo.objects.all().order_by("-id")
27 | list = []
28 | for i in data:
29 | a = {str("id"): str(i.id), str("img"): str(i.img),str("title"): str(i.title.encode("utf-8")),str("content"): str(i.content.encode("utf-8")),str("publisher"): str(i.publisher),str("times"): str(i.times),str("a_link"): str(i.a_link)}
30 | list.append(a)
31 | r.set("information", json.dumps(list, encoding="UTF-8", ensure_ascii=False))
32 |
33 | def informationhotdata():
34 | data = models.IndexBullhornInfo.objects.filter(hot_id=1).order_by("-id")
35 | list = []
36 | for i in data:
37 | a = {str("id"): str(i.id), str("img"): str(i.img),str("title"): str(i.title.encode("utf-8")),str("content"): str(i.content.encode("utf-8")),str("publisher"): str(i.publisher),str("times"): str(i.times),str("a_link"): str(i.a_link)}
38 | list.append(a)
39 | r.set("informationhot", json.dumps(list, encoding="UTF-8", ensure_ascii=False))
40 |
41 | def caseinfo():
42 | data = models.IndexCaseInfo.objects.all()
43 | list = []
44 | for i in data:
45 | a = {str("id"): str(i.id), str("img"): str(i.img),str("title"): str(i.title.encode("utf-8")),str("content"): str(i.content.encode("utf-8")),str("a_link"): str(i.a_link)}
46 | list.append(a)
47 | r.set("case", json.dumps(list, encoding="UTF-8", ensure_ascii=False))
48 |
49 | def whiletask():
50 | while True:
51 | time.sleep(60)
52 | moviedata()
53 | bannerdata()
54 | informationdata()
55 | informationhotdata()
56 | caseinfo()
57 |
58 | def TimedTask():
59 | t = threading.Thread(target=whiletask, args=())
60 | t.setDaemon(True)
61 | t.start()
62 |
63 | # TimedTask()
--------------------------------------------------------------------------------
/HPAdmin/templates/ADchartdata.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 总览图表统计
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | 总览图表统计
14 |
15 |
16 |
17 |
18 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
柱状图统计图
43 |
44 |
45 |
46 |
47 |
48 |
饼图统计图
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
总览曲线统计图
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
109 |
110 |
129 |
130 |
154 | {% include 'jedate.html' %}
155 |
156 |
157 |
--------------------------------------------------------------------------------
/HPAdmin/templates/ADchartdatas.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 单日图表统计
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
单日图表统计
15 |
16 |
17 |
18 |
19 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
详细曲线图
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
105 |
106 |
107 | {% include 'jedate.html' %}
108 |
109 |
110 |
--------------------------------------------------------------------------------
/HPAdmin/templates/ADlogin.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
网站管理后台登陆
6 |
7 |
8 |
9 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
网站管理后台登陆
28 | {#
#}
52 |
53 |
54 |
128 |
129 |
130 |
131 |
--------------------------------------------------------------------------------
/HPAdmin/templates/ADmessage.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
留言管理
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
留言管理
16 | 导出数据
17 | 批量删除
18 |
19 |
20 |
21 |
22 |
23 |
58 |
59 |
60 |
63 |
64 |
65 |
66 |
67 |
68 |
91 |
92 |
93 |
94 |
167 |
168 |
169 |
170 |
171 |
--------------------------------------------------------------------------------
/HPAdmin/templates/ADoperationlog.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
操作日志
6 |
7 |
27 |
28 |
29 |
30 |
31 |
Loading pages...
32 |
33 |
--------------------------------------------------------------------------------
/HPAdmin/tests.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 |
4 | from django.test import TestCase
5 |
6 | # Create your tests here.
7 |
--------------------------------------------------------------------------------
/HomePage/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/HomePage/__init__.py
--------------------------------------------------------------------------------
/HomePage/admin.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 |
4 | from django.contrib import admin
5 |
6 | # Register your models here.
7 |
--------------------------------------------------------------------------------
/HomePage/apps.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 |
4 | from django.apps import AppConfig
5 |
6 |
7 | class HomepageConfig(AppConfig):
8 | name = 'HomePage'
9 |
--------------------------------------------------------------------------------
/HomePage/models.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 | from django.db import models
4 |
5 | # Create your models here.
6 |
7 | class MessageManage(models.Model):
8 | name = models.CharField(max_length=10)
9 | phone = models.CharField(max_length=20)
10 | email = models.CharField(max_length=30)
11 | content = models.CharField(max_length=300)
12 | createtime = models.DateTimeField(auto_now_add=True)
13 |
14 |
15 | class CollectInfo(models.Model):
16 | ip = models.CharField(max_length=20)
17 | path = models.CharField(max_length=30)
18 | createtime = models.DateTimeField(auto_now_add=True)
--------------------------------------------------------------------------------
/HomePage/templates/case.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
案例
7 |
8 |
9 |
10 |
11 |
12 |
32 |
33 |
34 |
35 |
36 |
37 | 案例
38 | 和各大明星企业有着紧密合作...
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | {#
#}
47 | {#
#}
48 | {#

#}
49 | {#
#}
50 | {#
中国移动通信
#}
51 | {#
参与了本机构的总裁管理培训课程,学员反馈意见良好。
#}
52 | {#
#}
53 | {#
#}
54 | {#
#}
55 | {% for info in data %}
56 |
67 | {% endfor %}
68 |
69 |
70 |
71 |
72 |
73 |
79 |
80 |
81 |
82 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/HomePage/templates/information.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
资讯
7 |
8 |
9 |
10 |
11 |
12 |
32 |
33 |
34 |
35 |
36 | 资讯
37 | 企业内训的最新动态、资源等...
38 |
39 |
40 |
41 |
42 |
106 |
107 |
108 |
114 |
115 |
116 |
117 |
121 |
122 |
123 |
--------------------------------------------------------------------------------
/HomePage/templates/news.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
新闻栏目
7 |
8 |
9 |
10 |
11 |
12 |
32 |
33 |
34 |
35 |
36 | 新闻资讯
37 | 企业内训的最新动态、资源等...
38 |
39 |
40 |
41 |
42 |
95 |
96 |
102 |
103 |
104 |
105 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/HomePage/tests.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 |
4 | from django.test import TestCase
5 |
6 | # Create your tests here.
7 |
--------------------------------------------------------------------------------
/HomePage/views.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 | from django.shortcuts import render
4 | from django.http import HttpResponse
5 | from HPAdmin.redis_data import *
6 | from HomePage.models import MessageManage,CollectInfo
7 | from django.http import HttpResponseRedirect
8 |
9 |
10 | def index(request):
11 | collectinfo(request)
12 | ret = {'movie':models.IndexMovieInfo.objects.all(),'banner':models.IndexBanerInfo.objects.filter(status=1)}
13 | # redis缓存
14 | # ret = {'movie':json.loads(str(r.get("movie"))),'banner':json.loads(str(r.get("banner")))}
15 | return render(request, 'index.html', ret)
16 |
17 | def information(request):
18 | collectinfo(request)
19 | ret = {'common': models.IndexBullhornInfo.objects.all().order_by("-id"), 'hot': models.IndexBullhornInfo.objects.filter(hot_id=1).order_by("-id")}
20 | # redis缓存
21 | # ret = {'common': json.loads(str(r.get("information"))), 'hot': json.loads(str(r.get("informationhot")))}
22 | return render(request, 'information.html', ret)
23 |
24 | def case(request):
25 | collectinfo(request)
26 | ret = {'data': models.IndexCaseInfo.objects.all()}
27 | # redis缓存
28 | # ret = {'data': json.loads(str(r.get("case")))}
29 | return render(request, 'case.html', ret)
30 |
31 | def about(request):
32 | collectinfo(request)
33 | if request.method == "GET":
34 | return render(request, 'about.html')
35 | if request.method == "POST":
36 | name = request.POST.get("name")
37 | phone = request.POST.get("phone")
38 | email = request.POST.get("email")
39 | code = request.POST.get("code")
40 | content = request.POST.get("content")
41 | try:
42 | if code.lower() != request.session.get('validate', 'error').lower():
43 | return HttpResponse(json.dumps({"error": '验证码错误,请重新输入!'}))
44 | if name and phone and email and content:
45 | MessageManage(name=name, phone=phone, email=email,content=content).save()
46 | request.session['validate'] = None
47 | return HttpResponse(json.dumps({"success": '提交成功!'}))
48 | else:
49 | return HttpResponse(json.dumps({"error": '缺少字段,请填写完整!'}))
50 | except:
51 | return HttpResponse(json.dumps({"error": '非法字符,系统错误!'}))
52 |
53 | def news(request,page):
54 | collectinfo(request)
55 | if page:
56 | page = int(page)
57 | try:
58 | ret = {'data': models.News.objects.filter(id=page)[0],'hot': models.IndexBullhornInfo.objects.filter(hot_id=1).order_by("-id")}
59 | return render(request, 'news.html', ret)
60 | # redis缓存
61 | # ret = {'data': json.loads(str(r.get("news")))}
62 | except:
63 | return HttpResponseRedirect('/')
64 | else:
65 | return HttpResponseRedirect('/')
66 |
67 | # 统计用户信息
68 | def collectinfo(request):
69 | if request.META.has_key('HTTP_X_FORWARDED_FOR'):
70 | ip = request.META['HTTP_X_FORWARDED_FOR']
71 | else:
72 | ip = request.META['REMOTE_ADDR']
73 | path = request.path
74 | if "news" in path:
75 | path = "/news"
76 | CollectInfo(ip=ip, path=path).save()
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # HomePage
2 |
3 |
4 | Python开发管理后台+Bootstrap响应式官网首页
5 |
6 | 后端:Python Django
7 |
8 | 前端:Bootstrap
9 |
10 | 数据库:MySQL、Redis
11 |
12 | 服务端:Centos、Nginx、uWSGI、Supervisord
13 |
14 |
15 | # 计划前端实现功能:
16 |
17 | 1.首页:响应式导航条、轮播图、基本内容、Footer区块
18 |
19 | 2.资讯内容:响应式资讯内容管理、热门资讯
20 |
21 | 3.新闻模块:标题、作者、内容、日期,热门资讯
22 |
23 | 4.案例:合作相关展示页面
24 |
25 | 5.关于:Ajax留言板块,百度地图API,常见板式
26 |
27 | 6.页面访问次数、IP统计数据收集统计分析
28 |
29 |
30 | # 计划后端实现功能:
31 |
32 | 1.首页内容管理:Banner轮播图管理,包括:图片管理、超链接配置、标题、内容、启用停用
33 |
34 | 2.首页资源、资讯、案例:资讯管理、热门资讯管理等
35 |
36 | 3.新闻:集成KindEditor富文本编辑插件,编辑、修改回调等
37 |
38 | 4.用户管理、角色权限管理、菜单管理:实现增删改查、菜单路径配置、修改回调、用户权限分配等功能
39 |
40 | 5.留言管理:基本管理查看功能,新增留言条数显示
41 |
42 | 6.图标统计模块:按时间段统计页面访问次数,独立IP访问页面数,单日数据分析,分别生成柱状图、饼图、曲线图
43 |
44 |
45 | # 项目部署调试篇
46 |
47 | 1.本地调试:根目录运行>python manage.py runserver 0.0.0.0:8080
48 |
49 | 2.服务器部署篇:
50 |
51 | ## 运行环境:Centos、Nginx、uWSGI、Supervisord、Redis、Mysql
52 |
53 | 备注:Linux环境下需要手动下载并配置字体库,绝对文件路径
54 |
55 |
56 | Nginx.conf:
57 |
58 |
59 | server {
60 | listen 88;
61 | server_name localhost;
62 | location / {
63 | include /usr/local/nginx/conf/uwsgi_params;
64 | uwsgi_pass 127.0.0.1:8000;
65 | }
66 | location /static {
67 | alias /var/www/HomePage/static;
68 | }
69 | }
70 |
71 |
72 |
73 | uWSGI.ini:
74 |
75 |
76 | [uwsgi]
77 | #http = 127.0.0.1:8000
78 | socket = 127.0.0.1:8000
79 | chdir = /var/www/HomePage
80 | module = myapp.wsgi
81 | master = true
82 | processes = 2
83 | threads = 2
84 | max-requests = 6000
85 | chmod-socket = 664
86 | vacuum = true
87 |
88 |
89 | supervisord.conf:
90 |
91 |
92 | [program:HomePage]
93 | directory = /var/www/HomePage
94 | command = uwsgi --ini uwsgi.ini
95 |
96 |
97 |
98 |
99 |
100 | ## 想做就做呗,╮(╯▽╰)╭ !!!
101 |
102 |
--------------------------------------------------------------------------------
/delpyc.bat:
--------------------------------------------------------------------------------
1 | del HomePage\*.pyc
2 | del HomePage\migrations\*.pyc
3 | del HPAdmin\*.pyc
4 | del HPAdmin\migrations\*.pyc
5 | del kindeditor\*.pyc
6 | del kindeditor\migrations\*.pyc
7 | del myapp\*.pyc
8 |
9 |
--------------------------------------------------------------------------------
/kindeditor/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/kindeditor/__init__.py
--------------------------------------------------------------------------------
/kindeditor/admin.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 |
4 | from django.contrib import admin
5 |
6 | # Register your models here.
7 |
--------------------------------------------------------------------------------
/kindeditor/apps.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 |
4 | from django.apps import AppConfig
5 |
6 |
7 | class KindeditorConfig(AppConfig):
8 | name = 'kindeditor'
9 |
--------------------------------------------------------------------------------
/kindeditor/models.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 | from django.db import models
4 |
5 | # Create your models here.
6 |
7 | class KindEditor(models.Model):
8 | title = models.CharField(max_length=50)
9 | content = models.CharField(max_length=5000)
--------------------------------------------------------------------------------
/kindeditor/templates/jedate.html:
--------------------------------------------------------------------------------
1 |
2 | {##}
3 |
4 |
--------------------------------------------------------------------------------
/kindeditor/templates/kindeditor.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
49 |
50 |
51 | {#
#}
52 | {#
#}
59 |
60 |
--------------------------------------------------------------------------------
/kindeditor/templates/testviews.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
Title
6 |
7 |
8 | {{ ret.data }}
9 |
文章标题{{ ret.data.title }}
10 |
11 | 文章内容:{{ ret.data.content|safe }}
12 |
13 |
14 |
--------------------------------------------------------------------------------
/kindeditor/tests.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 |
4 | from django.test import TestCase
5 |
6 | # Create your tests here.
7 |
--------------------------------------------------------------------------------
/kindeditor/views.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 | from django.shortcuts import render
4 | from django.http import HttpResponse
5 | from django.conf import settings
6 | from django.views.decorators.csrf import csrf_exempt
7 | import os
8 | import uuid
9 | import json
10 | import datetime as dt
11 | from kindeditor.models import KindEditor
12 |
13 |
14 | # Create your views here.
15 | def uptest(request):
16 | if request.method == "GET":
17 | return render(request, 'test.html')
18 | if request.method == "POST":
19 | title = request.POST.get('title', '')
20 | content = request.POST.get('content', '')
21 | KindEditor(title=title, content=content).save()
22 | return render(request, 'kindeditor.html')
23 |
24 | def testviews(request):
25 | if request.method == "GET":
26 | data = KindEditor.objects.all()[0]
27 | ret = {"data":data}
28 | return render(request, 'testviews.html',{"ret":ret})
29 |
30 |
31 | @csrf_exempt
32 | def upload_image(request, dir_name):
33 | ##################
34 | # kindeditor图片上传返回数据格式说明:
35 | # {"error": 1, "message": "出错信息"}
36 | # {"error": 0, "url": "图片地址"}
37 | ##################
38 | result = {"error": 1, "message": "上传出错"}
39 | files = request.FILES.get("imgFile", None)
40 | if files:
41 | result =image_upload(files, dir_name)
42 | return HttpResponse(json.dumps(result), content_type="application/json")
43 |
44 | #目录创建
45 | def upload_generation_dir(dir_name):
46 | today = dt.datetime.today()
47 | dir_name = dir_name + '/%d/%d/' %(today.year,today.month)
48 | if not os.path.exists(settings.MEDIA_ROOT):
49 | os.makedirs(settings.MEDIA_ROOT)
50 | return dir_name
51 |
52 | # 图片上传
53 | def image_upload(files, dir_name):
54 | #允许上传文件类型
55 | allow_suffix =['jpg', 'png', 'jpeg', 'gif', 'bmp']
56 | file_suffix = files.name.split(".")[-1]
57 | if file_suffix not in allow_suffix:
58 | return {"error": 1, "message": "图片格式不正确"}
59 | relative_path_file = upload_generation_dir(dir_name)
60 | path=os.path.join(settings.MEDIA_ROOT, relative_path_file)
61 | print path
62 | if not os.path.exists(path): #如果目录不存在创建目录
63 | os.makedirs(path)
64 | file_name=str(uuid.uuid1())+"."+file_suffix
65 | path_file=os.path.join(path, file_name)
66 | file_url = settings.MEDIA_URL + relative_path_file + file_name
67 | open(path_file, 'wb').write(files.file.read())
68 | return {"error": 0, "url": file_url}
--------------------------------------------------------------------------------
/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import os
3 | import sys
4 |
5 | if __name__ == "__main__":
6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myapp.settings")
7 | try:
8 | from django.core.management import execute_from_command_line
9 | except ImportError:
10 | # The above import may fail for some other reason. Ensure that the
11 | # issue is really that Django is missing to avoid masking other
12 | # exceptions on Python 2.
13 | try:
14 | import django
15 | except ImportError:
16 | raise ImportError(
17 | "Couldn't import Django. Are you sure it's installed and "
18 | "available on your PYTHONPATH environment variable? Did you "
19 | "forget to activate a virtual environment?"
20 | )
21 | raise
22 | execute_from_command_line(sys.argv)
23 |
--------------------------------------------------------------------------------
/myapp/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/myapp/__init__.py
--------------------------------------------------------------------------------
/myapp/settings.py:
--------------------------------------------------------------------------------
1 | """
2 | Django settings for myapp project.
3 |
4 | Generated by 'django-admin startproject' using Django 1.11.5.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/1.11/topics/settings/
8 |
9 | For the full list of settings and their values, see
10 | https://docs.djangoproject.com/en/1.11/ref/settings/
11 | """
12 | import os
13 |
14 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
15 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
16 |
17 |
18 | # Quick-start development settings - unsuitable for production
19 | # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
20 |
21 | # SECURITY WARNING: keep the secret key used in production secret!
22 | SECRET_KEY = '1z^47ahh=bjd62p9xq!ys079z7vz6js($ir*k$*fnc%+)&%x@6'
23 |
24 | # SECURITY WARNING: don't run with debug turned on in production!
25 | DEBUG = True
26 |
27 | ALLOWED_HOSTS = []
28 |
29 |
30 | # Application definition
31 |
32 | INSTALLED_APPS = [
33 | 'django.contrib.admin',
34 | 'django.contrib.auth',
35 | 'django.contrib.contenttypes',
36 | 'django.contrib.sessions',
37 | 'django.contrib.messages',
38 | 'django.contrib.staticfiles',
39 | 'HomePage',
40 | 'HPAdmin',
41 | 'kindeditor',
42 | ]
43 |
44 | MIDDLEWARE = [
45 | 'django.middleware.security.SecurityMiddleware',
46 | 'django.contrib.sessions.middleware.SessionMiddleware',
47 | 'django.middleware.common.CommonMiddleware',
48 | 'django.middleware.csrf.CsrfViewMiddleware',
49 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
50 | 'django.contrib.messages.middleware.MessageMiddleware',
51 | 'django.middleware.clickjacking.XFrameOptionsMiddleware',
52 | ]
53 |
54 | ROOT_URLCONF = 'myapp.urls'
55 |
56 | TEMPLATES = [
57 | {
58 | 'BACKEND': 'django.template.backends.django.DjangoTemplates',
59 | 'DIRS': ["templates"],
60 | 'APP_DIRS': True,
61 | 'OPTIONS': {
62 | 'context_processors': [
63 | 'django.template.context_processors.debug',
64 | 'django.template.context_processors.request',
65 | 'django.contrib.auth.context_processors.auth',
66 | 'django.contrib.messages.context_processors.messages',
67 | ],
68 | },
69 | },
70 | ]
71 |
72 | WSGI_APPLICATION = 'myapp.wsgi.application'
73 |
74 |
75 | # Database
76 | # https://docs.djangoproject.com/en/1.11/ref/settings/#databases
77 |
78 | DATABASES = {
79 | 'default': {
80 | 'ENGINE': 'django.db.backends.mysql',
81 | 'NAME': 'homepage',
82 | 'USER': 'root',
83 | 'PASSWORD':'',
84 | 'HOST': '127.0.0.1',
85 | 'PORT': '3306',
86 | }
87 | }
88 |
89 |
90 | # Password validation
91 | # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
92 |
93 | AUTH_PASSWORD_VALIDATORS = [
94 | {
95 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
96 | },
97 | {
98 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
99 | },
100 | {
101 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
102 | },
103 | {
104 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
105 | },
106 | ]
107 |
108 |
109 | # Internationalization
110 | # https://docs.djangoproject.com/en/1.11/topics/i18n/
111 |
112 | LANGUAGE_CODE = 'en-us'
113 |
114 | # UTC > Asia/Shanghai
115 | TIME_ZONE = 'Asia/Shanghai'
116 |
117 | USE_I18N = True
118 |
119 | USE_L10N = True
120 |
121 | # True Flase
122 | USE_TZ = False
123 |
124 |
125 | # Static files (CSS, JavaScript, Images)
126 | # https://docs.djangoproject.com/en/1.11/howto/static-files/
127 | STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
128 | STATIC_URL = '/static/'
129 |
130 |
131 | MEDIA_URL = '/static/upload/'
132 | MEDIA_ROOT = os.path.join(BASE_DIR,'static/upload')
133 |
--------------------------------------------------------------------------------
/myapp/urls.py:
--------------------------------------------------------------------------------
1 | """myapp URL Configuration
2 |
3 | The `urlpatterns` list routes URLs to views. For more information please see:
4 | https://docs.djangoproject.com/en/1.11/topics/http/urls/
5 | Examples:
6 | Function views
7 | 1. Add an import: from my_app import views
8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
9 | Class-based views
10 | 1. Add an import: from other_app.views import Home
11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
12 | Including another URLconf
13 | 1. Import the include() function: from django.conf.urls import url, include
14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
15 | """
16 | from django.conf.urls import url
17 | from django.contrib import admin
18 | from HPAdmin.views import *
19 | from HomePage.views import *
20 | from kindeditor.views import *
21 |
22 |
23 | urlpatterns = [
24 | url(r'^admin/', admin.site.urls),
25 | url(r'^$', index),
26 | url(r'^index$', index),
27 | url(r'^information$', information),
28 | url(r'^case$', case),
29 | url(r'^about$', about),
30 |
31 | url(r'^news/(\d*)', news),
32 | url(r'^uptest$', uptest),
33 | url(r'^testviews$', testviews),
34 | url(r'^kindeditor/uploads/(?P
[^/]+)$', upload_image, name='upload_image'),
35 |
36 | url(r'^admins$', adminlogin),
37 | url(r'^admins/manage$', adminmanage),
38 | url(r'^admins/logout$', adminlogout),
39 | url(r'^admins/banner/(\d*)', adminbanner),
40 | url(r'^admins/movie/(\d*)', adminmovie),
41 | url(r'^admins/bullhorn/(\d*)', adminbullhorn),
42 | url(r'^admins/case/(\d*)', admincase),
43 | url(r'^admins/news/(\d*)', adminnews),
44 | url(r'^validate/$', validate, name='validate'),
45 | url(r'^admins/usermanage/(\d*)$', adminusermanage),
46 | url(r'^admins/domanage/(\d*)$', admindomanage),
47 | url(r'^admins/menumanage$', adminmenumanage),
48 | url(r'^admins/operationlog/(\d*)$', adminoperationlog),
49 | url(r'^admins/message/(\d*)$', adminmessage),
50 | url(r'^admins/chartdata$', adminchartdata),
51 | url(r'^admins/chartdatas$', adminchartdatas),
52 | ]
53 |
--------------------------------------------------------------------------------
/myapp/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for myapp project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myapp.settings")
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/static/css/style.css:
--------------------------------------------------------------------------------
1 | @charset "utf-8";
2 | body {
3 | font-family: "Helvetica Neue", Helvetica, Arial, "Microsoft Yahei UI", "Microsoft YaHei", SimHei, "\5B8B\4F53", simsun, sans-serif;
4 | }
5 | a:focus {
6 | outline: none;
7 | }
8 |
9 | #sever-prev{
10 | left: 0px;
11 | background: None;
12 | }
13 |
14 | #sever-next{
15 | right: 0px;
16 | background: None;
17 | }
18 |
19 | .navbar{
20 | background: azure;
21 | }
22 |
23 | .list-group a {
24 | color: #0059b2;
25 | }
26 | #myCarousel {
27 | margin:50px 0 30px 0;
28 | }
29 |
30 | .carousel-inner .item img {
31 | margin: 0 auto;
32 | width: 100%;
33 | }
34 |
35 | .carousel-control{
36 | font-size: 100px;
37 | }
38 |
39 | .tab-h2 {
40 | font-size: 20px;
41 | color: #0059B2;
42 | text-align: center;
43 | letter-spacing: 1px;
44 | }
45 | .tab-p {
46 | font-size: 15px;
47 | color: #999;
48 | text-align: center;
49 | letter-spacing: 1px;
50 | margin: 20px 0 40px 0;
51 | }
52 | .tab1,.tab2,.tab3 {
53 | margin: 30px 0;
54 | color: #666;
55 | }
56 | .tab1 .media-heading {
57 | margin: 5px 0 20px 0;
58 | }
59 | .tab1 .text-muted {
60 | color: #999;
61 | text-decoration: line-through;
62 | }
63 | .tab1 .col {
64 | padding: 20px;
65 | }
66 | .tab2 {
67 | background: #eee;
68 | padding: 60px 20px;
69 | text-align: center;
70 | }
71 | .tab2 img {
72 | width: 40%;
73 | height: 40%;
74 | }
75 | .tab3 {
76 | padding: 40px 0;
77 | text-align: center;
78 | }
79 | .tab3 img {
80 | width: 65%;
81 | height: 65%;
82 | }
83 | .text h3 {
84 | font-size: 20px;
85 | }
86 | .text p {
87 | font-size: 14px;
88 | }
89 |
90 | .jumbotron {
91 | margin: 50px 0 0 0;
92 | padding: 60px 0;
93 | background: #ccc url(../img/bg.jpg);
94 | color: #ccc;
95 | }
96 | .jumbotron h1 {
97 | font-size: 26px;
98 | padding: 0 0 0 20px;
99 | }
100 | .jumbotron h4 {
101 | font-size: 16px;
102 | padding: 0 0 0 20px;
103 | }
104 | #information {
105 | padding: 40px 0;
106 | background: #eee;
107 | }
108 | .info-left {
109 |
110 | }
111 | .info-right {
112 | background-color: #fff;
113 | box-shadow: 2px 2px 3px #ccc;
114 | }
115 | .info-right blockquote {
116 | padding: 0;
117 | margin: 0;
118 | }
119 | .info-right h2 {
120 | font-size: 20px;
121 | padding: 5px;
122 | }
123 | .info-right h4 {
124 | line-height: 1.6;
125 | }
126 | .info-content {
127 | background-color: #fff;
128 | box-shadow: 2px 2px 3px #ccc;
129 | margin: 0 0 20px 0;
130 | }
131 | .info-content img {
132 | margin: 12px 0;
133 | }
134 | .info-content h4 {
135 | font-size: 14px;
136 | padding: 2px 0 0 0;
137 | }
138 | .info-content p {
139 | line-height: 1.6;
140 | color: #666;
141 | }
142 | #case {
143 | padding: 40px 0;
144 | text-align: center;
145 | background-color: #eee;
146 | }
147 | #case h4 {
148 | color: #666;
149 | }
150 | #case p {
151 | color: #666;
152 | line-height: 1.6;
153 | }
154 | #case .col {
155 | margin: 0 0 20px 0;
156 | }
157 | #about {
158 | padding: 40px 15px;
159 | background-color: #eee;
160 | }
161 | #about .about {
162 | background-color: #fff;
163 | box-shadow: 2px 2px 3px #ccc;
164 | padding-bottom: 20px;
165 | }
166 | #about h3 {
167 | margin: 0 0 10px 0;
168 | padding: 20px 0;
169 | border-bottom: 1px solid #eee;
170 | font-size: 18px;
171 | }
172 | #about p {
173 | line-height: 2;
174 | font-size: 13px;
175 | }
176 | #footer {
177 | padding: 20px;
178 | text-align: center;
179 | background-color: #666;
180 | border-top: 1px solid #ccc;
181 | color: #ccc;
182 | }
183 |
184 | /* 小屏幕(平板,大于等于 768px) */
185 | @media (min-width: 768px) {
186 | .tab-h2 {
187 | font-size: 26px;
188 | }
189 | .tab-p {
190 | font-size: 16px;
191 | }
192 | .text h3 {
193 | font-size: 22px;
194 | }
195 | .text p {
196 | font-size: 15px;
197 | }
198 | .tab2-text {
199 | float: left;
200 | }
201 | .tab2-img {
202 | float: right;
203 | }
204 | .info-content h4 {
205 | font-size: 16px;
206 | }
207 | .jumbotron h1 {
208 | font-size: 30px;
209 | }
210 | .jumbotron h4 {
211 | font-size: 16px;
212 | }
213 | #about h3 {
214 | font-size: 19px;
215 | }
216 | #about p {
217 | font-size: 14px;
218 | }
219 | }
220 |
221 | /* 中等屏幕(桌面显示器,大于等于 992px) */
222 | @media (min-width: 992px) {
223 | .tab-h2 {
224 | font-size: 28px;
225 | }
226 | .tab-p {
227 | font-size: 17px;
228 | }
229 | .text h3 {
230 | font-size: 24px;
231 | }
232 | .text p {
233 | font-size: 16px;
234 | }
235 | .tab2-text {
236 | float: left;
237 | }
238 | .tab2-img {
239 | float: right;
240 | }
241 | .info-content h4 {
242 | font-size: 18px;
243 | overflow: hidden;
244 | white-space: nowrap;
245 | text-overflow: ellipsis;
246 | }
247 | .info-right h4 {
248 | font-size: 14px;
249 | }
250 | .jumbotron h1 {
251 | font-size: 33px;
252 | }
253 | .jumbotron h4 {
254 | font-size: 17px;
255 | }
256 | #about h3 {
257 | font-size: 20px;
258 | }
259 | #about p {
260 | font-size: 15px;
261 | }
262 | }
263 |
264 | /* 大屏幕(大桌面显示器,大于等于 1200px) */
265 | @media (min-width: 1200px) {
266 | .tab-h2 {
267 | font-size: 30px;
268 | }
269 | .tab-p {
270 | font-size: 18px;
271 | }
272 | .text h2 {
273 | font-size: 26px;
274 | }
275 | .text p {
276 | font-size: 18px;
277 | }
278 | .tab2-text {
279 | float: left;
280 | }
281 | .tab2-img {
282 | float: right;
283 | }
284 | .info-content h4 {
285 | font-size: 20px;
286 | overflow: hidden;
287 | white-space: nowrap;
288 | text-overflow: ellipsis;
289 | }
290 | .info-right h4 {
291 | font-size: 16px;
292 | }
293 | .jumbotron h1 {
294 | font-size: 36px;
295 | }
296 | .jumbotron h4 {
297 | font-size: 18px;
298 | }
299 | #about h3 {
300 | font-size: 22px;
301 | }
302 | #about p {
303 | font-size: 16px;
304 | }
305 | }
--------------------------------------------------------------------------------
/static/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/static/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/static/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/static/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/static/img/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/1.jpg
--------------------------------------------------------------------------------
/static/img/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/2.jpg
--------------------------------------------------------------------------------
/static/img/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/3.jpg
--------------------------------------------------------------------------------
/static/img/4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/4.jpg
--------------------------------------------------------------------------------
/static/img/Thumbs.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/Thumbs.db
--------------------------------------------------------------------------------
/static/img/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/bg.jpg
--------------------------------------------------------------------------------
/static/img/case1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/case1.jpg
--------------------------------------------------------------------------------
/static/img/case2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/case2.jpg
--------------------------------------------------------------------------------
/static/img/case3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/case3.jpg
--------------------------------------------------------------------------------
/static/img/case4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/case4.jpg
--------------------------------------------------------------------------------
/static/img/info1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/info1.jpg
--------------------------------------------------------------------------------
/static/img/info2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/info2.jpg
--------------------------------------------------------------------------------
/static/img/info3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/info3.jpg
--------------------------------------------------------------------------------
/static/img/loding.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/loding.gif
--------------------------------------------------------------------------------
/static/img/movie1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/movie1.jpg
--------------------------------------------------------------------------------
/static/img/tab1-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/tab1-1.png
--------------------------------------------------------------------------------
/static/img/tab1-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/tab1-2.png
--------------------------------------------------------------------------------
/static/img/tab1-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/tab1-3.png
--------------------------------------------------------------------------------
/static/img/tab1-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/tab1-4.png
--------------------------------------------------------------------------------
/static/img/tab2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/tab2.png
--------------------------------------------------------------------------------
/static/img/tab3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/tab3.png
--------------------------------------------------------------------------------
/static/img/welcome.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Github-Benjamin/HomePage/f0098a2f96972cfee47189728c7668bcae11476b/static/img/welcome.gif
--------------------------------------------------------------------------------
/static/js/bootstrap-collapse.js:
--------------------------------------------------------------------------------
1 | /* =============================================================
2 | * bootstrap-collapse.js v2.0.1
3 | * http://twitter.github.com/bootstrap/javascript.html#collapse
4 | * =============================================================
5 | * Copyright 2012 Twitter, Inc.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * ============================================================ */
19 |
20 | !function( $ ){
21 |
22 | "use strict"
23 |
24 | var Collapse = function ( element, options ) {
25 | this.$element = $(element)
26 | this.options = $.extend({}, $.fn.collapse.defaults, options)
27 |
28 | if (this.options["parent"]) {
29 | this.$parent = $(this.options["parent"])
30 | }
31 |
32 | this.options.toggle && this.toggle()
33 | }
34 |
35 | Collapse.prototype = {
36 |
37 | constructor: Collapse
38 |
39 | , dimension: function () {
40 | var hasWidth = this.$element.hasClass('width')
41 | return hasWidth ? 'width' : 'height'
42 | }
43 |
44 | , show: function () {
45 | var dimension = this.dimension()
46 | , scroll = $.camelCase(['scroll', dimension].join('-'))
47 | , actives = this.$parent && this.$parent.find('.in')
48 | , hasData
49 |
50 | if (actives && actives.length) {
51 | hasData = actives.data('collapse')
52 | actives.collapse('hide')
53 | hasData || actives.data('collapse', null)
54 | }
55 |
56 | this.$element[dimension](0)
57 | this.transition('addClass', 'show', 'shown')
58 | this.$element[dimension](this.$element[0][scroll])
59 |
60 | }
61 |
62 | , hide: function () {
63 | var dimension = this.dimension()
64 | this.reset(this.$element[dimension]())
65 | this.transition('removeClass', 'hide', 'hidden')
66 | this.$element[dimension](0)
67 | }
68 |
69 | , reset: function ( size ) {
70 | var dimension = this.dimension()
71 |
72 | this.$element
73 | .removeClass('collapse')
74 | [dimension](size || 'auto')
75 | [0].offsetWidth
76 |
77 | this.$element.addClass('collapse')
78 | }
79 |
80 | , transition: function ( method, startEvent, completeEvent ) {
81 | var that = this
82 | , complete = function () {
83 | if (startEvent == 'show') that.reset()
84 | that.$element.trigger(completeEvent)
85 | }
86 |
87 | this.$element
88 | .trigger(startEvent)
89 | [method]('in')
90 |
91 | $.support.transition && this.$element.hasClass('collapse') ?
92 | this.$element.one($.support.transition.end, complete) :
93 | complete()
94 | }
95 |
96 | , toggle: function () {
97 | this[this.$element.hasClass('in') ? 'hide' : 'show']()
98 | }
99 |
100 | }
101 |
102 | /* COLLAPSIBLE PLUGIN DEFINITION
103 | * ============================== */
104 |
105 | $.fn.collapse = function ( option ) {
106 | return this.each(function () {
107 | var $this = $(this)
108 | , data = $this.data('collapse')
109 | , options = typeof option == 'object' && option
110 | if (!data) $this.data('collapse', (data = new Collapse(this, options)))
111 | if (typeof option == 'string') data[option]()
112 | })
113 | }
114 |
115 | $.fn.collapse.defaults = {
116 | toggle: true
117 | }
118 |
119 | $.fn.collapse.Constructor = Collapse
120 |
121 |
122 | /* COLLAPSIBLE DATA-API
123 | * ==================== */
124 |
125 | $(function () {
126 | $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
127 | var $this = $(this), href
128 | , target = $this.attr('data-target')
129 | || e.preventDefault()
130 | || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
131 | , option = $(target).data('collapse') ? 'toggle' : $this.data()
132 | $(target).collapse(option)
133 | })
134 | })
135 |
136 | }( window.jQuery );
--------------------------------------------------------------------------------
/static/js/main.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by Anonymous on 2017/9/26.
3 | */
4 |
5 | $('.userinfo').click(function () {
6 | $("#myModal").modal();
7 | });
8 |
9 | $('.xiugai').click(function () {
10 | $("#UPPassWord").modal();
11 | });
12 |
13 | // ifame框架打开页面
14 | var openpage = function (href) {
15 | $(".addpage").empty();
16 | var html = ''
17 | $(".addpage").append(html);
18 | var ifm= document.getElementById("iframe-page-content");
19 | ifm.height=document.documentElement.clientHeight+220;
20 | }
21 |
22 | //加载ifame框架
23 | $(".addmeu").click(function(){
24 | var href= $(this).attr("data-href");
25 | openpage(href);
26 | });
27 |
28 | // 图片预览,鼠标移上时触发弹出提示框,开启html 为true的话,data-content里就能放html代码了
29 | $("[data-toggle='popover']").popover({
30 | trigger : 'hover',
31 | html:true,
32 | });
33 |
34 | // 修改Banner操作
35 | $(".upbanneredit").click(function () {
36 | $("#upBanner").modal();
37 | $(".alert-warning").remove()
38 | var upid= $(this).attr("id");
39 | var img= $(this).attr("data-img");
40 | var title= $(this).attr("data-title");
41 | var a= $(this).attr("data-a");
42 | var p= $(this).attr("data-p");
43 | xupstatus = $(this).attr("data-status");
44 | var status = xupstatus;
45 | $("#upid").val(upid);
46 | $("#uptitle").val(title);
47 | $("#uplink").val(a);
48 | $("#upcontent").val(p);
49 | $("#upstatus").val(status);
50 | $(".upimg").empty();
51 | $(".upimg").append('
');
52 | });
53 |
54 |
55 |
56 | var statuscount = $("#statuscount").attr("value");
57 |
58 | // 新增,不允许提交大于4个启用状态的Banner图
59 | $('.checkstatus').click(function () {
60 | var status = document.getElementById("status").value;
61 | if ((parseInt(statuscount)+parseInt(status))>4){
62 | $(".alert-warning").remove()
63 | $("#status").after('');
64 | return false;
65 | }
66 | });
67 |
68 | // 修改,不允许提交大于4个启用状态的Banner图
69 | $('.checkupstatus').click(function () {
70 | if (xupstatus==1){
71 | }else {
72 | var upstatus = document.getElementById("upstatus").value;
73 | if ((parseInt(statuscount)+parseInt(upstatus))>4){
74 | $(".alert-warning").remove()
75 | $("#upstatus").after('');
76 | return false;
77 | }
78 | }
79 | });
80 |
81 |
82 | // 修改电影弹窗操作
83 | $(".uptitleedit").click(function () {
84 | $("#UPmyModal").modal();
85 | var upid= $(this).attr("id");
86 | var img= $(this).attr("data-img");
87 | var title= $(this).attr("data-title");
88 | var content= $(this).attr("data-content");
89 | var link= $(this).attr("data-link");
90 | var a= $(this).attr("data-a");
91 | $("#upid").val(upid);
92 | $("#uptitle").val(title);
93 | $("#upcontent").val(content);
94 | $("#uplink").val(a);
95 | $("#uplinks").val(link);
96 | $(".upimg").empty();
97 | $(".upimg").append('
');
98 | });
99 |
100 |
101 | // 修改资讯操作
102 | $(".UPbullhorn").click(function () {
103 | $("#UPbullhorn").modal();
104 | var upid= $(this).attr("id");
105 | var img= $(this).attr("data-img");
106 | var title= $(this).attr("data-title");
107 | var content= $(this).attr("data-content");
108 | var publisher= $(this).attr("data-publisher");
109 | var times= $(this).attr("data-times");
110 | var a_link= $(this).attr("data-a_link");
111 | var hot_id= $(this).attr("data-hot_id");
112 | $("#upid").val(upid);
113 | $("#uptitle").val(title);
114 | $("#upcontent").val(content);
115 | $("#uplink").val(a_link);
116 | $("#uppublisher").val(publisher);
117 | $("#uptimes").val(times);
118 | $("#uphot_id").val(hot_id);
119 | $(".upimg").empty();
120 | $(".upimg").append('
');
121 | });
122 |
123 | // 删除Banner、电影操作
124 | $(".delid").click(function () {
125 | $("#delcfmModel").modal();
126 | var delid= $(this).attr("id");
127 | $("#delid").val(delid);
128 | });
129 |
130 |
131 |
132 | // 修改用户信息操作
133 | $(".upusermanage").click(function () {
134 | var upid= $(this).attr("id");
135 | var username= $(this).attr("data-username");
136 | var email= $(this).attr("data-email");
137 | var phone= $(this).attr("data-phone");
138 | var role= $(this).attr("data-role");
139 | $("#upid").val(upid);
140 | $("#upusername").val(username);
141 | $("#upemail").val(email);
142 | $("#upphone").val(phone);
143 | $("#uprole").val(role);
144 | $("#UPmyModal").modal();
145 | });
146 |
147 |
148 | // 启用操作
149 | $(".enable").click(function () {
150 | $("#delcfmModel").modal();
151 | var delid= $(this).attr("id");
152 | $('#uesrstaus').empty().append('启用')
153 | $("#delid").val(delid);
154 | $("#deluesrstaus").attr("value","1");
155 | });
156 |
157 |
158 | // 停用操作
159 | $(".disable").click(function () {
160 | $("#delcfmModel").modal();
161 | var delid= $(this).attr("id");
162 | $('#uesrstaus').empty().append('停用')
163 | $("#delid").val(delid);
164 | $("#deluesrstaus").attr("value","0");
165 | });
166 |
167 | // 修改新闻操作
168 | $(".upnews").click(function () {
169 | var upid= $(this).attr("id");
170 | var uptitle= $(this).attr("data-title");
171 | var upauthor= $(this).attr("data-author");
172 | var uptime= $(this).attr("data-uptime");
173 |
174 | $.ajax({
175 | type: "GET",
176 | url: "admins/news",
177 | dataType:'json',
178 | data:{"queryid":upid},
179 | success: function(data){
180 | if (data["success"]) {
181 | callbackeditor.html(data["success"]);
182 | }
183 | },
184 | error: function (data) {
185 | $(".alert-warning").remove();
186 | $(".error").append('');
187 | }
188 | });
189 |
190 |
191 | $("#upid").val(upid);
192 | $("#uptitle").val(uptitle);
193 | $("#upauthor").val(upauthor);
194 | $("#upselecttime").val(uptime);
195 | $("#UPmyModal").modal();
196 | });
197 |
198 |
199 |
200 |
--------------------------------------------------------------------------------
/static/js/map.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by Anonymous on 2017/11/15.
3 | */
4 |
5 | //创建和初始化地图函数:
6 | function initMap(){
7 | createMap();//创建地图
8 | setMapEvent();//设置地图事件
9 | addMapControl();//向地图添加控件
10 | addMapOverlay();//向地图添加覆盖物
11 | }
12 | function createMap(){
13 | map = new BMap.Map("map");
14 | map.centerAndZoom(new BMap.Point(104.082769,30.546855),13);
15 | }
16 | function setMapEvent(){
17 | map.enableScrollWheelZoom();
18 | map.enableKeyboard();
19 | map.enableDragging();
20 | map.enableDoubleClickZoom()
21 | }
22 | function addClickHandler(target,window){
23 | target.addEventListener("click",function(){
24 | target.openInfoWindow(window);
25 | });
26 | }
27 | function addMapOverlay(){
28 | var markers = [
29 | {content:"Hello,I'am Benjamin.",title:"天府软件园",imageOffset: {width:0,height:3},position:{lat:30.552795,lng:104.078098}}
30 | ];
31 | for(var index = 0; index < markers.length; index++ ){
32 | var point = new BMap.Point(markers[index].position.lng,markers[index].position.lat);
33 | var marker = new BMap.Marker(point,{icon:new BMap.Icon("http://api.map.baidu.com/lbsapi/createmap/images/icon.png",new BMap.Size(20,25),{
34 | imageOffset: new BMap.Size(markers[index].imageOffset.width,markers[index].imageOffset.height)
35 | })});
36 | var label = new BMap.Label(markers[index].title,{offset: new BMap.Size(25,5)});
37 | var opts = {
38 | width: 200,
39 | title: markers[index].title,
40 | enableMessage: false
41 | };
42 | var infoWindow = new BMap.InfoWindow(markers[index].content,opts);
43 | marker.setLabel(label);
44 | addClickHandler(marker,infoWindow);
45 | map.addOverlay(marker);
46 | };
47 | }
48 | //向地图添加控件
49 | function addMapControl(){
50 | var scaleControl = new BMap.ScaleControl({anchor:BMAP_ANCHOR_BOTTOM_LEFT});
51 | scaleControl.setUnit(BMAP_UNIT_IMPERIAL);
52 | map.addControl(scaleControl);
53 | var navControl = new BMap.NavigationControl({anchor:BMAP_ANCHOR_TOP_LEFT,type:1});
54 | map.addControl(navControl);
55 | var overviewControl = new BMap.OverviewMapControl({anchor:BMAP_ANCHOR_BOTTOM_RIGHT,isOpen:true});
56 | map.addControl(overviewControl);
57 | }
58 | var map;
59 | initMap();
--------------------------------------------------------------------------------
/static/js/npm.js:
--------------------------------------------------------------------------------
1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
2 | require('../../js/transition.js')
3 | require('../../js/alert.js')
4 | require('../../js/button.js')
5 | require('../../js/carousel.js')
6 | require('../../js/collapse.js')
7 | require('../../js/dropdown.js')
8 | require('../../js/modal.js')
9 | require('../../js/tooltip.js')
10 | require('../../js/popover.js')
11 | require('../../js/scrollspy.js')
12 | require('../../js/tab.js')
13 | require('../../js/affix.js')
--------------------------------------------------------------------------------
/static/kindeditor/plugins/anchor/anchor.js:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * KindEditor - WYSIWYG HTML Editor for Internet
3 | * Copyright (C) 2006-2011 kindsoft.net
4 | *
5 | * @author Roddy
6 | * @site http://www.kindsoft.net/
7 | * @licence http://www.kindsoft.net/license.php
8 | *******************************************************************************/
9 |
10 | KindEditor.plugin('anchor', function(K) {
11 | var self = this, name = 'anchor', lang = self.lang(name + '.');
12 | self.plugin.anchor = {
13 | edit : function() {
14 | var html = ['',
15 | '
',
16 | '',
17 | '',
18 | '
',
19 | '
'].join('');
20 | var dialog = self.createDialog({
21 | name : name,
22 | width : 300,
23 | title : self.lang(name),
24 | body : html,
25 | yesBtn : {
26 | name : self.lang('yes'),
27 | click : function(e) {
28 | self.insertHtml('').hideDialog().focus();
29 | }
30 | }
31 | });
32 | var div = dialog.div,
33 | nameBox = K('input[name="name"]', div);
34 | var img = self.plugin.getSelectedAnchor();
35 | if (img) {
36 | nameBox.val(unescape(img.attr('data-ke-name')));
37 | }
38 | nameBox[0].focus();
39 | nameBox[0].select();
40 | },
41 | 'delete' : function() {
42 | self.plugin.getSelectedAnchor().remove();
43 | }
44 | };
45 | self.clickToolbar(name, self.plugin.anchor.edit);
46 | });
47 |
--------------------------------------------------------------------------------
/static/kindeditor/plugins/autoheight/autoheight.js:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * KindEditor - WYSIWYG HTML Editor for Internet
3 | * Copyright (C) 2006-2011 kindsoft.net
4 | *
5 | * @author Roddy
6 | * @site http://www.kindsoft.net/
7 | * @licence http://www.kindsoft.net/license.php
8 | *******************************************************************************/
9 |
10 | KindEditor.plugin('autoheight', function(K) {
11 | var self = this;
12 |
13 | if (!self.autoHeightMode) {
14 | return;
15 | }
16 |
17 | var minHeight;
18 |
19 | function hideScroll() {
20 | var edit = self.edit;
21 | var body = edit.doc.body;
22 | edit.iframe[0].scroll = 'no';
23 | body.style.overflowY = 'hidden';
24 | }
25 |
26 | function resetHeight() {
27 | var edit = self.edit;
28 | var body = edit.doc.body;
29 | edit.iframe.height(minHeight);
30 | self.resize(null, Math.max((K.IE ? body.scrollHeight : body.offsetHeight) + 76, minHeight));
31 | }
32 |
33 | function init() {
34 | minHeight = K.removeUnit(self.height);
35 |
36 | self.edit.afterChange(resetHeight);
37 | hideScroll();
38 | resetHeight();
39 | }
40 |
41 | if (self.isCreated) {
42 | init();
43 | } else {
44 | self.afterCreate(init);
45 | }
46 | });
47 |
48 | /*
49 | * 如何实现真正的自动高度?
50 | * 修改编辑器高度之后,再次获取body内容高度时,最小值只会是当前iframe的设置高度,这样就导致高度只增不减。
51 | * 所以每次获取body内容高度之前,先将iframe的高度重置为最小高度,这样就能获取body的实际高度。
52 | * 由此就实现了真正的自动高度
53 | * 测试:chrome、firefox、IE9、IE8
54 | * */
55 |
--------------------------------------------------------------------------------
/static/kindeditor/plugins/baidumap/baidumap.js:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * KindEditor - WYSIWYG HTML Editor for Internet
3 | * Copyright (C) 2006-2011 kindsoft.net
4 | *
5 | * @author Roddy
6 | * @site http://www.kindsoft.net/
7 | * @licence http://www.kindsoft.net/license.php
8 | *******************************************************************************/
9 |
10 | // Baidu Maps: http://dev.baidu.com/wiki/map/index.php?title=%E9%A6%96%E9%A1%B5
11 |
12 | KindEditor.plugin('baidumap', function(K) {
13 | var self = this, name = 'baidumap', lang = self.lang(name + '.');
14 | var mapWidth = K.undef(self.mapWidth, 558);
15 | var mapHeight = K.undef(self.mapHeight, 360);
16 | self.clickToolbar(name, function() {
17 | var html = ['',
18 | '',
32 | '
',
33 | '
'].join('');
34 | var dialog = self.createDialog({
35 | name : name,
36 | width : mapWidth + 42,
37 | title : self.lang(name),
38 | body : html,
39 | yesBtn : {
40 | name : self.lang('yes'),
41 | click : function(e) {
42 | var map = win.map;
43 | var centerObj = map.getCenter();
44 | var center = centerObj.lng + ',' + centerObj.lat;
45 | var zoom = map.getZoom();
46 | var url = [checkbox[0].checked ? self.pluginsPath + 'baidumap/index.html' : 'http://api.map.baidu.com/staticimage',
47 | '?center=' + encodeURIComponent(center),
48 | '&zoom=' + encodeURIComponent(zoom),
49 | '&width=' + mapWidth,
50 | '&height=' + mapHeight,
51 | '&markers=' + encodeURIComponent(center),
52 | '&markerStyles=' + encodeURIComponent('l,A')].join('');
53 | if (checkbox[0].checked) {
54 | self.insertHtml('');
55 | } else {
56 | self.exec('insertimage', url);
57 | }
58 | self.hideDialog().focus();
59 | }
60 | },
61 | beforeRemove : function() {
62 | searchBtn.remove();
63 | if (doc) {
64 | doc.write('');
65 | }
66 | iframe.remove();
67 | }
68 | });
69 | var div = dialog.div,
70 | addressBox = K('[name="address"]', div),
71 | searchBtn = K('[name="searchBtn"]', div),
72 | checkbox = K('[name="insertDynamicMap"]', dialog.div),
73 | win, doc;
74 | var iframe = K('');
75 | function ready() {
76 | win = iframe[0].contentWindow;
77 | doc = K.iframeDoc(iframe);
78 | }
79 | iframe.bind('load', function() {
80 | iframe.unbind('load');
81 | if (K.IE) {
82 | ready();
83 | } else {
84 | setTimeout(ready, 0);
85 | }
86 | });
87 | K('.ke-map', div).replaceWith(iframe);
88 | // search map
89 | searchBtn.click(function() {
90 | win.search(addressBox.val());
91 | });
92 | });
93 | });
94 |
--------------------------------------------------------------------------------
/static/kindeditor/plugins/baidumap/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 百度地图API自定义地图
8 |
9 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
83 |
--------------------------------------------------------------------------------
/static/kindeditor/plugins/baidumap/map.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Baidu Maps
6 |
10 |
11 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/static/kindeditor/plugins/clearhtml/clearhtml.js:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * KindEditor - WYSIWYG HTML Editor for Internet
3 | * Copyright (C) 2006-2011 kindsoft.net
4 | *
5 | * @author Roddy
6 | * @site http://www.kindsoft.net/
7 | * @licence http://www.kindsoft.net/license.php
8 | *******************************************************************************/
9 |
10 | KindEditor.plugin('clearhtml', function(K) {
11 | var self = this, name = 'clearhtml';
12 | self.clickToolbar(name, function() {
13 | self.focus();
14 | var html = self.html();
15 | html = html.replace(/(
11 |
53 |
54 |
55 |
56 |
57 |