diff --git a/.cursor/rules/a.mdc b/.cursor/rules/a.mdc new file mode 100644 index 0000000..f790a3a --- /dev/null +++ b/.cursor/rules/a.mdc @@ -0,0 +1,28 @@ +--- +description: +globs: +alwaysApply: true +--- + +当前项目是uniapp开发微信小程序 + + +每次编写代码时,请你先查看我的整个目录,提供的哪些文件、组件、功能、API接口,了解我的代码风格,写出和我风格一致的代码 + +## 项目规则 +1、将列表以及列表中的元素封装成组件,并使用组件的方式来组织项目。使他可以复用 +2、项目中使用到的功能优先去查看uni_modules里面的组件列表,若没有则自己封装。 + +### 项目结构 +- components 放主包组件 +- pages 只放主页面 +- pages_order 放其他页面 + - components 放分包组件 + + +css语法按照scss的嵌套写法 + +白天/黑夜模式:白天模式保持当前的样式,黑夜模式颜色变暗 + + +主题色:#0A2463 \ No newline at end of file diff --git a/components/theme/DarkModeStyles.vue b/components/theme/DarkModeStyles.vue new file mode 100644 index 0000000..ef34a58 --- /dev/null +++ b/components/theme/DarkModeStyles.vue @@ -0,0 +1,156 @@ + + + + + \ No newline at end of file diff --git a/components/theme/ThemeProvider.vue b/components/theme/ThemeProvider.vue new file mode 100644 index 0000000..cdb63d0 --- /dev/null +++ b/components/theme/ThemeProvider.vue @@ -0,0 +1,32 @@ + + + + + \ No newline at end of file diff --git a/doc/dark-mode-guide.md b/doc/dark-mode-guide.md new file mode 100644 index 0000000..5b625b0 --- /dev/null +++ b/doc/dark-mode-guide.md @@ -0,0 +1,159 @@ +# 暗色主题使用指南 + +本文档介绍如何在项目中使用暗色主题功能。 + +## 概述 + +我们的应用支持白天/黑夜两种主题模式,用户可以根据自己的偏好切换。主题的状态保存在Vuex中,并且会持久化保存在本地存储中,以便下次打开应用时恢复用户的偏好设置。 + +## 使用方法 + +### 1. 在组件中使用主题混入器 + +我们提供了一个方便的混入器,可以轻松地在任何组件中使用主题相关的功能: + +```js +// 1. 导入主题混入器 +import themeMixin from '@/mixins/themeMode.js' + +export default { + // 2. 在组件中注册混入器 + mixins: [themeMixin], + + methods: { + someMethod() { + // 3. 直接使用混入器提供的属性和方法 + console.log(this.isDarkMode) // 是否为暗色模式 + console.log(this.currentTheme) // 当前主题模式:'light'或'dark' + + // 切换主题 + this.toggleThemeMode() + + // 设置为特定主题 + this.setThemeMode('dark') // 或 'light' + } + } +} +``` + +### 2. 为组件添加暗色主题样式 + +我们在`uni.scss`中定义了一系列暗色主题相关的变量,您可以在组件的样式中使用这些变量: + +```scss +/* 示例组件的样式 */ +.my-component { + background-color: #fff; + color: #333; + + /* 添加主题过渡效果 */ + @extend .theme-transition; + + /* 定义暗色主题下的样式 */ + .dark-mode & { + background-color: $dark-bg-color; + color: $dark-text-color-primary; + } +} +``` + +### 3. 使用主题组件 + +我们还提供了两个便捷的组件: + +#### ThemeProvider + +ThemeProvider是一个包装组件,它会自动传递当前的主题模式,并提供暗色主题的根容器: + +```html + + + +``` + +#### DarkModeStyles + +DarkModeStyles是一个提供通用暗色主题样式的无渲染组件,可以导入到您的页面中使用: + +```html + + + +``` + +## 可用的主题变量 + +以下是在`uni.scss`中定义的暗色主题相关变量,您可以在组件样式中使用: + +```scss +/* 背景色 */ +$dark-bg-color: #1a1a1a; // 主背景色 +$dark-bg-color-secondary: #222; // 次要背景色 +$dark-bg-color-tertiary: #333; // 第三级背景色 + +/* 文本颜色 */ +$dark-text-color-primary: #eee; // 主要文本颜色 +$dark-text-color-secondary: #bbb; // 次要文本颜色 +$dark-text-color-tertiary: #999; // 第三级文本颜色 + +/* 边框和阴影 */ +$dark-border-color: #444; // 边框颜色 +$dark-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.2); // 阴影 + +/* 强调色 */ +$dark-accent-color: #4a90e2; // 强调色 + +/* 过渡动画时间 */ +$theme-transition-duration: 0.3s; // 主题切换过渡时间 +``` + +## 最佳实践 + +1. 总是为可能受主题影响的元素添加`theme-transition`类,以确保主题切换时有平滑的过渡效果 +2. 使用预定义的变量而不是硬编码颜色值,以保持整个应用的视觉一致性 +3. 在设计组件时考虑两种主题模式,确保在暗色模式下内容仍然清晰可见 +4. 对于特定于组件的变量,可以基于全局主题变量派生: + ```scss + $my-component-bg: $dark-bg-color; + $my-component-text: $dark-text-color-primary; + ``` + +## 注意事项 + +- 当用户切换主题时,会立即应用新的主题并保存到本地存储中 +- 主题状态在整个应用中共享,任何组件都可以访问和修改它 +- 对于复杂的组件,考虑分别定义亮色和暗色两套图标或图片资源 \ No newline at end of file diff --git a/doc/布丁笔录小程序-切图x3/.DS_Store b/doc/布丁笔录小程序-切图x3/.DS_Store new file mode 100644 index 0000000..8f3f361 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/.DS_Store differ diff --git a/doc/布丁笔录小程序-切图x3/1.png b/doc/布丁笔录小程序-切图x3/1.png new file mode 100644 index 0000000..6751f08 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/1.png differ diff --git a/doc/布丁笔录小程序-切图x3/2.png b/doc/布丁笔录小程序-切图x3/2.png new file mode 100644 index 0000000..35b60b6 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/2.png differ diff --git a/doc/布丁笔录小程序-切图x3/3.png b/doc/布丁笔录小程序-切图x3/3.png new file mode 100644 index 0000000..180fbf9 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/3.png differ diff --git a/doc/布丁笔录小程序-切图x3/Group 2681.png b/doc/布丁笔录小程序-切图x3/Group 2681.png new file mode 100644 index 0000000..a80425c Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/Group 2681.png differ diff --git a/doc/布丁笔录小程序-切图x3/Group 2878-1.png b/doc/布丁笔录小程序-切图x3/Group 2878-1.png new file mode 100644 index 0000000..052d551 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/Group 2878-1.png differ diff --git a/doc/布丁笔录小程序-切图x3/Group 2878-2.png b/doc/布丁笔录小程序-切图x3/Group 2878-2.png new file mode 100644 index 0000000..5150221 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/Group 2878-2.png differ diff --git a/doc/布丁笔录小程序-切图x3/Group 2878-3.png b/doc/布丁笔录小程序-切图x3/Group 2878-3.png new file mode 100644 index 0000000..9e08809 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/Group 2878-3.png differ diff --git a/doc/布丁笔录小程序-切图x3/Group 2878.png b/doc/布丁笔录小程序-切图x3/Group 2878.png new file mode 100644 index 0000000..c2aedd4 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/Group 2878.png differ diff --git a/doc/布丁笔录小程序-切图x3/image-1.png b/doc/布丁笔录小程序-切图x3/image-1.png new file mode 100644 index 0000000..644f786 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/image-1.png differ diff --git a/doc/布丁笔录小程序-切图x3/image-2.png b/doc/布丁笔录小程序-切图x3/image-2.png new file mode 100644 index 0000000..f43db67 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/image-2.png differ diff --git a/doc/布丁笔录小程序-切图x3/image-3.png b/doc/布丁笔录小程序-切图x3/image-3.png new file mode 100644 index 0000000..d9f301a Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/image-3.png differ diff --git a/doc/布丁笔录小程序-切图x3/image-4.png b/doc/布丁笔录小程序-切图x3/image-4.png new file mode 100644 index 0000000..4492a01 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/image-4.png differ diff --git a/doc/布丁笔录小程序-切图x3/image-5.png b/doc/布丁笔录小程序-切图x3/image-5.png new file mode 100644 index 0000000..6ce666e Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/image-5.png differ diff --git a/doc/布丁笔录小程序-切图x3/image-6.png b/doc/布丁笔录小程序-切图x3/image-6.png new file mode 100644 index 0000000..7c7f356 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/image-6.png differ diff --git a/doc/布丁笔录小程序-切图x3/image-7.png b/doc/布丁笔录小程序-切图x3/image-7.png new file mode 100644 index 0000000..e0f7c20 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/image-7.png differ diff --git a/doc/布丁笔录小程序-切图x3/image.png b/doc/布丁笔录小程序-切图x3/image.png new file mode 100644 index 0000000..e9f9a4b Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/image.png differ diff --git a/doc/布丁笔录小程序-切图x3/下.png b/doc/布丁笔录小程序-切图x3/下.png new file mode 100644 index 0000000..add8564 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/下.png differ diff --git a/doc/布丁笔录小程序-切图x3/书城-1.png b/doc/布丁笔录小程序-切图x3/书城-1.png new file mode 100644 index 0000000..1be8f59 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/书城-1.png differ diff --git a/doc/布丁笔录小程序-切图x3/书城-2.png b/doc/布丁笔录小程序-切图x3/书城-2.png new file mode 100644 index 0000000..97cb2e0 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/书城-2.png differ diff --git a/doc/布丁笔录小程序-切图x3/书城.png b/doc/布丁笔录小程序-切图x3/书城.png new file mode 100644 index 0000000..6ed8577 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/书城.png differ diff --git a/doc/布丁笔录小程序-切图x3/书架.png b/doc/布丁笔录小程序-切图x3/书架.png new file mode 100644 index 0000000..502b5f3 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/书架.png differ diff --git a/doc/布丁笔录小程序-切图x3/任务中心.png b/doc/布丁笔录小程序-切图x3/任务中心.png new file mode 100644 index 0000000..f460eac Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/任务中心.png differ diff --git a/doc/布丁笔录小程序-切图x3/修改信息.png b/doc/布丁笔录小程序-切图x3/修改信息.png new file mode 100644 index 0000000..85311d6 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/修改信息.png differ diff --git a/doc/布丁笔录小程序-切图x3/全部公告.png b/doc/布丁笔录小程序-切图x3/全部公告.png new file mode 100644 index 0000000..99b58b8 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/全部公告.png differ diff --git a/doc/布丁笔录小程序-切图x3/加.png b/doc/布丁笔录小程序-切图x3/加.png new file mode 100644 index 0000000..dad33bf Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/加.png differ diff --git a/doc/布丁笔录小程序-切图x3/加载.png b/doc/布丁笔录小程序-切图x3/加载.png new file mode 100644 index 0000000..619e662 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/加载.png differ diff --git a/doc/布丁笔录小程序-切图x3/取消删除.png b/doc/布丁笔录小程序-切图x3/取消删除.png new file mode 100644 index 0000000..e0f98f6 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/取消删除.png differ diff --git a/doc/布丁笔录小程序-切图x3/右.png b/doc/布丁笔录小程序-切图x3/右.png new file mode 100644 index 0000000..2b603ac Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/右.png differ diff --git a/doc/布丁笔录小程序-切图x3/失败.png b/doc/布丁笔录小程序-切图x3/失败.png new file mode 100644 index 0000000..1253759 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/失败.png differ diff --git a/doc/布丁笔录小程序-切图x3/布丁小说logo.png b/doc/布丁笔录小程序-切图x3/布丁小说logo.png new file mode 100644 index 0000000..bf0340d Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/布丁小说logo.png differ diff --git a/doc/布丁笔录小程序-切图x3/成功.png b/doc/布丁笔录小程序-切图x3/成功.png new file mode 100644 index 0000000..ac87a61 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/成功.png differ diff --git a/doc/布丁笔录小程序-切图x3/我的.png b/doc/布丁笔录小程序-切图x3/我的.png new file mode 100644 index 0000000..5f905b6 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/我的.png differ diff --git a/doc/布丁笔录小程序-切图x3/我的等级.png b/doc/布丁笔录小程序-切图x3/我的等级.png new file mode 100644 index 0000000..e818119 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/我的等级.png differ diff --git a/doc/布丁笔录小程序-切图x3/我的评论.png b/doc/布丁笔录小程序-切图x3/我的评论.png new file mode 100644 index 0000000..fcd5c7a Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/我的评论.png differ diff --git a/doc/布丁笔录小程序-切图x3/投推荐票.png b/doc/布丁笔录小程序-切图x3/投推荐票.png new file mode 100644 index 0000000..3b34b2e Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/投推荐票.png differ diff --git a/doc/布丁笔录小程序-切图x3/推荐票.png b/doc/布丁笔录小程序-切图x3/推荐票.png new file mode 100644 index 0000000..1040205 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/推荐票.png differ diff --git a/doc/布丁笔录小程序-切图x3/申请成为创作者.png b/doc/布丁笔录小程序-切图x3/申请成为创作者.png new file mode 100644 index 0000000..cedbf43 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/申请成为创作者.png differ diff --git a/doc/布丁笔录小程序-切图x3/礼物盒.png b/doc/布丁笔录小程序-切图x3/礼物盒.png new file mode 100644 index 0000000..6449fc5 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/礼物盒.png differ diff --git a/doc/布丁笔录小程序-切图x3/移除书架.png b/doc/布丁笔录小程序-切图x3/移除书架.png new file mode 100644 index 0000000..05f05d2 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/移除书架.png differ diff --git a/doc/布丁笔录小程序-切图x3/移除全部.png b/doc/布丁笔录小程序-切图x3/移除全部.png new file mode 100644 index 0000000..2540c27 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/移除全部.png differ diff --git a/doc/布丁笔录小程序-切图x3/联系客服.png b/doc/布丁笔录小程序-切图x3/联系客服.png new file mode 100644 index 0000000..ec31519 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/联系客服.png differ diff --git a/doc/布丁笔录小程序-切图x3/读者榜单.png b/doc/布丁笔录小程序-切图x3/读者榜单.png new file mode 100644 index 0000000..8469bac Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/读者榜单.png differ diff --git a/doc/布丁笔录小程序-切图x3/退出登录.png b/doc/布丁笔录小程序-切图x3/退出登录.png new file mode 100644 index 0000000..348d071 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/退出登录.png differ diff --git a/doc/布丁笔录小程序-切图x3/钱包流水.png b/doc/布丁笔录小程序-切图x3/钱包流水.png new file mode 100644 index 0000000..d99b08c Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/钱包流水.png differ diff --git a/doc/布丁笔录小程序-切图x3/首页.png b/doc/布丁笔录小程序-切图x3/首页.png new file mode 100644 index 0000000..9f70337 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/首页.png differ diff --git a/doc/布丁笔录小程序-切图x3/默认头像.png b/doc/布丁笔录小程序-切图x3/默认头像.png new file mode 100644 index 0000000..65d23e6 Binary files /dev/null and b/doc/布丁笔录小程序-切图x3/默认头像.png differ diff --git a/main.js b/main.js index f971a7f..7891599 100644 --- a/main.js +++ b/main.js @@ -9,7 +9,7 @@ Vue.config.productionTip = false App.mpType = 'app' -import store from '@/store/store' +import store from '@/store/store.js' import './config' import './utils/index.js' @@ -25,6 +25,12 @@ import navbar from '@/components/base/navbar.vue' Vue.component('configPopup',configPopup) Vue.component('navbar',navbar) +// 注册全局store +Vue.prototype.$store = store + +// 初始化主题模式 +store.commit('initThemeMode') + const app = new Vue({ ...App, store, diff --git a/mixins/themeMode.js b/mixins/themeMode.js new file mode 100644 index 0000000..b53ba82 --- /dev/null +++ b/mixins/themeMode.js @@ -0,0 +1,18 @@ +import { mapGetters, mapMutations } from 'vuex' + +/** + * 主题模式混合器 + * 提供了isDarkMode和currentTheme计算属性,以及toggleThemeMode和setThemeMode方法 + * 使用方法: + * 1. 在组件中导入:import themeMixin from '@/mixins/themeMode.js' + * 2. 在组件中注册:mixins: [themeMixin] + * 3. 然后可以使用:this.isDarkMode 和 this.toggleThemeMode() 等 + */ +export default { + computed: { + ...mapGetters(['isDarkMode', 'currentTheme']) + }, + methods: { + ...mapMutations(['toggleThemeMode', 'setThemeMode']) + } +} \ No newline at end of file diff --git a/pages_order/components/novel/README.md b/pages_order/components/novel/README.md new file mode 100644 index 0000000..3b67c57 --- /dev/null +++ b/pages_order/components/novel/README.md @@ -0,0 +1,141 @@ +# 小说阅读相关组件 + +本目录包含小说阅读页面使用的各种公共组件,所有组件都支持暗色主题模式。 + +## 组件列表 + +### 1. 订阅弹窗 (subscriptionPopup.vue) + +中心弹出的订阅章节提示弹窗。 + +#### 使用方法 + +```html + + + +``` + +### 2. 支付弹窗 (paymentPopup.vue) + +从底部弹出的支付方式选择弹窗。 + +#### 使用方法 + +```html + + + +``` + +### 3. 章节目录弹窗 (chapterPopup.vue) + +显示小说章节列表的弹窗。 + +#### 使用方法 + +```html + + + +``` + +### 4. 评分弹窗 (novelVotePopup.vue) + +用于评价小说的弹窗组件。 + +## 暗色主题支持 + +所有组件都支持暗色主题模式,当系统切换到暗色模式或用户手动切换时,组件会自动应用暗色样式。 + +### 主题切换 + +主题的状态保存在Vuex中,可以通过以下方式切换: + +```js +// 切换主题模式 +this.$store.commit('toggleThemeMode') + +// 设置为特定模式 +this.$store.commit('setThemeMode', 'dark') // 或 'light' + +// 获取当前主题模式 +const isDarkMode = this.$store.getters.isDarkMode +``` + +### 使用主题混入器 + +为了方便在组件中使用主题相关功能,可以引入主题混入器: + +```js +import themeMixin from '@/mixins/themeMode.js' + +export default { + mixins: [themeMixin], + + // 然后可以直接使用以下属性和方法 + created() { + console.log(this.isDarkMode) // 是否为暗色模式 + console.log(this.currentTheme) // 'light' 或 'dark' + + // 切换主题 + this.toggleThemeMode() + } +} +``` + +详细的文档请参考 `doc/dark-mode-guide.md`。 \ No newline at end of file diff --git a/pages_order/components/novel/chapterPopup.vue b/pages_order/components/novel/chapterPopup.vue index aefd743..c3e25dc 100644 --- a/pages_order/components/novel/chapterPopup.vue +++ b/pages_order/components/novel/chapterPopup.vue @@ -1,29 +1,34 @@ \ No newline at end of file diff --git a/pages_order/components/novel/subscriptionPopup.vue b/pages_order/components/novel/subscriptionPopup.vue new file mode 100644 index 0000000..cf5d280 --- /dev/null +++ b/pages_order/components/novel/subscriptionPopup.vue @@ -0,0 +1,159 @@ + + + + + \ No newline at end of file diff --git a/pages_order/novel/Giftbox.vue b/pages_order/novel/Giftbox.vue index 34f00a5..6364994 100644 --- a/pages_order/novel/Giftbox.vue +++ b/pages_order/novel/Giftbox.vue @@ -1,13 +1,8 @@