diff --git a/App.vue b/App.vue
index 82ff1a6..8281a62 100644
--- a/App.vue
+++ b/App.vue
@@ -13,7 +13,7 @@
diff --git a/components/nav-bar/nav-bar.vue b/components/nav-bar/nav-bar.vue
index c0c3de0..7106200 100644
--- a/components/nav-bar/nav-bar.vue
+++ b/components/nav-bar/nav-bar.vue
@@ -2,7 +2,11 @@
-
+
+
+
+
+
diff --git a/locale/en.json b/locale/en.json
index 6133184..4c1de75 100644
--- a/locale/en.json
+++ b/locale/en.json
@@ -10,7 +10,10 @@
"close": "Close",
"confirm": "Confirm",
"loading": "Loading",
- "tips": "Tips"
+ "tips": "Tips",
+ "searchNoResult": "No search results found",
+ "more": "More",
+ "dataNull": "No data available"
},
"tabar.course": "COURSE",
"tabar.book": "EBOOK",
@@ -19,7 +22,7 @@
"title": "Taimed International",
"schema": "Schema",
"demo": "uni-app globalization",
- "demo-description": "Include uni-framework, manifest.json, pages.json, tabbar, Page, Component, API, Schema",
+ "demoDescription": "Include uni-framework, manifest.json, pages.json, tabbar, Page, Component, API, Schema",
"detail": "Detail",
"language": "Language",
"language-info": "Settings",
@@ -250,9 +253,14 @@
"deleteSuccess": "Deleted"
},
"home": {
+ "block1": "My Books",
+ "block2": "Recommended",
+ "more": "More",
+ "activityTitle": "Featured Books",
"readingCount": " reads",
"listenCount": " listens",
- "purchased": " purchased"
+ "purchased": " purchased",
+ "searchPlaceholder": "Search books..."
},
"listen": {
"title": "Audio Book",
diff --git a/locale/zh-Hans.json b/locale/zh-Hans.json
index 8dd831c..31bdba5 100644
--- a/locale/zh-Hans.json
+++ b/locale/zh-Hans.json
@@ -10,7 +10,10 @@
"close": "关闭",
"confirm": "确认",
"loading": "加载中",
- "tips": "提示"
+ "tips": "提示",
+ "searchNoResult": "暂无搜索结果",
+ "more": "更多",
+ "dataNull": "暂无数据"
},
"tabar.course": "课程",
"tabar.book": "图书",
@@ -19,7 +22,7 @@
"title": "太湖国际",
"schema": "Schema",
"demo": "uni-app 国际化演示",
- "demo-description": "包含 uni-framework、manifest.json、pages.json、tabbar、页面、组件、API、Schema",
+ "demoDescription": "包含 uni-framework、manifest.json、pages.json、tabbar、页面、组件、API、Schema",
"detail": "详情",
"language": "语言",
"language-info": "语言信息",
@@ -251,9 +254,14 @@
"deleteSuccess": "删除成功"
},
"home": {
+ "block1": "我的书单",
+ "block2": "推荐图书",
+ "more": "更多",
+ "activityTitle": "活动图书",
"readingCount": "次阅读",
"listenCount": "次听书",
- "purchased": "人购买"
+ "purchased": "人购买",
+ "searchPlaceholder": "搜索图书..."
},
"listen": {
"title": "听书",
diff --git a/manifest.json b/manifest.json
index a9f429b..dcf0c1b 100644
--- a/manifest.json
+++ b/manifest.json
@@ -3,7 +3,7 @@
"appid" : "__UNI__1250B39",
"description" : "",
"versionName" : "1.0.1",
- "versionCode" : "100",
+ "versionCode" : 101,
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
@@ -38,10 +38,14 @@
"",
"",
""
- ]
+ ],
+ "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],
+ "minSdkVersion" : 21
},
/* ios打包配置 */
- "ios" : {},
+ "ios" : {
+ "dSYMs" : false
+ },
/* SDK配置 */
"sdkConfigs" : {}
}
diff --git a/package.json b/package.json
index 9d7b1df..e40383c 100644
--- a/package.json
+++ b/package.json
@@ -9,8 +9,8 @@
"中医学 国学 心理学"
],
"scripts": {
- "tailwind-dev": "npx @tailwindcss/cli -i ./tailwind-input.css -o ./static/tailwind.css --watch",
- "tailwind-build": "npx @tailwindcss/cli -i ./tailwind-input.css -o ./static/tailwind.css"
+ "tailwind-dev": "npx @tailwindcss/cli -i ./tailwind-input.css -o ./style/tailwind.css --watch",
+ "tailwind-build": "npx @tailwindcss/cli -i ./tailwind-input.css -o ./style/tailwind.css"
},
"dcloudext": {
"sale": {
diff --git a/pages.json b/pages.json
index a2e20b6..0b9760f 100644
--- a/pages.json
+++ b/pages.json
@@ -103,6 +103,12 @@
"navigationStyle": "custom",
"navigationBarTitleText": "%book.read%"
}
+ }, {
+ "path": "pages/book/search",
+ "style": {
+ "navigationStyle": "custom",
+ "navigationBarTitleText": "%home.searchPlaceholder%"
+ }
}, {
"path": "pages/book/listen/index",
"style": {
diff --git a/pages/book/README.md b/pages/book/README.md
deleted file mode 100644
index 1248394..0000000
--- a/pages/book/README.md
+++ /dev/null
@@ -1,207 +0,0 @@
-# 我的书单功能模块
-
-## 概述
-
-本模块是从nuttyreading项目迁移并升级到Vue3+TypeScript+Pinia+TailwindCSS+WotUI+i18n技术栈的"我的书单"功能。
-
-## 功能列表
-
-### 1. 书单列表 (`pages/book/index.vue`)
-- ✅ 显示用户已购买的所有书籍
-- ✅ 分页加载
-- ✅ 空状态处理
-- ✅ 支持跳转到详情、阅读器、听书、书评页面
-- ✅ iOS平台自动隐藏书评按钮
-
-### 2. 书籍详情 (`pages/book/detail.vue`)
-- ✅ 显示书籍封面、标题、作者、简介
-- ✅ 显示阅读数、听书数、购买数统计
-- ✅ 显示前2条书评(非iOS)
-- ✅ 显示相关推荐书籍
-- ✅ 根据购买状态显示不同操作按钮
-- ✅ 购买弹窗
-
-### 3. 书评系统 (`pages/book/review.vue`)
-- ✅ 评论列表展示
-- ✅ 发表评论(富文本编辑器)
-- ✅ 点赞/取消点赞
-- ✅ 回复评论
-- ✅ 删除评论
-- ✅ 分页加载更多
-- ✅ Emoji支持(待完善)
-
-### 4. 阅读器 (`pages/book/reader.vue`)
-- ✅ 上下滚动模式
-- ✅ 左右翻页模式
-- ✅ 字体大小调节(8个级别)
-- ✅ 主题切换(5种主题)
-- ✅ 章节目录
-- ✅ 阅读进度保存和恢复
-- ✅ 图片内容显示
-- ✅ 试读限制提示
-
-### 5. 听书功能
-#### 章节列表 (`pages/book/listen/index.vue`)
-- ✅ 显示书籍信息
-- ✅ 章节列表
-- ✅ 章节锁定状态
-- ✅ 音频文件检查
-
-#### 音频播放器 (`pages/book/listen/player.vue`)
-- ✅ 音频播放/暂停
-- ✅ 进度条控制
-- ✅ 快进/快退(15秒)
-- ✅ 上一章/下一章
-- ✅ 播放速度调节(0.5x - 2x)
-- ✅ 自动播放下一章
-- ✅ 封面旋转动画
-
-## 技术栈
-
-- **框架**: Vue3 Composition API
-- **语言**: TypeScript
-- **状态管理**: Pinia
-- **UI组件**: WotUI
-- **样式**: SCSS + TailwindCSS
-- **国际化**: vue-i18n
-
-## 文件结构
-
-```
-pages/book/
-├── index.vue # 书单列表
-├── detail.vue # 书籍详情
-├── review.vue # 书评页面
-├── reader.vue # 阅读器
-└── listen/
- ├── index.vue # 听书章节列表
- └── player.vue # 音频播放器
-
-components/book/
-├── CustomNavbar.vue # 自定义导航栏
-├── BookCard.vue # 书籍卡片
-└── CommentList.vue # 评论列表
-
-api/modules/
-└── book.ts # 书籍API
-
-stores/
-└── book.ts # 书籍状态管理
-
-types/
-└── book.d.ts # 类型定义
-```
-
-## API接口
-
-所有API接口保持与原项目完全一致:
-
-- `bookAbroad/home/getbooks` - 获取我的书单
-- `bookAbroad/home/getBookInfo` - 获取书籍详情
-- `bookAbroad/home/getBookReadCount` - 获取统计数据
-- `bookAbroad/home/getRecommendBook` - 获取推荐书籍
-- `bookAbroad/getBookAbroadCommentTree` - 获取评论列表
-- `bookAbroad/insertBookAbroadComment` - 发表评论
-- `bookAbroad/insertBookAbroadCommentLike` - 点赞
-- `bookAbroad/delBookAbroadCommentLike` - 取消点赞
-- `bookAbroad/delBookAbroadComment` - 删除评论
-- `bookAbroad/home/getBookChapter` - 获取章节列表
-- `bookAbroad/home/getBookChapterContent` - 获取章节内容
-- `bookAbroad/home/getBookReadRate` - 获取阅读进度
-- `bookAbroad/home/insertBookReadRate` - 保存阅读进度
-
-## 国际化
-
-支持中文和英文两种语言,所有文本通过i18n配置管理。
-
-### 翻译键
-- `book.*` - 书单相关
-- `details.*` - 详情相关
-- `listen.*` - 听书相关
-- `common.*` - 通用文本
-
-## 平台适配
-
-### iOS特殊处理
-- 书评功能在iOS平台自动隐藏
-- 使用条件编译 `#ifdef APP-PLUS` 判断平台
-
-### 刘海屏适配
-- 所有页面自动适配状态栏高度
-- 使用 `uni.getSystemInfoSync().safeArea` 获取安全区域
-
-## 使用说明
-
-### 1. 从书单列表进入
-```typescript
-uni.navigateTo({
- url: '/pages/book/index'
-})
-```
-
-### 2. 直接进入书籍详情
-```typescript
-uni.navigateTo({
- url: `/pages/book/detail?id=${bookId}`
-})
-```
-
-### 3. 进入阅读器
-```typescript
-// 已购买
-uni.navigateTo({
- url: `/pages/book/reader?isBuy=0&bookId=${bookId}`
-})
-
-// 试读
-uni.navigateTo({
- url: `/pages/book/reader?isBuy=1&bookId=${bookId}&count=${freeChapterCount}`
-})
-```
-
-### 4. 进入听书
-```typescript
-uni.navigateTo({
- url: `/pages/book/listen/index?bookId=${bookId}`
-})
-```
-
-## 注意事项
-
-1. **不要修改API接口**:所有接口地址和参数必须与原项目保持一致
-2. **UI组件使用WotUI**:不要使用uView或uni-ui组件
-3. **国际化文本**:所有文本必须通过i18n配置,不能硬编码
-4. **iOS平台**:注意书评功能的隐藏处理
-5. **类型安全**:充分利用TypeScript类型检查
-
-## 待优化项
-
-1. Emoji选择器组件需要集成完整的Emoji库
-2. 阅读器可以添加更多主题
-3. 音频播放器可以添加播放列表功能
-4. 可以添加书签功能
-5. 可以添加笔记功能
-
-## 测试清单
-
-- [ ] 书单列表加载和分页
-- [ ] 书籍详情所有信息显示
-- [ ] 书评发表、点赞、删除
-- [ ] 阅读器两种模式切换
-- [ ] 阅读器字体和主题设置
-- [ ] 阅读进度保存和恢复
-- [ ] 听书播放控制
-- [ ] 听书速度调节
-- [ ] iOS平台书评隐藏
-- [ ] 试读/试听限制
-- [ ] 国际化文本切换
-
-## 更新日志
-
-### v1.0.0 (2024-01-XX)
-- ✅ 完成从Vue2到Vue3的迁移
-- ✅ 完成TypeScript类型定义
-- ✅ 完成Pinia状态管理
-- ✅ 完成WotUI组件替换
-- ✅ 完成国际化配置
-- ✅ 完成所有功能页面
diff --git a/pages/book/index.vue b/pages/book/index.vue
index 1da8775..0d7b8d7 100644
--- a/pages/book/index.vue
+++ b/pages/book/index.vue
@@ -1,24 +1,844 @@
-
- 这是一个等待开发的图书首页
- 内容是在线图书
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('home.block1') }}
+
+ {{ $t('home.more') }}
+
+
+
+
+
+ {{ item.name }}
+
+
+ {{ $t('common.data_null') }}
+
+
+
+
+ {{ $t('home.block2') }}
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+ {{ $t('home.activityTitle') }}
+
+
+
+ {{ item.title }}
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+ {{ $t('global.dataNull') }}
+
+
+
+
+
+
+
+
+ {{ item.title }}
+
+
+
+
+
+
+
+
+ {{ item.title }}
+
+
+
+
+
+
+
+
+ {{ item.name }}
+ {{
+ formatPrice(item)
+ }}
+ {{
+ formatStats(item)
+ }}
+
+
+ {{ $t('global.dataNull') }}
+
+
-
diff --git a/pages/book/reader.vue b/pages/book/reader.vue
index dc07b6a..bbd1386 100644
--- a/pages/book/reader.vue
+++ b/pages/book/reader.vue
@@ -99,6 +99,8 @@
+
+
@@ -108,7 +110,7 @@
{{ $t('book.language') }}
-
+
{{ lang.language }}
@@ -162,10 +164,9 @@
-
-
-
+
+
@@ -407,7 +408,7 @@ async function loadChapterContent(chapterId: number, index: number) {
}
// 切换章节
-function switchChapter(chapter: IChapter, index: number) {
+async function switchChapter(chapter: IChapter, index: number) {
if (isLocked(index)) {
uni.showToast({
title: t('book.afterPurchase'),
@@ -416,7 +417,8 @@ function switchChapter(chapter: IChapter, index: number) {
return
}
- loadChapterContent(chapter.id, index)
+ await loadChapterContent(chapter.id, index)
+ showControls.value = false
}
// 判断章节是否锁定
@@ -796,6 +798,10 @@ function goBack() {
.setting-item {
margin-bottom: 40rpx;
+
+ &:last-child {
+ margin-bottom: 0;
+ }
.setting-label {
display: block;
@@ -866,11 +872,6 @@ function goBack() {
}
}
}
-
- /* 底部占位 */
- .setting-ooter-placeholder {
- height: 80rpx;
- }
}
.empty-state {
@@ -884,5 +885,10 @@ function goBack() {
color: #999;
}
}
+
+ /* 底部占位 */
+ .setting-ooter-placeholder {
+ height: 55px;
+ }
}
diff --git a/pages/book/search.vue b/pages/book/search.vue
new file mode 100644
index 0000000..438d247
--- /dev/null
+++ b/pages/book/search.vue
@@ -0,0 +1,293 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+ {{
+ formatPrice(item)
+ }}
+ {{
+ formatStats(item)
+ }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 6feac22..442b6ec 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -1,6 +1,6 @@
- 这是一个等待开发的首页
+ 这是一个等待开发的首页
这是一个等待开发的首页
首页的内容是在线课程
diff --git a/pages/login/README.md b/pages/login/README.md
deleted file mode 100644
index cf00687..0000000
--- a/pages/login/README.md
+++ /dev/null
@@ -1,163 +0,0 @@
-# 登录功能说明
-
-## 功能概述
-
-本模块实现了从 nuttyreading-hw2 项目迁移的完整登录功能,包括:
-
-- ✅ 验证码登录/注册
-- ✅ 密码登录
-- ✅ 忘记密码
-- ✅ 用户协议和隐私政策
-- ✅ 游客体验入口
-
-## 技术栈
-
-- Vue3 Composition API
-- TypeScript
-- Pinia (状态管理)
-- WotUI (UI 组件库)
-- Tailwind CSS + SCSS
-- UniApp
-
-## 文件结构
-
-```
-pages/user/
-├── login.vue # 登录页面
-└── forget.vue # 忘记密码页面
-
-api/modules/
-├── auth.ts # 认证相关 API
-└── common.ts # 通用 API
-
-stores/
-└── user.ts # 用户状态管理
-
-types/
-└── user.ts # 用户相关类型定义
-
-utils/
-└── validator.ts # 表单验证工具
-```
-
-## API 接口
-
-### 登录相关
-
-1. **验证码登录/注册**
- - 接口:`GET book/user/registerOrLogin`
- - 参数:`{ tel: string, code: string }`
-
-2. **密码登录**
- - 接口:`POST book/user/login`
- - 参数:`{ phone: string, password: string }`
-
-3. **重置密码**
- - 接口:`POST book/user/setPassword`
- - 参数:`{ phone: string, code: string, password: string }`
-
-### 通用接口
-
-1. **发送邮箱验证码**
- - 接口:`GET common/user/getMailCaptcha`
- - 参数:`{ email: string }`
-
-2. **获取协议内容**
- - 接口:`GET common/agreement/detail`
- - 参数:`{ id: number }` (111: 用户协议, 112: 隐私政策)
-
-## 使用说明
-
-### 1. 登录页面
-
-访问路径:`/pages/user/login`
-
-**验证码登录**:
-1. 输入邮箱地址
-2. 点击"Get Code"获取验证码
-3. 输入收到的验证码
-4. 勾选用户协议
-5. 点击"Go Login"登录
-
-**密码登录**:
-1. 点击"Password Login"切换到密码登录
-2. 输入邮箱地址和密码
-3. 勾选用户协议
-4. 点击"Go Login"登录
-
-### 2. 忘记密码
-
-访问路径:`/pages/user/forget`
-
-1. 输入邮箱地址
-2. 点击"Get Code"获取验证码
-3. 输入验证码
-4. 输入新密码(需满足强度要求)
-5. 再次输入新密码确认
-6. 点击"Submit"提交
-
-### 3. 密码强度要求
-
-- **强密码**:8位以上,包含大小写字母、数字和特殊字符
-- **中等密码**:8位以上,包含大小写字母、数字、特殊字符中的两项
-- **弱密码**:8位以上
-- **最低要求**:6-20位,必须包含字母和数字
-
-## 状态管理
-
-使用 Pinia 管理用户状态:
-
-```typescript
-import { useUserStore } from '@/stores/user'
-
-const userStore = useUserStore()
-
-// 登录成功后设置用户信息
-userStore.setUserInfo(userInfo)
-
-// 检查登录状态
-if (userStore.isLoggedIn) {
- // 已登录
-}
-
-// 登出
-userStore.logout()
-```
-
-## 国际化
-
-支持中英文切换,翻译文件位于:
-- `locale/en.json` - 英文
-- `locale/zh-Hans.json` - 简体中文
-
-## 注意事项
-
-1. **API 地址**:已配置为 `https://global.nuttyreading.com/`
-2. **请求头**:自动添加 `token`、`appType: 'abroad'`、`version_code`
-3. **Token 失效**:自动处理 401 错误,清除用户信息并跳转登录页
-4. **验证码倒计时**:60秒,防止重复发送
-5. **协议同意**:登录和获取验证码前必须同意用户协议和隐私政策
-
-## 测试建议
-
-1. 测试验证码登录流程
-2. 测试密码登录流程
-3. 测试忘记密码流程
-4. 测试登录方式切换
-5. 测试表单验证
-6. 测试协议弹窗
-7. 测试多平台兼容性(H5、小程序、APP)
-
-## 已知问题
-
-- 游客页面 `/pages/visitor/visitor` 需要单独实现
-- 部分图标可能需要根据实际设计调整
-
-## 更新日志
-
-### v1.0.0 (2025-11-02)
-- ✅ 完成登录功能迁移
-- ✅ 实现验证码登录和密码登录
-- ✅ 实现忘记密码功能
-- ✅ 添加用户协议和隐私政策
-- ✅ 支持中英文国际化
diff --git a/style/tailwind.css b/style/tailwind.css
index 0ae3471..f1f8693 100644
--- a/style/tailwind.css
+++ b/style/tailwind.css
@@ -8,7 +8,10 @@
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
"Courier New", monospace;
--color-red-500: oklch(63.7% 0.237 25.331);
- --color-emerald-600: oklch(59.6% 0.145 163.225);
+ --color-blue-500: oklch(62.3% 0.214 259.815);
+ --color-white: #fff;
+ --spacing: 0.25rem;
+ --radius-lg: 0.5rem;
--ease-out: cubic-bezier(0, 0, 0.2, 1);
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
--default-transition-duration: 150ms;
@@ -187,9 +190,6 @@
.sticky {
position: sticky;
}
- .isolate {
- isolation: isolate;
- }
.container {
width: 100%;
@media (width >= 40rem) {
@@ -229,36 +229,63 @@
.inline-block {
display: inline-block;
}
- .list-item {
- display: list-item;
- }
.table {
display: table;
}
+ .w-\[100px\] {
+ width: 100px;
+ }
+ .flex-1 {
+ flex: 1;
+ }
.flex-shrink {
flex-shrink: 1;
}
+ .border-collapse {
+ border-collapse: collapse;
+ }
.transform {
transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);
}
.resize {
resize: both;
}
+ .flex-wrap {
+ flex-wrap: wrap;
+ }
+ .rounded-lg {
+ border-radius: var(--radius-lg);
+ }
.border {
border-style: var(--tw-border-style);
border-width: 1px;
}
+ .bg-\[blue\] {
+ background-color: blue;
+ }
.bg-\[red\] {
background-color: red;
}
- .text-left {
- text-align: left;
+ .bg-\[transparent\] {
+ background-color: transparent;
+ }
+ .bg-blue-500 {
+ background-color: var(--color-blue-500);
+ }
+ .p-4 {
+ padding: calc(var(--spacing) * 4);
+ }
+ .text-center {
+ text-align: center;
+ }
+ .text-\[\#000\] {
+ color: #000;
}
.text-\[\#fff\] {
color: #fff;
}
- .capitalize {
- text-transform: capitalize;
+ .text-white {
+ color: var(--color-white);
}
.lowercase {
text-transform: lowercase;
@@ -266,9 +293,6 @@
.uppercase {
text-transform: uppercase;
}
- .italic {
- font-style: italic;
- }
.ordinal {
--tw-ordinal: ordinal;
font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);
@@ -276,10 +300,6 @@
.underline {
text-decoration-line: underline;
}
- .shadow {
- --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
- box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
- }
.ring {
--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
@@ -304,10 +324,6 @@
--tw-ease: var(--ease-in-out);
transition-timing-function: var(--ease-in-out);
}
- .ease-out {
- --tw-ease: var(--ease-out);
- transition-timing-function: var(--ease-out);
- }
.hover\:bg-red-500 {
&:hover {
@media (hover: hover) {
diff --git a/tailwind.config.js b/tailwind.config.js
index 3ac9679..f7231b3 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -1 +1,54 @@
-/** @type {import('tailwindcss').Config} */
module.exports = {
separator: '__', // 如果是小程序项目需要设置这一项,将 : 选择器替换成 __,之后 hover:bg-red-500 将改为 hover__bg-red-500
corePlugins: {
// 预设样式
preflight: false, // 一般uniapp都有预设样式,所以不需要tailwindcss的预设
// 以下功能小程序不支持
space: false, // > 子节点选择器
divideWidth: false,
divideColor: false,
divideStyle: false,
divideOpacity: false,
},
// 指定要处理的文件
content: [
'./pages/**/*.{vue,js}',
'./main.js',
'./App.vue',
'./index.html'
],
theme: {
// 字号,使用 App.vue 中的 --x-font-size 样式变量配置
fontSize(config){
const list = ['2xs','xs','sm','base','md','lg','xl','2xl','3xl'];
let result = {}
list.forEach(it=>{
result[it] = `var(--x-font-size-${it})`
})
return result
},
extend: {
// 间距,tailwindcss中默认间距是rem单位,可以统一设置为uniapp的rpx单位。
// 类似的设置根据项目需求自己调整一下就好了,没必要去安装别人的预设,其实主要是小程序不兼容的css比较多,H5和App基本都直接兼容tailwindcss默认的预设
spacing(config) {
let result = { 0: '0' }
// 允许的数值大一些也无所谓,最后打包tailwindcss会摇树优化,未使用的样式并不会打包
for (let i = 1; i <= 300; i++) {
result[i] = `${i}rpx`
}
return result
},
// 增加颜色板,现在主流UI组件库大都是采用css变量实现定制主题,所以这里引用了全局的css变量,这个css变量的定义位置可以在 App.vue 中 page{} 选择器下
// 其实tailwindcss只是一个css工具,不必局限于它内部提供的东西,灵活运用css变量这些特性完全可以整合出自己的生产力工具
colors:{
'primary': 'var(--x-color-primary)',
'tips' : 'var(--x-color-tips)'
},
},
},
plugins: [],
}
\ No newline at end of file
+/** @type {import('tailwindcss').Config} */
+module.exports = {
+ separator: '__', // 如果是小程序项目需要设置这一项,将 : 选择器替换成 __,之后 hover:bg-red-500 将改为 hover__bg-red-500
+ corePlugins: {
+ // 预设样式
+ preflight: false, // 一般uniapp都有预设样式,所以不需要tailwindcss的预设
+
+// 以下功能小程序不支持
+ space: false, // > 子节点选择器
+ divideWidth: false,
+ divideColor: false,
+ divideStyle: false,
+ divideOpacity: false,
+ },
+
+// 指定要处理的文件
+ content: [
+ './pages/**/*.{vue,js}',
+ './components/**/*.{vue,js}',
+ './main.js',
+ './App.vue',
+ './index.html'
+ ],
+ theme: {
+ // 字号,使用 App.vue 中的 --x-font-size 样式变量配置
+ fontSize(config){
+ const list = ['2xs','xs','sm','base','md','lg','xl','2xl','3xl'];
+ let result = {}
+ list.forEach(it=>{
+ result[it] = `var(--x-font-size-${it})`
+ })
+ return result
+ },
+ extend: {
+ // 间距,tailwindcss中默认间距是rem单位,可以统一设置为uniapp的rpx单位。
+ // 类似的设置根据项目需求自己调整一下就好了,没必要去安装别人的预设,其实主要是小程序不兼容的css比较多,H5和App基本都直接兼容tailwindcss默认的预设
+ spacing(config) {
+ let result = { 0: '0' }
+ // 允许的数值大一些也无所谓,最后打包tailwindcss会摇树优化,未使用的样式并不会打包
+ for (let i = 1; i <= 300; i++) {
+ result[i] = `${i}rpx`
+ }
+ return result
+ },
+ // 增加颜色板,现在主流UI组件库大都是采用css变量实现定制主题,所以这里引用了全局的css变量,这个css变量的定义位置可以在 App.vue 中 page{} 选择器下
+ // 其实tailwindcss只是一个css工具,不必局限于它内部提供的东西,灵活运用css变量这些特性完全可以整合出自己的生产力工具
+ colors:{
+ 'primary': 'var(--x-color-primary)',
+ 'tips' : 'var(--x-color-tips)'
+ },
+ },
+ },
+ plugins: [],
+}
\ No newline at end of file
diff --git a/types/book.d.ts b/types/book.d.ts
index 3b2922a..d68076a 100644
--- a/types/book.d.ts
+++ b/types/book.d.ts
@@ -89,3 +89,76 @@ export interface IReaderSettings {
theme: 'default' | 'blue' | 'green' | 'purple' | 'night'
readMode: 'scroll' | 'page'
}
+
+/** 标签数据 */
+export interface ILabel {
+ id: number
+ title: string
+ type: number // 0: 分类标签, 1: 活动标签
+ pid?: number // 父级ID(用于二级分类)
+}
+
+/** 带统计的图书数据 */
+export interface IBookWithStats extends IBook {
+ bookId: number // 图书ID(部分接口返回的字段名)
+ readCount?: number // 阅读次数
+ listenCount?: number // 听书次数
+ buyCount?: number // 购买人数
+ isVip?: string // VIP专享标识 '2'表示VIP专享
+ sysDictData?: {
+ dictValue: string // 价格数值
+ }
+}
+
+/** VIP信息 */
+export interface IVipInfo {
+ id: number
+ endTime: string
+ vipType: number
+}
+
+/** 分页数据 */
+export interface IPageData {
+ records: T[]
+ total: number
+ current: number
+ size: number
+}
+
+/** API响应基础结构 */
+export interface IApiResponse {
+ code: number
+ msg?: string
+ info?: string
+ [key: string]: any
+}
+
+/** 我的书单响应 */
+export interface IMyBooksResponse extends IApiResponse {
+ page: IPageData
+}
+
+/** 推荐图书响应 */
+export interface IRecommendBooksResponse extends IApiResponse {
+ books: IBook[]
+}
+
+/** 标签列表响应 */
+export interface ILabelListResponse extends IApiResponse {
+ lableList: ILabel[] // 注意:原接口拼写为 lableList
+}
+
+/** 图书列表响应 */
+export interface IBookListResponse extends IApiResponse {
+ bookList: IBookWithStats[]
+}
+
+/** VIP信息响应 */
+export interface IVipInfoResponse extends IApiResponse {
+ vipInfo: IVipInfo | null
+}
+
+/** 搜索结果响应 */
+export interface ISearchResponse extends IApiResponse {
+ bookList: IBookWithStats[]
+}