diff --git a/code/docs/.vscode/settings.json b/code/docs/.vscode/settings.json index c50e3ef9..ad104b19 100644 --- a/code/docs/.vscode/settings.json +++ b/code/docs/.vscode/settings.json @@ -49,5 +49,9 @@ "scss", "pcss", "postcss" - ] + ], + + "markdown.copyFiles.destination": { + "**/*.md": "${documentDirName}/assets/${unixTime}.${fileExtName}" + } } diff --git a/code/docs/docs/coding/uniapp/01-基础配置.md b/code/docs/docs/coding/uniapp/01-基础配置.md new file mode 100644 index 00000000..16fe9392 --- /dev/null +++ b/code/docs/docs/coding/uniapp/01-基础配置.md @@ -0,0 +1,34 @@ +## 设置页面背景色 + +在 `pages.json` 中设置 `backgroundColor` 并未生效。 + +设置全局背景色在 `App.vue` 中进行设置 + +```css + + +``` + +设置单个页面背景色就在对应的页面中设置 + +```css + + +``` + + +``` css + +``` \ No newline at end of file diff --git a/code/docs/docs/coding/uniapp/02-h5低版本浏览器适配.md b/code/docs/docs/coding/uniapp/02-h5低版本浏览器适配.md new file mode 100644 index 00000000..11eedf20 --- /dev/null +++ b/code/docs/docs/coding/uniapp/02-h5低版本浏览器适配.md @@ -0,0 +1,100 @@ +## 白屏问题 + +环境: + +- 浏览器:Chrome56 +- Unibest:快速开发框架,官网:https://unibest.tech/ + +出现白屏参考上面的方案。 + +使用的是 Vscode 模板的话,直接参考 [vue3\_低版本浏览器适配.md](..\vue\vue3\vue3_低版本浏览器适配.md) + +使用的是 Hbuilderx 模板的话,在根目录下添加`vite.config.js`文件 + +```js +import Uni from '@dcloudio/vite-plugin-uni' +import legacy from '@vitejs/plugin-legacy' +import { defineConfig } from 'vite' + +export default defineConfig({ + plugins: [ + uni(), + legacyPlugin({ + // 配置参考上面的 md 文件 + }) + ] +}) +``` + +## 原生Tabbar遮挡 + +如果Uniapp原生的Tabbar会遮挡一部分内容,这是因为部分低版本浏览器可能不支持 `env` 计算函数,所以导致整个样式设置失效。 + +**解决方案:** + +新建 `/hooks/useSafeAreaBottom` 文件夹 + +在该目录下新建 `index.ts` 和 `index.css` 文件,添加一下内容 +`index.css`: + +```css +.safe-area-bottom { + padding-bottom: 50px; + padding-bottom: calc(50px + constant(safe-area-inset-bottom)); + padding-bottom: calc(50px + env(safe-area-inset-bottom)); +} +// 设置为50px是因为Uniapp的tabber的高度固定为50px。 +``` + +`index.ts`: + +```ts +import './index.css' + +export function useSafeAreaBottom(): { + safeAreaInsets: UniApp.GetSystemInfoResult['safeAreaInsets'] + needSafeAreaBottom: boolean +} { + const systemInfo = uni.getSystemInfoSync() + + const safeAreaInsets: UniApp.GetSystemInfoResult['safeAreaInsets'] + = systemInfo.safeAreaInsets ?? { + top: 0, + bottom: 0, + left: 0, + right: 0, + } + + // ✅ 仅检测是否支持 env(safe-area-inset-bottom) + const supportsEnv + = typeof window !== 'undefined' + && 'CSS' in window + && typeof CSS.supports === 'function' + && CSS.supports('padding-bottom', 'env(safe-area-inset-bottom)') + + const needSafeAreaBottom = !supportsEnv + + return { + safeAreaInsets, + needSafeAreaBottom, + } +} +``` + +使用: + +```html + + + +``` diff --git a/code/docs/docs/coding/uniapp/03-离线自定义基座_原生插件.md b/code/docs/docs/coding/uniapp/03-离线自定义基座_原生插件.md new file mode 100644 index 00000000..47a583df --- /dev/null +++ b/code/docs/docs/coding/uniapp/03-离线自定义基座_原生插件.md @@ -0,0 +1,381 @@ +> 背景:现在使用 HBuilderX 打自定义基座的话,一个账号会有限制次数。并且时间过慢。 + +## 1. 安装 Android Studio + +使用该工具进行自定义基座。 + +下载地址:https://developer.android.com/studio?hl=zh-cn + +按照顺序安装即可,注意SDK的位置不要安装到C盘 + +## 2. 下载 HBuilderX 离线SDK + +下载地址:https://nativesupport.dcloud.net.cn/AppDocs/download/android.html + +**注意:下载的 SDK 的版本需要与 HBuilderX 的版本保持一致。** + +历史版本:https://pan.baidu.com/share/init?surl=KtOCtMZJSgfAayHNjTpdTg&pwd=4hvi + +## 3. 导入 HBuilder-Integrate-AS 项目到 Android Studio + +解压从 HBuilderX 下载后的 Android-SDK,使用 Android Studio 打开解压后的 HBuilder-Integrate-AS 项目。 + +![alt text](assets/1767860095770.png) + +导入成功后,会发现目录只有部分内容。 + +![alt text](assets/1767860105639.png) + +这时候需要将 Android 更新为 Project 既可查看到项目全部内容 + +![alt text](assets/1767860116406.png) + +修改后的效果 + +![alt text](assets/1767860127749.png) + +## 4. 配置 Andriod Studio + +配置 JDK ,配置路径:Settings - Build - Build Tools - Gradle + +将 Gradle JDK 的路径修改为本地的路径,修改后点击 `Apply` 即可。注意:JDK 的版本需要和 Gradle 的版本进行适配,如果不适配那么运行的时候也会有详细的报错信息。 + +![alt text](assets/1767860213983.png) + +## 5. Uniapp开发者中心 申请相关信息 + +### 5.1 创建应用 + +首先根据应用名称检查是否已经存在当前的项目。 + +![alt text](assets/1767860225084.png) + +有过没有的话则点击右上角的 `创建应用` 按钮进行创建: + +![alt text](assets/1767860300109.png) + +创建成功后会添加到 **我的应用** 列表中 + +![alt text](assets/1767860311950.png) + +点击对应的 **应用名称** 即可进入对应的应用 + +### 5.2 申请云端证书 + +点击创建证书 + +![alt text](assets/1767860326407.png) + +因为需要时间,过段时间刷新即可 + +![alt text](assets/1767860336247.png) + +创建成功后,点击 **证书详情 ** 这里面有需要的一些信息。 + +需要的有 别名、MD5、SHA1、SHA256 + +![alt text](assets/1767860347571.png) + +同时还需要证书密码,点击 **查看证书密码 ** 即可获取到。 + +![alt text](assets/1767860358483.png) + +现在记录的信息有: 别名、MD5、SHA1、SHA256、证书密码 + +注意下载申请过的证书,后面需要用到 + +![alt text](assets/1767860370727.png) + +### 5.3 新增平台信息 + +进入 **各平台信息** ,点击 **新增** 按钮 + +![alt text](assets/1767860380849.png) + +填写以下信息,注意填写包名(任意),该包名后面使用到。这个时候 SHA1、MD5、SHA256 就是在 [5.2 申请云端证书](#52-申请云端证书) 章节申请的信息。 + +![alt text](assets/1767860391828.png) + +创建成功后就会显示 + +![alt text](assets/1767860402803.png) + +创建离线Key,点击刚刚创建的平台信息的 创建离线Key 按钮 + +![alt text](assets/1767860413675.png) + +点击进行创建,创建成功后,会显示 **查看离线Key** + +![alt text](assets/1767860423452.png) + +点击查看对应的离线Key,主要保留该值,后面会用到 + +## 6. 配置导入过的 HBuilder-Integrate-AS 项目 + +配置 `HBuilder-Integrate-AS\simpleDemo\build.gradle` ,这些修改的信息 已经都在 [5. Uniapp开发者中心 申请相关信息](#5-Uniapp开发者中心 申请相关信息) 申请过了,我已标注。注意下载云端证书,并放到 simpleDemo 目录下。 + +![alt text](assets/1767860437778.png) + +替换 离线Key(该值就在 [5.3 新增平台信息](#53-新增平台信息) 申请过了),配置 `HBuilder-Integrate-AS\simpleDemo\src\main\AndroidManifest.xml` 文件。 + +![alt text](assets/1767860447485.png) + +配置 `HBuilder-Integrate-AS\simpleDemo\src\main\assets\data\dcloud_control.xml` ,替换自己项目的appid。 + +![alt text](assets/1767860459644.png) + +## 7. Hbuilder X 导出本地打包资源 + +注意 APPID 需要和创建应用的 appid 保持一致。如果不一致,可以去源码视图进行修改 + +![alt text](assets/1767860475275.png) + +导出成功后,路径参考: + +![alt text](assets/1767860484887.png) + +复制 **resources** 文件夹下面文件夹,然后替换 **HBuilder-Integrate-AS** 项目中的 `HBuilder-Integrate-AS\simpleDemo\src\main\assets\apps\__UNI__A` 目录,将 `__UNI__A` 文件夹替换为导出的 `__UNI__9063282` 文件夹,替换后如下: + +![alt text](assets/1767860494289.png) + +确保 应用版本名称 和 应用版本号保持一致 + +![alt text](assets/1767860503374.png) + +![alt text](assets/1767860510261.png) + +## 8. 运行项目 + +先进行加载配置好的项目 + +![alt text](assets/1767860524973.png) + +加载成功后即可出现蓝色运行按钮,点击运行即可 + +![alt text](assets/1767860536194.png) + +## 9. 导入原生插件 + +> 如果不需要该步可以忽略,不影响自定义基座。 + +参考网站:https://zh.uniapp.dcloud.io/plugin/native-plugin.html#%E6%9C%AC%E5%9C%B0%E6%8F%92%E4%BB%B6-%E9%9D%9E%E5%86%85%E7%BD%AE%E5%8E%9F%E7%94%9F%E6%8F%92%E4%BB%B6 + +### 9.1 下载插件 + +这里用 **DCloud-RichAlert** 举例,插件下载地址:https://ext.dcloud.net.cn/plugin?id=36 + +下载完毕后,新建 **nativeplugins** 文件夹,将解压后的插件放到该文件夹下面 + +![alt text](assets/1767860546989.png) + +9.2 配置本地插件 + +![alt text](assets/1767860556154.png) + +选择插件 + +![alt text](assets/1767860566602.png) + +配置成功页面 + +![alt text](assets/1767860575227.png) + +然后就可以使用啦,在页面中添加测试代码 + +```html + + + + +``` + +当然,现在还没有结束,如果需要在本地看到效果,需要重复 [7. Hbuilder X 导出本地打包资源](#7-Hbuilder X 导出本地打包资源) 步骤,将新的打包资源将旧的替换掉。 + +### 9.3 配置项目 + +**重要的下一步**,将 `nativeplugins\DCloud-RichAlert\android\uniplugin_richalert.aar` 复制到 `HBuilder-Integrate-AS\simpleDemo\libs` 文件夹下。 + +![alt text](assets/1767860605362.png) + +然后呢,还没有结束哦。 + +在assets目录下创建 **dcloud_uniplugins.json** 文件,添加以下内容 + +```json +{ + "nativePlugins": [ + { + "plugins": [ + { + "type": "module", + "name": "DCloud-RichAlert", + "class": "uni.dcloud.io.uniplugin_richalert.RichAlertWXModule" + } + ] + } + ] +} +``` +![alt text](assets/1767860623138.png) + +### 9.4 配置gradle文件 + +添加制定依赖。 + +``` +dependencies { + implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: []) + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' + implementation 'androidx.core:core:1.1.0' + implementation "androidx.fragment:fragment:1.1.0" + implementation 'androidx.recyclerview:recyclerview:1.1.0' + implementation 'com.facebook.fresco:fresco:2.5.0' + implementation "com.facebook.fresco:animated-gif:2.5.0" + implementation 'com.github.bumptech.glide:glide:4.9.0' + implementation 'com.alibaba:fastjson:1.2.83' + implementation 'androidx.webkit:webkit:1.5.0' + // 基座需要,必须添加。主要是这个是 + implementation 'com.github.bumptech.glide:glide:4.9.0' +} +``` + +![alt text](assets/1767860638268.png) + +### 9.5 运行项目 + +然后就是可以重新运行项目啦。运行成功的结果如下: + +![alt text](assets/1767860648404.png) + +## 10. 自定义基座 + +### 10.1 Debug 配置 + +修改 `HBuilder-Integrate-AS\simpleDemo\src\main\assets\data\dcloud_control.xml` 文件,设置 Debug 模式: + +```xml + + + + + +``` + +![alt text](assets/1767860660364.png) + +修改 `HBuilder-Integrate-AS\simpleDemo\build.gradle` 在该文件中添加 **okhttp3** 依赖 + +``` +dependencies { + implementation "com.alibaba:fastjson:1.2.83" + implementation "com.squareup.okhttp3:okhttp:3.12.12" +} +``` + +![alt text](assets/1767860678022.png) + +### 10.2 导入 Debug SDK + +需要导入的 SDK 位于 `Android-SDK@4.66.82418_20250520\SDK\libs` 中 + +![alt text](assets/1767860687556.png) + +将 **debug-server-release.aar** 复制到 **libs** 下面 + +![alt text](assets/1767860696316.png) + +### 10.3 生成APK文件 + +![alt text](assets/1767860704777.png) + +生成后会生成在 debug 目录下 + +![alt text](assets/1767860712216.png) + +### 10.4 复制APK文件到HBuilderX中 + +1. 在HBuilderX项目中创建创建 unpackage 目录,在 unpackage 目录中创建 debug 目录,将上述生成的APK文件拷贝到debug目录中。 +2. **重命名**文件为 **android_debug.apk**,目录结构参考下图 + ![alt text](assets/1767860732712.png) + +### 10.5 运行自定义基座 + +![alt text](assets/1767860747593.png) + +选择自定义基座 + +![alt text](assets/1767860756953.png) + +点击运行,运行结果如下: + +![alt text](assets/1767860772664.png) + +同时能支持 **热更新** 。修改下,查看效果吧。 + +![alt text](assets/1767860784873.png) + +## 11. 模块及三方 SDK 配置 + +参考官网:https://nativesupport.dcloud.net.cn/AppDocs/usemodule/androidModuleConfig/others.html \ No newline at end of file diff --git a/code/docs/docs/coding/uniapp/assets/1767860095770.png b/code/docs/docs/coding/uniapp/assets/1767860095770.png new file mode 100644 index 00000000..9f65c6eb Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860095770.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860105639.png b/code/docs/docs/coding/uniapp/assets/1767860105639.png new file mode 100644 index 00000000..d9d9babb Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860105639.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860116406.png b/code/docs/docs/coding/uniapp/assets/1767860116406.png new file mode 100644 index 00000000..94d49741 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860116406.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860127749.png b/code/docs/docs/coding/uniapp/assets/1767860127749.png new file mode 100644 index 00000000..c8bad823 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860127749.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860213983.png b/code/docs/docs/coding/uniapp/assets/1767860213983.png new file mode 100644 index 00000000..07b214de Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860213983.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860225084.png b/code/docs/docs/coding/uniapp/assets/1767860225084.png new file mode 100644 index 00000000..9af26f42 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860225084.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860300109.png b/code/docs/docs/coding/uniapp/assets/1767860300109.png new file mode 100644 index 00000000..1eab321f Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860300109.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860311950.png b/code/docs/docs/coding/uniapp/assets/1767860311950.png new file mode 100644 index 00000000..a1b7fc90 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860311950.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860326407.png b/code/docs/docs/coding/uniapp/assets/1767860326407.png new file mode 100644 index 00000000..a068a651 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860326407.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860336247.png b/code/docs/docs/coding/uniapp/assets/1767860336247.png new file mode 100644 index 00000000..cedae602 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860336247.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860347571.png b/code/docs/docs/coding/uniapp/assets/1767860347571.png new file mode 100644 index 00000000..fb5b8156 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860347571.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860358483.png b/code/docs/docs/coding/uniapp/assets/1767860358483.png new file mode 100644 index 00000000..eac6480e Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860358483.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860370727.png b/code/docs/docs/coding/uniapp/assets/1767860370727.png new file mode 100644 index 00000000..5b4a1d81 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860370727.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860380849.png b/code/docs/docs/coding/uniapp/assets/1767860380849.png new file mode 100644 index 00000000..cfb86a1c Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860380849.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860391828.png b/code/docs/docs/coding/uniapp/assets/1767860391828.png new file mode 100644 index 00000000..b4401aa1 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860391828.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860402803.png b/code/docs/docs/coding/uniapp/assets/1767860402803.png new file mode 100644 index 00000000..6eeb6c24 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860402803.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860413675.png b/code/docs/docs/coding/uniapp/assets/1767860413675.png new file mode 100644 index 00000000..13d82a67 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860413675.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860423452.png b/code/docs/docs/coding/uniapp/assets/1767860423452.png new file mode 100644 index 00000000..844e78ed Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860423452.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860437778.png b/code/docs/docs/coding/uniapp/assets/1767860437778.png new file mode 100644 index 00000000..a91b83b5 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860437778.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860447485.png b/code/docs/docs/coding/uniapp/assets/1767860447485.png new file mode 100644 index 00000000..9c916b33 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860447485.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860459644.png b/code/docs/docs/coding/uniapp/assets/1767860459644.png new file mode 100644 index 00000000..0e947480 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860459644.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860475275.png b/code/docs/docs/coding/uniapp/assets/1767860475275.png new file mode 100644 index 00000000..8dd9e715 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860475275.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860484887.png b/code/docs/docs/coding/uniapp/assets/1767860484887.png new file mode 100644 index 00000000..373e6af2 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860484887.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860494289.png b/code/docs/docs/coding/uniapp/assets/1767860494289.png new file mode 100644 index 00000000..930ccb9c Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860494289.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860503374.png b/code/docs/docs/coding/uniapp/assets/1767860503374.png new file mode 100644 index 00000000..f921f2e1 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860503374.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860510261.png b/code/docs/docs/coding/uniapp/assets/1767860510261.png new file mode 100644 index 00000000..ec5b9b20 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860510261.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860524973.png b/code/docs/docs/coding/uniapp/assets/1767860524973.png new file mode 100644 index 00000000..2a93c62a Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860524973.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860536194.png b/code/docs/docs/coding/uniapp/assets/1767860536194.png new file mode 100644 index 00000000..9fd10391 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860536194.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860546989.png b/code/docs/docs/coding/uniapp/assets/1767860546989.png new file mode 100644 index 00000000..3d146bfd Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860546989.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860556154.png b/code/docs/docs/coding/uniapp/assets/1767860556154.png new file mode 100644 index 00000000..abcf7981 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860556154.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860566602.png b/code/docs/docs/coding/uniapp/assets/1767860566602.png new file mode 100644 index 00000000..aef57835 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860566602.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860575227.png b/code/docs/docs/coding/uniapp/assets/1767860575227.png new file mode 100644 index 00000000..4bf2ae9a Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860575227.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860605362.png b/code/docs/docs/coding/uniapp/assets/1767860605362.png new file mode 100644 index 00000000..3ad00ed9 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860605362.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860623138.png b/code/docs/docs/coding/uniapp/assets/1767860623138.png new file mode 100644 index 00000000..89f738cb Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860623138.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860638268.png b/code/docs/docs/coding/uniapp/assets/1767860638268.png new file mode 100644 index 00000000..df47ccc5 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860638268.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860648404.png b/code/docs/docs/coding/uniapp/assets/1767860648404.png new file mode 100644 index 00000000..ab64a596 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860648404.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860660364.png b/code/docs/docs/coding/uniapp/assets/1767860660364.png new file mode 100644 index 00000000..a63a3951 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860660364.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860678022.png b/code/docs/docs/coding/uniapp/assets/1767860678022.png new file mode 100644 index 00000000..25523ea1 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860678022.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860687556.png b/code/docs/docs/coding/uniapp/assets/1767860687556.png new file mode 100644 index 00000000..7cb9c6c0 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860687556.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860696316.png b/code/docs/docs/coding/uniapp/assets/1767860696316.png new file mode 100644 index 00000000..021fc4a2 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860696316.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860704777.png b/code/docs/docs/coding/uniapp/assets/1767860704777.png new file mode 100644 index 00000000..124daf25 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860704777.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860712216.png b/code/docs/docs/coding/uniapp/assets/1767860712216.png new file mode 100644 index 00000000..8437995b Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860712216.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860732712.png b/code/docs/docs/coding/uniapp/assets/1767860732712.png new file mode 100644 index 00000000..0c5cda4d Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860732712.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860747593.png b/code/docs/docs/coding/uniapp/assets/1767860747593.png new file mode 100644 index 00000000..3b2deb6e Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860747593.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860756953.png b/code/docs/docs/coding/uniapp/assets/1767860756953.png new file mode 100644 index 00000000..1918fd0b Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860756953.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860772664.png b/code/docs/docs/coding/uniapp/assets/1767860772664.png new file mode 100644 index 00000000..efcc36a2 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860772664.png differ diff --git a/code/docs/docs/coding/uniapp/assets/1767860784873.png b/code/docs/docs/coding/uniapp/assets/1767860784873.png new file mode 100644 index 00000000..99abba46 Binary files /dev/null and b/code/docs/docs/coding/uniapp/assets/1767860784873.png differ diff --git a/code/docs/docs/coding/vue/低版本浏览器适配.md b/code/docs/docs/coding/vue/低版本浏览器适配.md new file mode 100644 index 00000000..eff07ed2 --- /dev/null +++ b/code/docs/docs/coding/vue/低版本浏览器适配.md @@ -0,0 +1,65 @@ +环境: +- 浏览器:Chrome56 +- Vue:^3.5.15 +- Vite:6.3.5 + +解决方案: + +`@vitejs/plugin-legacy` ,该包是Vite提供的一个插件,为打包后的文件提供传统浏览器兼容性支持。官网:https://github.com/vitejs/vite/tree/main/packages/plugin-legacy + +`terser`,主要用于压缩代码,还有代码混淆、源码映射等功能。 + +```bash +pnpm i @vitejs/plugin-legacy terser -D +``` + +安装上述依赖后,在 `vite.config.ts/js` 中添加以下内容: + +```ts +import legacy from '@vitejs/plugin-legacy' +// 在插件处添加一下功能 +plugins: [ + legacy({ + // 目标浏览器环境,'defaults' 是浏览器列表默认设置,支持 Chrome 56 及以上 + targets: ['defaults', 'Chrome >= 56'], + + // 额外引入的兼容性 polyfill,这里加入了对 generator 函数的支持 + additionalLegacyPolyfills: ['regenerator-runtime/runtime'], + + // 是否生成兼容旧浏览器的代码块(chunk) + renderLegacyChunks: true, + + // 需要引入的具体 polyfill 列表,确保目标环境缺失的 API 得到支持 + polyfills: [ + 'es.symbol', // Symbol 支持 + 'es.array.filter', // Array.prototype.filter 支持 + 'es.promise', // Promise 支持 + 'es.promise.finally', // Promise.prototype.finally 支持 + 'es.object.assign', // Object.assign 支持 + 'es.map', // Map 支持 + 'es.set', // Set 支持 + 'es.array.for-each', // Array.prototype.forEach 支持 + 'es.object.define-properties', // Object.defineProperties 支持 + 'es.object.define-property', // Object.defineProperty 支持 + 'es.object.get-own-property-descriptor', // Object.getOwnPropertyDescriptor 支持 + 'es.object.get-own-property-descriptors', // Object.getOwnPropertyDescriptors 支持 + 'es.object.keys', // Object.keys 支持 + 'es.object.to-string', // Object.prototype.toString 支持 + 'web.dom-collections.for-each', // DOM 集合的 forEach 支持 + 'esnext.global-this', // 全局变量 globalThis 支持 + 'esnext.string.match-all', // String.prototype.matchAll 支持 + 'es.array.iterator', // 数组迭代器支持 + 'es.string.includes', // String.prototype.includes 支持 + 'es.string.starts-with', // String.prototype.startsWith 支持 + 'es.object.values', // Object.values 支持 + ], + }), +] +``` + +`targets` 可以参考:[Browserslist官网](https://github.com/browserslist/browserslist) 查询 + +**注意该方案只在打包后生效。** + + + diff --git a/code/docs/docs/dev-tools/docusaurus/插件/02-giscus-评论.md b/code/docs/docs/dev-tools/docusaurus/插件/02-giscus-评论.md new file mode 100644 index 00000000..383610e6 --- /dev/null +++ b/code/docs/docs/dev-tools/docusaurus/插件/02-giscus-评论.md @@ -0,0 +1,271 @@ +## 1. 准备一个 github 仓库 + +> 新建 或 已存在 的库都可以 + +修改配置:`/Settings/General` + +保证仓库的 Danger Zone - visibility 是 public的 + +![alt text](assets/1767853063727.png) + +开启 Features - Discussions 功能 + +![alt text](assets/1767853047679.png) + +## 2. 配置 [giscus](https://github.com/apps/giscus) + +在 github 中开启 giscus 功能,可根据需求选择指定的仓库或公共仓库 + +![alt text](assets/1767853481078.png) + +开启完毕后进入 [giscus](https://github.com/apps/giscus) 的官网,然后按照顺序配置: + +1. 选择语言 +2. **仓库**:输入刚刚准备好的 github 仓库地址 +3. **页面 ↔️ discussion 映射关系** 选择 **Discussion 的标题包含页面的 pathname** +4. **Discussion 分类** 选择第一个 **Announcements** +5. 其他保持默认即可 + +然后下滑找到 **启用 giscus** 模块,里面的 ` + + ) +} diff --git a/code/docs/src/theme/BlogPostPage/index.js b/code/docs/src/theme/BlogPostPage/index.js new file mode 100644 index 00000000..99aa9ca9 --- /dev/null +++ b/code/docs/src/theme/BlogPostPage/index.js @@ -0,0 +1,91 @@ +import { + BlogPostProvider, + useBlogPost, +} from '@docusaurus/plugin-content-blog/client' +import { HtmlClassNameProvider, ThemeClassNames } from '@docusaurus/theme-common' +import BlogLayout from '@theme/BlogLayout' +import BlogPostItem from '@theme/BlogPostItem' +import BlogPostPageMetadata from '@theme/BlogPostPage/Metadata' +import BlogPostPageStructuredData from '@theme/BlogPostPage/StructuredData' +import BlogPostPaginator from '@theme/BlogPostPaginator' +import ContentVisibility from '@theme/ContentVisibility' +import TOC from '@theme/TOC' +import clsx from 'clsx' +import React, { useEffect, useRef } from 'react' + +function BlogPostPageContent({ sidebar, children }) { + const { metadata, toc } = useBlogPost() + const { nextItem, prevItem, frontMatter } = metadata + const { + hide_table_of_contents: hideTableOfContents, + toc_min_heading_level: tocMinHeadingLevel, + toc_max_heading_level: tocMaxHeadingLevel, + } = frontMatter + + const commentElement = useRef(null) + + useEffect(() => { + // Update the document title using the browser API + let s = document.createElement('script') + s.src = 'https://giscus.app/client.js' + s.setAttribute('data-repo', 'oneao/docs') + s.setAttribute('data-repo-id', 'R_kgDOQ1seUQ') + s.setAttribute('data-category', 'Announcements') + s.setAttribute('data-category-id', 'DIC_kwDOQ1seUc4C0swY') + s.setAttribute('data-mapping', 'pathname') + s.setAttribute('data-reactions-enabled', '1') + s.setAttribute('data-emit-metadata', '0') + s.setAttribute('data-input-position', 'bottom') + s.setAttribute('data-theme', document.documentElement.getAttribute('data-theme')) + s.setAttribute('data-lang', 'zh-CN') + s.setAttribute('crossorigin', 'anonymous') + s.async = true + commentElement.current.appendChild(s) + }, []) + + return ( + 0 + ? ( + + ) + : undefined + } + > + + + {children} + + {(nextItem || prevItem) && ( + + )} + +
+
+ ) +} +export default function BlogPostPage(props) { + const BlogPostContent = props.content + return ( + + + + + + + + + + ) +} diff --git a/code/docs/src/theme/DocItem/Layout/index.js b/code/docs/src/theme/DocItem/Layout/index.js new file mode 100644 index 00000000..2f09ad8d --- /dev/null +++ b/code/docs/src/theme/DocItem/Layout/index.js @@ -0,0 +1,81 @@ +import { useDoc } from '@docusaurus/plugin-content-docs/client' +import { useWindowSize } from '@docusaurus/theme-common' +import ContentVisibility from '@theme/ContentVisibility' +import DocBreadcrumbs from '@theme/DocBreadcrumbs' +import DocItemContent from '@theme/DocItem/Content' +import DocItemFooter from '@theme/DocItem/Footer' +import DocItemPaginator from '@theme/DocItem/Paginator' +import DocItemTOCDesktop from '@theme/DocItem/TOC/Desktop' +import DocItemTOCMobile from '@theme/DocItem/TOC/Mobile' +import DocVersionBadge from '@theme/DocVersionBadge' +import DocVersionBanner from '@theme/DocVersionBanner' +import clsx from 'clsx' +import React, { useEffect, useRef } from 'react' +import styles from './styles.module.css' +/** + * Decide if the toc should be rendered, on mobile or desktop viewports + */ +function useDocTOC() { + const { frontMatter, toc } = useDoc() + const windowSize = useWindowSize() + const hidden = frontMatter.hide_table_of_contents + const canRender = !hidden && toc.length > 0 + const mobile = canRender ? : undefined + const desktop + = canRender && (windowSize === 'desktop' || windowSize === 'ssr') + ? ( + + ) + : undefined + return { + hidden, + mobile, + desktop, + } +} +export default function DocItemLayout({ children }) { + const docTOC = useDocTOC() + const { metadata } = useDoc() + + const commentElement = useRef(null) + + useEffect(() => { + // Update the document title using the browser API + let s = document.createElement('script') + s.src = 'https://giscus.app/client.js' + s.setAttribute('data-repo', 'oneao/docs') + s.setAttribute('data-repo-id', 'R_kgDOQ1seUQ') + s.setAttribute('data-category', 'Announcements') + s.setAttribute('data-category-id', 'DIC_kwDOQ1seUc4C0swY') + s.setAttribute('data-mapping', 'pathname') + s.setAttribute('data-reactions-enabled', '1') + s.setAttribute('data-emit-metadata', '0') + s.setAttribute('data-input-position', 'bottom') + s.setAttribute('data-theme', document.documentElement.getAttribute('data-theme')) + s.setAttribute('data-lang', 'zh-CN') + s.setAttribute('crossorigin', 'anonymous') + s.async = true + commentElement.current.appendChild(s) + }, []) + + return ( +
+
+ + +
+
+ + + {docTOC.mobile} + {children} +
+ +
+ +
+
+ {docTOC.desktop &&
{docTOC.desktop}
} +
+ ) +} diff --git a/code/docs/src/theme/DocItem/Layout/styles.module.css b/code/docs/src/theme/DocItem/Layout/styles.module.css new file mode 100644 index 00000000..d5aaec13 --- /dev/null +++ b/code/docs/src/theme/DocItem/Layout/styles.module.css @@ -0,0 +1,10 @@ +.docItemContainer header + *, +.docItemContainer article > *:first-child { + margin-top: 0; +} + +@media (min-width: 997px) { + .docItemCol { + max-width: 75% !important; + } +} diff --git a/code/email/Email-Springboot/src/main/java/com/email/service/impl/EmailManagementServiceImpl.java b/code/email/Email-Springboot/src/main/java/com/email/service/impl/EmailManagementServiceImpl.java index 6c524bec..1c682b03 100644 --- a/code/email/Email-Springboot/src/main/java/com/email/service/impl/EmailManagementServiceImpl.java +++ b/code/email/Email-Springboot/src/main/java/com/email/service/impl/EmailManagementServiceImpl.java @@ -350,6 +350,7 @@ public class EmailManagementServiceImpl implements EmailManagementService { if (!attachments.isEmpty()) allAttachments.addAll(attachments); current++; + double progress = Math.round(current * 1000.0 / total) / 1000.0; String title = isIncremental ? "增量拉取中" : "首次拉取最新邮件中"; String msg = String.format("正在处理第 %d 封邮件,共 %d 封", current, total); diff --git a/code/email/Email-Springboot/src/main/resources/application-sqlServer.yml b/code/email/Email-Springboot/src/main/resources/application-sqlServer.yml index 20ca0e6e..76fd04b3 100644 --- a/code/email/Email-Springboot/src/main/resources/application-sqlServer.yml +++ b/code/email/Email-Springboot/src/main/resources/application-sqlServer.yml @@ -1,5 +1,5 @@ server: - port: 8081 + port: 8088 spring: datasource: type: com.alibaba.druid.pool.DruidDataSource diff --git a/code/email/Email-Springboot/src/main/resources/application.yml b/code/email/Email-Springboot/src/main/resources/application.yml index 1090b81c..7f4e9e92 100644 --- a/code/email/Email-Springboot/src/main/resources/application.yml +++ b/code/email/Email-Springboot/src/main/resources/application.yml @@ -40,4 +40,4 @@ email: storage: base-path: D:/data/email static-path: /static/email - server-url: http://127.0.0.1:8081 + server-url: http://127.0.0.1:8088 diff --git a/code/email/Email-Vue/.env.test b/code/email/Email-Vue/.env.test index cf186007..c4197f09 100644 --- a/code/email/Email-Vue/.env.test +++ b/code/email/Email-Vue/.env.test @@ -1 +1 @@ -VITE_SERVER_BASEURL = 'http://127.0.0.1:8081' \ No newline at end of file +VITE_SERVER_BASEURL = 'http://127.0.0.1:8088' \ No newline at end of file diff --git a/code/email/Email-Vue/src/components/email-editor/index.vue b/code/email/Email-Vue/src/components/email-editor/index.vue index ee9590e6..3bfa3cd3 100644 --- a/code/email/Email-Vue/src/components/email-editor/index.vue +++ b/code/email/Email-Vue/src/components/email-editor/index.vue @@ -99,7 +99,7 @@ const init = { } // 只在执行“插入表格”命令时添加样式 - editor.on("ExecCommand", (e: any) => { + editor.on("ExecCommand", (e: any) => { if (e.command === "mceInsertTable") { // 延迟一下让表格插入完毕 setTimeout(() => {