refactor: 更新 useDialog 调用方式

This commit is contained in:
Mickey wu
2026-05-24 11:59:45 +08:00
parent 03d1d54bc1
commit 705182de67
4 changed files with 10 additions and 10 deletions

View File

@@ -172,7 +172,7 @@ import UserAPI, {
} from "@/api/user";
const toast = useToast();
const { messageBox } = useDialog();
const { confirm } = useDialog();
const validatorConfirmPassword = (value: string) => {
if (!value) {
@@ -225,10 +225,10 @@ const { countdown: emailCountdown, start: startEmailCountdown } = useCountdown(6
const handleUnbindWechat = async () => {
try {
await messageBox({
await confirm({
title: "提示",
msg: "确定要解绑微信吗?解绑后将无法使用微信小程序登录",
type: "warning",
headerImage: "warning",
});
await UserAPI.unbindSocial("WECHAT_MINI");
toast.success("解绑成功");

View File

@@ -212,7 +212,7 @@ import { getAccessToken } from "@/utils/auth";
import { formatBytes } from "@/utils/format";
const toast = useToast();
const { messageBox } = useDialog();
const { confirm } = useDialog();
const userStore = useUserStore();
const themeStore = useThemeStore();
@@ -391,10 +391,10 @@ const handleClearCache = async () => {
const handleLogout = async () => {
try {
await messageBox({
await confirm({
title: "提示",
msg: "确定要退出登录吗?",
type: "warning",
headerImage: "warning",
});
userStore.logout();
toast.success("已退出登录");

View File

@@ -126,7 +126,7 @@ import UserAPI, { type UserProfileForm } from "@/api/user";
import FileAPI, { type FileInfo } from "@/api/file";
const toast = useToast();
const { messageBox } = useDialog();
const { confirm } = useDialog();
const userStore = useUserStore();
const redirect = ref("/pages/index/index");
@@ -258,7 +258,7 @@ const handleComplete = async () => {
const handleSkip = async () => {
try {
await messageBox({ title: "提示", msg: "跳过信息完善可能会影响部分功能使用,确定要跳过吗?", type: "warning" });
await confirm({ title: "提示", msg: "跳过信息完善可能会影响部分功能使用,确定要跳过吗?", headerImage: "warning" });
uni.reLaunch({ url: redirect.value });
} catch {
// 用户取消

View File

@@ -122,7 +122,7 @@ import { useToast, useDialog } from "@wot-ui/ui";
const { isDark, themeVars, themeColorOptions, toggleTheme, setThemeColor } = useTheme();
const toast = useToast();
const { messageBox } = useDialog();
const { confirm } = useDialog();
// 创建响应式的计算属性
const isDarkMode = computed(() => isDark.value);
@@ -195,7 +195,7 @@ const applyCustomColor = () => {
// 重置为默认主题
const handleResetTheme = async () => {
try {
await messageBox({ title: "确认重置", msg: "确定要重置为默认主题吗?", type: "warning" });
await confirm({ title: "确认重置", msg: "确定要重置为默认主题吗?", headerImage: "warning" });
setThemeColor(themeColorOptions[0]);
customColor.value = themeColorOptions[0].primary;
toast.success("已重置为默认主题");