mirror of
https://github.com/wtc86939209/WeChatMsg110.git
synced 2026-05-20 03:16:15 +08:00
上传html模板
This commit is contained in:
Generated
+48
-34
@@ -4,19 +4,26 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="修改导入路径,方便打包成exe">
|
||||
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="修改部分UI">
|
||||
<change afterPath="$PROJECT_DIR$/app/Ui/contact/report/annual_report.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/data/html/0.html" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/data/html/1.html" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/data/html/2.html" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/data/html/3.html" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/data/html/4.html" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/data/html/5.html" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/data/html/6.html" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/data/html/index.html" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/data/icons/back.svg" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/data/icons/output.svg" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/ImageBox/ui.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/ImageBox/ui.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/Icon.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/Icon.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/DataBase/data.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/DataBase/data.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/MyComponents/Button_Contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/MyComponents/Button_Contact.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/chat/chatUi.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/chat/chatUi.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/chat/chatUi.ui" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/chat/chatUi.ui" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/contact/analysis/analysis.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/analysis/analysis.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contactInfo.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contactInfo.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contactUi.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contactUi.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contactUi.ui" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contactUi.ui" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/contact/report/report.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/report/report.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/mainview.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/mainview.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/mainwindow.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/mainwindow.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/mainwindow.ui" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/mainwindow.ui" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/requirements.txt" beforeDir="false" afterPath="$PROJECT_DIR$/requirements.txt" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -83,6 +90,27 @@
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager" selected="Python.main">
|
||||
<configuration name="annual_report" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||
<module name="WeChatMsg" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/app/Ui/contact/report" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/app/Ui/contact/report/annual_report.py" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="decrypt" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||
<module name="WeChatMsg" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
@@ -146,27 +174,6 @@
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="report" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||
<module name="WeChatMsg" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/app/Ui/contact/report" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/app/Ui/contact/report/report.py" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="test" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||
<module name="WeChatMsg" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
@@ -191,10 +198,10 @@
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Python.main" />
|
||||
<item itemvalue="Python.annual_report" />
|
||||
<item itemvalue="Python.test" />
|
||||
<item itemvalue="Python.decrypt" />
|
||||
<item itemvalue="Python.output" />
|
||||
<item itemvalue="Python.report" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
@@ -532,7 +539,14 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699373594568</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="47" />
|
||||
<task id="LOCAL-00047" summary="修改部分UI">
|
||||
<created>1699531863395</created>
|
||||
<option name="number" value="00047" />
|
||||
<option name="presentableId" value="LOCAL-00047" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699531863395</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="48" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="UnknownFeatures">
|
||||
@@ -590,10 +604,10 @@
|
||||
<MESSAGE value="update readme" />
|
||||
<MESSAGE value="用stackWidget重写contactUI" />
|
||||
<MESSAGE value="修改联系人视图架构" />
|
||||
<MESSAGE value="修改部分UI" />
|
||||
<MESSAGE value="加快打开速度" />
|
||||
<MESSAGE value="修改导入路径,方便打包成exe" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="修改导入路径,方便打包成exe" />
|
||||
<MESSAGE value="修改部分UI" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="修改部分UI" />
|
||||
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
|
||||
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
|
||||
</component>
|
||||
|
||||
@@ -68,6 +68,7 @@ def mkdir(path):
|
||||
return True
|
||||
|
||||
|
||||
root_path = os.path.abspath('.')
|
||||
mkdir(os.path.abspath('.') + '/app/DataBase')
|
||||
mkdir(os.path.abspath('.') + '/app/data/emoji')
|
||||
if os.path.exists('./app/DataBase/Msg.db'):
|
||||
@@ -219,17 +220,18 @@ def avatar_md5(wxid):
|
||||
|
||||
def get_avator(wxid):
|
||||
if wxid == None:
|
||||
return './app/data/icons/default_avatar.svg'
|
||||
return os.path.join(root_path, '/app/data/icons/default_avatar.svg')
|
||||
wxid = str(wxid)
|
||||
avatar = avatar_md5(wxid)
|
||||
avatar_path = r"./app/data/avatar/"
|
||||
path = avatar_path + avatar[:2] + '/' + avatar[2:4]
|
||||
path = os.path.join(root_path, 'app', 'data', 'avatar', avatar[:2], avatar[2:4])
|
||||
# avatar_path + avatar[:2] + '/' + avatar[2:4]
|
||||
for root, dirs, files in os.walk(path):
|
||||
for file in files:
|
||||
if avatar in file:
|
||||
avatar = file
|
||||
break
|
||||
return f'''{path}/{avatar}'''
|
||||
return os.path.join(path, avatar)
|
||||
# return f'''{path}/{avatar}'''
|
||||
# return f'''{path}/user_{avatar}.png'''
|
||||
|
||||
|
||||
|
||||
@@ -57,9 +57,9 @@ class ContactUi(QtWidgets.QPushButton):
|
||||
self.gridLayout1.addWidget(self.label_time, 0, 2, 1, 1)
|
||||
self.label_remark = QtWidgets.QLabel(self.layoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("微软雅黑")
|
||||
font.setFamily("黑体")
|
||||
font.setPointSize(10)
|
||||
font.setBold(True)
|
||||
# font.setBold(True)
|
||||
self.label_remark.setFont(font)
|
||||
self.label_remark.setObjectName("label_remark")
|
||||
self.gridLayout1.addWidget(self.label_remark, 0, 1, 1, 1)
|
||||
|
||||
@@ -72,9 +72,6 @@ class AnalysisController(QWidget):
|
||||
self.browser4.resize(800, 600)
|
||||
self.browser5 = QWebEngineView()
|
||||
self.browser5.load(QUrl('file:///data/聊天统计/chat_session.html'))
|
||||
# self.browser5.adjustSize()
|
||||
|
||||
# self.browser5.resize(800, 600)
|
||||
self.browser6 = QWebEngineView()
|
||||
self.browser6.load(QUrl('file:///data/聊天统计/sports.html'))
|
||||
self.browser7 = QWebEngineView()
|
||||
@@ -95,23 +92,18 @@ class AnalysisController(QWidget):
|
||||
|
||||
scrollAreaContent = QWidget(self.scrollArea)
|
||||
scrollAreaContent.setStyleSheet('''QWidget{background-color:rgb(240, 240, 240);}''')
|
||||
|
||||
Vlayout2 = QVBoxLayout()
|
||||
Vlayout2.setContentsMargins(0, 0, 0, 0)
|
||||
Vlayout2.setSpacing(0)
|
||||
|
||||
Vlayout2.addWidget(self.browser3)
|
||||
Vlayout2.addWidget(self.browser2)
|
||||
|
||||
Vlayout2.addWidget(self.browser8)
|
||||
Vlayout2.addWidget(self.browser6)
|
||||
Vlayout2.addWidget(self.browser5)
|
||||
Vlayout2.addWidget(self.browser7)
|
||||
|
||||
Vlayout2.addWidget(self.browser9)
|
||||
Vlayout2.addWidget(self.browser10)
|
||||
scrollAreaContent.setLayout(Vlayout2)
|
||||
|
||||
self.scrollArea.setWidget(scrollAreaContent)
|
||||
main_box.addWidget(self.scrollArea)
|
||||
main_box.setStretch(0, 1)
|
||||
|
||||
@@ -73,8 +73,8 @@ class ContactInfo(QWidget, Ui_Form):
|
||||
"敬请期待"
|
||||
)
|
||||
return
|
||||
self.report = report.ReportController(123)
|
||||
self.report.show()
|
||||
# self.report = report.ReportController(self.contact)
|
||||
# self.report.show()
|
||||
|
||||
def emotionale_Analysis(self):
|
||||
self.stackedWidget.setCurrentWidget(self.view_emotion)
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
|
||||
def create_title_page(nickname, time, avatar_path):
|
||||
with open('D:\\Project\\Python\\WeChatMsg\\app\\data\\html\\0.html', 'r+', encoding='utf-8') as f:
|
||||
html_document = f.read()
|
||||
# 创建Beautiful Soup对象
|
||||
soup = BeautifulSoup(html_document, 'html.parser')
|
||||
# 找到需要替换的图片元素
|
||||
target_image = soup.find(id='avatar')
|
||||
# 替换图片元素的src属性
|
||||
if target_image:
|
||||
target_image['src'] = avatar_path
|
||||
# 找到需要替换的元素
|
||||
target_element = soup.find(id='nickname')
|
||||
# 替换元素的文本内容
|
||||
if target_element:
|
||||
target_element.string = nickname
|
||||
target_element = soup.find(id='first_time')
|
||||
# 替换元素的文本内容
|
||||
if target_element:
|
||||
target_element.string = time
|
||||
with open('./data/AnnualReport/0.html', 'w', encoding='utf-8') as f1:
|
||||
f1.write(soup.prettify())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
create_title_page('小学生', '2023-09-18 20:39:08', 'D:\Project\Python\WeChatMsg\\app\data\icons\default_avatar.svg')
|
||||
@@ -5,12 +5,17 @@ from PyQt5.QtGui import *
|
||||
from PyQt5.QtWebEngineWidgets import QWebEngineView
|
||||
from PyQt5.QtWidgets import *
|
||||
|
||||
from app import person
|
||||
from app.DataBase import data
|
||||
from . import annual_report
|
||||
|
||||
|
||||
class ReportController(QWidget):
|
||||
def __init__(self, username, parent=None):
|
||||
def __init__(self, contact: person.Contact, me: person.Me = None, parent=None):
|
||||
super().__init__(parent)
|
||||
self.ta_username = username
|
||||
|
||||
self.ta_username = contact.wxid
|
||||
self.contact = contact
|
||||
self.Me = me
|
||||
# self.setStyleSheet('''QWidget{background-color:rgb(240, 240, 240);}''')
|
||||
# 加载动画
|
||||
self.center()
|
||||
@@ -40,15 +45,15 @@ class ReportController(QWidget):
|
||||
movie.start()
|
||||
|
||||
def initUI(self):
|
||||
start_time = data.get_msg_start_time(self.contact.wxid)
|
||||
annual_report.create_title_page(self.contact.nickname, start_time, self.contact.avatar_path)
|
||||
self.label.setVisible(False)
|
||||
# self.setStyleSheet('''QWidget{background-color:rgb(244, 244, 244);}''')
|
||||
main_box = QHBoxLayout(self)
|
||||
self.browser1 = QWebEngineView()
|
||||
self.browser1.load(QUrl('file:///data/AnnualReport/index.html'))
|
||||
# self.browser1.setStyleSheet('''QWidget{background-color:rgb(240, 240, 240);}''')
|
||||
|
||||
splitter1 = QSplitter(Qt.Vertical)
|
||||
|
||||
splitter1.addWidget(self.browser1)
|
||||
main_box.addWidget(splitter1)
|
||||
self.setLayout(main_box)
|
||||
|
||||
@@ -46,12 +46,15 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
# self.btn_myinfo.clicked.connect(self.myInfo)
|
||||
self.btn_about.clicked.connect(self.about)
|
||||
self.now_btn = self.btn_chat
|
||||
self.btn_about.setIcon(Icon.MainWindow_Icon)
|
||||
self.btn_about.setContextMenuPolicy(Qt.CustomContextMenu)
|
||||
self.btn_about.customContextMenuRequested.connect(self.create_rightmenu) # 连接到菜单显示函数
|
||||
self.last_btn = None
|
||||
self.lastView = None
|
||||
self.show_avatar()
|
||||
self.init_ui()
|
||||
self.menubar.setVisible(False)
|
||||
self.statusbar.setVisible(False)
|
||||
# self.state_lable = QLabel(self)
|
||||
# self.state_lable.raise_()
|
||||
# pixmap = QPixmap('./app/data/icons/default_avatar.svg').scaled(32, 32) # 按指定路径找到图片
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,252 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
|
||||
<title></title>
|
||||
<!--
|
||||
@time: 2018-08-04
|
||||
@version: 0.0.1
|
||||
@author: Mortal
|
||||
-->
|
||||
<style type="text/css">
|
||||
/*
|
||||
* 说明:
|
||||
* 标注为慎删的属性暂时认定可以删除,即在作者测试的环境下删除暂时没有影响,但不代表所有环境下删除都没有影响
|
||||
* 其他属性一概不可以删除
|
||||
*/
|
||||
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body,
|
||||
ul,
|
||||
li,
|
||||
a,
|
||||
p,
|
||||
div {
|
||||
/*慎删*/
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
#wrap {
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#main {
|
||||
top: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.page {
|
||||
/*谨删*/
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#pageUl {
|
||||
position: fixed;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!--
|
||||
每个全屏页面div的class为page,其中的图片的class为pageImg
|
||||
ul为右侧的导航栏
|
||||
pageUlLi和page的数目必须相等,修改数目时还应修改最下面js鼠标悬停的跳转代码
|
||||
-->
|
||||
<div id="wrap">
|
||||
<div id="main">
|
||||
<ul id="pageUl" type="circle">
|
||||
<li id="pageUlLi1" class="pageUlLi" style="color: red;"> </li>
|
||||
<li id="pageUlLi2" class="pageUlLi"> </li>
|
||||
<li id="pageUlLi3" class="pageUlLi"> </li>
|
||||
<li id="pageUlLi4" class="pageUlLi"> </li>
|
||||
<li id="pageUlLi5" class="pageUlLi"> </li>
|
||||
<li id="pageUlLi6" class="pageUlLi"> </li>
|
||||
<li id="pageUlLi7" class="pageUlLi"> </li>
|
||||
</ul>
|
||||
<div id="page1" class="page">
|
||||
<iframe src="0.html" frameborder="0" height="100%"
|
||||
width="100%"></iframe>
|
||||
</div>
|
||||
<div id="page2" class="page">
|
||||
<iframe src="1.html" frameborder="0" height="100%"
|
||||
width="100%"></iframe>
|
||||
</div>
|
||||
<div style="background-color: #8a6d3b" id="page3" class="page">
|
||||
<iframe src="2.html" frameborder="0" id="iframe0" height="100%"
|
||||
width="100%"></iframe>
|
||||
</div>
|
||||
<div style="background-color: #337ab7" id="page4" class="page">
|
||||
<iframe src="3.html" frameborder="0" id="iframe3" height="100%"
|
||||
width="100%"></iframe>
|
||||
</div>
|
||||
<div style="background-color: #337ab7" id="page5" class="page">
|
||||
<iframe src="4.html" frameborder="0" id="iframe4" height="100%"
|
||||
width="100%"></iframe>
|
||||
</div>
|
||||
<div style="background-color: #337ab7" id="page6" class="page">
|
||||
<iframe src="5.html" frameborder="0" id="iframe5" height="100%"
|
||||
width="100%"></iframe>
|
||||
</div>
|
||||
<div style="background-color: #337ab7" id="page7" class="page">
|
||||
<iframe src="6.html" frameborder="0" id="iframe6" height="100%"
|
||||
width="100%"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
//改变窗口大小时调整图片大小
|
||||
window.onload = resizeImages;
|
||||
window.onresize = resizeImages;
|
||||
|
||||
function resizeImages() {
|
||||
$(function (e) {
|
||||
var screenWeight = document.documentElement.clientWidth;
|
||||
var screenHeight = document.documentElement.clientHeight;
|
||||
$("[name=pageImg]").css("width", screenWeight).css("height", screenHeight);
|
||||
$("#pageUl").css("bottom", screenHeight >> 1);
|
||||
});
|
||||
}
|
||||
|
||||
var index = 1;
|
||||
var curIndex = 1;
|
||||
var wrap = document.getElementById("wrap");
|
||||
var main = document.getElementById("main");
|
||||
var hei = document.body.clientHeight;
|
||||
wrap.style.height = hei + "px";
|
||||
var obj = document.getElementsByTagName("div");
|
||||
for (var i = 0; i < obj.length; i++) {
|
||||
if (obj[i].className == 'page') {
|
||||
obj[i].style.height = hei + "px";
|
||||
}
|
||||
}
|
||||
var pageNum = document.querySelectorAll(".page").length;
|
||||
//如果不加时间控制,滚动会过度灵敏,一次翻好几屏
|
||||
var startTime = 0, //翻屏起始时间
|
||||
endTime = 0,
|
||||
now = 0;
|
||||
//浏览器兼容
|
||||
if ((navigator.userAgent.toLowerCase().indexOf("firefox") != -1)) {
|
||||
document.addEventListener("DOMMouseScroll", scrollFun, false);
|
||||
} else if (document.addEventListener) {
|
||||
document.addEventListener("mousewheel", scrollFun, false);
|
||||
} else if (document.attachEvent) {
|
||||
document.attachEvent("onmousewheel", scrollFun);
|
||||
} else {
|
||||
document.onmousewheel = scrollFun;
|
||||
}
|
||||
|
||||
//滚动事件处理函数
|
||||
function scrollFun(event) {
|
||||
startTime = new Date().getTime();
|
||||
var delta = event.detail || (-event.wheelDelta);
|
||||
//mousewheel事件中的 “event.wheelDelta” 属性值:返回的如果是正值说明滚轮是向上滚动
|
||||
//DOMMouseScroll事件中的 “event.detail” 属性值:返回的如果是负值说明滚轮是向上滚动
|
||||
if ((endTime - startTime) < -1000) {
|
||||
if (delta > 0 && parseInt(main.offsetTop) > -(hei * (pageNum - 1))) {
|
||||
//向下滚动
|
||||
index++;
|
||||
toPage(index);
|
||||
}
|
||||
if (delta < 0 && parseInt(main.offsetTop) < 0) {
|
||||
//向上滚动
|
||||
index--;
|
||||
toPage(index);
|
||||
}
|
||||
endTime = new Date().getTime();
|
||||
} else {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toPage(idx) {
|
||||
//jquery实现动画效果
|
||||
if(idx!=curIndex){
|
||||
index=idx
|
||||
var delta=idx - curIndex;
|
||||
now = now - delta * hei;
|
||||
$("#main").animate({
|
||||
top: (now + 'px')
|
||||
}, 500);
|
||||
curIndex = idx;
|
||||
//更改列表的选中项
|
||||
$(".pageUlLi").css("color", "black");
|
||||
$("#pageUlLi" + idx).css("color", "red");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// //鼠标悬停翻页
|
||||
// document.getElementById("pageUlLi1").onmouseover = function () {
|
||||
// toPage(1);
|
||||
// }
|
||||
// document.getElementById("pageUlLi2").onmouseover = function () {
|
||||
// toPage(2);
|
||||
// }
|
||||
// document.getElementById("pageUlLi3").onmouseover = function () {
|
||||
// toPage(3);
|
||||
// }
|
||||
// document.getElementById("pageUlLi4").onmouseover = function () {
|
||||
// toPage(4);
|
||||
// }
|
||||
// document.getElementById("pageUlLi5").onmouseover = function () {
|
||||
// toPage(5);
|
||||
// }
|
||||
//鼠标点击翻页
|
||||
document.getElementById("pageUlLi1").onclick = function () {
|
||||
toPage(1);
|
||||
}
|
||||
document.getElementById("pageUlLi2").onclick = function () {
|
||||
toPage(2);
|
||||
}
|
||||
document.getElementById("pageUlLi3").onclick = function () {
|
||||
toPage(3);
|
||||
}
|
||||
document.getElementById("pageUlLi4").onclick = function () {
|
||||
toPage(4);
|
||||
}
|
||||
document.getElementById("pageUlLi5").onclick = function () {
|
||||
toPage(5);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1699273771059" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12579" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><path d="M700.371228 394.525472 174.028569 394.525472l255.952416-227.506551c12.389168-11.011798 13.505595-29.980825 2.492774-42.369993-11.011798-12.386098-29.977755-13.506619-42.367947-2.492774L76.425623 400.975371c-6.960529 5.496178-11.434423 14.003945-11.434423 23.561625 0 0.013303 0.001023 0.026606 0.001023 0.039909 0 0.01228-0.001023 0.025583-0.001023 0.037862 0 0.473791 0.01535 0.946558 0.037862 1.418302 0.001023 0.016373 0.001023 0.032746 0.001023 0.049119 0.39295 8.030907 3.992941 15.595186 10.034541 20.962427l315.040163 280.028764c5.717212 5.083785 12.83533 7.580652 19.925818 7.580652 8.274454 0 16.514115-3.403516 22.442128-10.07445 11.011798-12.387122 9.896394-31.357172-2.492774-42.367947l-256.128425-227.665163 526.518668 0c109.219517 0 198.075241 88.855724 198.075241 198.075241s-88.855724 198.075241-198.075241 198.075241L354.324888 850.696955c-16.57449 0-30.011524 13.437034-30.011524 30.011524s13.437034 30.011524 30.011524 30.011524l346.046341 0c142.31631 0 258.098289-115.783003 258.098289-258.098289S842.686515 394.525472 700.371228 394.525472z" fill="#272636" p-id="12580"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1699272892992" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4188" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><path d="M182.857143 146.285714h360.594286L768 370.834286V438.857143h146.285714V310.125714L604.16 0H36.571429v1024h877.714285v-146.285714H182.857143V146.285714z" fill="#272536" p-id="4189"></path><path d="M987.428571 658.285714l-219.428571-146.285714v73.142857H475.428571v146.285714h292.571429v73.142858l219.428571-146.285715z" fill="#272536" p-id="4190"></path></svg>
|
||||
|
After Width: | Height: | Size: 690 B |
Binary file not shown.
Reference in New Issue
Block a user