diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json new file mode 100644 index 00000000..be77d70f --- /dev/null +++ b/.eslintrc-auto-import.json @@ -0,0 +1,91 @@ +{ + "globals": { + "Component": true, + "ComponentPublicInstance": true, + "ComputedRef": true, + "EffectScope": true, + "ExtractDefaultPropTypes": true, + "ExtractPropTypes": true, + "ExtractPublicPropTypes": true, + "InjectionKey": true, + "PropType": true, + "Ref": true, + "VNode": true, + "WritableComputedRef": true, + "computed": true, + "createApp": true, + "customRef": true, + "defineAsyncComponent": true, + "defineComponent": true, + "effectScope": true, + "getCurrentInstance": true, + "getCurrentScope": true, + "h": true, + "inject": true, + "isProxy": true, + "isReactive": true, + "isReadonly": true, + "isRef": true, + "markRaw": true, + "nextTick": true, + "onActivated": true, + "onAddToFavorites": true, + "onBackPress": true, + "onBeforeMount": true, + "onBeforeUnmount": true, + "onBeforeUpdate": true, + "onDeactivated": true, + "onError": true, + "onErrorCaptured": true, + "onHide": true, + "onLaunch": true, + "onLoad": true, + "onMounted": true, + "onNavigationBarButtonTap": true, + "onNavigationBarSearchInputChanged": true, + "onNavigationBarSearchInputClicked": true, + "onNavigationBarSearchInputConfirmed": true, + "onNavigationBarSearchInputFocusChanged": true, + "onPageNotFound": true, + "onPageScroll": true, + "onPullDownRefresh": true, + "onReachBottom": true, + "onReady": true, + "onRenderTracked": true, + "onRenderTriggered": true, + "onResize": true, + "onScopeDispose": true, + "onServerPrefetch": true, + "onShareAppMessage": true, + "onShareTimeline": true, + "onShow": true, + "onTabItemTap": true, + "onThemeChange": true, + "onUnhandledRejection": true, + "onUnload": true, + "onUnmounted": true, + "onUpdated": true, + "provide": true, + "reactive": true, + "readonly": true, + "ref": true, + "resolveComponent": true, + "shallowReactive": true, + "shallowReadonly": true, + "shallowRef": true, + "toRaw": true, + "toRef": true, + "toRefs": true, + "toValue": true, + "triggerRef": true, + "unref": true, + "useAttrs": true, + "useCssModule": true, + "useCssVars": true, + "useSlots": true, + "watch": true, + "watchEffect": true, + "watchPostEffect": true, + "watchSyncEffect": true + } +} diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 43df0260..e86973ba 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -66,6 +66,10 @@ module.exports = { '@typescript-eslint/no-explicit-any': 'off', 'no-underscore-dangle': 'off', 'no-use-before-define': 'off', + 'no-undef': 'off', + 'no-unused-vars': 'off', + 'no-param-reassign': 'off', + '@typescript-eslint/no-unused-vars': 'off', }, // eslint-import-resolver-typescript 插件,@see https://www.npmjs.com/package/eslint-import-resolver-typescript settings: { diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..bed7e7d6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,32 @@ +--- +name: Bug report(报告问题) +about: Create a report to help us improve +--- + + + +# Bug report(问题描述) + +please write your issue description here + +## Steps to reproduce(问题复现步骤) + + + +## Screenshot or Gif(截图或动态图) + +## minimal reproduction(最小可还原代码) + +## System Info + +`npx envinfo --system --npmPackages vue --binaries --browsers` + +执行上面命令,将结果贴下面 diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..c6b45b76 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,6 @@ +--- +name: Feature Request(新功能建议) +about: Suggest an idea for this project +--- + +# Feature request(新功能建议) diff --git a/.github/workflows/deploy-h5.yml b/.github/workflows/deploy-h5.yml index c3278d8a..a6608198 100644 --- a/.github/workflows/deploy-h5.yml +++ b/.github/workflows/deploy-h5.yml @@ -19,6 +19,9 @@ jobs: build: runs-on: ubuntu-latest steps: + # 设置服务器时区为东八区 + - name: Set time zone + run: sudo timedatectl set-timezone 'Asia/Shanghai' - uses: actions/checkout@v4 - uses: pnpm/action-setup@v2 with: diff --git a/.github/workflows/deploy-laf.yml b/.github/workflows/deploy-laf.yml new file mode 100644 index 00000000..46c6108e --- /dev/null +++ b/.github/workflows/deploy-laf.yml @@ -0,0 +1,50 @@ +name: Build +on: + push: + branches: + - demosss + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +env: + # 云存储名称,比如 ukw0y1-site 只需要写 site + BUCKET_NAME: site + # 网站资源推送到云存储的目标目录(默认是根目录,会覆盖原有文件) + BUCKET_DIST_PATH: unibest-demo + # 目前本地测试过,随便一个名字就行 + LAF_APPID: feige + LAF_PAT: ${{ secrets.LAF_PAT }} + API_URL: 'https://api.laf.run' + DIST_PATH: 'dist/build/h5' +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v2 + with: + version: 8 + - uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'pnpm' + - name: Install dependencies + run: pnpm i + - name: Build + run: pnpm build:h5 + # 安装 laf-cli + - name: Install Laf-CLI + run: pnpm i laf-cli -g + # 登录 laf api + - name: Login laf-cli + run: | + laf user add ${{ env.LAF_APPID }} -r ${{ env.API_URL }} + laf user switch ${{ env.LAF_APPID }} + laf login ${{ env.LAF_PAT }} + # 初始化 Laf 应用然后将编译好的代码推送到云存储 + - name: Init appid and push + env: + LAF_APPID: ${{ env.LAF_APPID }} + run: | + laf app init ${{ env.LAF_APPID }} + laf storage push -f ${{ env.BUCKET_NAME }}/${{ env.BUCKET_DIST_PATH }} ${{ env.DIST_PATH }}/ diff --git a/.gitignore b/.gitignore index 257a781a..4de1e482 100644 --- a/.gitignore +++ b/.gitignore @@ -19,21 +19,21 @@ dist *.njsproj *.sln *.sw? +.hbuilderx .stylelintcache # rollup-plugin-visualizer 生成的分析文件 stats.html # unplugin-auto-import 生成的类型文件 auto-import.d.ts -.eslintrc-auto-import.json # unplugin-vue-components 生成的类型文件 components.d.ts # vite-plugin-uni-pages 生成的类型文件 uni-pages.d.ts # 插件生成的文件 -src/pages.json -src/manifest.json +# src/pages.json +# src/manifest.json # lock 文件还是不要了,我主要的版本写死就好了 # github actions 需要这些文件,所以留着 @@ -46,3 +46,8 @@ src/manifest.json # git rm -r --cached file1 file2 ## 针对某些文件 # git rm -r --cached dir1 dir2 ## 针对某些文件夹 # git rm -r --cached . ## 针对所有文件 + +# 要跳过检查时,使用 --no-verify 过滤 +# git commit -m 'feat: 引入 ucharts' --no-verify + +# npx @dcloudio/uvm@latest 更新 uniapp diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json deleted file mode 100644 index 5f90ebe3..00000000 --- a/.hbuilderx/launch.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ - // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 - "version": "0.0", - "configurations": [ - { - "app-plus": { - "launchtype": "local" - }, - "default": { - "launchtype": "local" - }, - "type": "uniCloud" - } - ] -} diff --git a/.npmrc b/.npmrc index d8b83868..356a6560 100644 --- a/.npmrc +++ b/.npmrc @@ -1,3 +1,6 @@ +# registry = https://registry.npmjs.org +registry = https://registry.npmmirror.com + strict-peer-dependencies=false auto-install-peers=true shamefully-hoist=true diff --git a/.prettierrc.cjs b/.prettierrc.cjs index cf108a5b..3986355e 100644 --- a/.prettierrc.cjs +++ b/.prettierrc.cjs @@ -7,6 +7,7 @@ module.exports = { semi: false, trailingComma: 'all', endOfLine: 'auto', + htmlWhitespaceSensitivity: 'ignore', overrides: [ { files: '*.json', diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 32ad8c18..a7ab418f 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,11 +1,11 @@ { "recommendations": [ "vue.volar", - "vue.vscode-typescript-vue-plugin", "stylelint.vscode-stylelint", "esbenp.prettier-vscode", "dbaeumer.vscode-eslint", "antfu.unocss", + "antfu.iconify", "evils.uniapp-vscode", "mrmaoddxxaa.create-uniapp-view", "uni-helper.uni-helper-vscode", @@ -13,6 +13,7 @@ "uni-helper.uni-highlight-vscode", "uni-helper.uni-ui-snippets-vscode", "uni-helper.uni-app-snippets-vscode", - "uni-helper.uni-cloud-snippets-vscode" + "uni-helper.uni-cloud-snippets-vscode", + "mrmlnc.vscode-json5" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 88eb9d13..5bef4dbb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -39,8 +39,10 @@ "climblee", "commitlint", "dcloudio", + "feige", "qrcode", "refresherrefresh", + "safeareainsets", "scrolltolower", "tabbar", "unibest", diff --git a/.vscode/vue3.code-snippets b/.vscode/vue3.code-snippets index 5de173ec..8656b83e 100644 --- a/.vscode/vue3.code-snippets +++ b/.vscode/vue3.code-snippets @@ -21,7 +21,10 @@ "body": [ "", "{", - " style: { navigationBarTitleText: '$1' },", + " layout: 'default',", + " style: {", + " navigationBarTitleText: '$1'," + " },", "}", "\n", " diff --git a/src/pages.json b/src/pages.json new file mode 100644 index 00000000..dfd902d8 --- /dev/null +++ b/src/pages.json @@ -0,0 +1,343 @@ +{ + "globalStyle": { + "navigationStyle": "default", + "navigationBarTitleText": "unibest", + "navigationBarBackgroundColor": "#f8f8f8", + "navigationBarTextStyle": "black", + "backgroundColor": "#FFFFFF", + "h5": { + "navigationStyle": "custom" + } + }, + "easycom": { + "autoscan": true, + "custom": { + "^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue", + "^uv-(.*)": "@climblee/uv-ui/components/uv-$1/uv-$1.vue", + "^wd-(.*)": "wot-design-uni/components/wd-$1/wd-$1.vue" + } + }, + "tabBar": { + "color": "#999999", + "selectedColor": "#018d71", + "backgroundColor": "#F8F8F8", + "borderStyle": "black", + "height": "50px", + "fontSize": "10px", + "iconWidth": "24px", + "spacing": "3px", + "list": [ + { + "iconPath": "static/tabbar/home.png", + "selectedIconPath": "static/tabbar/homeHL.png", + "pagePath": "pages/index/index", + "text": "首页" + }, + { + "iconPath": "static/tabbar/example.png", + "selectedIconPath": "static/tabbar/exampleHL.png", + "pagePath": "pages/demo/index", + "text": "示例" + } + ] + }, + "pages": [ + { + "path": "pages/index/index", + "type": "home", + "style": { + "navigationStyle": "custom", + "navigationBarTitleText": "首页" + } + }, + { + "path": "pages/demo/index", + "type": "page", + "style": { + "navigationBarTitleText": "unibest 示例" + } + }, + { + "path": "pages/index/request", + "type": "page", + "layout": "demo", + "style": { + "navigationBarTitleText": "请求" + } + }, + { + "path": "pages/login/index", + "type": "page", + "style": { + "navigationBarTitleText": "登录" + } + }, + { + "path": "pages/demo/base/auto-import", + "type": "page", + "layout": "demo", + "style": { + "navigationBarTitleText": "auto import component" + } + }, + { + "path": "pages/demo/base/enum", + "type": "page", + "hide": true, + "style": { + "navigationBarTitleText": "enum 使用" + } + }, + { + "path": "pages/demo/base/env", + "type": "page", + "style": { + "navigationBarTitleText": "环境获取" + } + }, + { + "path": "pages/demo/base/mock", + "type": "page", + "layout": "demo", + "style": { + "navigationBarTitleText": "mock" + } + }, + { + "path": "pages/demo/base/mp-weixin-share", + "type": "page", + "layout": "demo", + "style": { + "navigationBarTitleText": "微信分享" + } + }, + { + "path": "pages/demo/base/navbar", + "type": "page", + "style": { + "navigationBarTitleText": "自定义导航栏", + "navigationStyle": "custom" + } + }, + { + "path": "pages/demo/base/no-navbar", + "type": "page", + "style": { + "navigationBarTitleText": "无导航栏", + "navigationStyle": "custom" + } + }, + { + "path": "pages/demo/base/pinia", + "type": "page", + "layout": "demo", + "style": { + "navigationBarTitleText": "pinia+持久化" + } + }, + { + "path": "pages/demo/base/request", + "type": "page", + "layout": "demo", + "style": { + "navigationBarTitleText": "请求" + } + }, + { + "path": "pages/demo/base/route-interceptor", + "type": "page", + "needLogin": true, + "style": { + "navigationBarTitleText": "路由拦截" + } + }, + { + "path": "pages/demo/base/throughout", + "type": "page", + "style": { + "navigationBarTitleText": "通屏+下拉刷新+自定义导航栏", + "enablePullDownRefresh": false, + "backgroundColor": "#23c09c", + "app-plus": { + "titleNView": { + "type": "transparent" + } + }, + "mp-weixin": { + "navigationStyle": "custom" + } + } + }, + { + "path": "pages/demo/base/uni-ui-icons", + "type": "page", + "layout": "demo", + "style": { + "navigationBarTitleText": "UniUI Icons 使用" + } + }, + { + "path": "pages/demo/base/uni-ui", + "type": "page", + "layout": "demo", + "style": { + "navigationBarTitleText": "UniUI 使用" + } + }, + { + "path": "pages/demo/base/unocss-icons", + "type": "page", + "layout": "demo", + "style": { + "navigationBarTitleText": "UnoCss Icons 使用" + } + }, + { + "path": "pages/demo/base/unocss", + "type": "page", + "layout": "demo", + "style": { + "navigationBarTitleText": "UnoCss 使用" + } + }, + { + "path": "pages/demo/base/uv-ui", + "type": "page", + "style": { + "navigationBarTitleText": "uv ui" + } + }, + { + "path": "pages/demo/base/vconsole", + "type": "page", + "layout": "demo", + "style": { + "navigationBarTitleText": "小程序vConsole" + } + }, + { + "path": "pages/demo/base/wot", + "type": "page", + "layout": "demo", + "style": { + "navigationBarTitleText": "wot" + } + }, + { + "path": "pages/demo/page/clock", + "type": "page", + "layout": "demo", + "style": { + "navigationBarTitleText": "动态时钟" + } + }, + { + "path": "pages/demo/page/clock2", + "type": "page", + "layout": "demo", + "style": { + "navigationBarTitleText": "动态时钟-抗锯齿" + } + }, + { + "path": "pages/demo/page/floating-bubble", + "type": "page", + "layout": "default", + "hide": true, + "style": { + "navigationBarTitleText": "页面悬浮球" + } + }, + { + "path": "pages/demo/page/i18n", + "type": "page", + "layout": "demo", + "style": { + "navigationBarTitleText": "%app.name%" + } + }, + { + "path": "pages/demo/page/sign", + "type": "page", + "layout": "default", + "style": { + "navigationBarTitleText": "签字板" + } + }, + { + "path": "pages/demo/page/waterfall", + "type": "page", + "style": { + "navigationBarTitleText": "waterfall" + } + }, + { + "path": "pages/demo/route-interceptor/index", + "type": "page", + "style": { + "navigationBarTitleText": "登陆拦截" + } + }, + { + "path": "pages/demo/route-interceptor/login-auto", + "type": "page", + "layout": "default", + "style": { + "navigationBarTitleText": "自动登录(无需拦截)" + } + }, + { + "path": "pages/demo/route-interceptor/login-model", + "type": "page", + "style": { + "navigationBarTitleText": "登陆拦截 - 登陆弹窗" + } + }, + { + "path": "pages/demo/route-interceptor/login-page", + "type": "page", + "needLogin": true, + "style": { + "navigationBarTitleText": "登陆拦截 - 登陆页面" + } + }, + { + "path": "pages/demo/page/img-min/index", + "type": "page", + "layout": "demo", + "style": { + "navigationBarTitleText": "图片压缩" + } + }, + { + "path": "pages/demo/page/lottery/big-wheel", + "type": "page", + "layout": "demo", + "style": { + "navigationBarTitleText": "大转盘抽奖" + } + }, + { + "path": "pages/demo/page/lottery/nine-grid", + "type": "page", + "layout": "demo", + "style": { + "navigationBarTitleText": "九宫格抽奖" + } + } + ], + "subPackages": [ + { + "root": "pages-sub", + "pages": [ + { + "path": "demo/index", + "type": "page", + "style": { + "navigationBarTitleText": "分包页面 标题" + } + } + ] + } + ] +} diff --git a/src/pages/demo/base/auto-import.vue b/src/pages/demo/base/auto-import.vue index e5784fb0..b758fe7c 100644 --- a/src/pages/demo/base/auto-import.vue +++ b/src/pages/demo/base/auto-import.vue @@ -6,7 +6,13 @@ diff --git a/src/pages/demo/base/enum.vue b/src/pages/demo/base/enum.vue index 34b992cc..3802e298 100644 --- a/src/pages/demo/base/enum.vue +++ b/src/pages/demo/base/enum.vue @@ -1,16 +1,15 @@ { - style: { navigationBarTitleText: 'enum' }, + hide: true, + style: { navigationBarTitleText: 'enum 使用' }, } + + diff --git a/src/pages/demo/base/mock.vue b/src/pages/demo/base/mock.vue new file mode 100644 index 00000000..c91eaed9 --- /dev/null +++ b/src/pages/demo/base/mock.vue @@ -0,0 +1,45 @@ + +{ + layout: 'demo', + style: { + navigationBarTitleText: 'mock', + }, +} + + + + + + + diff --git a/src/pages/demo/base/mp-weixin-share.vue b/src/pages/demo/base/mp-weixin-share.vue index 9e499e4f..70c7cad5 100644 --- a/src/pages/demo/base/mp-weixin-share.vue +++ b/src/pages/demo/base/mp-weixin-share.vue @@ -27,9 +27,8 @@ onShareAppMessage((options: Page.ShareAppMessageOption): Page.CustomShareContent console.log('options:', options) return { title: '自定义分享标题', + desc: 'unibest 演示示例', path: '/pages/index/index?id=xxx', - imageUrl: - 'https://cip-shopping-page-0eysug01066a9e-1302818703.tcloudbaseapp.com/pretty-girl.png', } }) /** 激活“分享到朋友圈”, 注意:需要先激活“分享给好友” */ diff --git a/src/pages/demo/base/navbar.vue b/src/pages/demo/base/navbar.vue index 7985584a..f1a3f8c3 100644 --- a/src/pages/demo/base/navbar.vue +++ b/src/pages/demo/base/navbar.vue @@ -5,15 +5,24 @@ diff --git a/src/pages/demo/base/no-navbar.vue b/src/pages/demo/base/no-navbar.vue new file mode 100644 index 00000000..b81b5112 --- /dev/null +++ b/src/pages/demo/base/no-navbar.vue @@ -0,0 +1,20 @@ + +{ + style: { navigationBarTitleText: '无导航栏', navigationStyle: 'custom' }, +} + + + + + diff --git a/src/pages/demo/base/pinia.vue b/src/pages/demo/base/pinia.vue index 4ae0c527..08368e93 100644 --- a/src/pages/demo/base/pinia.vue +++ b/src/pages/demo/base/pinia.vue @@ -29,7 +29,7 @@ const countStore = useCountStore() const userStore = useUserStore() const setUserInfo = () => { - userStore.setUserInfo({ nickname: 'fly', avatar: '', token: 'abcdef' }) + userStore.setUserInfo({ nickname: '菲鸽', avatar: '', token: 'abcdef' }) } const clearUserInfo = () => { userStore.clearUserInfo() diff --git a/src/pages/demo/base/request.vue b/src/pages/demo/base/request.vue index 2af78a9b..f1f9fc88 100644 --- a/src/pages/demo/base/request.vue +++ b/src/pages/demo/base/request.vue @@ -37,7 +37,6 @@ + + diff --git a/src/pages/demo/base/throughout.vue b/src/pages/demo/base/throughout.vue index 10d8c7e1..07dc6e70 100644 --- a/src/pages/demo/base/throughout.vue +++ b/src/pages/demo/base/throughout.vue @@ -65,8 +65,8 @@ diff --git a/src/pages/demo/base/unocss.vue b/src/pages/demo/base/unocss.vue index 3fd903cd..6cd4d314 100644 --- a/src/pages/demo/base/unocss.vue +++ b/src/pages/demo/base/unocss.vue @@ -6,10 +6,10 @@ diff --git a/src/pages/demo/base/vconsole.vue b/src/pages/demo/base/vconsole.vue index 072f3e47..e55b4a84 100644 --- a/src/pages/demo/base/vconsole.vue +++ b/src/pages/demo/base/vconsole.vue @@ -1,7 +1,7 @@ { layout: 'demo', - style: { navigationBarTitleText: '开启 vConsole' }, + style: { navigationBarTitleText: '小程序vConsole' }, } diff --git a/src/pages/demo/base/wot.vue b/src/pages/demo/base/wot.vue new file mode 100644 index 00000000..4afd5292 --- /dev/null +++ b/src/pages/demo/base/wot.vue @@ -0,0 +1,61 @@ + +{ + layout: 'demo', + style: { + navigationBarTitleText: 'wot', + }, +} + + + + + + + diff --git a/src/pages/demo/index.vue b/src/pages/demo/index.vue index 7a940eef..6c797d75 100644 --- a/src/pages/demo/index.vue +++ b/src/pages/demo/index.vue @@ -1,14 +1,31 @@ + +{ + style: { navigationBarTitleText: 'unibest 示例' }, +} + +