Skip to content

Commit 5436e78

Browse files
committed
自定义统计dialog
customize statistics dialog
1 parent b2c6dc8 commit 5436e78

16 files changed

+473
-27
lines changed

README.md

+11-4
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,19 @@ mush thanks to these projects🙇‍
4444

4545
## screenshot
4646

47-
<img width="250" style="margin-right:10px" src="screenshot/1.jpg"/> <img width="250" style="margin-right:10px" src="screenshot/2.jpg"/> <img width="250" src="screenshot/3.jpg"/>
47+
<img width="250" style="margin-right:10px" src="screenshot/1.jpg"/>
48+
<img width="250" style="margin-right:10px" src="screenshot/2.jpg"/>
49+
<img width="250" style="margin-right:10px" src="screenshot/3.jpg"/>
50+
<img width="250" src="screenshot/4.jpg"/>
4851

49-
<img width="770" src="screenshot/4.png"/>
52+
<img width="770" src="screenshot/0.png"/>
5053

5154
## Main Features
5255

5356
- [x] GalleryPage, Popular, Favorite, Watched, History, support multiple gallery list style
5457
- [x] search, search suggestion, tap tag to search, file search, jump to a certain page
5558
- [x] online reading and download, support restore download task
56-
- [x] favorite, rating, torrent, archive, share
59+
- [x] favorite, rating, torrent, archive, statistics, share
5760
- [x] password login, Cookie login, web login
5861
- [x] support EX site
5962
- [x] vote for Tag, watch and hidden tags
@@ -64,7 +67,6 @@ mush thanks to these projects🙇‍
6467
## Feature Todo
6568

6669
- [ ] customize Archive Page, support automatic unzip and read directly
67-
- [ ] customize Statistic Page
6870
- [ ] support sharing favorite
6971

7072
## Improvement & Todo
@@ -81,6 +83,11 @@ mush thanks to these projects🙇‍
8183

8284
## Bug
8385

86+
1. Local cookie file will be broken in some cases, causing login status invalid, and now I don't know why.
87+
In logs, we can see errors like `_hostSet hasn't been initializeed`.
88+
Can be solved by logout and login again temporarily.
89+
90+
8491
## Main Dart Dependencies
8592

8693
- dependency management, state management, l18n, NoSQL: get

README_cn.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
E-hentai 的一个移动端app。
88

99
仍在起步阶段,欢迎提交issue。
10+
1011
## 下载&安装
1112

1213
[下载](https://github.com/jiangtian616/JHenTai/releases)
@@ -37,16 +38,19 @@ E-hentai 的一个移动端app。
3738

3839
## 截图
3940

40-
<img width="250" style="margin-right:10px" src="screenshot/1.jpg"/> <img width="250" style="margin-right:10px" src="screenshot/2.jpg"/> <img width="250" src="screenshot/3.jpg"/>
41+
<img width="250" style="margin-right:10px" src="screenshot/1.jpg"/>
42+
<img width="250" style="margin-right:10px" src="screenshot/2.jpg"/>
43+
<img width="250" style="margin-right:10px" src="screenshot/3.jpg"/>
44+
<img width="250" src="screenshot/4.jpg"/>
4145

42-
<img width="770" src="screenshot/4.png"/>
46+
<img width="770" src="screenshot/0.png"/>
4347

4448
## 主要功能
4549

4650
- [x] 主页、热门、收藏、关注、历史,支持多种画廊样式
4751
- [x] 搜索、搜索Tag提示、点击Tag快捷搜索、以图搜图、跳页
4852
- [x] 在线阅读与下载,支持恢复下载记录
49-
- [x] 收藏、评分、磁力、归档、分享
53+
- [x] 收藏、评分、磁力、归档、统计、分享
5054
- [x] 账号密码登录、Cookie登录、Web登录
5155
- [x] 支持里站
5256
- [x] Tag翻译、Tag投票、关注Tag、隐藏Tag
@@ -56,9 +60,7 @@ E-hentai 的一个移动端app。
5660

5761
## 功能Todo
5862

59-
- [ ] 接入E站本身的My Tags
6063
- [ ] 自定义归档视图,支持下载完后自动解压、阅读
61-
- [ ] 自定义统计视图
6264
- [ ] 支持收藏夹分享
6365

6466
## 优化Todo
@@ -74,6 +76,8 @@ E-hentai 的一个移动端app。
7476

7577
## 已知bug
7678

79+
1. 本地Cookie文件记录会因不明原因而损坏,导致登录状态失效。日志中可以见到 `_hostSet hasn't been initializeed` 等字样,暂时可以通过注销再重新登陆解决。
80+
7781
## 主要dart依赖
7882

7983
- 依赖管理、状态管理、国际化、NoSQL:get

lib/src/l18n/en_US.dart

+10
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@ class en_US {
9090
'addNewHiddenTagSetSuccess': 'Add New Hidden Tag Set Success',
9191
'addNewTagSetSuccessHint': 'You can check your tags at Setting->EH->My Tags',
9292
'addNewTagSetFailed': 'Add New Tag Set Failed',
93+
'VisitorStatistics': 'Visitor Statistics',
94+
'invisible2UserWithoutDonation': 'This gallery\'s stats is invisible to user without donation',
95+
'getGalleryStatisticsFailed': 'Get Gallery Statistics Failed',
96+
'totalVisits': 'Total Visits',
97+
'visits': 'Visits',
98+
'imageAccesses': 'Image Accesses',
99+
'period': 'Period',
100+
'ranking': 'Ranking',
101+
'score': 'Score',
102+
'NotOnTheList': 'Not on the list',
93103

94104
/// comment page
95105
'newComment': 'New Comment',

lib/src/l18n/zh_CN.dart

+10
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@ class zh_CN {
9090
'addNewHiddenTagSetSuccess': '添加新隐藏标签成功',
9191
'addNewTagSetSuccessHint': '你可以在 设置->EH->我的标签 查看你的所有标签',
9292
'addNewTagSetFailed': '添加新标签数据失败',
93+
'VisitorStatistics': '访问数据',
94+
'invisible2UserWithoutDonation': '该画廊统计数据对未捐赠用户不可见',
95+
'getGalleryStatisticsFailed': '获取画廊统计数据失败',
96+
'totalVisits': '总访问量',
97+
'visits': '访问数',
98+
'imageAccesses': '图片访问数',
99+
'period': '时间段',
100+
'ranking': '排行',
101+
'score': '分数',
102+
'NotOnTheList': '未上榜',
93103

94104
/// comment page
95105
'newComment': '新评论',

lib/src/model/gallery_stats.dart

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
class GalleryStats {
2+
int totalVisits;
3+
4+
int? allTimeRanking;
5+
int? allTimeScore;
6+
int? yearRanking;
7+
int? yearScore;
8+
int? monthRanking;
9+
int? monthScore;
10+
int? dayRanking;
11+
int? dayScore;
12+
13+
List<VisitStat> yearlyStats;
14+
List<VisitStat> monthlyStats;
15+
List<VisitStat> dailyStats;
16+
17+
GalleryStats({
18+
required this.totalVisits,
19+
this.allTimeRanking,
20+
this.allTimeScore,
21+
this.yearRanking,
22+
this.yearScore,
23+
this.monthRanking,
24+
this.monthScore,
25+
this.dayRanking,
26+
this.dayScore,
27+
required this.yearlyStats,
28+
required this.monthlyStats,
29+
required this.dailyStats,
30+
});
31+
}
32+
33+
class VisitStat {
34+
/// 1. 2013
35+
/// 2. January
36+
/// 3. 1st
37+
String period;
38+
39+
/// 1. 16.2M
40+
/// 2. 570K
41+
/// 3. 5731
42+
double visits;
43+
44+
/// 1. 16.2M
45+
/// 2. 570K
46+
/// 3. 5731
47+
double hits;
48+
49+
VisitStat({
50+
required this.period,
51+
required this.visits,
52+
required this.hits,
53+
});
54+
}

lib/src/network/eh_request.dart

+9
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,15 @@ class EHRequest {
342342
return parser(response);
343343
}
344344

345+
static Future<T> requestStatPage<T>({
346+
required int gid,
347+
required String token,
348+
required EHHtmlParser<T> parser,
349+
}) async {
350+
Response<String> response = await _dio.get('${EHConsts.EStat}?gid=$gid&t=$token');
351+
return parser(response);
352+
}
353+
345354
static Future<T> requestAddTagSet<T>({
346355
required String tag,
347356
String? tagColor,

lib/src/pages/details/details_page_logic.dart

+2-8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import 'package:get/get.dart';
77
import 'package:jhentai/src/model/gallery_thumbnail.dart';
88
import 'package:jhentai/src/network/eh_request.dart';
99
import 'package:jhentai/src/pages/details/widget/favorite_dialog.dart';
10+
import 'package:jhentai/src/pages/details/widget/stat_dialog.dart';
1011
import 'package:jhentai/src/pages/details/widget/torrent_dialog.dart';
1112
import 'package:jhentai/src/pages/search/search_page_logic.dart';
1213
import 'package:jhentai/src/routes/routes.dart';
@@ -404,14 +405,7 @@ class DetailsPageLogic extends GetxController {
404405
}
405406

406407
Future<void> handleTapStatistic() async {
407-
List<Cookie> cookies = await EHRequest.getCookie(Uri.parse(EHConsts.EIndex));
408-
toNamed(
409-
Routes.webview,
410-
arguments: {
411-
'url': '${EHConsts.EStat}?gid=${state.gallery!.gid}&t=${state.gallery!.token}',
412-
'cookies': CookieUtil.parse2String(cookies)
413-
},
414-
);
408+
Get.dialog(const StatDialog());
415409
}
416410

417411
void goToReadPage([int? index]) {

0 commit comments

Comments
 (0)