refactor: 替换 wot-design-uni 为 sard-uniapp 组件库

- 更新 vite 配置以优化 sard-uniapp 的依赖处理
- 修改全局样式导入和组件引用路径
- 移除 wot-design-uni 相关配置和依赖
- 更新 tsconfig 和页面配置中的类型定义
- 调整布局组件中的配置提供逻辑
This commit is contained in:
feige996 2025-06-03 13:07:08 +08:00
parent de55a88d0e
commit 2f7c60856b
12 changed files with 36 additions and 55 deletions

View File

@ -106,8 +106,8 @@
"pinia": "2.0.36",
"pinia-plugin-persistedstate": "3.2.1",
"qs": "6.5.3",
"sard-uniapp": "^1.17.1",
"vue": "^3.5.15",
"wot-design-uni": "^1.9.1",
"z-paging": "^2.8.4"
},
"devDependencies": {

View File

@ -12,7 +12,7 @@ export default defineUniPages({
autoscan: true,
custom: {
'^fg-(.*)': '@/components/fg-$1/fg-$1.vue',
'^wd-(.*)': 'wot-design-uni/components/wd-$1/wd-$1.vue',
'^sar-(.*)': 'sard-uniapp/components/$1/$1.vue',
'^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)':
'z-paging/components/z-paging$1/z-paging$1.vue',
},

28
pnpm-lock.yaml generated
View File

@ -80,12 +80,12 @@ importers:
qs:
specifier: 6.5.3
version: 6.5.3
sard-uniapp:
specifier: ^1.17.1
version: 1.17.1(@dcloudio/types@3.4.14)(vue@3.5.15(typescript@5.7.2))
vue:
specifier: ^3.5.15
version: 3.5.15(typescript@5.7.2)
wot-design-uni:
specifier: ^1.9.1
version: 1.9.1(vue@3.5.15(typescript@5.7.2))
z-paging:
specifier: ^2.8.4
version: 2.8.4
@ -4641,6 +4641,13 @@ packages:
safer-buffer@2.1.2:
resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
sard-uniapp@1.17.1:
resolution: {integrity: sha512-XbBM0hQ777nmV+PjRlmjpH6ZihUhSTDXlDZju2QOLrXmwn5uVICw4YcOgAo6qzKp7nDtmM6pTSmQIUlILdn3pg==}
engines: {HBuilderX: ^3.6.0}
peerDependencies:
'@dcloudio/types': ^3.4.8
vue: ^3.3.13
sass@1.77.8:
resolution: {integrity: sha512-4UHg6prsrycW20fqLGPShtEvo/WyHRVRHwOP4DzkUrObWoWI05QBSfzU71TVB7PFaL104TwNaHpjlWXAZbQiNQ==}
engines: {node: '>=14.0.0'}
@ -5229,12 +5236,6 @@ packages:
engines: {node: '>= 8'}
hasBin: true
wot-design-uni@1.9.1:
resolution: {integrity: sha512-bZBt6xt5HfvmHBm76BZWBrvthHKeK7cbR//bbmv2ICjPRLXvD9KKHGZDZrq6C/j+DXHzA4UbcGer3iE8XcuVkw==}
engines: {HBuilderX: ^3.8.7}
peerDependencies:
vue: '>=3.2.47'
wrap-ansi@7.0.0:
resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==}
engines: {node: '>=10'}
@ -11083,6 +11084,11 @@ snapshots:
safer-buffer@2.1.2: {}
sard-uniapp@1.17.1(@dcloudio/types@3.4.14)(vue@3.5.15(typescript@5.7.2)):
dependencies:
'@dcloudio/types': 3.4.14
vue: 3.5.15(typescript@5.7.2)
sass@1.77.8:
dependencies:
chokidar: 3.6.0
@ -11709,10 +11715,6 @@ snapshots:
dependencies:
isexe: 2.0.0
wot-design-uni@1.9.1(vue@3.5.15(typescript@5.7.2)):
dependencies:
vue: 3.5.15(typescript@5.7.2)
wrap-ansi@7.0.0:
dependencies:
ansi-styles: 4.3.0

View File

@ -14,6 +14,7 @@ onHide(() => {
</script>
<style lang="scss">
@import 'sard-uniapp/index.scss';
/* stylelint-disable selector-type-no-unknown */
button::after {
border: none;

View File

@ -1,4 +1,3 @@
@import 'wot-design-uni/components/wd-button/index.scss';
:deep(.wd-privacy-popup) {
width: 600rpx;
padding: 0 24rpx;

View File

@ -1,18 +1,7 @@
<template>
<wd-config-provider :themeVars="themeVars">
<div>
<slot />
<wd-toast />
<wd-message-box />
<privacy-popup />
</wd-config-provider>
</div>
</template>
<script lang="ts" setup>
import type { ConfigProviderThemeVars } from 'wot-design-uni'
const themeVars: ConfigProviderThemeVars = {
// colorTheme: 'red',
// buttonPrimaryBgColor: '#07c160',
// buttonPrimaryColor: '#07c160',
}
</script>
<script lang="ts" setup></script>

View File

@ -1,17 +1,7 @@
<template>
<wd-config-provider :themeVars="themeVars">
<div>
<slot />
<wd-toast />
<wd-message-box />
</wd-config-provider>
</div>
</template>
<script lang="ts" setup>
import type { ConfigProviderThemeVars } from 'wot-design-uni'
const themeVars: ConfigProviderThemeVars = {
// colorTheme: 'red',
// buttonPrimaryBgColor: '#07c160',
// buttonPrimaryColor: '#07c160',
}
</script>
<script lang="ts" setup></script>

View File

@ -10,7 +10,7 @@
"autoscan": true,
"custom": {
"^fg-(.*)": "@/components/fg-$1/fg-$1.vue",
"^wd-(.*)": "wot-design-uni/components/wd-$1/wd-$1.vue",
"^sar-(.*)": "sard-uniapp/components/$1/$1.vue",
"^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)": "z-paging/components/z-paging$1/z-paging$1.vue"
}
},
@ -57,8 +57,7 @@
"path": "pages/about/about",
"type": "page",
"style": {
"navigationBarTitleText": "关于",
"navigationStyle": "custom"
"navigationBarTitleText": "关于"
}
},
{

View File

@ -2,14 +2,13 @@
{
style: {
navigationBarTitleText: '关于',
navigationStyle: 'custom', //
// navigationStyle: 'custom', //
},
}
</route>
<template>
<view>
<fg-navbar>关于</fg-navbar>
<view
class="bg-white overflow-hidden pt-2 px-4"
:style="{ marginTop: safeAreaInsets?.top + 'px' }"
@ -18,6 +17,7 @@
鸽友们好我是
<text class="text-red-500">菲鸽</text>
</view>
<sar-button>按钮</sar-button>
<view class="test-css">测试 scss 样式</view>
<RequestComp />
<UploadComp />

View File

@ -87,14 +87,12 @@
<script lang="ts" setup>
import { useUserStore } from '@/store'
import { useToast } from 'wot-design-uni'
import { toast } from 'sard-uniapp'
import { uploadFileUrl, useUpload } from '@/utils/uploadFile'
import { storeToRefs } from 'pinia'
import { IUploadSuccessInfo } from '@/api/login.typings'
const userStore = useUserStore()
const toast = useToast()
const hasLogin = ref(false)
onShow((options) => {
@ -192,7 +190,7 @@ const handleAppUpdate = () => {
})
updateManager.onUpdateFailed(function (res) {
//
toast.error('新版本下载失败')
toast.fail('新版本下载失败')
})
// #endif
// #endif
@ -220,7 +218,7 @@ const handleClearCache = () => {
toast.success('清除缓存成功')
} catch (err) {
console.error('清除缓存失败:', err)
toast.error('清除缓存失败')
toast.fail('清除缓存失败')
}
}
},

View File

@ -19,7 +19,7 @@
"@dcloudio/types",
"@uni-helper/uni-types",
"@types/wechat-miniprogram",
"wot-design-uni/global.d.ts",
"sard-uniapp/global",
"z-paging/types",
"./src/typings.d.ts"
]

View File

@ -179,5 +179,8 @@ export default async ({ command, mode }) => {
},
},
},
optimizeDeps: {
exclude: ['sard-uniapp'],
},
})
}